/** Creates new form BrowseFolders */ public BrowseFolders(SourceGroup[] folders, boolean showFiles) { initComponents(); this.folders = folders; this.showFiles = showFiles; manager = new ExplorerManager(); AbstractNode rootNode = new AbstractNode(new SourceGroupsChildren(folders)); manager.setRootContext(rootNode); // Create the templates view BeanTreeView btv = new BeanTreeView(); btv.setRootVisible(false); btv.setSelectionMode(javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION); btv.setBorder(SAMPLE_SCROLL_PANE.getBorder()); btv.getAccessibleContext() .setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_SelectFile")); folderPanel.add(btv, java.awt.BorderLayout.CENTER); }
/** the constructor */ private DirectoryTreeTopComponent() { initComponents(); // only allow one item to be selected at a time ((BeanTreeView) jScrollPane1).setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); // remove the close button putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE); setName(NbBundle.getMessage(DirectoryTreeTopComponent.class, "CTL_DirectoryTreeTopComponent")); setToolTipText( NbBundle.getMessage(DirectoryTreeTopComponent.class, "HINT_DirectoryTreeTopComponent")); subscribeToChangeEvents(); associateLookup(ExplorerUtils.createLookup(em, getActionMap())); this.pcs = new PropertyChangeSupport(this); // set the back & forward list and also disable the back & forward button this.backList = new LinkedList<>(); this.forwardList = new LinkedList<>(); backButton.setEnabled(false); forwardButton.setEnabled(false); }
public SpecSelectionComponent(boolean showSystemOnly) { this.tree = new BeanTreeView(); this.em = new ExplorerManager(); this.selectionListener = new SelectionListener(); this.specification = newProperty(SPECIFICATION_PROPERTY, null); this.icon = newProperty(ICON_PROPERTY, null); tree.setRootVisible(false); tree.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); DecoratedNode root = new DecoratedNode( new DummyWsNode(WorkspaceFactory.getInstance().getActiveWorkspace(), SPECS_ID), showSystemOnly ? ItemWsNodeFilter.SYSTEM_ONLY : Predicates.<Node>alwaysTrue()); for (DecoratedNode o : root.breadthFirstIterable()) { o.setPreferredActionDecorator(DecoratedNode.PreferredAction.DO_NOTHING); } em.setRootContext(root); setLayout(new BorderLayout()); add(tree, BorderLayout.CENTER); setPreferredSize(new Dimension(225, 300)); em.addVetoableChangeListener(selectionListener); addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String p = evt.getPropertyName(); if (p.equals(SPECIFICATION_PROPERTY)) { onSpecificationChange(); } } }); }