@Override public void removeSelectionPaths(TreePath[] paths) { for (int i = 0; i < paths.length; i++) { TreePath path = paths[i]; if (path.getPathCount() == 1) { super.removeSelectionPaths(new TreePath[]{path}); } else { toggleRemoveSelection(path); } } }
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}); }
super.removeSelectionPaths((TreePath[]) toBeRemoved.toArray(new TreePath[0]));
private void delegateRemoveSelectionPaths(TreePath[] paths) { if (!isBatchMode()) { super.removeSelectionPaths(paths); } else { for (TreePath path : paths) { _toBeRemoved.add(path); _toBeAdded.remove(path); } } }
@Override public void removeSelectionPaths(TreePath[] paths) { if (willContinueSelection()) { super.removeSelectionPaths(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); } }
@Override public void removeSelectionPaths( TreePath[] paths ) { if( !dig ) { super.removeSelectionPaths( paths ); return; } for ( int i=0; i < paths.length; i++ ) { TreePath path = paths[i]; if ( path.getPathCount() == 1 ) { super.removeSelectionPaths( new TreePath[]{path} ); } else { toggleRemoveSelection( path ); } } }
@Override public void removeSelectionPaths( final TreePath[] paths ) { for ( final TreePath path : paths ) { if ( path.getPathCount() == 1 ) { super.removeSelectionPaths( new TreePath[] { path } ); } else { toggleRemoveSelection( path ); } } }
super.removeSelectionPaths( new TreePath[] { path } ); super.removeSelectionPaths( new TreePath[] { parent } );
super.removeSelectionPaths( new TreePath[]{path} ); return; super.removeSelectionPaths( new TreePath[]{parent} );
public void removeSelectionPaths(TreePath[] paths, boolean doFireEvent) { if (!isDigIn()) { super.removeSelectionPaths(paths); return;
super.removeSelectionPaths( toBeRemoved.toArray( new TreePath[ toBeRemoved.size() ] ) );
super.removeSelectionPaths( (TreePath[])toBeRemoved.toArray( new TreePath[0] ) );
}}); m_treeSelectionModel.removeSelectionPaths(paths);