Search in sources :

Example 6 with TreeSelectionModel

use of javax.swing.tree.TreeSelectionModel in project vcell by virtualcell.

the class ImageDbTreePanel method treeSelection.

/**
 * Comment
 */
private void treeSelection() {
    TreeSelectionModel treeSelectionModel = getselectionModel1();
    TreePath treePath = treeSelectionModel.getSelectionPath();
    if (treePath == null) {
        setSelectedVersionInfo(null);
        return;
    }
    BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
    Object object = bioModelNode.getUserObject();
    if (object instanceof VersionInfo) {
        setSelectedVersionInfo((VersionInfo) object);
    // 
    // if selected parent of VCImageInfo, setSelection as it's SimulationInfo
    // 
    } else if (object instanceof String && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof VCImageInfo) {
        VCImageInfo imgInfo = (VCImageInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
        setSelectedVersionInfo(imgInfo);
    } else {
        setSelectedVersionInfo(null);
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) TreePath(javax.swing.tree.TreePath) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) VCImageInfo(cbit.image.VCImageInfo)

Example 7 with TreeSelectionModel

use of javax.swing.tree.TreeSelectionModel in project vcell by virtualcell.

the class TestingFrameworkPanel method getTestCaseOfSelectedCriteria.

/**
 * Comment
 */
public TestCaseNew getTestCaseOfSelectedCriteria() {
    TreeSelectionModel treeSelectionModel = getselectionModel();
    TreePath treePath = treeSelectionModel.getSelectionPath();
    if (treePath == null) {
        return null;
    }
    BioModelNode selectedNode = (BioModelNode) treePath.getLastPathComponent();
    if (selectedNode.getUserObject() instanceof TestCriteriaNew) {
        TreePath parentPath = treePath.getParentPath();
        BioModelNode parentNode = (BioModelNode) parentPath.getLastPathComponent();
        if (parentNode.getUserObject() instanceof TestCaseNew) {
            return (TestCaseNew) parentNode.getUserObject();
        }
    }
    return null;
}
Also used : TreePath(javax.swing.tree.TreePath) TestCriteriaNew(cbit.vcell.numericstest.TestCriteriaNew) BioModelNode(cbit.vcell.desktop.BioModelNode) TestCaseNew(cbit.vcell.numericstest.TestCaseNew) TreeSelectionModel(javax.swing.tree.TreeSelectionModel)

Example 8 with TreeSelectionModel

use of javax.swing.tree.TreeSelectionModel in project vcell by virtualcell.

the class TestingFrameworkPanel method getTestSuiteInfoOfSelectedTestCase.

public TestSuiteInfoNew getTestSuiteInfoOfSelectedTestCase() {
    TreeSelectionModel treeSelectionModel = getselectionModel();
    TreePath treePath = treeSelectionModel.getSelectionPath();
    return getTestSuiteInfoOfTreePath(treePath);
}
Also used : TreePath(javax.swing.tree.TreePath) TreeSelectionModel(javax.swing.tree.TreeSelectionModel)

Aggregations

TreeSelectionModel (javax.swing.tree.TreeSelectionModel)8 TreePath (javax.swing.tree.TreePath)5 BioModelNode (cbit.vcell.desktop.BioModelNode)2 VCImageInfo (cbit.image.VCImageInfo)1 TestCaseNew (cbit.vcell.numericstest.TestCaseNew)1 TestCriteriaNew (cbit.vcell.numericstest.TestCriteriaNew)1 SwingNode (javafx.embed.swing.SwingNode)1 JScrollPane (javax.swing.JScrollPane)1 JTree (javax.swing.JTree)1 BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)1 DefaultTreeCellRenderer (javax.swing.tree.DefaultTreeCellRenderer)1 DefaultTreeSelectionModel (javax.swing.tree.DefaultTreeSelectionModel)1 NotNull (org.jetbrains.annotations.NotNull)1 VersionInfo (org.vcell.util.document.VersionInfo)1