Changeset 2936 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-02-04T21:04:02+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/history/History.java
r2845 r2936 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm.history; 3 4 import static org.openstreetmap.josm.tools.I18n.tr;5 3 6 4 import java.text.MessageFormat; … … 39 37 private ArrayList<HistoryOsmPrimitive> versions; 40 38 /** the object id */ 41 private long id;42 private OsmPrimitiveType type;39 private final long id; 40 private final OsmPrimitiveType type; 43 41 44 42 /** -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
r2871 r2936 54 54 } 55 55 56 protected void fireHistoryUpdated( SimplePrimitiveId id) {56 protected void fireHistoryUpdated(PrimitiveId id) { 57 57 for (HistoryDataSetListener l : listeners) { 58 58 l.historyUpdated(this, id); … … 94 94 */ 95 95 public void put(HistoryOsmPrimitive primitive) { 96 SimplePrimitiveId id = new SimplePrimitiveId(primitive.getId(), primitive.getType());96 PrimitiveId id = new SimplePrimitiveId(primitive.getId(), primitive.getType()); 97 97 if (data.get(id) == null) { 98 98 data.put(id, new ArrayList<HistoryOsmPrimitive>()); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
r2846 r2936 9 9 import java.beans.PropertyChangeListener; 10 10 import java.util.ArrayList; 11 import java.util. logging.Logger;11 import java.util.List; 12 12 13 13 import javax.swing.ImageIcon; … … 67 67 static public final String THEIR_PRIMITIVE_PROP = ConflictResolver.class.getName() + ".theirPrimitive"; 68 68 69 private static final Logger logger = Logger.getLogger(ConflictResolver.class.getName());69 //private static final Logger logger = Logger.getLogger(ConflictResolver.class.getName()); 70 70 71 71 private JTabbedPane tabbedPane = null; … … 74 74 private RelationMemberMerger relationMemberMerger; 75 75 private PropertiesMerger propertiesMerger; 76 private final List<IConflictResolver> conflictResolvers = new ArrayList<IConflictResolver>(); 76 77 private OsmPrimitive my; 77 78 private OsmPrimitive their; … … 119 120 setLayout(new BorderLayout()); 120 121 add(tabbedPane, BorderLayout.CENTER); 122 123 conflictResolvers.add(propertiesMerger); 124 conflictResolvers.add(tagMerger); 125 conflictResolvers.add(nodeListMerger); 126 conflictResolvers.add(relationMemberMerger); 121 127 } 122 128 … … 174 180 } else if (evt.getPropertyName().equals(ListMergeModel.FROZEN_PROP)) { 175 181 boolean frozen = (Boolean)evt.getNewValue(); 176 if (frozen && evt.getSource() == nodeListMerger.getModel()) { 177 tabbedPane.setTitleAt(2, tr("Nodes(resolved)")); 178 tabbedPane.setToolTipTextAt(2, tr("Merged node list frozen. No pending conflicts in the node list of this way")); 179 tabbedPane.setIconAt(2, mergeComplete); 180 } else { 181 tabbedPane.setTitleAt(2, tr("Nodes(with conflicts)")); 182 tabbedPane.setToolTipTextAt(2,tr("Pending conflicts in the node list of this way")); 183 tabbedPane.setIconAt(2, mergeIncomplete); 184 } 185 if (frozen && evt.getSource() == relationMemberMerger.getModel()) { 186 tabbedPane.setTitleAt(3, tr("Members(resolved)")); 187 tabbedPane.setToolTipTextAt(3, tr("Merged member list frozen. No pending conflicts in the member list of this relation")); 188 tabbedPane.setIconAt(3, mergeComplete); 189 } else { 190 tabbedPane.setTitleAt(3, tr("Members(with conflicts)")); 191 tabbedPane.setToolTipTextAt(3, tr("Pending conflicts in the member list of this relation")); 192 tabbedPane.setIconAt(3, mergeIncomplete); 182 if (evt.getSource() == nodeListMerger.getModel() && my instanceof Way) { 183 if (frozen) { 184 tabbedPane.setTitleAt(2, tr("Nodes(resolved)")); 185 tabbedPane.setToolTipTextAt(2, tr("Merged node list frozen. No pending conflicts in the node list of this way")); 186 tabbedPane.setIconAt(2, mergeComplete); 187 } else { 188 tabbedPane.setTitleAt(2, tr("Nodes(with conflicts)")); 189 tabbedPane.setToolTipTextAt(2,tr("Pending conflicts in the node list of this way")); 190 tabbedPane.setIconAt(2, mergeIncomplete); 191 } 192 } else if (evt.getSource() == relationMemberMerger.getModel() && my instanceof Relation) { 193 if (frozen) { 194 tabbedPane.setTitleAt(3, tr("Members(resolved)")); 195 tabbedPane.setToolTipTextAt(3, tr("Merged member list frozen. No pending conflicts in the member list of this relation")); 196 tabbedPane.setIconAt(3, mergeComplete); 197 } else { 198 tabbedPane.setTitleAt(3, tr("Members(with conflicts)")); 199 tabbedPane.setToolTipTextAt(3, tr("Pending conflicts in the member list of this relation")); 200 tabbedPane.setIconAt(3, mergeIncomplete); 201 } 193 202 } 194 203 updateResolvedCompletely(); … … 205 214 } 206 215 updateResolvedCompletely(); 216 } else if (PropertiesMergeModel.DELETE_PRIMITIVE_PROP.equals(evt.getPropertyName())) { 217 for (IConflictResolver resolver: conflictResolvers) { 218 resolver.deletePrimitive((Boolean) evt.getNewValue()); 219 } 207 220 } 208 221 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java
r2881 r2936 117 117 } 118 118 119 protected ArrayList<T> getMergedEntries() {119 protected List<T> getMergedEntries() { 120 120 return entries.get(MERGED_ENTRIES); 121 121 } 122 122 123 protected ArrayList<T> getMyEntries() {123 protected List<T> getMyEntries() { 124 124 return entries.get(MY_ENTRIES); 125 125 } 126 126 127 protected ArrayList<T> getTheirEntries() {127 protected List<T> getTheirEntries() { 128 128 return entries.get(THEIR_ENTRIES); 129 129 } … … 230 230 protected void copyToTop(ListRole role, int []rows) { 231 231 copy(role, rows, 0); 232 fireModelDataChanged();233 232 mergedEntriesSelectionModel.setSelectionInterval(0, rows.length -1); 234 233 } … … 267 266 public void copyToEnd(ListRole source, int [] rows) { 268 267 copy(source, rows, getMergedEntriesSize()); 269 fireModelDataChanged();270 268 mergedEntriesSelectionModel.setSelectionInterval(getMergedEntriesSize()-rows.length, getMergedEntriesSize() -1); 271 269 … … 292 290 public void copyTheirToEnd(int [] rows) { 293 291 copyToEnd(THEIR_ENTRIES, rows); 292 } 293 294 public void clearMerged() { 295 getMergedEntries().clear(); 296 fireModelDataChanged(); 294 297 } 295 298 … … 304 307 } 305 308 getMergedEntries().addAll(position, newItems); 309 fireModelDataChanged(); 306 310 } 307 311 … … 318 322 protected void copyBeforeCurrent(ListRole source, int [] rows, int current) { 319 323 copy(source, rows, current); 320 fireModelDataChanged();321 324 mergedEntriesSelectionModel.setSelectionInterval(current, current + rows.length-1); 322 325 } … … 360 363 protected void copyAfterCurrent(ListRole source, int [] rows, int current) { 361 364 copy(source, rows, current + 1); 362 fireModelDataChanged();363 365 mergedEntriesSelectionModel.setSelectionInterval(current+1, current + rows.length-1); 364 366 notifyObservers(); … … 404 406 // can't move up 405 407 return; 406 ArrayList<T> mergedEntries = getMergedEntries();408 List<T> mergedEntries = getMergedEntries(); 407 409 for (int row: rows) { 408 410 T n = mergedEntries.get(row); … … 427 429 if (rows == null || rows.length == 0) 428 430 return; 429 ArrayList<T> mergedEntries = getMergedEntries();431 List<T> mergedEntries = getMergedEntries(); 430 432 if (rows[rows.length -1] == mergedEntries.size() -1) 431 433 // can't move down … … 455 457 return; 456 458 457 ArrayList<T> mergedEntries = getMergedEntries();459 List<T> mergedEntries = getMergedEntries(); 458 460 459 461 for (int i = rows.length-1; i>=0;i--) { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMerger.java
r2512 r2936 1 1 package org.openstreetmap.josm.gui.conflict.pair.nodes; 2 3 import java.util.logging.Logger;4 2 5 3 import javax.swing.JScrollPane; … … 8 6 import org.openstreetmap.josm.data.osm.Node; 9 7 import org.openstreetmap.josm.data.osm.Way; 8 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 10 9 import org.openstreetmap.josm.gui.conflict.pair.ListMerger; 11 10 … … 14 13 * 15 14 */ 16 public class NodeListMerger extends ListMerger<Node> {17 private static final Logger logger = Logger.getLogger(NodeListMerger.class.getName());15 public class NodeListMerger extends ListMerger<Node> implements IConflictResolver { 16 //private static final Logger logger = Logger.getLogger(NodeListMerger.class.getName()); 18 17 19 18 public NodeListMerger() { … … 66 65 ((NodeListMergeModel)model).populate(my, their); 67 66 } 67 68 public void deletePrimitive(boolean deleted) { 69 if (deleted) { 70 model.setFrozen(true); 71 model.clearMerged(); 72 } else { 73 model.setFrozen(false); 74 } 75 } 68 76 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
r2846 r2936 53 53 54 54 static public final String RESOLVED_COMPLETELY_PROP = PropertiesMergeModel.class.getName() + ".resolvedCompletely"; 55 static public final String DELETE_PRIMITIVE_PROP = PropertiesMergeModel.class.getName() + ".deletePrimitive"; 55 56 56 57 private OsmPrimitive my; … … 287 288 } 288 289 290 private boolean getMergedDeletedState(MergeDecisionType decision) { 291 switch (decision) { 292 case KEEP_MINE: 293 return myDeletedState; 294 case KEEP_THEIR: 295 return theirDeletedState; 296 default: 297 return false; 298 } 299 } 300 289 301 /** 290 302 * decides the conflict between two deleted states … … 295 307 public void decideDeletedStateConflict(MergeDecisionType decision) throws IllegalArgumentException{ 296 308 CheckParameterUtil.ensureParameterNotNull(decision, "decision"); 309 310 boolean oldMergedDeletedState = getMergedDeletedState(this.deletedMergeDecision); 311 boolean newMergedDeletedState = getMergedDeletedState(decision); 312 297 313 this.deletedMergeDecision = decision; 298 314 setChanged(); 299 315 notifyObservers(); 300 316 fireCompletelyResolved(); 317 318 if (oldMergedDeletedState != newMergedDeletedState) { 319 support.firePropertyChange(DELETE_PRIMITIVE_PROP, oldMergedDeletedState, newMergedDeletedState); 320 } 301 321 } 302 322 … … 478 498 dependent.size(), dependent.size(), way.getId()) 479 499 + "</html>", 480 tr("Undelete additional nodes?"),481 JOptionPane.YES_NO_OPTION,482 JOptionPane.QUESTION_MESSAGE,483 null,484 options,485 options[0]500 tr("Undelete additional nodes?"), 501 JOptionPane.YES_NO_OPTION, 502 JOptionPane.QUESTION_MESSAGE, 503 null, 504 options, 505 options[0] 486 506 ); 487 507 … … 512 532 dependent.size(), dependent.size(), r.getId()) 513 533 + "</html>", 514 tr("Undelete dependent primitives?"),515 JOptionPane.YES_NO_OPTION,516 JOptionPane.QUESTION_MESSAGE,517 null,518 options,519 options[0]534 tr("Undelete dependent primitives?"), 535 JOptionPane.YES_NO_OPTION, 536 JOptionPane.QUESTION_MESSAGE, 537 null, 538 options, 539 options[0] 520 540 ); 521 541 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r2612 r2936 22 22 23 23 import org.openstreetmap.josm.data.coor.LatLon; 24 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 24 25 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 25 26 import org.openstreetmap.josm.tools.ImageProvider; … … 30 31 * 31 32 */ 32 public class PropertiesMerger extends JPanel implements Observer {33 public class PropertiesMerger extends JPanel implements Observer, IConflictResolver { 33 34 private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000"); 34 35 … … 650 651 } 651 652 } 653 654 public void deletePrimitive(boolean deleted) { 655 // Do nothing 656 } 652 657 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMerger.java
r2512 r2936 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.conflict.pair.relation; 3 4 import java.util.logging.Logger;5 3 6 4 import javax.swing.JScrollPane; … … 9 7 import org.openstreetmap.josm.data.osm.Relation; 10 8 import org.openstreetmap.josm.data.osm.RelationMember; 9 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 11 10 import org.openstreetmap.josm.gui.conflict.pair.ListMerger; 12 11 … … 14 13 * A UI component for resolving conflicts in the member lists of two {@see Relation} 15 14 */ 16 public class RelationMemberMerger extends ListMerger<RelationMember> {17 private static final Logger logger = Logger.getLogger(RelationMemberMerger.class.getName());15 public class RelationMemberMerger extends ListMerger<RelationMember> implements IConflictResolver { 16 //private static final Logger logger = Logger.getLogger(RelationMemberMerger.class.getName()); 18 17 19 18 @Override … … 62 61 super(new RelationMemberListMergeModel()); 63 62 } 63 64 public void deletePrimitive(boolean deleted) { 65 if (deleted) { 66 model.clearMerged(); 67 model.setFrozen(true); 68 } else { 69 model.setFrozen(false); 70 } 71 } 64 72 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeModel.java
r2512 r2936 7 7 import java.util.HashSet; 8 8 import java.util.Set; 9 import java.util.logging.Logger;10 9 11 10 import javax.swing.table.DefaultTableModel; … … 29 28 */ 30 29 public class TagMergeModel extends DefaultTableModel { 31 private static final Logger logger = Logger.getLogger(TagMergeModel.class.getName());30 //private static final Logger logger = Logger.getLogger(TagMergeModel.class.getName()); 32 31 33 32 static public final String PROP_NUM_UNDECIDED_TAGS = TagMergeModel.class.getName() + ".numUndecidedTags"; -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r2846 r2936 26 26 import javax.swing.event.ListSelectionListener; 27 27 28 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 28 29 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 29 30 import org.openstreetmap.josm.tools.ImageProvider; … … 32 33 * 33 34 */ 34 public class TagMerger extends JPanel {35 public class TagMerger extends JPanel implements IConflictResolver { 35 36 36 37 private JTable mineTable; … … 393 394 } 394 395 } 396 397 public void deletePrimitive(boolean deleted) { 398 // Use my entries, as it doesn't really matter 399 MergeDecisionType decision = deleted?MergeDecisionType.KEEP_MINE:MergeDecisionType.UNDECIDED; 400 for (int i=0; i<model.getRowCount(); i++) { 401 model.decide(i, decision); 402 } 403 } 395 404 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
r2512 r2936 109 109 110 110 public void historyUpdated(HistoryDataSet source, PrimitiveId primitiveId) { 111 if (primitiveId == null ) {111 if (primitiveId == null || primitiveId.equals(browser.getHistory().getPrimitmiveId())) { 112 112 browser.populate(source.getHistory(browser.getHistory().getPrimitmiveId())); 113 } else if (primitiveId.equals(browser.getHistory().getPrimitmiveId())) {114 browser.populate(source.getHistory(primitiveId));115 113 } 116 114 } -
trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java
r2512 r2936 37 37 public class OsmHistoryReader { 38 38 39 private InputStream in;40 private HistoryDataSet data;39 private final InputStream in; 40 private final HistoryDataSet data; 41 41 42 42 private class Parser extends DefaultHandler { … … 131 131 throwException(tr("Missing mandatory attribute ''{0}''.", name)); 132 132 } 133 if ( v.equals("true")) return true;134 if ( v.equals("false")) return false;133 if ("true".equals(v)) return true; 134 if ("false".equals(v)) return false; 135 135 throwException(tr("Illegal value for mandatory attribute ''{0}'' of type boolean. Got ''{1}''.", name, v)); 136 136 // not reached … … 231 231 public OsmHistoryReader(InputStream source) { 232 232 this.in = source; 233 data = new HistoryDataSet();233 this.data = new HistoryDataSet(); 234 234 } 235 235
Note:
See TracChangeset
for help on using the changeset viewer.