Package org.apache.cayenne.modeler

Examples of org.apache.cayenne.modeler.ProjectController$ControllerState


    public CreateProcedureAction(Application application) {
        super(getActionName(), application);
    }

    public void performAction(ActionEvent e) {
        ProjectController mediator = getProjectController();
        Procedure procedure = createProcedure(mediator.getCurrentDataMap());

        mediator.fireProcedureEvent(new ProcedureEvent(this, procedure, MapEvent.ADD));
        mediator.fireProcedureDisplayEvent(new ProcedureDisplayEvent(
                this,
                procedure,
                mediator.getCurrentDataMap(),
                mediator.getCurrentDataDomain()));
    }
View Full Code Here


            }
        }
    }

    public void createObjRelationship(ObjEntity objEnt) {
        ProjectController mediator = getProjectController();

        ObjRelationship rel =
            (ObjRelationship) NamedObjectFactory.createObject(
                ObjRelationship.class,
                objEnt);
        rel.setSourceEntity(objEnt);
        objEnt.addRelationship(rel);

        mediator.fireObjRelationshipEvent(
            new RelationshipEvent(this, rel, objEnt, MapEvent.ADD));
       
        RelationshipDisplayEvent rde = new RelationshipDisplayEvent(
                this,
                rel,
                objEnt,
                mediator.getCurrentDataMap(),
                mediator.getCurrentDataDomain());
       
        mediator.fireObjRelationshipDisplayEvent(rde);
    }
View Full Code Here

       
        mediator.fireObjRelationshipDisplayEvent(rde);
    }

    public void createDbRelationship(DbEntity dbEnt) {
        ProjectController mediator = getProjectController();

        DbRelationship rel =
            (DbRelationship) NamedObjectFactory.createObject(DbRelationship.class, dbEnt);

        rel.setSourceEntity(dbEnt);
        dbEnt.addRelationship(rel);

        mediator.fireDbRelationshipEvent(
            new RelationshipEvent(this, rel, dbEnt, MapEvent.ADD));

        RelationshipDisplayEvent rde = new RelationshipDisplayEvent(
                this,
                rel,
                dbEnt,
                mediator.getCurrentDataMap(),
                mediator.getCurrentDataDomain());
       
        mediator.fireDbRelationshipDisplayEvent(rde);
    }
View Full Code Here

        return KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    }

    public void performAction(ActionEvent e) {

        ProjectController mediator = getProjectController();

        if (mediator.getCurrentObjEntity() != null) {
            removeObjEntity();
        }
        else if (mediator.getCurrentDbEntity() != null) {
            removeDbEntity();
        }
        else if (mediator.getCurrentQuery() != null) {
            removeQuery();
        }
        else if (mediator.getCurrentProcedure() != null) {
            removeProcedure();
        }
        else if (mediator.getCurrentDataMap() != null) {
            // In context of Data node just remove from Data Node
            if (mediator.getCurrentDataNode() != null) {
                removeDataMapFromDataNode();
            }
            else {
                // Not under Data Node, remove completely
                removeDataMap();
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            removeDataNode();
        }
        else if (mediator.getCurrentDataDomain() != null) {
            removeDomain();
        }
    }
View Full Code Here

        }
    }

    protected void removeDomain() {
        ApplicationProject project = (ApplicationProject) getCurrentProject();
        ProjectController mediator = getProjectController();
        DataDomain domain = mediator.getCurrentDataDomain();
        project.getConfiguration().removeDomain(domain.getName());
        mediator.fireDomainEvent(new DomainEvent(
                Application.getFrame(),
                domain,
                MapEvent.REMOVE));
    }
View Full Code Here

                domain,
                MapEvent.REMOVE));
    }

    protected void removeDataMap() {
        ProjectController mediator = getProjectController();
        DataMap map = mediator.getCurrentDataMap();
        DataDomain domain = mediator.getCurrentDataDomain();
        domain.removeMap(map.getName());
        mediator.fireDataMapEvent(new DataMapEvent(
                Application.getFrame(),
                map,
                MapEvent.REMOVE));
    }
View Full Code Here

                map,
                MapEvent.REMOVE));
    }

    protected void removeDataNode() {
        ProjectController mediator = getProjectController();
        DataNode node = mediator.getCurrentDataNode();
        DataDomain domain = mediator.getCurrentDataDomain();
        domain.removeDataNode(node.getName());
        mediator.fireDataNodeEvent(new DataNodeEvent(
                Application.getFrame(),
                node,
                MapEvent.REMOVE));
    }
View Full Code Here

    /**
     * Removes current DbEntity from its DataMap and fires "remove" EntityEvent.
     */
    protected void removeDbEntity() {
        ProjectController mediator = getProjectController();
        DbEntity ent = mediator.getCurrentDbEntity();
        DataMap map = mediator.getCurrentDataMap();
        map.removeDbEntity(ent.getName(), true);
        mediator.fireDbEntityEvent(new EntityEvent(
                Application.getFrame(),
                ent,
                MapEvent.REMOVE));
    }
View Full Code Here

    /**
     * Removes current Query from its DataMap and fires "remove" QueryEvent.
     */
    protected void removeQuery() {
        ProjectController mediator = getProjectController();
        Query query = mediator.getCurrentQuery();
        DataMap map = mediator.getCurrentDataMap();
        map.removeQuery(query.getName());
        mediator.fireQueryEvent(new QueryEvent(
                Application.getFrame(),
                query,
                MapEvent.REMOVE));
    }
View Full Code Here

    /**
     * Removes current Procedure from its DataMap and fires "remove" ProcedureEvent.
     */
    protected void removeProcedure() {
        ProjectController mediator = getProjectController();
        Procedure procedure = mediator.getCurrentProcedure();
        DataMap map = mediator.getCurrentDataMap();
        map.removeProcedure(procedure.getName());
        mediator.fireProcedureEvent(new ProcedureEvent(
                Application.getFrame(),
                procedure,
                MapEvent.REMOVE));
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.ProjectController$ControllerState

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.