Search in sources :

Example 16 with EmbeddableAttribute

use of org.apache.cayenne.map.EmbeddableAttribute in project cayenne by apache.

the class RemoveAttributeAction method removeEmbeddableAttributes.

public void removeEmbeddableAttributes(Embeddable embeddable, EmbeddableAttribute[] attrs) {
    ProjectController mediator = getProjectController();
    for (EmbeddableAttribute attrib : attrs) {
        embeddable.removeAttribute(attrib.getName());
        EmbeddableAttributeEvent e = new EmbeddableAttributeEvent(Application.getFrame(), attrib, embeddable, MapEvent.REMOVE);
        mediator.fireEmbeddableAttributeEvent(e);
    }
}
Also used : EmbeddableAttributeEvent(org.apache.cayenne.map.event.EmbeddableAttributeEvent) EmbeddableAttribute(org.apache.cayenne.map.EmbeddableAttribute) ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 17 with EmbeddableAttribute

use of org.apache.cayenne.map.EmbeddableAttribute in project cayenne by apache.

the class EmbeddableAttributeDisplayEventType method saveLastDisplayEvent.

@Override
public void saveLastDisplayEvent() {
    preferences.setEvent(EmbeddableAttributeDisplayEvent.class.getSimpleName());
    preferences.setDomain(controller.getCurrentDataChanel().getName());
    preferences.setDataMap(controller.getCurrentDataMap().getName());
    preferences.setEmbeddable(controller.getCurrentEmbeddable().getClassName());
    EmbeddableAttribute[] currentEmbAttributes = controller.getCurrentEmbAttributes();
    if (currentEmbAttributes == null) {
        preferences.setEmbAttrs("");
    } else {
        StringBuilder sb = new StringBuilder();
        for (EmbeddableAttribute embeddableAttribute : currentEmbAttributes) {
            sb.append(embeddableAttribute.getName()).append(",");
        }
        preferences.setEmbAttrs(sb.toString());
    }
}
Also used : EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent) EmbeddableAttribute(org.apache.cayenne.map.EmbeddableAttribute)

Example 18 with EmbeddableAttribute

use of org.apache.cayenne.map.EmbeddableAttribute in project cayenne by apache.

the class EmbeddableAttributeDisplayEventType 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;
    }
    Embeddable embeddable = dataMap.getEmbeddable(preferences.getEmbeddable());
    if (embeddable == null) {
        return;
    }
    EmbeddableDisplayEvent embeddableDisplayEvent = new EmbeddableDisplayEvent(this, embeddable, dataMap, dataChannel);
    controller.fireEmbeddableDisplayEvent(embeddableDisplayEvent);
    EmbeddableAttribute[] embeddableAttributes = getLastEmbeddableAttributes(embeddable);
    EmbeddableAttributeDisplayEvent attributeDisplayEvent = new EmbeddableAttributeDisplayEvent(this, embeddable, embeddableAttributes, dataMap, dataChannel);
    controller.fireEmbeddableAttributeDisplayEvent(attributeDisplayEvent);
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent) EmbeddableDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableDisplayEvent) EmbeddableAttribute(org.apache.cayenne.map.EmbeddableAttribute) DataMap(org.apache.cayenne.map.DataMap) Embeddable(org.apache.cayenne.map.Embeddable)

Aggregations

EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)18 Embeddable (org.apache.cayenne.map.Embeddable)10 DbAttribute (org.apache.cayenne.map.DbAttribute)6 DbEntity (org.apache.cayenne.map.DbEntity)6 ObjEntity (org.apache.cayenne.map.ObjEntity)6 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)5 ObjAttribute (org.apache.cayenne.map.ObjAttribute)5 ProjectController (org.apache.cayenne.modeler.ProjectController)4 DataMap (org.apache.cayenne.map.DataMap)3 DbRelationship (org.apache.cayenne.map.DbRelationship)3 ObjRelationship (org.apache.cayenne.map.ObjRelationship)3 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)3 EmbeddableAttributeEvent (org.apache.cayenne.map.event.EmbeddableAttributeEvent)3 EmbeddableAttributeDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)2 Procedure (org.apache.cayenne.map.Procedure)2 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)2 ObjCallbackMethod (org.apache.cayenne.modeler.editor.ObjCallbackMethod)2