Search in sources :

Example 1 with ProcedureDisplayEvent

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

the class ProcedureParameterErrorMsg method displayField.

public void displayField(ProjectController mediator, JFrame frame) {
    Object object = super.validationFailure.getSource();
    DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
    ProcedureParameter procedureParameter = (ProcedureParameter) object;
    Procedure procedure = procedureParameter.getProcedure();
    DataMap map = procedure.getDataMap();
    // Race condition between the two events...?
    // first display the stored procedure
    // for whatever reason, other validators do not require this step
    // (E.g. DbAttributeErrorMsg)
    ProcedureDisplayEvent procedureEvent = new ProcedureDisplayEvent(frame, procedure, map, domain);
    procedureEvent.setTabReset(true);
    mediator.fireProcedureDisplayEvent(procedureEvent);
    // now show the failed parameter
    ProcedureParameterDisplayEvent event = new ProcedureParameterDisplayEvent(frame, procedureParameter, procedure, map, domain);
    event.setTabReset(true);
    mediator.fireProcedureParameterDisplayEvent(event);
}
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)

Example 2 with ProcedureDisplayEvent

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

the class CreateProcedureAction method fireProcedureEvent.

/**
 * Fires events when a procedure was added
 */
static void fireProcedureEvent(Object src, ProjectController mediator, DataMap dataMap, Procedure procedure) {
    mediator.fireProcedureEvent(new ProcedureEvent(src, procedure, MapEvent.ADD));
    mediator.fireProcedureDisplayEvent(new ProcedureDisplayEvent(src, procedure, mediator.getCurrentDataMap(), (DataChannelDescriptor) mediator.getProject().getRootNode()));
}
Also used : ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent)

Example 3 with ProcedureDisplayEvent

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

the class CreateProcedureParameterUndoableEdit method undo.

@Override
public void undo() throws CannotUndoException {
    RemoveProcedureParameterAction action = actionManager.getAction(RemoveProcedureParameterAction.class);
    if (procedure != null) {
        action.removeProcedureParameters(procedure, new ProcedureParameter[] { parameter });
        controller.fireProcedureDisplayEvent(new ProcedureDisplayEvent(this, procedure, dataMap, domain));
    }
}
Also used : RemoveProcedureParameterAction(org.apache.cayenne.modeler.action.RemoveProcedureParameterAction) ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent)

Example 4 with ProcedureDisplayEvent

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

the class ProcedureDisplayEventType 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);
}
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 5 with ProcedureDisplayEvent

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

the class ProcedureTab method processExistingSelection.

public void processExistingSelection(EventObject e) {
    ProcedureDisplayEvent pde = new ProcedureDisplayEvent(this, eventController.getCurrentProcedure(), eventController.getCurrentDataMap(), (DataChannelDescriptor) eventController.getProject().getRootNode());
    eventController.fireProcedureDisplayEvent(pde);
}
Also used : ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent)

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