Search in sources :

Example 1 with SimpleTree

use of replete.gui.controls.simpletree.SimpleTree in project n2a by frothga.

the class OutputParameterPanel method dragGestureRecognized.

public void dragGestureRecognized(DragGestureEvent event) {
    Cursor cursor = null;
    SimpleTree list = (SimpleTree) event.getComponent();
    TreePath[] paths = list.getSelectionPaths();
    if (paths == null) {
        return;
    }
    List<ParameterBundle> bundles = new ArrayList<ParameterBundle>();
    for (TreePath path : paths) {
        List<ParameterDomain> domains = new ArrayList<ParameterDomain>();
        for (int p = 0; p < path.getPathCount(); p++) {
            Object u = ((TNode) path.getPathComponent(p)).getObject();
            if (u instanceof NodeSubdomain) {
                domains.add(((NodeSubdomain) u).getSubdomain());
            }
        }
        NodeBase uLeaf = ((TNode) path.getLastPathComponent()).getObject();
        if (uLeaf instanceof NodeParameter) {
            NodeParameter p = (NodeParameter) uLeaf;
            bundles.add(new ParameterBundle(domains, p.getParameter()));
        } else {
            // TODO: add all children?
            return;
        }
    }
    if (event.getDragAction() == DnDConstants.ACTION_LINK) {
        cursor = DragCursors.getGrabhandcursor();
    }
    event.startDrag(cursor, new TransferableParameterBundles(bundles));
}
Also used : ArrayList(java.util.ArrayList) TransferableParameterBundles(gov.sandia.umf.platform.ui.ensemble.TransferableParameterBundles) ParameterBundle(gov.sandia.n2a.parms.ParameterBundle) Cursor(java.awt.Cursor) SimpleTree(replete.gui.controls.simpletree.SimpleTree) NodeSubdomain(gov.sandia.umf.platform.ui.ensemble.tree.NodeSubdomain) NodeBase(replete.gui.controls.simpletree.NodeBase) TNode(replete.gui.controls.simpletree.TNode) TreePath(javax.swing.tree.TreePath) NodeParameter(gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter) ParameterDomain(gov.sandia.n2a.parms.ParameterDomain)

Example 2 with SimpleTree

use of replete.gui.controls.simpletree.SimpleTree in project n2a by frothga.

the class FixedParameterSpacePanel method dragGestureRecognized.

public void dragGestureRecognized(DragGestureEvent event) {
    Cursor cursor = null;
    SimpleTree list = (SimpleTree) event.getComponent();
    TreePath[] paths = list.getSelectionPaths();
    if (paths == null) {
        return;
    }
    List<ParameterBundle> bundles = getSelectedParamsAsBundles(paths);
    if (bundles == null) {
        return;
    }
    if (event.getDragAction() == DnDConstants.ACTION_LINK) {
        cursor = DragCursors.getGrabhandcursor();
    }
    event.startDrag(cursor, new TransferableParameterBundles(bundles));
}
Also used : TreePath(javax.swing.tree.TreePath) ParameterBundle(gov.sandia.n2a.parms.ParameterBundle) Cursor(java.awt.Cursor) SimpleTree(replete.gui.controls.simpletree.SimpleTree)

Aggregations

ParameterBundle (gov.sandia.n2a.parms.ParameterBundle)2 Cursor (java.awt.Cursor)2 TreePath (javax.swing.tree.TreePath)2 SimpleTree (replete.gui.controls.simpletree.SimpleTree)2 ParameterDomain (gov.sandia.n2a.parms.ParameterDomain)1 TransferableParameterBundles (gov.sandia.umf.platform.ui.ensemble.TransferableParameterBundles)1 NodeParameter (gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter)1 NodeSubdomain (gov.sandia.umf.platform.ui.ensemble.tree.NodeSubdomain)1 ArrayList (java.util.ArrayList)1 NodeBase (replete.gui.controls.simpletree.NodeBase)1 TNode (replete.gui.controls.simpletree.TNode)1