Package org.apache.cayenne.configuration

Examples of org.apache.cayenne.configuration.DataChannelDescriptor


            return new DataNodeDescriptor(name);
        }

        @Override
        protected boolean isNameInUse(String name, Object namingContext) {
            DataChannelDescriptor domain = (DataChannelDescriptor) namingContext;
            Iterator<DataNodeDescriptor> nodeIt = domain.getNodeDescriptors().iterator();
            while (nodeIt.hasNext()) {
                if (nodeIt.next().getName().equals(name)) {
                    return true;
                }
            }
View Full Code Here


                dsi.setJdbcDriver(keyAsString(connection, "driver"));
                dsi.setPassword(keyAsString(connection, "password"));
                dsi.setUserName(keyAsString(connection, "username"));
            }

            DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                    .getProject()
                    .getRootNode();
            domain.getNodeDescriptors().add(node);

            // send events after the node creation is complete
            getProjectController().fireDataNodeEvent(
                    new DataNodeEvent(this, node, MapEvent.ADD));
            getProjectController().fireDataNodeDisplayEvent(
View Full Code Here

                    .getProject()
                    .getRootNode(), mediator.getCurrentDataNode()));
        }
        else {
            // fix DataMap name, as there maybe a map with the same name already
            DataChannelDescriptor domain = (DataChannelDescriptor) mediator
                    .getProject()
                    .getRootNode();
            map.setName(NamedObjectFactory.createName(DataMap.class, domain, map
                    .getName()));
View Full Code Here

                    CayenneTransferable.CAYENNE_FLAVOR);

            Object currentObject = getProjectController().getCurrentObject();

            if (content != null && currentObject != null) {
                DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                        .getProject()
                        .getRootNode();
                DataMap map = getProjectController().getCurrentDataMap();

                UndoableEdit undoableEdit;
View Full Code Here

                }
                catch (IOException ioex) {
                }
            }

            DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                    .getProject()
                    .getRootNode();

            if (newMap.getName() != null) {
                newMap.setName(NamedObjectFactory.createName(
View Full Code Here

     *
     * @param path
     * @return tree path
     */
    public static TreePath buildTreePath(Entity entity) {
        DataChannelDescriptor domain = (DataChannelDescriptor) Application
                .getInstance()
                .getProject()
                .getRootNode();
       
        Object[] path = new Object[] {domain, entity.getDataMap(), entity};
View Full Code Here

            return "project";
        }

        @Override
        protected Object create(String name, Object namingContext) {
            DataChannelDescriptor dataChDes = new DataChannelDescriptor();
            dataChDes.setName(name);
            return dataChDes;
        }
View Full Code Here

                DataDomain domain = (DataDomain) namingContext;
                return domain.getDataMap(name) != null;
            }

            if (namingContext instanceof DataChannelDescriptor) {
                DataChannelDescriptor domain = (DataChannelDescriptor) namingContext;
                return domain.getDataMap(name) != null;
            }
            return false;

        }
View Full Code Here

    public void testSaveAs_Sorted() throws Exception {

        File testFolder = setupTestDirectory("testSaveAs_Sorted");

        DataChannelDescriptor rootNode = new DataChannelDescriptor();
        rootNode.setName("test");

        // add maps and nodes in reverse alpha order. Check that they are saved in alpha
        // order
        rootNode.getDataMaps().add(new DataMap("C"));
        rootNode.getDataMaps().add(new DataMap("B"));
        rootNode.getDataMaps().add(new DataMap("A"));

        DataNodeDescriptor[] nodes = new DataNodeDescriptor[3];
        nodes[0] = new DataNodeDescriptor("Z");
        nodes[1] = new DataNodeDescriptor("Y");
        nodes[2] = new DataNodeDescriptor("X");

        nodes[0].getDataMapNames().add("C");
        nodes[0].getDataMapNames().add("B");
        nodes[0].getDataMapNames().add("A");

        rootNode.getNodeDescriptors().addAll(Arrays.asList(nodes));

        Project project = new Project(new ConfigurationTree<DataChannelDescriptor>(
                rootNode));

        saver.saveAs(project, new URLResource(testFolder.toURL()));
View Full Code Here

                    superClassName.setText(entity.getSuperClassName());

                    // fire both EntityEvent and EntityDisplayEvent;
                    // the later is to update attribute and relationship display

                    DataChannelDescriptor domain = (DataChannelDescriptor) mediator
                            .getProject()
                            .getRootNode();
                    DataMap map = mediator.getCurrentDataMap();

                    mediator.fireObjEntityEvent(new EntityEvent(this, entity));
                    mediator.fireObjEntityDisplayEvent(new EntityDisplayEvent(
                            this,
                            entity,
                            map,
                            domain));
                }
            }
        });

        tableLabel.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                // Jump to DbEntity of the current ObjEntity
                DbEntity entity = mediator.getCurrentObjEntity().getDbEntity();
                if (entity != null) {
                    DataChannelDescriptor dom = (DataChannelDescriptor) mediator
                            .getProject()
                            .getRootNode();
                    mediator.fireDbEntityDisplayEvent(new EntityDisplayEvent(
                            this,
                            entity,
View Full Code Here

TOP

Related Classes of org.apache.cayenne.configuration.DataChannelDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.