Search in sources :

Example 26 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class RemoveAttributeAction method removeDbAttributes.

public void removeDbAttributes(DataMap dataMap, DbEntity entity, DbAttribute[] attribs) {
    ProjectController mediator = getProjectController();
    for (DbAttribute attrib : attribs) {
        entity.removeAttribute(attrib.getName());
        AttributeEvent e = new AttributeEvent(Application.getFrame(), attrib, entity, MapEvent.REMOVE);
        mediator.fireDbAttributeEvent(e);
    }
    ProjectUtil.cleanObjMappings(dataMap);
}
Also used : DbAttribute(org.apache.cayenne.map.DbAttribute) ProjectController(org.apache.cayenne.modeler.ProjectController) AttributeEvent(org.apache.cayenne.map.event.AttributeEvent) EmbeddableAttributeEvent(org.apache.cayenne.map.event.EmbeddableAttributeEvent)

Example 27 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class RemoveCallbackMethodAction method removeCallbackMethods.

/**
 * base logic for callback method removing
 * @param actionEvent event
 */
private void removeCallbackMethods(ActionEvent actionEvent) {
    ProjectController mediator = getProjectController();
    CallbackType callbackType = mediator.getCurrentCallbackType();
    ObjCallbackMethod[] callbackMethods = mediator.getCurrentCallbackMethods();
    for (ObjCallbackMethod callbackMethod : callbackMethods) {
        removeCallbackMethod(callbackType, callbackMethod.getName());
    }
    Application.getInstance().getUndoManager().addEdit(new RemoveCallbackMethodUndoableEdit(callbackType, callbackMethods));
}
Also used : CallbackType(org.apache.cayenne.modeler.editor.CallbackType) RemoveCallbackMethodUndoableEdit(org.apache.cayenne.modeler.undo.RemoveCallbackMethodUndoableEdit) ProjectController(org.apache.cayenne.modeler.ProjectController) ObjCallbackMethod(org.apache.cayenne.modeler.editor.ObjCallbackMethod)

Example 28 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class RemoveProcedureParameterAction method removeProcedureParameters.

public void removeProcedureParameters(Procedure procedure, ProcedureParameter[] parameters) {
    ProjectController mediator = getProjectController();
    for (ProcedureParameter parameter : parameters) {
        procedure.removeCallParameter(parameter.getName());
        ProcedureParameterEvent e = new ProcedureParameterEvent(Application.getFrame(), parameter, MapEvent.REMOVE);
        mediator.fireProcedureParameterEvent(e);
    }
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) ProcedureParameterEvent(org.apache.cayenne.configuration.event.ProcedureParameterEvent) ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 29 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class RemoveProcedureParameterAction method removeProcedureParameters.

protected void removeProcedureParameters() {
    ProjectController mediator = getProjectController();
    ProcedureParameter[] parameters = mediator.getCurrentProcedureParameters();
    removeProcedureParameters(mediator.getCurrentProcedure(), parameters);
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 30 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class RemoveRelationshipAction method removeDbRelationships.

public void removeDbRelationships(DbEntity entity, DbRelationship[] rels) {
    ProjectController mediator = getProjectController();
    for (DbRelationship rel : rels) {
        entity.removeRelationship(rel.getName());
        RelationshipEvent e = new RelationshipEvent(Application.getFrame(), rel, entity, MapEvent.REMOVE);
        mediator.fireDbRelationshipEvent(e);
    }
    ProjectUtil.cleanObjMappings(mediator.getCurrentDataMap());
}
Also used : DbRelationship(org.apache.cayenne.map.DbRelationship) ProjectController(org.apache.cayenne.modeler.ProjectController) RelationshipEvent(org.apache.cayenne.map.event.RelationshipEvent)

Aggregations

ProjectController (org.apache.cayenne.modeler.ProjectController)59 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)12 ObjEntity (org.apache.cayenne.map.ObjEntity)10 DbEntity (org.apache.cayenne.map.DbEntity)8 DataMap (org.apache.cayenne.map.DataMap)7 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)6 EntityEvent (org.apache.cayenne.map.event.EntityEvent)6 DataNodeEvent (org.apache.cayenne.configuration.event.DataNodeEvent)5 ObjAttribute (org.apache.cayenne.map.ObjAttribute)5 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)5 ArrayList (java.util.ArrayList)4 DbAttribute (org.apache.cayenne.map.DbAttribute)4 DbRelationship (org.apache.cayenne.map.DbRelationship)4 Embeddable (org.apache.cayenne.map.Embeddable)4 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)4 ObjRelationship (org.apache.cayenne.map.ObjRelationship)4 RelationshipEvent (org.apache.cayenne.map.event.RelationshipEvent)4 ComponentAdapter (java.awt.event.ComponentAdapter)3 ComponentEvent (java.awt.event.ComponentEvent)3 EntityMergeSupport (org.apache.cayenne.dbsync.merge.context.EntityMergeSupport)3