Search in sources :

Example 31 with PanelEquationTree

use of gov.sandia.n2a.ui.eq.PanelEquationTree 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();
    }
}
Also used : MPart(gov.sandia.n2a.eqset.MPart) PanelEquationGraph(gov.sandia.n2a.ui.eq.PanelEquationGraph) TreeNode(javax.swing.tree.TreeNode) CannotRedoException(javax.swing.undo.CannotRedoException) PanelEquations(gov.sandia.n2a.ui.eq.PanelEquations) NodePart(gov.sandia.n2a.ui.eq.tree.NodePart) PanelEquationTree(gov.sandia.n2a.ui.eq.PanelEquationTree) FilteredTreeModel(gov.sandia.n2a.ui.eq.FilteredTreeModel)

Aggregations

PanelEquationTree (gov.sandia.n2a.ui.eq.PanelEquationTree)31 FilteredTreeModel (gov.sandia.n2a.ui.eq.FilteredTreeModel)29 TreeNode (javax.swing.tree.TreeNode)28 MPart (gov.sandia.n2a.eqset.MPart)25 NodeBase (gov.sandia.n2a.ui.eq.tree.NodeBase)24 NodePart (gov.sandia.n2a.ui.eq.tree.NodePart)19 CannotRedoException (javax.swing.undo.CannotRedoException)18 TreePath (javax.swing.tree.TreePath)13 CannotUndoException (javax.swing.undo.CannotUndoException)13 NodeVariable (gov.sandia.n2a.ui.eq.tree.NodeVariable)12 PanelEquations (gov.sandia.n2a.ui.eq.PanelEquations)11 PanelEquationGraph (gov.sandia.n2a.ui.eq.PanelEquationGraph)9 NodeContainer (gov.sandia.n2a.ui.eq.tree.NodeContainer)7 MNode (gov.sandia.n2a.db.MNode)6 NodeAnnotations (gov.sandia.n2a.ui.eq.tree.NodeAnnotations)5 JTree (javax.swing.JTree)4 Variable (gov.sandia.n2a.eqset.Variable)3 NodeAnnotation (gov.sandia.n2a.ui.eq.tree.NodeAnnotation)3 NodeEquation (gov.sandia.n2a.ui.eq.tree.NodeEquation)3 EquationSet (gov.sandia.n2a.eqset.EquationSet)2