Search in sources :

Example 1 with LinkDataMapAction

use of org.apache.cayenne.modeler.action.LinkDataMapAction in project cayenne by apache.

the class LinkDataMapUndoableEdit method redo.

@Override
public void redo() throws CannotRedoException {
    LinkDataMapAction action = actionManager.getAction(LinkDataMapAction.class);
    action.linkDataMap(map, node);
}
Also used : LinkDataMapAction(org.apache.cayenne.modeler.action.LinkDataMapAction)

Example 2 with LinkDataMapAction

use of org.apache.cayenne.modeler.action.LinkDataMapAction in project cayenne by apache.

the class DataMapView method setDataNode.

void setDataNode() {
    DataNodeDescriptor node = (DataNodeDescriptor) nodeSelector.getSelectedItem();
    DataMap map = eventController.getCurrentDataMap();
    LinkDataMapAction action = eventController.getApplication().getActionManager().getAction(LinkDataMapAction.class);
    action.linkDataMap(map, node);
}
Also used : DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) LinkDataMapAction(org.apache.cayenne.modeler.action.LinkDataMapAction) DataMap(org.apache.cayenne.map.DataMap)

Example 3 with LinkDataMapAction

use of org.apache.cayenne.modeler.action.LinkDataMapAction in project cayenne by apache.

the class TreeDropTarget method drop.

public void drop(DropTargetDropEvent dtde) {
    if (targetPath != null) {
        try {
            dtde.acceptDrop(dtde.getDropAction());
            DefaultMutableTreeNode target = (DefaultMutableTreeNode) targetPath.getLastPathComponent();
            DefaultMutableTreeNode parent = (DefaultMutableTreeNode) parentPath.getLastPathComponent();
            if (target.getUserObject() instanceof DataNodeDescriptor && parent.getUserObject() instanceof DataMap) {
                DataNodeDescriptor currentDataNode = (DataNodeDescriptor) target.getUserObject();
                DataMap currentDataMap = (DataMap) parent.getUserObject();
                LinkDataMapAction action = eventController.getApplication().getActionManager().getAction(LinkDataMapAction.class);
                action.linkDataMap(currentDataMap, currentDataNode);
                targetTree.makeVisible(targetPath.pathByAddingChild(target));
                dtde.dropComplete(true);
            }
        } catch (Exception e) {
            e.printStackTrace();
            dtde.rejectDrop();
        }
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) LinkDataMapAction(org.apache.cayenne.modeler.action.LinkDataMapAction) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) IOException(java.io.IOException) DataMap(org.apache.cayenne.map.DataMap)

Aggregations

LinkDataMapAction (org.apache.cayenne.modeler.action.LinkDataMapAction)3 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)2 DataMap (org.apache.cayenne.map.DataMap)2 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 IOException (java.io.IOException)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1