private void displaySearchResult() { int sz = results.size(); if (sz > 0) { if (currentSelectionIndex < 0) { currentSelectionIndex = sz - 1; } else if (currentSelectionIndex >= sz) { currentSelectionIndex = 0; } TreePath path = (TreePath) results.get(currentSelectionIndex); setSelectionPath(path); scrollPathToVisible(path); } else { clearSelection(); } }
private void displaySearchResult() { int sz = results.size(); if (sz > 0) { if (currentSelectionIndex < 0) { currentSelectionIndex = sz - 1; } else if (currentSelectionIndex >= sz) { currentSelectionIndex = 0; } TreePath path = (TreePath) results.get(currentSelectionIndex); setSelectionPath(path); scrollPathToVisible(path); } else { clearSelection(); } }
private void displaySearchResult() { int sz = searchResults.size(); if (sz > 0) { if (currentSelectionIndex < 0) { currentSelectionIndex = sz - 1; } else if (currentSelectionIndex >= sz) { currentSelectionIndex = 0; } TreePath path = searchResults.get(currentSelectionIndex); setSelectionPath(path); scrollPathToVisible(path); } else { if (lastSearchText.isEmpty() && origSelectionPaths != null) { setSelectionPaths(origSelectionPaths); scrollPathToVisible(origSelectionPaths[0]); } else { clearSelection(); } } }
public void treeStructureChanged(TreeModelEvent e) { // Remember selections and expansions TreePath selectionPaths[] = getSelectionPaths(); java.util.Enumeration expanded = getExpandedDescendants( e.getTreePath() ); // Restructure the node super.treeStructureChanged( e ); // Expand previously expanded paths if ( expanded != null ) { while( expanded.hasMoreElements() ) { expandPath( (TreePath)expanded.nextElement() ); } } // Select previously selected paths if ( selectionPaths != null && selectionPaths.length > 0 ) { boolean wasSelected = isPathSelected(selectionPaths[0]); setSelectionPaths( selectionPaths ); if (!wasSelected) { // do not scroll if the first selection path survived structure change scrollPathToVisible( selectionPaths[0] ); } } }
@Override public void treeStructureChanged(TreeModelEvent e) { // Remember selections and expansions TreePath[] selectionPaths = getSelectionPaths(); java.util.Enumeration expanded = getExpandedDescendants(e.getTreePath()); // Restructure the node super.treeStructureChanged(e); // Expand previously expanded paths if (expanded != null) { while (expanded.hasMoreElements()) { expandPath((TreePath) expanded.nextElement()); } } // Select previously selected paths if ((selectionPaths != null) && (selectionPaths.length > 0)) { boolean wasSelected = isPathSelected(selectionPaths[0]); setSelectionPaths(selectionPaths); if (!wasSelected) { // do not scroll if the first selection path survived structure change scrollPathToVisible(selectionPaths[0]); } } }
public void treeStructureChanged(TreeModelEvent e) { // Remember selections and expansions TreePath selectionPaths[] = getSelectionPaths(); java.util.Enumeration expanded = getExpandedDescendants( e.getTreePath() ); // Restructure the node super.treeStructureChanged( e ); // Expand previously expanded paths if ( expanded != null ) { while( expanded.hasMoreElements() ) { expandPath( (TreePath)expanded.nextElement() ); } } // Select previously selected paths if ( selectionPaths != null && selectionPaths.length > 0 ) { boolean wasSelected = isPathSelected(selectionPaths[0]); setSelectionPaths( selectionPaths ); if (!wasSelected) { // do not scroll if the first selection path survived structure change scrollPathToVisible( selectionPaths[0] ); } } }