Search in sources :

Example 31 with Embeddable

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

the class FindAction method jumpToEmbeddableAttributeResult.

private static void jumpToEmbeddableAttributeResult(EmbeddableAttribute attribute, EditorView editor, DataChannelDescriptor domain) {
    Embeddable embeddable = attribute.getEmbeddable();
    DataMap map = embeddable.getDataMap();
    buildAndSelectTreePath(map, embeddable, editor);
    EmbeddableAttributeDisplayEvent event = new EmbeddableAttributeDisplayEvent(editor.getProjectTreeView(), embeddable, attribute, map, domain);
    event.setMainTabFocus(true);
    editor.getEmbeddableView().currentEmbeddableAttributeChanged(event);
}
Also used : EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent) Embeddable(org.apache.cayenne.map.Embeddable) DataMap(org.apache.cayenne.map.DataMap)

Example 32 with Embeddable

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

the class ProjectUtil method setEmbeddableAttributeName.

/**
 * Changes the name of the embeddable attribute and all references to this embeddable attribute.
 */
public static void setEmbeddableAttributeName(EmbeddableAttribute attribute, String newName) {
    String oldName = attribute.getName();
    attribute.setName(newName);
    Embeddable embeddable = attribute.getEmbeddable();
    if (embeddable != null) {
        embeddable.removeAttribute(oldName);
        embeddable.addAttribute(attribute);
    }
}
Also used : Embeddable(org.apache.cayenne.map.Embeddable)

Example 33 with Embeddable

use of org.apache.cayenne.map.Embeddable 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

Embeddable (org.apache.cayenne.map.Embeddable)33 DataMap (org.apache.cayenne.map.DataMap)14 ObjEntity (org.apache.cayenne.map.ObjEntity)14 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)11 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)11 DbEntity (org.apache.cayenne.map.DbEntity)8 ArrayList (java.util.ArrayList)7 ObjAttribute (org.apache.cayenne.map.ObjAttribute)7 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)6 DbAttribute (org.apache.cayenne.map.DbAttribute)5 Procedure (org.apache.cayenne.map.Procedure)5 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)4 ObjRelationship (org.apache.cayenne.map.ObjRelationship)4 ProjectController (org.apache.cayenne.modeler.ProjectController)4 HashMap (java.util.HashMap)3 DbRelationship (org.apache.cayenne.map.DbRelationship)3 EmbeddableDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableDisplayEvent)3 RemoveAttributeUndoableEdit (org.apache.cayenne.modeler.undo.RemoveAttributeUndoableEdit)3 File (java.io.File)2 LinkedList (java.util.LinkedList)2