Search in sources :

Example 91 with TreeNode

use of javax.swing.tree.TreeNode in project fql by CategoricalData.

the class AqlOutline method conv.

@SuppressWarnings("unchecked")
TreePath conv(TreePath path) {
    TreePath parent = path.getParentPath();
    if (parent == null) {
        return new TreePath(getComp().getModel().getRoot());
    }
    TreePath rest = conv(parent);
    DefaultMutableTreeNode last = (DefaultMutableTreeNode) rest.getLastPathComponent();
    DefaultMutableTreeNode us = (DefaultMutableTreeNode) path.getLastPathComponent();
    Enumeration<TreeNode> cs = last.children();
    if (cs == null) {
        return null;
    }
    while (cs.hasMoreElements()) {
        DefaultMutableTreeNode m = (DefaultMutableTreeNode) cs.nextElement();
        if (nodeEq(m, us)) {
            return rest.pathByAddingChild(m);
        }
    }
    return null;
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 92 with TreeNode

use of javax.swing.tree.TreeNode in project ffx by mjschnie.

the class Joint method getPiOrbitalTorsions.

/**
 * <p>
 * getPiOrbitalTorsions</p>
 *
 * @return a {@link ffx.potential.bonded.MSNode} object.
 */
public MSNode getPiOrbitalTorsions() {
    for (Enumeration e = children(); e.hasMoreElements(); ) {
        MSNode m = (MSNode) e.nextElement();
        TreeNode node = m.getChildAt(0);
        if (node instanceof PiOrbitalTorsion) {
            return m;
        }
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) TreeNode(javax.swing.tree.TreeNode)

Example 93 with TreeNode

use of javax.swing.tree.TreeNode in project ffx by mjschnie.

the class Joint method getOutOfPlaneBends.

/**
 * <p>
 * getOutOfPlaneBends</p>
 *
 * @return a {@link ffx.potential.bonded.MSNode} object.
 */
public MSNode getOutOfPlaneBends() {
    for (Enumeration e = children(); e.hasMoreElements(); ) {
        MSNode m = (MSNode) e.nextElement();
        TreeNode node = m.getChildAt(0);
        if (node instanceof OutOfPlaneBend) {
            return m;
        }
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) TreeNode(javax.swing.tree.TreeNode)

Example 94 with TreeNode

use of javax.swing.tree.TreeNode in project ffx by mjschnie.

the class Joint method getAngles.

/**
 * <p>
 * getAngles</p>
 *
 * @return a {@link ffx.potential.bonded.MSNode} object.
 */
public MSNode getAngles() {
    for (Enumeration e = children(); e.hasMoreElements(); ) {
        MSNode m = (MSNode) e.nextElement();
        TreeNode node = m.getChildAt(0);
        if (node instanceof Angle) {
            return m;
        }
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) TreeNode(javax.swing.tree.TreeNode)

Example 95 with TreeNode

use of javax.swing.tree.TreeNode in project ffx by mjschnie.

the class Joint method getUreyBradleys.

/**
 * <p>
 * getUreyBradleys</p>
 *
 * @return a {@link ffx.potential.bonded.MSNode} object.
 */
public MSNode getUreyBradleys() {
    for (Enumeration e = children(); e.hasMoreElements(); ) {
        MSNode m = (MSNode) e.nextElement();
        TreeNode node = m.getChildAt(0);
        if (node instanceof UreyBradley) {
            return m;
        }
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) TreeNode(javax.swing.tree.TreeNode)

Aggregations

TreeNode (javax.swing.tree.TreeNode)313 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)146 TreePath (javax.swing.tree.TreePath)125 FilteredTreeModel (gov.sandia.n2a.ui.eq.FilteredTreeModel)31 Enumeration (java.util.Enumeration)30 PanelEquationTree (gov.sandia.n2a.ui.eq.PanelEquationTree)28 MPart (gov.sandia.n2a.eqset.MPart)27 ArrayList (java.util.ArrayList)27 NodeBase (gov.sandia.n2a.ui.eq.tree.NodeBase)25 JTree (javax.swing.JTree)23 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)23 Nullable (org.jetbrains.annotations.Nullable)23 MutableTreeNode (javax.swing.tree.MutableTreeNode)19 CannotRedoException (javax.swing.undo.CannotRedoException)18 NodePart (gov.sandia.n2a.ui.eq.tree.NodePart)16 CannotUndoException (javax.swing.undo.CannotUndoException)14 NodeVariable (gov.sandia.n2a.ui.eq.tree.NodeVariable)12 MouseEvent (java.awt.event.MouseEvent)11 NotNull (org.jetbrains.annotations.NotNull)11 PanelEquations (gov.sandia.n2a.ui.eq.PanelEquations)10