javax.swing.tree.DefaultTreeSelectionModel Java Examples
The following examples show how to use
javax.swing.tree.DefaultTreeSelectionModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PullRequestsTreeModel.java From azure-devops-intellij with MIT License | 6 votes |
public PullRequestsTreeModel() { super(null); this.root = new PRTreeNode(TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_TITLE)); setRoot(root); this.requestedByMeRoot = new PRTreeNode(TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REQUESTED_BY_ME)); root.insert(requestedByMeRoot, 0); this.assignedToMeRoot = new PRTreeNode(TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_ASSIGNED_TO_ME)); root.insert(assignedToMeRoot, 1); allRequestedByMePullRequests = new ArrayList<GitPullRequest>(); allAssignedToMePullRequests = new ArrayList<GitPullRequest>(); selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION); }
Example #2
Source File: ActiveConnectionPanel.java From p4ic4idea with Apache License 2.0 | 6 votes |
private void setup() { root = new JPanel(new BorderLayout()); JScrollPane scroll = new JBScrollPane(); root.add(scroll, BorderLayout.CENTER); connectionTree = new Tree(); scroll.setViewportView(connectionTree); connectionTree.getEmptyText().setText(P4Bundle.getString("connection.tree.initial")); connectionTree.setEditable(false); connectionTreeModel = new DefaultTreeModel(treeNode); connectionTree.setModel(connectionTreeModel); connectionTree.setCellRenderer(new ConnectionTreeCellRenderer()); connectionTree.setRootVisible(false); DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); connectionTree.setSelectionModel(selectionModel); ActionGroup actionButtons = createActionGroup(); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("p4.active-connection", actionButtons, false); root.add(toolbar.getComponent(), BorderLayout.WEST); // TODO add context menu support for each selected node type. // TODO add support for navigating to a file if a FilePath is selected. }
Example #3
Source File: ConfigEditorPane.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Creates the JTree for the report configuration. * * @return the tree component. * @throws ConfigTreeModelException if the model could not be built. */ private JComponent createEntryTree( final boolean includeGlobals ) { treeModel = new ConfigTreeModel( packageManager, includeGlobals ); final TreeSelectionModel selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); tree = new JTree( treeModel ); tree.setSelectionModel( selectionModel ); tree.setCellRenderer( new ConfigTreeRenderer() ); tree.setRootVisible( false ); tree.setShowsRootHandles( true ); tree.addTreeSelectionListener( new ModuleTreeSelectionHandler() ); return new JScrollPane ( tree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); }
Example #4
Source File: ExpressionChooserDialog.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
protected void init() { setTitle( EditorExpressionsMessages.getString( "ExpressionChooserDialog.Title" ) ); setModal( true ); final DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); selectionModel.addTreeSelectionListener( new ExpressionSelectionHandler() ); expressionsTree = new JTree( ExpressionsTreeModel.getTreeModel() ); expressionsTree.setRootVisible( false ); expressionsTree.setSelectionModel( selectionModel ); expressionsTree.addMouseListener( new DblClickHandler() ); expressionsTree.setCellRenderer( new ExpressionTreeCellRenderer() ); addAction = new AddAction(); super.init(); }
Example #5
Source File: CTagsTree.java From binnavi with Apache License 2.0 | 5 votes |
/** * Creates a new tree object. * * @param parent Parent window used for dialogs. * @param graph Graph shown in the window. * @param manager Provides tag information. */ public CTagsTree(final JFrame parent, final ZyGraph graph, final ITagManager manager) { m_parent = Preconditions.checkNotNull(parent, "IE02308: Perent argument can not be null"); m_graph = Preconditions.checkNotNull(graph, "IE01776: Graph can not be null"); m_tagManager = Preconditions.checkNotNull(manager, "IE01777: Manager argument can not be null"); m_model = new CTagsTreeModel(this); setModel(m_model); getModel().addTreeModelListener(new InternalModelListener()); addMouseListener(m_mouseListener); m_graph.addListener(m_graphSelectionListener); m_graph.addListener(m_graphVisibilityListener); setRootVisible(false); m_rootNode = new CRootTagTreeNode(parent, this, graph, m_tagManager); m_model.setRoot(m_rootNode); setCellRenderer(new CTagTreeCellRenderer()); // ATTENTION: UNDER NO CIRCUMSTANCES MOVE THIS LINE // ABOVE THE SETROOT LINE m_model.nodeStructureChanged(m_rootNode); final List<IDropHandler> handlers = new ArrayList<IDropHandler>(); handlers.add(new CTagSortingHandler()); new CDefaultTransferHandler(this, DnDConstants.ACTION_COPY_OR_MOVE, handlers); final DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); setSelectionModel(selectionModel); final InputMap windowImap = getInputMap(JComponent.WHEN_FOCUSED); windowImap.put(HotKeys.DELETE_HK.getKeyStroke(), "DELETE"); getActionMap().put("DELETE", CActionProxy.proxy(new DeleteAction())); }
Example #6
Source File: TypesTree.java From binnavi with Apache License 2.0 | 5 votes |
public TypesTree() { setRootVisible(false); setDragEnabled(true); setDropMode(DropMode.INSERT); // Dropped objects are inserted behind the drop location. setToggleClickCount(1); // Child nodes expand with a single click. final DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); setSelectionModel(selectionModel); final IconNodeRenderer renderer = new IconNodeRenderer(); renderer.setFont(GuiHelper.MONOSPACED_FONT); setCellRenderer(renderer); }
Example #7
Source File: CSelectionHistoryChooser.java From binnavi with Apache License 2.0 | 5 votes |
/** * Frees allocated resources. */ public void dispose() { m_selectionHistory.removeHistoryListener(m_selectionHistoryListener); m_graph.removeListener(m_graphSelectionListener); m_tree.removeMouseListener(m_treeMouseListener); m_tree.removeTreeSelectionListener(m_treeSelectionListener); m_tree.setSelectionModel(new DefaultTreeSelectionModel()); }
Example #8
Source File: MainFrame.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Inits the. */ private void init() { // Set the title. this.setTitle("Type System Editor"); JSplitPane contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); this.setContentPane(contentPane); // Set up the type tree. Use simple DefaultTreeModel. DefaultMutableTreeNode root = new DefaultMutableTreeNode("<html><b>No CAS!</b></html>"); DefaultTreeModel treeModel = new DefaultTreeModel(root); this.typeTree = new JTree(treeModel); this.typeTree.addTreeSelectionListener(new TypeTreeSelectionListener()); TreeSelectionModel treeSelectionModel = new DefaultTreeSelectionModel(); treeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); this.typeTree.setSelectionModel(treeSelectionModel); JScrollPane treePane = new JScrollPane(this.typeTree); contentPane.setLeftComponent(treePane); DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer(); cellRenderer.setLeafIcon(null); // cellRenderer.setIcon(null); cellRenderer.setClosedIcon(null); cellRenderer.setOpenIcon(null); this.typeTree.setCellRenderer(cellRenderer); // Set up the feature table. this.featureTable = new JTable(new FeatureTableModel()); JScrollPane featurePane = new JScrollPane(this.featureTable); featurePane.getViewport().setBackground(Color.WHITE); contentPane.setRightComponent(featurePane); this.setJMenuBar(createMenuBar()); }
Example #9
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 4 votes |
public SelectionListener(DefaultTreeModel treeModel, JList list, DefaultListModel otherListModel, DefaultTreeSelectionModel otherTreeModel) { this.treeModel = treeModel; this.list = list; this.otherListModel = otherListModel; this.otherTreeSelectionModel = otherTreeModel; }
Example #10
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 4 votes |
public SelectionListener(DefaultTreeModel treeModel, JList list, DefaultListModel otherListModel, DefaultTreeSelectionModel otherTreeModel) { this.treeModel = treeModel; this.list = list; this.otherListModel = otherListModel; this.otherTreeSelectionModel = otherTreeModel; }
Example #11
Source File: CCombinedRightPanel.java From binnavi with Apache License 2.0 | 4 votes |
/** * Frees allocated resources. */ public void dispose() { taggingPanel.getTree().dispose(); taggingPanel.getTree().setSelectionModel(new DefaultTreeSelectionModel()); }