private void toggleRemoveSelection(TreePath path) { Stack stack = new Stack(); TreePath parent = path.getParentPath(); while (parent != null && !isPathSelected(parent)) { stack.push(parent); parent = parent.getParentPath(); } if (parent != null) { stack.push(parent); } else { super.removeSelectionPaths(new TreePath[]{path}); return; } while (!stack.isEmpty()) { TreePath temp = (TreePath) stack.pop(); TreePath peekPath = stack.isEmpty() ? path : (TreePath) stack.peek(); Object node = temp.getLastPathComponent(); Object peekNode = peekPath.getLastPathComponent(); int childCount = model.getChildCount(node); for (int i = 0; i < childCount; i++) { Object childNode = model.getChild(node, i); if (childNode != peekNode) { super.addSelectionPaths(new TreePath[]{temp.pathByAddingChild(childNode)}); } } } super.removeSelectionPaths(new TreePath[]{parent}); }
removeSelectionPaths(getSelectionPaths()); super.addSelectionPaths(new TreePath[]{temp}); super.addSelectionPaths(new TreePath[]{path});
@Override public void addSelectionPaths(TreePath[] paths) { DefaultMutableTreeNode lastSelected = (DefaultMutableTreeNode) paths[paths.length-1].getLastPathComponent(); if (isSelectedPathAllowed(lastSelected)) { super.addSelectionPaths(paths); } } };
@Override public void addSelectionPaths(TreePath[] paths) { if (willContinueSelection()) { super.addSelectionPaths(paths); } }
public void setBatchMode(boolean batchMode) { _batchMode = batchMode; if (!_batchMode) { TreePath[] treePaths = _toBeRemoved.toArray(new TreePath[_toBeRemoved.size()]); _toBeRemoved.clear(); super.removeSelectionPaths(treePaths); treePaths = _toBeAdded.toArray(new TreePath[_toBeAdded.size()]); _toBeAdded.clear(); super.addSelectionPaths(treePaths); } }
public void addSelectionPaths(final TreePath[] _paths) { super.addSelectionPaths(getCorrectPaths(_paths)); }
public void addSelectionPaths(final TreePath[] _paths) { super.addSelectionPaths(getCorrectPaths(_paths)); }
private void delegateAddSelectionPaths(TreePath[] paths) { if (!isBatchMode()) { super.addSelectionPaths(paths); } else { for (TreePath path : paths) { addToExistingSet(_toBeAdded, path); _toBeRemoved.remove(path); } } }
Object childNode = model.getChild( node, i ); if ( childNode != peekNode ) { super.addSelectionPaths( new TreePath[]{temp.pathByAddingChild( childNode )} );
super.addSelectionPaths( new TreePath[] { temp.pathByAddingChild( childNode ) } );
@Override public void addSelectionPaths( TreePath[] paths ) { if ( !dig ) { super.addSelectionPaths( paths ); return; removeSelectionPaths( getSelectionPaths() ); super.addSelectionPaths( new TreePath[]{temp} ); super.addSelectionPaths( new TreePath[]{path} );
super.addSelectionPaths( new TreePath[] { temp } ); super.addSelectionPaths( new TreePath[] { path } );
super.addSelectionPaths(paths); return;
}}); m_treeSelectionModel.addSelectionPaths(paths);