Search in sources :

Example 6 with ProcedureEvent

use of org.apache.cayenne.configuration.event.ProcedureEvent in project cayenne by apache.

the class ProcedureTab method setSchema.

void setSchema(String text) {
    if (text != null && text.trim().length() == 0) {
        text = null;
    }
    Procedure procedure = eventController.getCurrentProcedure();
    if (procedure != null && !Util.nullSafeEquals(procedure.getSchema(), text)) {
        procedure.setSchema(text);
        eventController.fireProcedureEvent(new ProcedureEvent(this, procedure));
    }
}
Also used : ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure)

Example 7 with ProcedureEvent

use of org.apache.cayenne.configuration.event.ProcedureEvent in project cayenne by apache.

the class ProcedureTab method initController.

private void initController() {
    returnsValue.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            Procedure procedure = eventController.getCurrentProcedure();
            if (procedure != null && !ignoreChange) {
                procedure.setReturningValue(returnsValue.isSelected());
                eventController.fireProcedureEvent(new ProcedureEvent(ProcedureTab.this, procedure));
            }
        }
    });
    eventController.addProcedureDisplayListener(this);
}
Also used : ItemEvent(java.awt.event.ItemEvent) ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure) ItemListener(java.awt.event.ItemListener)

Example 8 with ProcedureEvent

use of org.apache.cayenne.configuration.event.ProcedureEvent in project cayenne by apache.

the class ProcedureTab method setCatalog.

void setCatalog(String text) {
    if (text != null && text.trim().length() == 0) {
        text = null;
    }
    Procedure procedure = eventController.getCurrentProcedure();
    if (procedure != null && !Util.nullSafeEquals(procedure.getCatalog(), text)) {
        procedure.setCatalog(text);
        eventController.fireProcedureEvent(new ProcedureEvent(this, procedure));
    }
}
Also used : ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure)

Example 9 with ProcedureEvent

use of org.apache.cayenne.configuration.event.ProcedureEvent in project cayenne by apache.

the class SchemaUpdateController method updateSchema.

protected void updateSchema() {
    boolean doAll = isAllEntities();
    String defaultSchema = dataMap.getDefaultSchema();
    // set schema for DbEntities
    for (DbEntity entity : dataMap.getDbEntities()) {
        if (doAll || Util.isEmptyString(entity.getSchema())) {
            if (!Util.nullSafeEquals(defaultSchema, entity.getSchema())) {
                entity.setSchema(defaultSchema);
                // any way to batch events, a big change will flood the app with
                // entity events..?
                mediator.fireDbEntityEvent(new EntityEvent(this, entity));
            }
        }
    }
    // set schema for procedures...
    for (Procedure procedure : dataMap.getProcedures()) {
        if (doAll || Util.isEmptyString(procedure.getSchema())) {
            if (!Util.nullSafeEquals(defaultSchema, procedure.getSchema())) {
                procedure.setSchema(defaultSchema);
                // any way to batch events, a big change will flood the app with
                // procedure events..?
                mediator.fireProcedureEvent(new ProcedureEvent(this, procedure));
            }
        }
    }
    view.dispose();
}
Also used : DbEntity(org.apache.cayenne.map.DbEntity) EntityEvent(org.apache.cayenne.map.event.EntityEvent) ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure)

Example 10 with ProcedureEvent

use of org.apache.cayenne.configuration.event.ProcedureEvent in project cayenne by apache.

the class RemoveAction method removeProcedure.

/**
 * Removes current Procedure from its DataMap and fires "remove" ProcedureEvent.
 */
public void removeProcedure(DataMap map, Procedure procedure) {
    ProjectController mediator = getProjectController();
    ProcedureEvent e = new ProcedureEvent(Application.getFrame(), procedure, MapEvent.REMOVE);
    e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
    map.removeProcedure(procedure.getName());
    mediator.fireProcedureEvent(e);
}
Also used : ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) ProjectController(org.apache.cayenne.modeler.ProjectController)

Aggregations

ProcedureEvent (org.apache.cayenne.configuration.event.ProcedureEvent)10 Procedure (org.apache.cayenne.map.Procedure)6 EntityEvent (org.apache.cayenne.map.event.EntityEvent)3 DbEntity (org.apache.cayenne.map.DbEntity)2 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 ArrayList (java.util.ArrayList)1 EventObject (java.util.EventObject)1 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)1 DataMapEvent (org.apache.cayenne.configuration.event.DataMapEvent)1 DataNodeEvent (org.apache.cayenne.configuration.event.DataNodeEvent)1 DomainEvent (org.apache.cayenne.configuration.event.DomainEvent)1 QueryEvent (org.apache.cayenne.configuration.event.QueryEvent)1 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)1 EmbeddableEvent (org.apache.cayenne.map.event.EmbeddableEvent)1 ProjectController (org.apache.cayenne.modeler.ProjectController)1 ProcedureDisplayEvent (org.apache.cayenne.modeler.event.ProcedureDisplayEvent)1