Changeset 2712 in josm
- Timestamp:
- 2009-12-30T21:28:16+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/conflict/tags
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
r2626 r2712 15 15 import java.beans.PropertyChangeEvent; 16 16 import java.beans.PropertyChangeListener; 17 import java.util.HashSet; 17 18 import java.util.LinkedList; 18 19 import java.util.List; 20 import java.util.Set; 19 21 20 22 import javax.swing.AbstractAction; … … 31 33 import org.openstreetmap.josm.data.osm.Node; 32 34 import org.openstreetmap.josm.data.osm.OsmPrimitive; 35 import org.openstreetmap.josm.data.osm.Relation; 33 36 import org.openstreetmap.josm.data.osm.TagCollection; 34 37 import org.openstreetmap.josm.data.osm.Way; … … 130 133 } 131 134 if (targetPrimitive instanceof Way) { 132 setTitle( 133 tr( 134 "Conflicts when combining ways - combined way is ''{0}''", 135 targetPrimitive.getDisplayName(DefaultNameFormatter.getInstance()) 136 ) 137 ); 135 setTitle(tr("Conflicts when combining ways - combined way is ''{0}''", targetPrimitive 136 .getDisplayName(DefaultNameFormatter.getInstance()))); 138 137 helpAction.setHelpTopic(ht("/Action/CombineWay#ResolvingConflicts")); 139 138 getRootPane().putClientProperty("help", ht("/Action/CombineWay#ResolvingConflicts")); 140 139 } else if (targetPrimitive instanceof Node) { 141 setTitle( 142 tr( 143 "Conflicts when merging nodes - target node is ''{0}''", 144 targetPrimitive.getDisplayName(DefaultNameFormatter.getInstance()) 145 ) 146 ); 140 setTitle(tr("Conflicts when merging nodes - target node is ''{0}''", targetPrimitive 141 .getDisplayName(DefaultNameFormatter.getInstance()))); 147 142 helpAction.setHelpTopic(ht("/Action/MergeNodes#ResolvingConflicts")); 148 143 getRootPane().putClientProperty("help", ht("/Action/MergeNodes#ResolvingConflicts")); … … 195 190 196 191 public CombinePrimitiveResolverDialog(Component owner) { 197 super(JOptionPane.getFrameForComponent(owner), true /* modal */);192 super(JOptionPane.getFrameForComponent(owner), true /* modal */); 198 193 build(); 199 194 } … … 227 222 List<Command> cmds = new LinkedList<Command>(); 228 223 229 if (getTagConflictResolverModel().getNumDecisions() > 0) {224 if (getTagConflictResolverModel().getNumDecisions() > 0) { 230 225 TagCollection tc = getTagConflictResolverModel().getResolution(); 231 226 cmds.addAll(buildTagChangeCommand(targetPrimitive, tc)); … … 235 230 } 236 231 237 if (getRelationMemberConflictResolverModel().getNumDecisions() > 0) {232 if (getRelationMemberConflictResolverModel().getNumDecisions() > 0) { 238 233 cmds.addAll(getRelationMemberConflictResolverModel().buildResolutionCommands(targetPrimitive)); 239 234 } 240 235 241 Command cmd = pnlRelationMemberConflictResolver.buildTagApplyCommands( 242 getRelationMemberConflictResolverModel().getModifiedRelations(targetPrimitive) 243 ); 236 Command cmd = pnlRelationMemberConflictResolver.buildTagApplyCommands(getRelationMemberConflictResolverModel() 237 .getModifiedRelations(targetPrimitive)); 244 238 if (cmd != null) { 245 239 cmds.add(cmd); … … 250 244 protected void prepareDefaultTagDecisions() { 251 245 TagConflictResolverModel model = getTagConflictResolverModel(); 252 for (int i = 0; i< model.getRowCount(); i++) {246 for (int i = 0; i < model.getRowCount(); i++) { 253 247 MultiValueResolutionDecision decision = model.getDecision(i); 254 248 List<String> values = decision.getValues(); … … 265 259 protected void prepareDefaultRelationDecisions() { 266 260 RelationMemberConflictResolverModel model = getRelationMemberConflictResolverModel(); 267 for (int i=0; i < model.getNumDecisions(); i++) { 268 model.getDecision(i).decide(RelationMemberConflictDecisionType.KEEP); 261 Set<Relation> relations = new HashSet<Relation>(); 262 for (int i = 0; i < model.getNumDecisions(); i++) { 263 RelationMemberConflictDecision decision = model.getDecision(i); 264 if (!relations.contains(decision.getRelation())) { 265 decision.decide(RelationMemberConflictDecisionType.KEEP); 266 relations.add(decision.getRelation()); 267 } else { 268 decision.decide(RelationMemberConflictDecisionType.REMOVE); 269 } 269 270 } 270 271 model.refresh(); … … 298 299 // 299 300 getContentPane().add(pnlRelationMemberConflictResolver, BorderLayout.CENTER); 300 } else if (tagModel.getNumDecisions() > 0) {301 } else if (tagModel.getNumDecisions() > 0) { 301 302 // tag conflicts only 302 303 // … … 310 311 int numTagDecisions = getTagConflictResolverModel().getNumDecisions(); 311 312 int numRelationDecisions = getRelationMemberConflictResolverModel().getNumDecisions(); 312 if (numTagDecisions > 0 && 313 if (numTagDecisions > 0 && numRelationDecisions > 0) { 313 314 spTagConflictTypes.setDividerLocation(0.5); 314 315 } … … 328 329 if (visible) { 329 330 prepareGUIBeforeConflictResolutionStarts(); 330 new WindowGeometry( 331 getClass().getName() + ".geometry", 332 WindowGeometry.centerInWindow( 333 Main.parent, 334 new Dimension(600,400) 335 ) 336 ).applySafe(this); 331 new WindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(Main.parent, 332 new Dimension(600, 400))).applySafe(this); 337 333 setCancelled(false); 338 334 btnApply.requestFocusInWindow(); … … 372 368 373 369 protected void updateEnabledState() { 374 setEnabled( 375 pnlTagConflictResolver.getModel().getNumConflicts() == 0 376 && pnlRelationMemberConflictResolver.getModel().getNumConflicts() == 0 377 ); 370 setEnabled(pnlTagConflictResolver.getModel().getNumConflicts() == 0 371 && pnlRelationMemberConflictResolver.getModel().getNumConflicts() == 0); 378 372 } 379 373 … … 393 387 int numTagDecisions = getTagConflictResolverModel().getNumDecisions(); 394 388 int numRelationDecisions = getRelationMemberConflictResolverModel().getNumDecisions(); 395 if (numTagDecisions > 0 && 389 if (numTagDecisions > 0 && numRelationDecisions > 0) { 396 390 spTagConflictTypes.setDividerLocation(0.5); 397 391 } … … 404 398 public AutoAdjustingSplitPane(int newOrientation) { 405 399 super(newOrientation); 406 addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, this);400 addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, this); 407 401 addHierarchyBoundsListener(this); 408 402 } 409 403 410 404 public void ancestorResized(HierarchyEvent e) { 411 setDividerLocation((int) (dividerLocation * getHeight()));405 setDividerLocation((int) (dividerLocation * getHeight())); 412 406 } 413 407 … … 418 412 public void propertyChange(PropertyChangeEvent evt) { 419 413 if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) { 420 int newVal = (Integer) evt.getNewValue();414 int newVal = (Integer) evt.getNewValue(); 421 415 if (getHeight() != 0) { 422 dividerLocation = (double) newVal / (double)getHeight();416 dividerLocation = (double) newVal / (double) getHeight(); 423 417 } 424 418 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
r2512 r2712 121 121 122 122 public void initForWayCombining() { 123 lblHeader.setText(tr("<html>The combined ways are members in one ore more relations. "124 + "Please decide whether you rwant to <strong>keep</strong> these memberships "123 lblHeader.setText(tr("<html>The combined ways are members in one ore more relations. " 124 + "Please decide whether you want to <strong>keep</strong> these memberships " 125 125 + "for the combined way or whether you want to <strong>remove</strong> them.<br>" 126 + "The default is to <strong>keep</strong> them: the combined way will take the place of the original way in the membership." 127 + "</html>")); 128 invalidate(); 126 + "The default is to <strong>keep</strong> the first way and <strong>remove</strong> " 127 + "the other ways that are members of the same relation: the combined way will " 128 + "take the place of the original way in the membership." 129 + "</html>")); 130 invalidate(); 129 131 } 130 132 131 133 public void initForNodeMerging() { 132 134 lblHeader.setText(tr("<html>The merged nodes are members in one ore more relations. " 133 + "Please decide whether your want to <strong>keep</strong> these memberships " 134 + "for the target node or whether you want to <strong>remove</strong> them.<br>" 135 + "The default is to <strong>keep</strong> them: the target node will take the place of the original node in the membership." 136 + "</html>")); 135 + "Please decide whether you want to <strong>keep</strong> these memberships " 136 + "for the target node or whether you want to <strong>remove</strong> them.<br>" 137 + "The default is to <strong>keep</strong> the first node and <strong>remove</strong> " 138 + "the other nodes that are members of the same relation: the target node will " 139 + "take the place of the original node in the membership." 140 + "</html>")); 137 141 invalidate(); 138 142 } 139 143 140 144 class ApplyRoleAction extends AbstractAction { … … 183 187 AutoCompletionCache.getCacheForLayer(Main.main.getEditLayer()).populateWithMemberRoles(acList); 184 188 tfRole.setAutoCompletionList(acList); 185 AutoCompletingTextField editor = (AutoCompletingTextField) tblResolver.getColumnModel().getColumn(2) 186 .getCellEditor(); 189 AutoCompletingTextField editor = (AutoCompletingTextField) tblResolver.getColumnModel().getColumn(2).getCellEditor(); 187 190 if (editor != null) { 188 191 editor.setAutoCompletionList(acList);
Note:
See TracChangeset
for help on using the changeset viewer.