Java Code Examples for javax.swing.event.TreeSelectionEvent#getNewLeadSelectionPath()
The following examples show how to use
javax.swing.event.TreeSelectionEvent#getNewLeadSelectionPath() .
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: OutlineComponent.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent aEvent) { TreePath thePath = aEvent.getNewLeadSelectionPath(); if (thePath != null) { DefaultMutableTreeNode theNode = (DefaultMutableTreeNode) thePath .getLastPathComponent(); if (theNode != null) { Object theUserObject = theNode.getUserObject(); if (theUserObject instanceof UsedBy) { theUserObject = ((UsedBy) theUserObject).ref; } if (theUserObject instanceof ModelItem) { SQLComponent.getDefault().displaySQLFor( new ModelItem[]{(ModelItem) theUserObject}); ERDesignerComponent.getDefault().setSelectedObject( (ModelItem) theUserObject); } else { SQLComponent.getDefault().resetDisplay(); } } } }
Example 2
Source File: ElementSelectionListener.java From niftyeditor with Apache License 2.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); if (!node.isRoot()) { try { SelectCommand command = CommandProcessor.getInstance().getCommand(SelectCommand.class); command.setElement((GElement) node.getUserObject()); CommandProcessor.getInstance().excuteCommand(command); } catch (Exception ex) { Logger.getLogger(ElementSelectionListener.class.getName()).log(Level.SEVERE, null, ex); } } final JTree temp = (JTree) e.getSource(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { temp.updateUI(); } }); } }
Example 3
Source File: Viewer.java From accumulo-examples with Apache License 2.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath selected = e.getNewLeadSelectionPath(); if (selected == null) return; DefaultMutableTreeNode node = (DefaultMutableTreeNode) selected.getLastPathComponent(); text.setText(getText(node)); try { String hash = ((NodeInfo) node.getUserObject()).getHash(); if (hash != null) { data.setText(fdq.getSomeData(hash, 10000)); } else { data.setText(""); } } catch (IOException e1) { log.error("Could not get data from FileDataQuery.", e1); } }
Example 4
Source File: SessionPanel.java From bigtable-sql with Apache License 2.0 | 6 votes |
public void valueChanged(TreeSelectionEvent evt) { final TreePath selPath = evt.getNewLeadSelectionPath(); if (selPath != null) { StringBuffer buf = new StringBuffer(); Object[] fullPath = selPath.getPath(); for (int i = 0; i < fullPath.length; ++i) { if (fullPath[i] instanceof ObjectTreeNode) { ObjectTreeNode node = (ObjectTreeNode)fullPath[i]; buf.append('/').append(node.toString()); } } setStatusBarMessage(buf.toString()); } }
Example 5
Source File: DataTableColumnDropTextFieldTransferHandler.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath newLeadSelectionPath = e.getNewLeadSelectionPath(); if (newLeadSelectionPath == null) { return; } Object lastPathComponent = newLeadSelectionPath.getLastPathComponent(); if (lastPathComponent instanceof ValueSourceTreeNode) { ValueSourceTreeNode valueSourceNode = (ValueSourceTreeNode) lastPathComponent; // get the selected PVC ValueSource selectedValueSource = valueSourceNode.getUserObject(); if (selectedValueSource == currentValueSource) { return; } // change current PlotValueConfig currentValueSource = selectedValueSource; } else { currentValueSource = null; } }
Example 6
Source File: RangeAxisConfigPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath newLeadSelectionPath = e.getNewLeadSelectionPath(); if (newLeadSelectionPath == null) { selectedRangeAxisConfig = null; return; } Object lastPathComponent = newLeadSelectionPath.getLastPathComponent(); if (lastPathComponent instanceof RangeAxisConfigTreeNode) { RangeAxisConfig selectedConfig = ((RangeAxisConfigTreeNode) lastPathComponent).getUserObject(); selectedRangeAxisConfig = selectedConfig; adaptGUI(); } else { selectedRangeAxisConfig = null; } }
Example 7
Source File: CompoundDemoFrame.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void valueChanged(TreeSelectionEvent e) { final TreePath treePath = e.getNewLeadSelectionPath(); if (treePath == null) { setSelectedHandler(null); } else { final Object o = treePath.getLastPathComponent(); if (o instanceof DemoHandlerTreeNode) { DemoHandlerTreeNode handlerNode = (DemoHandlerTreeNode) o; DemoHandler handler = handlerNode.getHandler(); setSelectedHandler(handler); } else { setSelectedHandler(null); } } }
Example 8
Source File: UiInspectorAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (path == null) { onComponentChanged((Component)null); return; } Object component = path.getLastPathComponent(); if (component instanceof ComponentNode) { Component c = ((ComponentNode)component).getComponent(); onComponentChanged(c); } if (component instanceof ClickInfoNode) { onComponentChanged(((ClickInfoNode)component).getInfo()); } }
Example 9
Source File: ObjectTreeInternalFrame.java From bigtable-sql with Apache License 2.0 | 6 votes |
public void valueChanged(TreeSelectionEvent evt) { final TreePath selPath = evt.getNewLeadSelectionPath(); if (selPath != null) { StringBuffer buf = new StringBuffer(); Object[] fullPath = selPath.getPath(); for (int i = 0; i < fullPath.length; ++i) { if (fullPath[i] instanceof ObjectTreeNode) { ObjectTreeNode node = (ObjectTreeNode)fullPath[i]; buf.append('/').append(node.toString()); } } //JASON: have a main application status bar setStatusBarMessage(buf.toString()); } }
Example 10
Source File: LayerManager.java From Spade with GNU General Public License v3.0 | 5 votes |
@Override public void valueChanged(TreeSelectionEvent e) { if(Spade.getDocument() == null) return; if(e.getNewLeadSelectionPath() == null) { Spade.getDocument().setCurrent(Spade.getDocument().getRoot()); controls.setVisible(false); return; } Layer l = (Layer) e.getNewLeadSelectionPath().getLastPathComponent(); if(l == null) { Spade.getDocument().setCurrent(Spade.getDocument().getRoot()); controls.setVisible(false); } else { Layer current = Spade.getDocument().getCurrent(); if(Spade.getDocument().setCurrent(l) && current != null) { if(current.getImage().isMaskEnabled()) { boolean[] mask = current.getImage().copyMask(); current.addChange(new ClearMaskChange()); if(Spade.main.currentTool instanceof SelectionTool) { l.addChange(new SetMaskChange(mask)); } } } controls.setVisible(true); lsettings.updateIfVisible(l); } }
Example 11
Source File: ScreenInfoPanel.java From hprof-tools with MIT License | 5 votes |
@Override public void valueChanged(TreeSelectionEvent event) { if (selectedView != null) { selectedView.setSelected(false); } if (event.getNewLeadSelectionPath() == null) { selectedView = null; return; } DefaultMutableTreeNode newNode = (DefaultMutableTreeNode) event.getNewLeadSelectionPath().getLastPathComponent(); View newView = (View) newNode.getUserObject(); newView.setSelected(true); selectedView = newView; updateImage(false); }
Example 12
Source File: DomViewerWindow.java From LoboBrowser with MIT License | 5 votes |
public void valueChanged(final TreeSelectionEvent treeselectionevent) { final TreePath path = treeselectionevent.getNewLeadSelectionPath(); if (path != null) { final DomTreeNode domNode = (DomTreeNode) path.getLastPathComponent(); final Node node = domNode.getNode(); if ((node.getNodeType() == Node.TEXT_NODE) || (node.getNodeType() == Node.COMMENT_NODE)) { this.textArea.setText(node.getNodeValue()); } else { this.textArea.setText(""); this.appendNode(0, node); } this.textArea.setCaretPosition(0); } }
Example 13
Source File: HelpViewerWindow.java From bigtable-sql with Apache License 2.0 | 5 votes |
public void valueChanged(TreeSelectionEvent evt) { final TreePath path = evt.getNewLeadSelectionPath(); if (path != null) { Object lastComp = path.getLastPathComponent(); if (lastComp instanceof DocumentNode) { setSelectedDocument(((DocumentNode) lastComp).getURL()); } } }
Example 14
Source File: GroupingConfigurationPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath newLeadSelectionPath = e.getNewLeadSelectionPath(); if (newLeadSelectionPath != null) { if (newLeadSelectionPath.getLastPathComponent() instanceof DimensionConfigTreeNode) { adaptGUI(); } } }
Example 15
Source File: PreviewView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void handleTreeSelectionEvent(TreeSelectionEvent e) { final TreePath selectionPath = e.getNewLeadSelectionPath(); if (selectionPath != null) { ApplicationManager.getApplication().invokeLater(() -> selectPath(selectionPath, false)); } activeOutlines.setValue(getOutlinesSelectedInTree()); }
Example 16
Source File: PreviewView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void handleTreeSelectionEvent(TreeSelectionEvent e) { final TreePath selectionPath = e.getNewLeadSelectionPath(); if (selectionPath != null) { ApplicationManager.getApplication().invokeLater(() -> selectPath(selectionPath, false)); } activeOutlines.setValue(getOutlinesSelectedInTree()); }
Example 17
Source File: ProjectExplorer.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (listener != null) { listener.selectionChanged(new Event(path)); } }
Example 18
Source File: DirectoryChooserUI.java From netbeans with Apache License 2.0 | 5 votes |
/************ imple of TreeSelectionListener *******/ @Override public void valueChanged(TreeSelectionEvent e) { showPopupCompletion = false; FileSystemView fsv = fileChooser.getFileSystemView(); JTree tree = (JTree) e.getSource(); TreePath path = tree.getSelectionPath(); TreePath curSel = e.getNewLeadSelectionPath(); curSelPath = (curSel != null) ? new WeakReference<TreePath>(curSel) : null; if(path != null) { DirectoryNode node = (DirectoryNode)path.getLastPathComponent(); File file = node.getFile(); if(file != null) { setSelected(getSelectedNodes(tree.getSelectionPaths())); newFolderAction.setEnabled(false); if(!node.isLeaf()) { newFolderAction.enable(file); setDirectorySelected(true); } } } }
Example 19
Source File: DBBrowserTree.java From nextreports-designer with Apache License 2.0 | 5 votes |
/** * TreeSelectionListener - sets selected node */ public void valueChanged(TreeSelectionEvent evt) { selectedTreePath = evt.getNewLeadSelectionPath(); if (selectedTreePath == null) { selectedNode = null; return; } selectedNode = (DBBrowserNode) selectedTreePath.getLastPathComponent(); }
Example 20
Source File: ViewManager.java From nmonvisualizer with Apache License 2.0 | 4 votes |
@Override public void valueChanged(TreeSelectionEvent e) { currentPath = e.getNewLeadSelectionPath(); pathParser.parse(currentPath); }