Package org.apache.cayenne.modeler.editor

Examples of org.apache.cayenne.modeler.editor.EditorView


        return object instanceof Entity;
    }

    void showEntity(Entity entity) {
        // we're always in same domain
        EditorView editor = ((CayenneModelerFrame) Application
                .getInstance()
                .getFrameController()
                .getView()).getView();

        editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                editor
                        .getProjectTreeView()
                        .getSelectionPath()
                        .getParentPath()
                        .getParentPath());
        DomainDisplayEvent event = new EntityDisplayEvent(
                editor.getProjectTreeView(),
                entity,
                entity.getDataMap(),
                (DataChannelDescriptor) getProjectController().getProject().getRootNode());
        getProjectController().fireDomainDisplayEvent(event);
    }
View Full Code Here


    public TextCompoundEdit(JTextComponent editor, JTextFieldUndoListener listener) {

        this.editor = editor;
        this.listener = listener;

        EditorView editorView = ((CayenneModelerFrame) Application
                .getInstance()
                .getFrameController()
                .getView()).getView();

        treePath = editorView.getProjectTreeView().getSelectionPath();

        DefaultMutableTreeNode newPath = (DefaultMutableTreeNode) treePath
                .getLastPathComponent();

        targetObject = newPath.getUserObject();

        if (targetObject instanceof ObjEntity) {
            tabbedPane = editorView.getObjDetailView();
        }

        if (targetObject instanceof DbEntity) {
            tabbedPane = editorView.getDbDetailView();
        }

        if (targetObject instanceof Embeddable) {
            tabbedPane = editorView.getEmbeddableView();
        }

        if (targetObject instanceof SQLTemplate) {
            tabbedPane = editorView.getSqlTemplateView();
           
            if (tabbedPane != null) {
                selectedItem = ((SQLTemplateTabbedView) tabbedPane)
                        .getScriptsTab()
                        .getSelectedIndex();
            }
        }

        if (targetObject instanceof EJBQLQuery) {
            tabbedPane = editorView.getEjbqlQueryView();
        }

        if (targetObject instanceof DataNodeDescriptor) {
            tabbedPane = editorView.getDataNodeView();
        }

        if (targetObject instanceof DataMap) {
            tabbedPane = editorView.getDataMapView();
        }

        if (targetObject instanceof DataChannelDescriptor) {
            tabbedPane = editorView.getDataDomainView();
        }

        if (tabbedPane != null) {
            selectedTabIndex = tabbedPane.getSelectedIndex();
        }
View Full Code Here

        }
    }

    private void restoreSelections() {

        EditorView editorView = ((CayenneModelerFrame) Application
                .getInstance()
                .getFrameController()
                .getView()).getView();

        editorView.getProjectTreeView().getSelectionModel().setSelectionPath(treePath);

        if (tabbedPane != null) {
            tabbedPane.setSelectedIndex(selectedTabIndex);
           
            if (tabbedPane instanceof SQLTemplateTabbedView) {
View Full Code Here

        table.addMouseListener(new JumpToResultActionListener());
        table.getSelectionModel().setSelectionInterval(0, 0);
    }

    public static void jumpToResult(Object path) {
        EditorView editor = ((CayenneModelerFrame) Application
                .getInstance()
                .getFrameController()
                .getView()).getView();
        DataChannelDescriptor domain = (DataChannelDescriptor) Application
                .getInstance()
                .getProject()
                .getRootNode();
        if (path instanceof Entity) {

            Object[] o = new Object[3];
            o[0] = domain;
            o[1] = ((Entity) path).getDataMap();
            o[2] = (Entity) path;
            /** Make selection in a project tree, open correspondent entity tab */
            editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                    buildTreePath(o, editor));
            EntityDisplayEvent event = new EntityDisplayEvent(
                    editor.getProjectTreeView(),
                    (Entity) path,
                    ((Entity) path).getDataMap(),
                    domain);
            event.setMainTabFocus(true);

            if (path instanceof ObjEntity)
                editor.getObjDetailView().currentObjEntityChanged(event);
            if (path instanceof DbEntity)
                editor.getDbDetailView().currentDbEntityChanged(event);
        }
        else if (path instanceof Query) {

            DataMap dmForQuery = null;

            if (path instanceof EJBQLQuery) {
                dmForQuery = ((EJBQLQuery) path).getDataMap();
            }
            if (path instanceof AbstractQuery) {
                dmForQuery = ((AbstractQuery) path).getDataMap();
            }

            Object[] o = new Object[3];
            o[0] = domain;
            o[1] = dmForQuery;
            o[2] = (Query) path;

            /** Make selection in a project tree, open correspondent entity tab */
            editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                    buildTreePath(o, editor));
            QueryDisplayEvent event = new QueryDisplayEvent(
                    editor.getProjectTreeView(),
                    (Query) path,
                    (DataMap) dmForQuery,
                    domain);

            editor.currentQueryChanged(event);
        }

        else if (path instanceof Embeddable) {

            Object[] o = new Object[3];
            o[0] = domain;
            o[1] = ((Embeddable) path).getDataMap();
            o[2] = (Embeddable) path;

            /** Make selection in a project tree, open correspondent entity tab */
            editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                    buildTreePath(o, editor));
            EmbeddableDisplayEvent event = new EmbeddableDisplayEvent(editor
                    .getProjectTreeView(), (Embeddable) path, ((Embeddable) path)
                    .getDataMap(), domain);
            event.setMainTabFocus(true);

            editor.currentEmbeddableChanged(event);
        }

        else if (path instanceof EmbeddableAttribute) {

            /** Make selection in a project tree, open correspondent embeddable tab */
            Object[] o = new Object[3];
            o[0] = domain;
            o[1] = ((EmbeddableAttribute) path).getEmbeddable().getDataMap();
            o[2] = ((EmbeddableAttribute) path).getEmbeddable();

            editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                    buildTreePath(o, editor));

            EmbeddableAttributeDisplayEvent event = new EmbeddableAttributeDisplayEvent(
                    editor.getProjectTreeView(),
                    ((EmbeddableAttribute) path).getEmbeddable(),
                    (EmbeddableAttribute) path,
                    ((EmbeddableAttribute) path).getEmbeddable().getDataMap(),
                    domain);
            event.setMainTabFocus(true);

            editor.getEmbeddableView().currentEmbeddableAttributeChanged(event);
        }

        else if (path instanceof Attribute || path instanceof Relationship) {

            /** Make selection in a project tree, open correspondent attributes tab */
            Object[] o = new Object[3];
            o[0] = domain;
            if (path instanceof Attribute) {
                o[1] = ((Attribute) path).getEntity().getDataMap();
                o[2] = ((Attribute) path).getEntity();
            }
            else {
                o[1] = ((Relationship) path).getSourceEntity().getDataMap();
                o[2] = ((Relationship) path).getSourceEntity();
            }
            editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                    buildTreePath(o, editor));

            if (path instanceof DbAttribute) {
                AttributeDisplayEvent event = new AttributeDisplayEvent(editor
                        .getProjectTreeView(), (Attribute) path, ((Attribute) path)
                        .getEntity(), ((Attribute) path).getEntity().getDataMap(), domain);
                event.setMainTabFocus(true);
                editor.getDbDetailView().currentDbAttributeChanged(event);
            }

            if (path instanceof ObjAttribute) {
                AttributeDisplayEvent event = new AttributeDisplayEvent(editor
                        .getProjectTreeView(), (Attribute) path, ((Attribute) path)
                        .getEntity(), ((Attribute) path).getEntity().getDataMap(), domain);
                event.setMainTabFocus(true);
                editor.getObjDetailView().currentObjAttributeChanged(event);
            }

            if (path instanceof DbRelationship) {
                RelationshipDisplayEvent event = new RelationshipDisplayEvent(editor
                        .getProjectTreeView(), (Relationship) path, ((Relationship) path)
                        .getSourceEntity(), ((Relationship) path)
                        .getSourceEntity()
                        .getDataMap(), domain);
                event.setMainTabFocus(true);
                editor.getDbDetailView().currentDbRelationshipChanged(event);
            }
            if (path instanceof ObjRelationship) {
                RelationshipDisplayEvent event = new RelationshipDisplayEvent(editor
                        .getProjectTreeView(), (Relationship) path, ((Relationship) path)
                        .getSourceEntity(), ((Relationship) path)
                        .getSourceEntity()
                        .getDataMap(), domain);
                event.setMainTabFocus(true);
                editor.getObjDetailView().currentObjRelationshipChanged(event);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.editor.EditorView

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.