Package org.apache.cayenne.modeler.event

Examples of org.apache.cayenne.modeler.event.EntityDisplayEvent


                }
            }

            public void dbEntityAdded(DbEntity ent) {
                c.fireDbEntityEvent(new EntityEvent(src, ent, MapEvent.ADD));
                c.fireDbEntityDisplayEvent(new EntityDisplayEvent(
                        src,
                        ent,
                        dataMap,
                        node,
                        domain));
            }

            public void dbEntityRemoved(DbEntity ent) {
                c.fireDbEntityEvent(new EntityEvent(src, ent, MapEvent.REMOVE));
                c.fireDbEntityDisplayEvent(new EntityDisplayEvent(
                        src,
                        ent,
                        dataMap,
                        node,
                        domain));
            }

            public void dbRelationshipAdded(DbRelationship rel) {
                if (c.getCurrentDbEntity() == rel.getSourceEntity()) {
                    c.fireDbRelationshipDisplayEvent(new RelationshipDisplayEvent(
                            src,
                            rel,
                            rel.getSourceEntity(),
                            dataMap,
                            domain));
                }
            }

            public void dbRelationshipRemoved(DbRelationship rel) {
                if (c.getCurrentDbEntity() == rel.getSourceEntity()) {
                    c.fireDbRelationshipDisplayEvent(new RelationshipDisplayEvent(
                            src,
                            rel,
                            rel.getSourceEntity(),
                            dataMap,
                            domain));
                }
            }

            public void objAttributeAdded(ObjAttribute att) {
                if (c.getCurrentObjEntity() == att.getEntity()) {
                    c.fireObjAttributeDisplayEvent(new AttributeDisplayEvent(
                            src,
                            att,
                            att.getEntity(),
                            dataMap,
                            domain));
                }
            }

            public void objAttributeModified(ObjAttribute att) {
                if (c.getCurrentObjEntity() == att.getEntity()) {
                    c.fireObjAttributeDisplayEvent(new AttributeDisplayEvent(
                            src,
                            att,
                            att.getEntity(),
                            dataMap,
                            domain));
                }
            }

            public void objAttributeRemoved(ObjAttribute att) {
                if (c.getCurrentObjEntity() == att.getEntity()) {
                    c.fireObjAttributeDisplayEvent(new AttributeDisplayEvent(
                            src,
                            att,
                            att.getEntity(),
                            dataMap,
                            domain));
                }
            }

            public void objEntityAdded(ObjEntity ent) {
                c.fireObjEntityEvent(new EntityEvent(src, ent, MapEvent.ADD));
                c.fireObjEntityDisplayEvent(new EntityDisplayEvent(
                        src,
                        ent,
                        dataMap,
                        node,
                        domain));
            }

            public void objEntityRemoved(ObjEntity ent) {
                c.fireObjEntityEvent(new EntityEvent(src, ent, MapEvent.REMOVE));
                c.fireObjEntityDisplayEvent(new EntityDisplayEvent(
                        src,
                        ent,
                        dataMap,
                        node,
                        domain));
View Full Code Here


        mediator.fireObjEntityEvent(new EntityEvent(
                this,
                model.getEntity(),
                MapEvent.CHANGE));

        EntityDisplayEvent event = new EntityDisplayEvent(this, mediator
                .getCurrentObjEntity(), mediator.getCurrentDataMap(), (DataChannelDescriptor)mediator.getProject().getRootNode());

        mediator.fireObjEntityDisplayEvent(event);

        mediator.fireObjAttributeEvent(new AttributeEvent(this, attributeSaved, model
View Full Code Here

                            .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,
                            entity.getDataMap(),
                            dom));
                }
View Full Code Here

        clientClassName.getComponent().setEnabled(clientFieldsEnabled);
    }

    public void processExistingSelection(EventObject e) {

        EntityDisplayEvent ede = new EntityDisplayEvent(
                this,
                mediator.getCurrentObjEntity(),
                mediator.getCurrentDataMap(),
                (DataChannelDescriptor) mediator.getProject().getRootNode());
        mediator.fireObjEntityDisplayEvent(ede);
View Full Code Here

                .getProject()
                .getRootNode();
    }

    public void displayField(ProjectController mediator, JFrame frame) {
        EntityDisplayEvent event = new EntityDisplayEvent(frame, entity, map, domain);
        if (entity instanceof ObjEntity) {
            mediator.fireObjEntityDisplayEvent(event);
        }
        else if (entity instanceof DbEntity) {
            mediator.fireDbEntityDisplayEvent(event);
View Full Code Here

            }

            if (merger.synchronizeWithDbEntity(entity)) {
                mediator
                        .fireObjEntityEvent(new EntityEvent(this, entity, MapEvent.CHANGE));
                mediator.fireObjEntityDisplayEvent(new EntityDisplayEvent(
                        this,
                        entity,
                        entity.getDataMap(),
                        (DataChannelDescriptor)mediator.getProject().getRootNode()));
            }
View Full Code Here

                        (DataChannelDescriptor) mediator.getProject().getRootNode(),
                        (DataNodeDescriptor) obj));
            }
        }
        else if (obj instanceof Entity) {
            EntityDisplayEvent e = new EntityDisplayEvent(this, (Entity) obj);
            e.setUnselectAttributes(true);
            if (data.length == 3) {
                e.setDataMap((DataMap) data[data.length - 2]);
                e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
                e.setDataNode((DataNodeDescriptor) data[data.length - 3]);
            }
            else if (data.length == 2) {
                e.setDataMap((DataMap) data[data.length - 2]);
                e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
            }

            if (obj instanceof ObjEntity) {
                mediator.fireObjEntityDisplayEvent(e);
            }
View Full Code Here

            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

        if (objEntity != null) {
            action.removeObjAttributes(objEntity, new ObjAttribute[] {
                objAttr
            });

            controller.fireObjEntityDisplayEvent(new EntityDisplayEvent(
                    this,
                    objEntity,
                    dataMap,
                    domain));
        }

        if (dbEntity != null) {
            action.removeDbAttributes(dataMap, dbEntity, new DbAttribute[] {
                dbAttr
            });

            controller.fireDbEntityDisplayEvent(new EntityDisplayEvent(
                    this,
                    dbEntity,
                    dataMap,
                    domain));
        }
View Full Code Here

        RemoveAttributeAction action = actionManager
                .getAction(RemoveAttributeAction.class);

        if (objEntity != null) {
            action.removeObjAttributes(objEntity, objAttributes);
            controller.fireObjEntityDisplayEvent(new EntityDisplayEvent(
                    this,
                    objEntity,
                    dataMap,
                    domain));
        }

        if (dbEntity != null) {
            action.removeDbAttributes(dbEntity.getDataMap(), dbEntity, dbAttributes);
            controller.fireDbEntityDisplayEvent(new EntityDisplayEvent(
                    this,
                    dbEntity,
                    dataMap,
                    domain));
        }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.event.EntityDisplayEvent

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.