Changeset 11128 in josm
- Timestamp:
- 2016-10-14T21:29:40+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r11127 r11128 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Map.Entry;17 16 import java.util.Set; 18 17 import java.util.function.Predicate; … … 178 177 filterToUse = filterToUse.and(e -> e.getPrimitives().stream().anyMatch(filter::contains)); 179 178 } 180 Map<Severity, Map<String, Map<String, List<TestError>>>> error TreeDeep179 Map<Severity, Map<String, Map<String, List<TestError>>>> errorsBySeverityMessageDescription 181 180 = errors.stream().filter(filterToUse).collect( 182 181 Collectors.groupingBy(TestError::getSeverity, () -> new EnumMap<>(Severity.class), … … 185 184 )))); 186 185 187 List<TreePath> expandedPaths = new ArrayList<>();188 error TreeDeep.forEach((s, severityErrorsDeep) -> {186 final List<TreePath> expandedPaths = new ArrayList<>(); 187 errorsBySeverityMessageDescription.forEach((severity, errorsByMessageDescription) -> { 189 188 // Severity node 190 DefaultMutableTreeNode severityNode = new GroupTreeNode(s);189 final DefaultMutableTreeNode severityNode = new GroupTreeNode(severity); 191 190 rootNode.add(severityNode); 192 191 193 if (oldSelectedRows.contains(s )) {192 if (oldSelectedRows.contains(severity)) { 194 193 expandedPaths.add(new TreePath(new Object[] {rootNode, severityNode})); 195 194 } 196 195 197 Map<String, List<TestError>> severityErrors = severityErrorsDeep.get(""); 198 if (severityErrors != null) { 199 for (Entry<String, List<TestError>> msgErrors : severityErrors.entrySet()) { 200 // Message node 201 List<TestError> errs = msgErrors.getValue(); 202 String msg = tr("{0} ({1})", msgErrors.getKey(), errs.size()); 203 DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg); 196 final Map<String, List<TestError>> errorsWithEmptyMessageByDescription = errorsByMessageDescription.get(""); 197 if (errorsWithEmptyMessageByDescription != null) { 198 errorsWithEmptyMessageByDescription.forEach((description, errors) -> { 199 final String msg = tr("{0} ({1})", description, errors.size()); 200 final DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg); 204 201 severityNode.add(messageNode); 205 202 206 if (oldSelectedRows.contains( msgErrors.getKey())) {203 if (oldSelectedRows.contains(description)) { 207 204 expandedPaths.add(new TreePath(new Object[] {rootNode, severityNode, messageNode})); 208 205 } 209 206 210 err s.stream().map(DefaultMutableTreeNode::new).forEach(messageNode::add);211 } 212 } 213 214 severityErrorsDeep.forEach((description, errorlist) -> {215 if ( description.isEmpty()) {207 errors.stream().map(DefaultMutableTreeNode::new).forEach(messageNode::add); 208 }); 209 } 210 211 errorsByMessageDescription.forEach((message, errorsByDescription) -> { 212 if (message.isEmpty()) { 216 213 return; 217 214 } 218 215 // Group node 219 DefaultMutableTreeNode groupNode;220 if (error list.size() > 1) {221 groupNode = new GroupTreeNode( description);216 final DefaultMutableTreeNode groupNode; 217 if (errorsByDescription.size() > 1) { 218 groupNode = new GroupTreeNode(message); 222 219 severityNode.add(groupNode); 223 if (oldSelectedRows.contains( description)) {220 if (oldSelectedRows.contains(message)) { 224 221 expandedPaths.add(new TreePath(new Object[] {rootNode, severityNode, groupNode})); 225 222 } … … 228 225 } 229 226 230 error list.forEach((message, errs) -> {227 errorsByDescription.forEach((description, errors) -> { 231 228 // Message node 232 String msg;229 final String msg; 233 230 if (groupNode != null) { 234 msg = tr("{0} ({1})", message, errs.size());231 msg = tr("{0} ({1})", description, errors.size()); 235 232 } else { 236 msg = tr("{0} - {1} ({2})", message, description, err s.size());237 } 238 DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg);233 msg = tr("{0} - {1} ({2})", message, description, errors.size()); 234 } 235 final DefaultMutableTreeNode messageNode = new DefaultMutableTreeNode(msg); 239 236 if (groupNode != null) { 240 237 groupNode.add(messageNode); … … 243 240 } 244 241 245 if (oldSelectedRows.contains( message)) {242 if (oldSelectedRows.contains(description)) { 246 243 if (groupNode != null) { 247 244 expandedPaths.add(new TreePath(new Object[] {rootNode, severityNode, groupNode, messageNode})); … … 251 248 } 252 249 253 err s.stream().map(DefaultMutableTreeNode::new).forEach(messageNode::add);250 errors.stream().map(DefaultMutableTreeNode::new).forEach(messageNode::add); 254 251 }); 255 252 });
Note:
See TracChangeset
for help on using the changeset viewer.