Changeset 2801 in osm for applications/editors/josm/plugins/validator/src
- Timestamp:
- 2007-05-06T21:44:24+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorTreePanel.java
r2793 r2801 77 77 return; 78 78 } 79 79 80 // Remember the currently expanded rows 81 Set<Object> oldSelectedRows = new HashSet<Object>(); 82 Enumeration<TreePath> expanded = getExpandedDescendants( new TreePath(getRoot()) ); 83 if( expanded != null ) 84 { 85 while( expanded.hasMoreElements() ) 86 { 87 TreePath path = expanded.nextElement(); 88 DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); 89 Object userObject = node.getUserObject(); 90 if( userObject instanceof Severity ) 91 oldSelectedRows.add(userObject); 92 else if (userObject instanceof String) 93 { 94 String msg = (String)userObject; 95 msg = msg.substring(0, msg.lastIndexOf(" (")); 96 oldSelectedRows.add(msg); 97 } 98 } 99 } 100 80 101 Map<Severity, Bag<String, TestError>> errorTree = new HashMap<Severity, Bag<String, TestError>>(); 81 102 for(Severity s : Severity.values()) … … 89 110 } 90 111 112 List<TreePath> expandedPaths = new ArrayList<TreePath>(); 91 113 for(Severity s : Severity.values()) 92 114 { … … 98 120 DefaultMutableTreeNode severityNode = new DefaultMutableTreeNode(s); 99 121 rootNode.add(severityNode); 100 122 123 if( oldSelectedRows.contains(s)) 124 expandedPaths.add( new TreePath( new Object[] {rootNode, severityNode} ) ); 125 101 126 for(Entry<String, List<TestError>> msgErrors : severityErrors.entrySet() ) 102 127 { … … 106 131 DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg); 107 132 severityNode.add(messageNode); 108 133 134 if( oldSelectedRows.contains(msgErrors.getKey())) 135 expandedPaths.add( new TreePath( new Object[] {rootNode, severityNode, messageNode} ) ); 136 109 137 for (TestError error : errors) 110 138 { … … 116 144 } 117 145 118 treeModel.setRoot(rootNode); 119 this.scrollRowToVisible(treeModel.getChildCount(rootNode)-1); 146 treeModel.setRoot(rootNode); 147 for( TreePath path : expandedPaths) 148 { 149 this.expandPath(path); 150 } 120 151 } 121 152 … … 135 166 public void expandAll() 136 167 { 137 DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();168 DefaultMutableTreeNode root = getRoot(); 138 169 139 170 int row = 0;
Note:
See TracChangeset
for help on using the changeset viewer.