Search in sources :

Example 1 with TreeSelectionModel

use of javax.swing.tree.TreeSelectionModel in project android by JetBrains.

the class UiUtil method setUp.

@NotNull
public static JScrollPane setUp(@NotNull AbstractBaseTreeBuilder treeBuilder) {
    JTree tree = treeBuilder.getUi().getTree();
    tree.setExpandsSelectedPaths(true);
    tree.setRootVisible(false);
    TreeSelectionModel selectionModel = tree.getSelectionModel();
    selectionModel.setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
    TreeBuilderSpeedSearch.installTo(treeBuilder);
    JScrollPane scrollPane = createScrollPane(tree);
    scrollPane.setBorder(IdeBorderFactory.createEmptyBorder());
    return scrollPane;
}
Also used : TreeSelectionModel(javax.swing.tree.TreeSelectionModel) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with TreeSelectionModel

use of javax.swing.tree.TreeSelectionModel in project JMRI by JMRI.

the class RosterGroupsPanel method getTree.

/**
     * Get the JTree containing the roster groups.
     *
     * @return The internal JTree
     */
public final JTree getTree() {
    if (_tree == null) {
        TreeSelectionModel sm = new DefaultTreeSelectionModel();
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        sm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        renderer.setLeafIcon(null);
        renderer.setClosedIcon(null);
        renderer.setOpenIcon(null);
        _tree = new JTree(getModel());
        _tree.setUI(new TreeUI());
        _tree.putClientProperty("JTree.lineStyle", "None");
        _tree.setRootVisible(false);
        _tree.expandRow(0);
        _tree.setSelectionModel(sm);
        _tree.setCellRenderer(renderer);
        _tree.addTreeWillExpandListener(new TreeWillExpandListener());
        _TSL = new TreeSelectionListener();
        _tree.addTreeSelectionListener(_TSL);
        _tree.setDragEnabled(true);
        _tree.setDropMode(DropMode.ON);
        _tree.setTransferHandler(new TransferHandler());
        _tree.addMouseListener(new MouseAdapter());
        setSelectionToGroup(selectedRosterGroup);
        Roster.getDefault().addPropertyChangeListener(new PropertyChangeListener());
    }
    return _tree;
}
Also used : JTree(javax.swing.JTree) DefaultTreeSelectionModel(javax.swing.tree.DefaultTreeSelectionModel) DefaultTreeCellRenderer(javax.swing.tree.DefaultTreeCellRenderer) DefaultTreeSelectionModel(javax.swing.tree.DefaultTreeSelectionModel) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) BasicTreeUI(javax.swing.plaf.basic.BasicTreeUI)

Example 3 with TreeSelectionModel

use of javax.swing.tree.TreeSelectionModel in project Gargoyle by callakrsos.

the class DesignerFx method createASTPanel.

private javafx.scene.Node createASTPanel() {
    astTreeWidget.setCellRenderer(createNoImageTreeCellRenderer());
    TreeSelectionModel model = astTreeWidget.getSelectionModel();
    model.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    model.addTreeSelectionListener(new SymbolTableListener());
    model.addTreeSelectionListener(new CodeHighlightListener());
    SwingNode swingNode = new SwingNode();
    createSwingContent(swingNode, new JScrollPane(astTreeWidget));
    return swingNode;
}
Also used : JScrollPane(javax.swing.JScrollPane) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) SwingNode(javafx.embed.swing.SwingNode)

Example 4 with TreeSelectionModel

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

the class TestingFrameworkPanel method getTestSuiteInfoOfSelectedTestCriteria.

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

Example 5 with TreeSelectionModel

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

the class TestingFrameworkPanel method getTreeSelection.

/**
 * Comment
 */
public Object getTreeSelection() {
    TreeSelectionModel treeSelectionModel = getselectionModel();
    TreePath treePath = treeSelectionModel.getSelectionPath();
    if (treePath == null) {
        return null;
    }
    BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
    Object object = bioModelNode.getUserObject();
    return object;
}
Also used : TreePath(javax.swing.tree.TreePath) BioModelNode(cbit.vcell.desktop.BioModelNode) 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