Search in sources :

Example 6 with ProcedureDisplayEvent

use of org.apache.cayenne.modeler.event.ProcedureDisplayEvent in project cayenne by apache.

the class ProcedureErrorMsg method displayField.

public void displayField(ProjectController mediator, JFrame frame) {
    Object object = super.validationFailure.getSource();
    DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
    Procedure procedure = (Procedure) object;
    DataMap map = procedure.getDataMap();
    ProcedureDisplayEvent event = new ProcedureDisplayEvent(frame, procedure, map, domain);
    event.setTabReset(true);
    mediator.fireProcedureDisplayEvent(event);
}
Also used : ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) Procedure(org.apache.cayenne.map.Procedure) DataMap(org.apache.cayenne.map.DataMap)

Example 7 with ProcedureDisplayEvent

use of org.apache.cayenne.modeler.event.ProcedureDisplayEvent in project cayenne by apache.

the class ProjectTreeView method processSelection.

/**
 * Processes node selection regardless of whether a new node was selected, or an
 * already selected node was clicked again. Normally called from event listener
 * methods.
 */
public void processSelection(TreePath path) {
    if (path == null) {
        return;
    }
    DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) path.getLastPathComponent();
    Object[] data = getUserObjects(currentNode);
    if (data.length == 0) {
        // this should clear the right-side panel
        DomainDisplayEvent domEvent = new DomainDisplayEvent(this, null);
        domEvent.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
        mediator.fireDomainDisplayEvent(domEvent);
        return;
    }
    Object obj = data[data.length - 1];
    if (obj instanceof DataChannelDescriptor) {
        mediator.fireDomainDisplayEvent(new DomainDisplayEvent(this, (DataChannelDescriptor) obj));
    } else if (obj instanceof DataMap) {
        if (data.length == 2) {
            mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(this, (DataMap) obj, (DataChannelDescriptor) mediator.getProject().getRootNode(), (DataNodeDescriptor) data[data.length - 2]));
        } else if (data.length == 1) {
            mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(this, (DataMap) obj, (DataChannelDescriptor) mediator.getProject().getRootNode()));
        }
    } else if (obj instanceof DataNodeDescriptor) {
        if (data.length == 1) {
            mediator.fireDataNodeDisplayEvent(new DataNodeDisplayEvent(this, (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);
        } else if (obj instanceof DbEntity) {
            mediator.fireDbEntityDisplayEvent(e);
        }
    } else if (obj instanceof Embeddable) {
        EmbeddableDisplayEvent e = new EmbeddableDisplayEvent(this, (Embeddable) obj, (DataMap) data[data.length - 2], (DataChannelDescriptor) mediator.getProject().getRootNode());
        mediator.fireEmbeddableDisplayEvent(e);
    } else if (obj instanceof Procedure) {
        ProcedureDisplayEvent e = new ProcedureDisplayEvent(this, (Procedure) obj, (DataMap) data[data.length - 2], (DataChannelDescriptor) mediator.getProject().getRootNode());
        mediator.fireProcedureDisplayEvent(e);
    } else if (obj instanceof QueryDescriptor) {
        QueryDisplayEvent e = new QueryDisplayEvent(this, (QueryDescriptor) obj, (DataMap) data[data.length - 2], (DataChannelDescriptor) mediator.getProject().getRootNode());
        mediator.fireQueryDisplayEvent(e);
    }
    this.scrollPathToVisible(path);
}
Also used : ObjEntity(org.apache.cayenne.map.ObjEntity) Entity(org.apache.cayenne.map.Entity) DbEntity(org.apache.cayenne.map.DbEntity) ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) EntityDisplayEvent(org.apache.cayenne.modeler.event.EntityDisplayEvent) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) EmbeddableDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableDisplayEvent) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) DataMapDisplayEvent(org.apache.cayenne.modeler.event.DataMapDisplayEvent) DataMap(org.apache.cayenne.map.DataMap) Embeddable(org.apache.cayenne.map.Embeddable) QueryDescriptor(org.apache.cayenne.map.QueryDescriptor) QueryDisplayEvent(org.apache.cayenne.modeler.event.QueryDisplayEvent) ObjEntity(org.apache.cayenne.map.ObjEntity) DomainDisplayEvent(org.apache.cayenne.modeler.event.DomainDisplayEvent) DbEntity(org.apache.cayenne.map.DbEntity) DataNodeDisplayEvent(org.apache.cayenne.modeler.event.DataNodeDisplayEvent) Procedure(org.apache.cayenne.map.Procedure)

Example 8 with ProcedureDisplayEvent

use of org.apache.cayenne.modeler.event.ProcedureDisplayEvent in project cayenne by apache.

the class ProcedureParameterDisplayEventType method fireLastDisplayEvent.

@Override
public void fireLastDisplayEvent() {
    DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
    if (!dataChannel.getName().equals(preferences.getDomain())) {
        return;
    }
    DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
    if (dataMap == null) {
        return;
    }
    Procedure procedure = dataMap.getProcedure(preferences.getProcedure());
    if (procedure == null) {
        return;
    }
    ProcedureDisplayEvent procedureDisplayEvent = new ProcedureDisplayEvent(this, procedure, dataMap, dataChannel);
    controller.fireProcedureDisplayEvent(procedureDisplayEvent);
    ProcedureParameter[] procedureParameters = getLastProcedureParameters(procedure);
    ProcedureParameterDisplayEvent procedureParameterDisplayEvent = new ProcedureParameterDisplayEvent(this, procedureParameters, procedure, dataMap, dataChannel);
    controller.fireProcedureParameterDisplayEvent(procedureParameterDisplayEvent);
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent) ProcedureParameterDisplayEvent(org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) Procedure(org.apache.cayenne.map.Procedure) DataMap(org.apache.cayenne.map.DataMap)

Aggregations

ProcedureDisplayEvent (org.apache.cayenne.modeler.event.ProcedureDisplayEvent)8 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)6 DataMap (org.apache.cayenne.map.DataMap)5 Procedure (org.apache.cayenne.map.Procedure)5 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)2 ProcedureParameterDisplayEvent (org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)1 ProcedureEvent (org.apache.cayenne.configuration.event.ProcedureEvent)1 DbEntity (org.apache.cayenne.map.DbEntity)1 Embeddable (org.apache.cayenne.map.Embeddable)1 Entity (org.apache.cayenne.map.Entity)1 ObjEntity (org.apache.cayenne.map.ObjEntity)1 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)1 RemoveProcedureParameterAction (org.apache.cayenne.modeler.action.RemoveProcedureParameterAction)1 DataMapDisplayEvent (org.apache.cayenne.modeler.event.DataMapDisplayEvent)1 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)1 DomainDisplayEvent (org.apache.cayenne.modeler.event.DomainDisplayEvent)1 EmbeddableDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableDisplayEvent)1 EntityDisplayEvent (org.apache.cayenne.modeler.event.EntityDisplayEvent)1