@Override public void valueChanged(TreeSelectionEvent ev) { TreePath[] paths = tree.getSelectionPaths(); if (paths == null) { // part of bugfix #37279, if DnD is active then is useless select a nearby node if (ExplorerDnDManager.getDefault().isDnDActive()) { return; } callSelectionChanged(new Node[0]); } else { // we need to force no changes to nodes hierarchy => // we are requesting read request, but it is not necessary // to execute the next action immediatelly, so postReadRequest // should be enough readAccessPaths = paths; Children.MUTEX.postReadRequest(this); } }
public HintsPanel(HintMetadata preselected, @NullAllowed final CustomizerContext<?, ?> cc, ClassPathBasedHintWrapper cpBased) { this.cpBased = cpBased; this.queryStatus = cc == null ? QueryStatus.NEVER : QueryStatus.SHOW_QUERIES; this.showHeavyInspections = true; init(null, true, false, false, false, cc == null, false, cc != null); select(preselected); configurationsPanel.setVisible(false); if (cc != null) { errorTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { HintMetadata hm = getSelectedHint(); if (hm != null) { cc.setSelectedId(AnalyzerImpl.ID_JAVA_HINTS_PREFIX + hm.id); } } }); } }
@Override public void valueChanged(TreeSelectionEvent e) { if (e.isAddedPath()) { otherTreeSelectionModel.clearSelection(); } int idx = treeModel.getIndexOfChild(treeModel.getRoot(), e.getPath().getLastPathComponent()); if (idx >= 0) { if (otherListModel != null) { idx += otherListModel.getSize() + 1; } if (e.isAddedPath()) { list.setSelectionInterval(idx, idx); } else { list.removeSelectionInterval(idx, idx); } } else { list.clearSelection(); } }
@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; } }
@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; } }
@Override public void valueChanged(TreeSelectionEvent e) { TreePath[] paths = getSelectionPaths(); // If only one item has been selected, then change the text in the // description area if (paths == null) { return; } if (paths.length == 1) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[0].getLastPathComponent(); if (!node.getAllowsChildren()) { ClusterTreeLeaf leaf = (ClusterTreeLeaf) node.getUserObject(); ObjectVisualizer viz = ObjectVisualizerService.getVisualizerForObject(clusterModel); viz.startVisualization(leaf.getId()); } } }
public AvailableTreeTable() { super(); setTreeTableModel(new AvailableTreeTableModel(data.getRoot())); sizeColumns(); setRowHeight(CELL_HEIGHT); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); getTableHeader().setReorderingAllowed(false); addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getPath(); TreeTableNode node = (TreeTableNode) path.getLastPathComponent(); if ("template".equals(node.getType())) { tempDownload.setEnabled(true); } else { tempDownload.setEnabled(false); } } }); }
/** Required by TreeSelectionListener interface. */ public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) return; Object nodeInfo = node.getUserObject(); if (node.isLeaf()) { BookInfo book = (BookInfo) nodeInfo; displayURL(book.bookURL); if (DEBUG) { System.out.print(book.bookURL + ": \n "); } } else { displayURL(helpURL); } if (DEBUG) { System.out.println(nodeInfo.toString()); } }
public void valueChanged(TreeSelectionEvent e) { super.valueChanged(e); final TreePath p = e.getPath(); if (p != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode) p.getLastPathComponent(); Object x[] = node.getUserObjectPath(); Configurable[] userObjectPath = new Configurable[x.length]; for (int i = 0; i < x.length; i++) { userObjectPath[i] = (Configurable) x[i]; } path = ArrayUtils.copyOfRange(userObjectPath, 1, userObjectPath.length); } else { path = null; } }
/** Required by TreeSelectionListener interface. */ public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) return; Object nodeInfo = node.getUserObject(); if (node.isLeaf()) { BookInfo book = (BookInfo)nodeInfo; displayURL(book.bookURL); if (DEBUG) { System.out.print(book.bookURL + ": \n "); } } else { displayURL(helpURL); } if (DEBUG) { System.out.println(nodeInfo.toString()); } }
/** Construct a Tree object with the given font size. */ public OurTree(int fontSize) { Font font = OurUtil.getVizFont().deriveFont((float) fontSize); OurTreeRenderer renderer = new OurTreeRenderer(fontSize); renderer.setFont(font); renderer.invalidate(); renderer.validate(); setRowHeight(0); // To allow variable row height on Mac OS X setCellRenderer(renderer); setFont(font); setBorder(new EmptyBorder(8, 8, 2, 2)); getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); putClientProperty("JTree.lineStyle", "Angled"); setRootVisible(true); setForeground(Color.BLACK); setBackground(Color.WHITE); setOpaque(true); addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath path = OurTree.this.getSelectionPath(); if (path != null) OurTree.this.listeners.fire(OurTree.this, Listener.Event.CLICK, path.getLastPathComponent()); } }); }
/** * Emphasises/deemphasises cells in the associated jmodel, based on the list * selection. */ @Override public void valueChanged(TreeSelectionEvent e) { Set<JCell<?>> emphSet = new HashSet<>(); TreePath[] selectionPaths = getSelectionPaths(); if (selectionPaths != null) { for (TreePath selectedPath : selectionPaths) { Object treeNode = selectedPath.getLastPathComponent(); if (treeNode instanceof LabelTree.EntryNode) { Entry entry = ((EntryNode) treeNode).getEntry(); Set<JCell<G>> occurrences = getFilter().getJCells(entry); if (occurrences != null) { emphSet.addAll(occurrences); } } } } this.jGraph.setSelectionCells(emphSet.toArray()); }
protected void createInnerComponent() { panel.removeAll(); Attribute[] attributes = getAttributes(); RootCreater rootCreater = getRootCreater(); component = new RowTreeTableComponent(engine, qualifier, accessRules, rootCreater, attributes, framework); rowSet = component.getRowSet(); table = component.getTable(); table.getTreeSelectionModel().addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { refreshActions(); } }); refreshActions(); panel.add(component, BorderLayout.CENTER); panel.revalidate(); panel.repaint(); }
/** * This function analyses a tree selection event and calls the * right methods to take care of building the requested unit's * details. * * @param event The incoming TreeSelectionEvent. */ @Override public void valueChanged(TreeSelectionEvent event) { detailPanel.removeAll(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node != null) { if (node.isLeaf()) { OptionGroup group = (OptionGroup) node.getUserObject(); for (Option option : group.getOptions()) { addOptionUI(option, editable && group.isEditable()); } } else { tree.expandPath(event.getPath()); } } detailPanel.revalidate(); detailPanel.repaint(); }
@Override public void valueChanged(TreeSelectionEvent evt) { // Get all nodes whose selection status has changed TreePath[] paths = evt.getPaths(); if (paths.length > 0 && evt.isAddedPath(0) && paths[0].getLastPathComponent() instanceof DefaultMutableTreeNode) { if (((DefaultMutableTreeNode) paths[0].getLastPathComponent()) .isLeaf() && !((DefaultMutableTreeNode) paths[0] .getLastPathComponent()).isRoot()) { // a leaf has been selected, allow delete relation deleteRelationButton.setEnabled(true); } else { deleteRelationButton.setEnabled(false); } } }
/** * Called whenever the value of the selection changes. * @param e the event that characterizes the change. */ public void valueChanged(TreeSelectionEvent e) { if (!updatingSelection && tree.getSelectionCount() == 1) { TreePath selPath = tree.getSelectionPath(); Object lastPathComponent = selPath.getLastPathComponent(); if (!(lastPathComponent instanceof DefaultMutableTreeNode)) { Element selElement = (Element) lastPathComponent; updatingSelection = true; try { getEditor().select(selElement.getStartOffset(), selElement.getEndOffset()); } finally { updatingSelection = false; } } } }
/** Construct a Tree object with the given font size. */ public OurTree(int fontSize) { Font font = OurUtil.getVizFont().deriveFont((float)fontSize); OurTreeRenderer renderer = new OurTreeRenderer(fontSize); renderer.setFont(font); renderer.invalidate(); renderer.validate(); setRowHeight(0); // To allow variable row height on Mac OS X setCellRenderer(renderer); setFont(font); setBorder(new EmptyBorder(8, 8, 2, 2)); getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); putClientProperty("JTree.lineStyle", "Angled"); setRootVisible(true); setForeground(Color.BLACK); setBackground(Color.WHITE); setOpaque(true); addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath path = OurTree.this.getSelectionPath(); if (path!=null) OurTree.this.listeners.fire(OurTree.this, Listener.Event.CLICK, path.getLastPathComponent()); } }); }
/** Construct a FileTree */ public FileTree(File dir) { setLayout(new BorderLayout()); applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); setBorder(null); // Make a tree list with all the nodes, and make it a JTree JTree tree = new JTree(addNodes(null, dir)); tree.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); // Add a listener tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) e .getPath().getLastPathComponent(); } }); add(BorderLayout.CENTER, tree); JScrollPane scrollBarExplorer = new JScrollPane(); scrollBarExplorer.getViewport().add(tree); scrollBarExplorer.setBorder(null); add(scrollBarExplorer, BorderLayout.CENTER); }
public ViewTreeGroups(String directory) { //super("JTree FileSystem Viewer - JavaProgrammingForums.com"); setTitle("GroupsTree Structure"); fileDetailsTextArea.setEditable(false); fileSystemModel = new FileSystemModel(new File(directory)); fileTree = new JTree(fileSystemModel); fileTree.setEditable(true); fileTree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent event) { File file = (File) fileTree.getLastSelectedPathComponent(); fileDetailsTextArea.setText(getFileDetails(file)); } }); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(fileTree), new JScrollPane( fileDetailsTextArea)); getContentPane().add(splitPane); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(640, 480); setVisible(true); }
public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); // If nothing is selected, or it is not a data child, or it is the Unscaled Data // load the field config panel if (node == null || !data.isNodeChild(node) || data.getChildAt(0) == node) { if (currentComponent == fieldConfig) return; getContentPane().remove(currentComponent); getContentPane().add(fieldConfig); currentComponent = fieldConfig; } else { int i = data.getIndex(node) - 1; JPanel p = scalePanels.get(i); if (currentComponent == p) return; getContentPane().remove(currentComponent); getContentPane().add(p); currentComponent = p; } validate(); currentComponent.repaint(); }
private void loadEntry(final TreeSelectionEvent e) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treeDir.getLastSelectedPathComponent(); if (node == null) { return; } final Object userObject = node.getUserObject(); if (userObject instanceof TreeModelEntry) { ((TreeModelEntry)userObject).activate(); treeObservable.notifyObservers(); } }
private Component createTreePanel() { treeComponent = new TaskTreeComponent(gradlePluginLord, new TaskTreeComponent.Interaction() { public void rightClick(JTree tree, int x, int y) { enableThingsAppropriately(); popupMenu.show(tree, x, y); } public void taskInvoked(TaskView task, boolean isCtrlKeyDown) { if (isCtrlKeyDown) { gradlePluginLord.addExecutionRequestToQueue(task, false, "-a"); } else { gradlePluginLord.addExecutionRequestToQueue(task, false); } } public void projectInvoked(ProjectView project) { executeDefaultTasksInProject(project); } }); treeComponent.getTree().addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { enableThingsAppropriately(); } }); defaultTreeBackground = treeComponent.getTree().getBackground(); treeScrollPane = new JScrollPane(); treeComponent.getTree().setBackground(workingBackgroundColor); //change the color to better indicate that showTextInViewport("Has not built projects/tasks yet."); return treeScrollPane; }
private void trTransValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_trTransValueChanged TreeNode tn = (TreeNode) evt.getPath().getLastPathComponent(); if (tn instanceof CheckNode) { setReferenceTree((CheckNode)tn); } else { trRef.setModel(new DefaultTreeModel(new DefaultMutableTreeNode())); } }
public void valueChanged(TreeSelectionEvent ex) { Object o = getUserObject(errorTree.getSelectionPath()); if ( o instanceof UserConfigurableRule ) { UserConfigurableRule hint = (UserConfigurableRule) o; // Enable components componentsSetEnabled(true); // Set proper values to the componetnts Preferences p = getCurrentPrefernces(hint); ignoreControlChanges = true; try { HintSeverity severity = HintsSettings.getSeverity(hint, p); severityComboBox.setSelectedIndex(severity2index.get(severity)); boolean toTasklist = HintsSettings.isShowInTaskList(hint, p); tasklistCheckBox.setSelected(toTasklist); String description = hint.getDescription(); descriptionTextArea.setText( description == null ? wrapDescription("") : wrapDescription(description)); // NOI18N } finally { ignoreControlChanges = false; } // Optionally show the customizer customizerPanel.removeAll(); JComponent c = hint.getCustomizer(getPreferences4Modification(hint)); if ( c != null ) { customizerPanel.add(c, BorderLayout.CENTER); } customizerPanel.getParent().invalidate(); ((JComponent)customizerPanel.getParent()).revalidate(); customizerPanel.getParent().repaint(); } else { // Category or nonsense selected. componentsSetEnabled(false); } }
public void valueChanged(TreeSelectionEvent e) { String status = null; int state = 0; Object o[] = e.getPath().getPath(); for (int i = 0; i < o.length; i++) { XDMTreeNode node = (XDMTreeNode) o[i]; if (node.id.equals("TREE_UNFINISHED")) { state = 1; } if (node.id.equals("TREE_FINISHED")) { state = IXDMConstants.COMPLETE; } if (node.id.equals("TREE_DOCUMENTS")) { status = IXDMConstants.DOCUMENTS; } if (node.id.equals("TREE_COMPRESSED")) { status = IXDMConstants.COMPRESSED; } if (node.id.equals("TREE_MUSIC")) { status = IXDMConstants.MUSIC; } if (node.id.equals("TREE_PROGRAMS")) { status = IXDMConstants.PROGRAMS; } if (node.id.equals("TREE_VIDEOS")) { status = IXDMConstants.VIDEO; } list.setState(state); list.setType(status); model.fireTableDataChanged(); } }
public void valueChanged(TreeSelectionEvent e) { if (internal) return; TreePath selected = e.getPath(); int row = selected == null ? -1 : tree.getRowForPath(selected); try { internal = true; if (row != -1) selectRow(row, !tree.isChangingModel()); else clearSelection(); } finally { internal = false; } }
/** * This method will be invoked after a user selection of an operator in the tree. Causes a * property table update and an update of the conditional action container. */ @Override public void valueChanged(TreeSelectionEvent e) { if (preventEvent) { return; } if (mainFrame != null) { List<Operator> selectedOperators = getSelectedOperators(); if (selectedOperators != null && !selectedOperators.isEmpty()) { mainFrame.selectOperators(selectedOperators); } } }
@Override public void valueChanged(TreeSelectionEvent e) { TreePath newLeadSelectionPath = e.getNewLeadSelectionPath(); if (newLeadSelectionPath != null) { if (newLeadSelectionPath.getLastPathComponent() instanceof DimensionConfigTreeNode) { adaptGUI(); } } }
@Override public void valueChanged(TreeSelectionEvent e) { TreePath newLeadSelectionPath = e.getNewLeadSelectionPath(); if (newLeadSelectionPath == null) { return; } Object lastPathComponent = newLeadSelectionPath.getLastPathComponent(); if (lastPathComponent instanceof ValueSourceTreeNode) { valueSourceNode = (ValueSourceTreeNode) lastPathComponent; // get the selected PVC ValueSource selectedValueSource = valueSourceNode.getUserObject(); if (selectedValueSource == currentValueSource) { return; } // change current PlotValueConfig currentValueSource = selectedValueSource; adaptGUI(); } else { currentValueSource = null; valueSourceNode = null; } }
@Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (path != null) { if (path.getLastPathComponent() instanceof GroupTree) { setOperatorList((GroupTree) path.getLastPathComponent()); } } }
/** * Once you select a subsection from the menu window, * it does refer to the correct page */ @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); OutlineNode selectedNode = (OutlineNode) path.getLastPathComponent(); GoToAction act = (GoToAction) selectedNode.getAction(); try { int pageNode = pdfFile .getPageNumber(act.getDestination().getPage()); bar.setValue(pageNode - pageStart); loadPage(pageNode - pageStart); updateCanvas(); } catch (IOException e1) { } }
/** * This method get last selected node * @param e Tree selection event */ @Override public void valueChanged( TreeSelectionEvent e) { lastSelectedFile = (FileNode) (((JTree)(e.getSource())).getLastSelectedPathComponent()); // if (lastSelectedFile != null) // lastSelectedFile.shallowUpdate(); }
@Override public void valueChanged( TreeSelectionEvent e) { TreeNode clickedNode = (TreeNode)((JTree) e.getSource()).getLastSelectedPathComponent(); if (clickedNode instanceof VisitableNode) { File file = ((VisitableNode) clickedNode).getFile(); Position position = ((VisitableNode) clickedNode).getPosition(); visitor.visitNode( file, position); } }