use of gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter in project n2a by frothga.
the class FixedParameterSpacePanel method populate.
// AMap wrap operation
private void populate(TNode nParent, ParameterDomain domain) {
for (ParameterDomain subdomain : domain.getSubdomains()) {
TNode nSubdomain = new TNode(new NodeSubdomain(subdomain));
populate(nSubdomain, subdomain);
nParent.add(nSubdomain);
}
for (Parameter param : domain.getParameters()) {
TNode nParam = new TNode(new NodeParameter(param));
nParent.add(nParam);
}
}
use of gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter 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));
}
use of gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter in project n2a by frothga.
the class FixedParameterSpacePanel method getSelectedParamsAsBundles.
private List<ParameterBundle> getSelectedParamsAsBundles(TreePath[] paths) {
List<ParameterBundle> bundles = new ArrayList<ParameterBundle>();
for (TreePath path : paths) {
List<ParameterDomain> domains = new ArrayList<ParameterDomain>();
if (tabParamDomains.getSelectedIndex() == 0) {
domains.add(new ParameterDomain("Model"));
} else {
domains.add(new ParameterDomain("Simulator"));
}
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 null;
}
}
return bundles;
}
use of gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter in project n2a by frothga.
the class OutputParameterPanel method populate.
// AMap wrap operation
private void populate(TNode nParent, ParameterDomain domain) {
for (ParameterDomain subdomain : domain.getSubdomains()) {
TNode nSubdomain = new TNode(new NodeSubdomain(subdomain));
populate(nSubdomain, subdomain);
nParent.add(nSubdomain);
}
for (Parameter param : domain.getParameters()) {
TNode nParam = new TNode(new NodeParameter(param));
nParent.add(nParam);
}
}
Aggregations