Search in sources :

Example 1 with EmbeddableAttributeDisplayEvent

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

the class EmbeddableAttributeErrorMsg method displayField.

@Override
public void displayField(ProjectController mediator, JFrame frame) {
    EmbeddableAttributeDisplayEvent event = new EmbeddableAttributeDisplayEvent(frame, embeddable, embeddableAttribute, map, domain);
    mediator.fireEmbeddableDisplayEvent(event);
    mediator.fireEmbeddableAttributeDisplayEvent(event);
}
Also used : EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent)

Example 2 with EmbeddableAttributeDisplayEvent

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

the class CreateAttributeAction method fireEmbeddableAttributeEvent.

static void fireEmbeddableAttributeEvent(Object src, ProjectController mediator, Embeddable embeddable, EmbeddableAttribute attr) {
    mediator.fireEmbeddableAttributeEvent(new EmbeddableAttributeEvent(src, attr, embeddable, MapEvent.ADD));
    EmbeddableAttributeDisplayEvent e = new EmbeddableAttributeDisplayEvent(src, embeddable, attr, mediator.getCurrentDataMap(), (DataChannelDescriptor) mediator.getProject().getRootNode());
    mediator.fireEmbeddableAttributeDisplayEvent(e);
}
Also used : EmbeddableAttributeEvent(org.apache.cayenne.map.event.EmbeddableAttributeEvent) EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent)

Example 3 with EmbeddableAttributeDisplayEvent

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

the class EmbeddableAttributeTab method processExistingSelection.

public void processExistingSelection(EventObject e) {
    if (e instanceof ChangeEvent) {
        table.clearSelection();
    }
    EmbeddableAttribute[] attrs = new EmbeddableAttribute[0];
    if (table.getSelectedRow() >= 0) {
        EmbeddableAttributeTableModel model = (EmbeddableAttributeTableModel) table.getModel();
        int[] sel = table.getSelectedRows();
        attrs = new EmbeddableAttribute[sel.length];
        for (int i = 0; i < sel.length; i++) {
            attrs[i] = model.getEmbeddableAttribute(sel[i]);
        }
        if (sel.length == 1) {
            UIUtil.scrollToSelectedRow(table);
        }
    }
    EmbeddableAttributeDisplayEvent ev = new EmbeddableAttributeDisplayEvent(this, mediator.getCurrentEmbeddable(), attrs, mediator.getCurrentDataMap(), (DataChannelDescriptor) mediator.getProject().getRootNode());
    mediator.fireEmbeddableAttributeDisplayEvent(ev);
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent) EmbeddableAttribute(org.apache.cayenne.map.EmbeddableAttribute)

Example 4 with EmbeddableAttributeDisplayEvent

use of org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent 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);
    editor.getEmbeddableView().repaint();
}
Also used : EmbeddableAttributeDisplayEvent(org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent) Embeddable(org.apache.cayenne.map.Embeddable) DataMap(org.apache.cayenne.map.DataMap)

Example 5 with EmbeddableAttributeDisplayEvent

use of org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent 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

EmbeddableAttributeDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableAttributeDisplayEvent)5 DataMap (org.apache.cayenne.map.DataMap)2 Embeddable (org.apache.cayenne.map.Embeddable)2 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)2 ChangeEvent (javax.swing.event.ChangeEvent)1 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)1 EmbeddableAttributeEvent (org.apache.cayenne.map.event.EmbeddableAttributeEvent)1 EmbeddableDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableDisplayEvent)1