Changeset 11772 in josm for trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
- Timestamp:
- 2017-03-23T00:01:04+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r10791 r11772 58 58 } 59 59 60 private final TagConflictResolver allPrimitivesResolver = new TagConflictResolver();60 private final TagConflictResolverModel model = new TagConflictResolverModel(); 61 61 private final transient Map<OsmPrimitiveType, TagConflictResolver> resolvers = new EnumMap<>(OsmPrimitiveType.class); 62 62 private final JTabbedPane tpResolvers = new JTabbedPane(); … … 81 81 setTitle(tr("Conflicts in pasted tags")); 82 82 for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) { 83 resolvers.put(type, new TagConflictResolver()); 84 resolvers.get(type).getModel().addPropertyChangeListener(this); 83 TagConflictResolverModel tagModel = new TagConflictResolverModel(); 84 resolvers.put(type, new TagConflictResolver(tagModel)); 85 tagModel.addPropertyChangeListener(this); 85 86 } 86 87 getContentPane().setLayout(new GridBagLayout()); … … 106 107 getContentPane().add(buildButtonPanel(), gc); 107 108 InputMapUtils.addEscapeAction(getRootPane(), new CancelAction()); 108 109 109 } 110 110 … … 114 114 // -- apply button 115 115 ApplyAction applyAction = new ApplyAction(); 116 allPrimitivesResolver.getModel().addPropertyChangeListener(applyAction);116 model.addPropertyChangeListener(applyAction); 117 117 for (TagConflictResolver r : resolvers.values()) { 118 118 r.getModel().addPropertyChangeListener(applyAction); … … 141 141 */ 142 142 protected void initResolver(OsmPrimitiveType type, TagCollection tc, Map<OsmPrimitiveType, Integer> targetStatistics) { 143 resolvers.get(type).getModel().populate(tc, tc.getKeysWithMultipleValues()); 144 resolvers.get(type).getModel().prepareDefaultTagDecisions(); 143 TagConflictResolver resolver = resolvers.get(type); 144 resolver.getModel().populate(tc, tc.getKeysWithMultipleValues()); 145 resolver.getModel().prepareDefaultTagDecisions(); 145 146 if (!tc.isEmpty() && targetStatistics.get(type) != null && targetStatistics.get(type) > 0) { 146 tpResolvers.add(PANE_TITLES.get(type), resolver s.get(type));147 tpResolvers.add(PANE_TITLES.get(type), resolver); 147 148 } 148 149 } … … 164 165 // init the resolver 165 166 // 166 allPrimitivesResolver.getModel().populate(tagsForAllPrimitives, tagsForAllPrimitives.getKeysWithMultipleValues());167 allPrimitivesResolver.getModel().prepareDefaultTagDecisions();167 model.populate(tagsForAllPrimitives, tagsForAllPrimitives.getKeysWithMultipleValues()); 168 model.prepareDefaultTagDecisions(); 168 169 169 170 // prepare the dialog with one tag resolver 170 171 pnlTagResolver.removeAll(); 171 pnlTagResolver.add( allPrimitivesResolver, BorderLayout.CENTER);172 pnlTagResolver.add(new TagConflictResolver(model), BorderLayout.CENTER); 172 173 173 174 statisticsModel.reset(); … … 297 298 setEnabled(false); 298 299 } else if (mode.equals(Mode.RESOLVING_ONE_TAGCOLLECTION_ONLY)) { 299 setEnabled( allPrimitivesResolver.getModel().isResolvedCompletely());300 setEnabled(model.isResolvedCompletely()); 300 301 } else { 301 302 setEnabled(resolvers.values().stream().allMatch(val -> val.getModel().isResolvedCompletely())); … … 329 330 */ 330 331 public TagCollection getResolution() { 331 return allPrimitivesResolver.getModel().getResolution();332 return model.getResolution(); 332 333 } 333 334 … … 340 341 public void propertyChange(PropertyChangeEvent evt) { 341 342 if (evt.getPropertyName().equals(TagConflictResolverModel.NUM_CONFLICTS_PROP)) { 342 TagConflictResolverModel model = (TagConflictResolverModel) evt.getSource();343 TagConflictResolverModel tagModel = (TagConflictResolverModel) evt.getSource(); 343 344 for (int i = 0; i < tpResolvers.getTabCount(); i++) { 344 345 TagConflictResolver resolver = (TagConflictResolver) tpResolvers.getComponentAt(i); 345 if ( model == resolver.getModel()) {346 if (tagModel == resolver.getModel()) { 346 347 tpResolvers.setIconAt(i, 347 348 (Integer) evt.getNewValue() == 0 ? iconResolved : iconUnresolved
Note:
See TracChangeset
for help on using the changeset viewer.