use of gov.sandia.n2a.ui.eq.tree.NodePart in project n2a by frothga.
the class CompoundEditView method selectLead.
public void selectLead() {
if (leadPath == null)
return;
NodeBase n = NodeBase.locateNode(leadPath);
if (n == null)
return;
if (clearSelection == CLEAR_GRAPH) {
// CLEAR_GRAPH should only be used for compound operations on parts, so this should be a safe cast.
NodePart p = (NodePart) n;
if (p.graph != null) {
p.graph.takeFocusOnTitle();
return;
}
}
// Otherwise, assume this is a compound operation on tree nodes.
PanelEquationTree pet = n.getTree();
if (pet != null)
pet.tree.setLeadSelectionPath(new TreePath(n.getPath()));
}
use of gov.sandia.n2a.ui.eq.tree.NodePart in project n2a by frothga.
the class ChangeInherit method apply.
public void apply(String value) {
NodeBase node = NodeBase.locateNode(path);
if (node == null)
throw new CannotRedoException();
NodePart parent = (NodePart) node.getParent();
NodePart grandparent = (NodePart) parent.getTrueParent();
PanelEquations pe = PanelModel.instance.panelEquations;
PanelEquationTree pet = node.getTree();
FilteredTreeModel model = (FilteredTreeModel) pet.tree.getModel();
PanelEquationGraph peg = pe.panelEquationGraph;
// Complex restructuring happens here.
node.source.set(value);
parent.build();
if (grandparent == null)
parent.findConnections();
else
grandparent.findConnections();
parent.rebuildPins();
parent.filter();
if (parent == pe.part) {
peg.reloadPart();
// Ensure that parts are not visible in parent panel.
parent.filter();
}
model.nodeStructureChanged(parent);
TreeNode[] nodePath = parent.child("$inherit").getPath();
pet.updateOrder(nodePath);
pet.updateVisibility(nodePath);
pet.animate();
if (parent != pe.part) {
peg.updatePins();
peg.reconnect();
peg.repaint();
}
if (// root node, so update categories in search list
parent.getTrueParent() == null) {
PanelModel.instance.panelSearch.search();
}
}
use of gov.sandia.n2a.ui.eq.tree.NodePart in project n2a by frothga.
the class ChangeVariableToInherit method redo.
public void redo() {
super.redo();
NodePart parent = (NodePart) NodeBase.locateNode(path);
if (parent == null)
throw new CannotRedoException();
NodePart grandparent = (NodePart) parent.getTrueParent();
// Update database
MPart mparent = parent.source;
mparent.clear(treeBefore.key());
mparent.set(valueAfter, "$inherit");
// Update GUI
PanelEquations pe = PanelModel.instance.panelEquations;
PanelEquationTree pet = parent.getTree();
FilteredTreeModel model = (FilteredTreeModel) pet.tree.getModel();
PanelEquationGraph peg = pe.panelEquationGraph;
parent.build();
if (grandparent == null)
parent.findConnections();
else
grandparent.findConnections();
parent.rebuildPins();
parent.filter();
if (parent == pe.part) {
peg.reloadPart();
parent.filter();
}
model.nodeStructureChanged(parent);
TreeNode[] nodePath = parent.child("$inherit").getPath();
pet.updateOrder(nodePath);
pet.updateVisibility(nodePath);
pet.animate();
if (parent != pe.part) {
peg.updatePins();
peg.reconnect();
peg.repaint();
}
if (// root node, so update categories in search list
parent.getTrueParent() == null) {
PanelModel.instance.panelSearch.search();
}
}
Aggregations