public void updateUI() { super.updateUI(); //On GTK L&F, the viewport border must be set to empty (not null!) or we still get border buildup setViewportBorder(BorderFactory.createEmptyBorder()); setBorder(BorderFactory.createEmptyBorder()); }
public void run() { if(view != null) { view.expandNode(node); } } });
@Override public String getAccessibleDescription() { return TreeView.this.getAccessibleContext().getAccessibleDescription(); } }
setLayout(new ExplorerScrollPaneLayout()); initializeTree(); setDropTarget(DragDropUtilities.dragAndDropEnabled); setPopupAllowed(popupAllowed); setDefaultActionAllowed(defaultAction); dim = getPreferredSize(); setPreferredSize(dim);
/** Constructor. * @param defaultAction should double click on a node open its default action? * @param popupAllowed should right-click open popup? */ public TreeView (boolean defaultAction, boolean popupAllowed) { initializeTree (); // activation of drop target if (DragDropUtilities.dragAndDropEnabled) { ExplorerDnDManager.getDefault ().addFutureDropTarget (this); // note: drag target is activated on focus gained } setPopupAllowed (popupAllowed); setDefaultActionAllowed (defaultAction); Dimension dim = null; try { dim = getPreferredSize(); if (dim == null) { dim = new Dimension(MIN_TREEVIEW_WIDTH, MIN_TREEVIEW_HEIGHT); } } catch (NullPointerException npe) { dim = new Dimension(MIN_TREEVIEW_WIDTH, MIN_TREEVIEW_HEIGHT); } if (dim.width < MIN_TREEVIEW_WIDTH) dim.width = MIN_TREEVIEW_WIDTH; if (dim.height < MIN_TREEVIEW_HEIGHT) dim.height = MIN_TREEVIEW_HEIGHT; setPreferredSize(dim); }
treeModel = createModel (); tree.setCellRenderer(rend); tree.putClientProperty("JTree.lineStyle", "Angled"); // NOI18N setViewportView (tree); setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); setRequestFocusEnabled (false); getActionMap().put ("org.openide.actions.PopupAction", defaultActionListener.popup); tree.addFocusListener(defaultActionListener); tree.addMouseListener(defaultActionListener);
tv.setMinimumSize(new Dimension(50, 50)); manager = new ExplorerManager(); pnlView.add(tv, BorderLayout.CENTER); tv.setBorder(jScrollPane1.getBorder()); tv.setDefaultActionAllowed(false); tv.setPopupAllowed(false); tv.setRootVisible(false); tv.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); Childs childs = new Childs(); childs.addArchetype(LOADING_ARCHETYPE);
if (nodes.length <= 1 || getSelectionMode()==TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) return false; if (getSelectionMode()==TreeSelectionModel.SINGLE_TREE_SELECTION) return true; Node n = nodes[i]; while (n.getParentNode ()!=null) { if (!isExpanded (n)) toBeExpaned.add (n); n = n.getParentNode (); expandNode ((Node)toBeExpaned.get (j));
if ((nodes.length <= 1) || (getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)) { return false; if (getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) { return true; if (!isExpanded(n)) { toBeExpaned.add(n); expandNode(toBeExpaned.get(j)); paths[i] = getTreePath(nodes[i]);
public DataProviderExplorerPanel() { view.setDropTarget(false); view.setDragSource(false); view.setRootVisible(false); setLayout(new BorderLayout()); add(view, BorderLayout.CENTER); getExplorerManager().setRootContext(new AbstractNode(children)); initialize(); }
treeView.setBorder(BorderFactory.createEmptyBorder()); accessCtx = treeView.getAccessibleContext(); accessCtx.setAccessibleName( bundle.getString("AD_Name_ChooseClassToTest")); //NOI18N
@Override public void focusGained(java.awt.event.FocusEvent ev) { // unregister ev.getComponent().removeFocusListener(this); // lazy activation of drag source if (DragDropUtilities.dragAndDropEnabled && dragActive) { setDragSource(true); // note: dropTarget is activated in constructor } }
/** Called under Children.MUTEX to refresh the currently selected nodes. */ public void run () { if (readAccessPaths == null) { return; } TreePath[] paths = readAccessPaths; // non null value caused leak in // ComponentInspector // When the last Form was closed then the ComponentInspector was // closed as well. Since this variable was not null - // last selected Node (RADComponentNode) was held ---> FormManager2 was held, etc. readAccessPaths = null; java.util.List ll = new java.util.ArrayList(paths.length); for (int i = 0; i < paths.length; i++) { Node n = Visualizer.findNode (paths[i].getLastPathComponent ()); if (n == manager.getRootContext() || n.getParentNode() != null) { ll.add (n); } } callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()])); }
void setDnDActive (boolean state) { isDnDActive = state; if (setOfTargets != null && !setOfTargets.isEmpty ()) { Iterator it = setOfTargets.iterator(); while (it.hasNext ()) { JScrollPane pane = (JScrollPane)it.next (); if (pane.isEnabled ()) { if (pane instanceof TreeView) { ((TreeView)pane).setDropTarget (state); } else if (pane instanceof ListView) { ((ListView)pane).setDropTarget (state); } } } } }
/** Called under Children.MUTEX to refresh the currently selected nodes. */ @Override public void run() { if (readAccessPaths == null) { return; } TreePath[] paths = readAccessPaths; // non null value caused leak in // ComponentInspector // When the last Form was closed then the ComponentInspector was // closed as well. Since this variable was not null - // last selected Node (RADComponentNode) was held ---> FormManager2 was held, etc. readAccessPaths = null; java.util.List<Node> ll = new java.util.ArrayList<Node>(paths.length); for (int i = 0; i < paths.length; i++) { Node n = Visualizer.findNode(paths[i].getLastPathComponent()); n = getOriginalNode (n); if( isUnderRoot( manager.getRootContext(), n ) ) { ll.add(n); } } callSelectionChanged(ll.toArray(new Node[ll.size()])); }
treeModel = createModel (); tree.setCellRenderer(rend); tree.putClientProperty("JTree.lineStyle", "Angled"); // NOI18N setViewportView (tree); setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); setRequestFocusEnabled (false); getActionMap().put ("org.openide.actions.PopupAction", defaultActionListener.popup); tree.addFocusListener(defaultActionListener); tree.addMouseListener(defaultActionListener);
/** Constructor. * @param defaultAction should double click on a node open its default action? * @param popupAllowed should right-click open popup? */ public TreeView (boolean defaultAction, boolean popupAllowed) { initializeTree (); // activation of drop target if (DragDropUtilities.dragAndDropEnabled) { ExplorerDnDManager.getDefault ().addFutureDropTarget (this); // note: drag target is activated on focus gained } setPopupAllowed (popupAllowed); setDefaultActionAllowed (defaultAction); Dimension dim = null; try { dim = getPreferredSize(); if (dim == null) { dim = new Dimension(MIN_TREEVIEW_WIDTH, MIN_TREEVIEW_HEIGHT); } } catch (NullPointerException npe) { dim = new Dimension(MIN_TREEVIEW_WIDTH, MIN_TREEVIEW_HEIGHT); } if (dim.width < MIN_TREEVIEW_WIDTH) dim.width = MIN_TREEVIEW_WIDTH; if (dim.height < MIN_TREEVIEW_HEIGHT) dim.height = MIN_TREEVIEW_HEIGHT; setPreferredSize(dim); }
if (nodes.length <= 1 || getSelectionMode()==TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) return false; if (getSelectionMode()==TreeSelectionModel.SINGLE_TREE_SELECTION) return true; Node n = nodes[i]; while (n.getParentNode ()!=null) { if (!isExpanded (n)) toBeExpaned.add (n); n = n.getParentNode (); expandNode ((Node)toBeExpaned.get (j));
public void focusGained(java.awt.event.FocusEvent ev) { // unregister ev.getComponent().removeFocusListener(this); // lazy activation of drag source if (DragDropUtilities.dragAndDropEnabled && dragActive) { setDragSource(true); // note: dropTarget is activated in constructor } }
/** Called under Children.MUTEX to refresh the currently selected nodes. */ public void run () { if (readAccessPaths == null) { return; } TreePath[] paths = readAccessPaths; // non null value caused leak in // ComponentInspector // When the last Form was closed then the ComponentInspector was // closed as well. Since this variable was not null - // last selected Node (RADComponentNode) was held ---> FormManager2 was held, etc. readAccessPaths = null; java.util.List ll = new java.util.ArrayList(paths.length); for (int i = 0; i < paths.length; i++) { Node n = Visualizer.findNode (paths[i].getLastPathComponent ()); if (n == manager.getRootContext() || n.getParentNode() != null) { ll.add (n); } } callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()])); }