Changeset 9468 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-15T19:01:02+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r9371 r9468 89 89 } 90 90 91 /** 92 * Creates a changeset with the data obtained from the given preset, i.e., 93 * the {@link AbstractPrimitive#getChangesetId() changeset id}, {@link AbstractPrimitive#getUser() user}, and 94 * {@link AbstractPrimitive#getTimestamp() timestamp}. 95 * @param primitive the primitive to use 96 * @return the created changeset 97 */ 98 public static Changeset fromPrimitive(final OsmPrimitive primitive) { 99 final Changeset changeset = new Changeset(primitive.getChangesetId()); 100 changeset.setUser(primitive.getUser()); 101 changeset.setCreatedAt(primitive.getTimestamp()); // not accurate in all cases 102 return changeset; 103 } 104 91 105 public void visit(Visitor v) { 92 106 v.visit(this); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r9440 r9468 27 27 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 28 28 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 29 import org.openstreetmap.josm.gui.history.VersionInfoPanel; 29 30 import org.openstreetmap.josm.tools.ImageProvider; 30 31 … … 48 49 49 50 private final transient PropertiesMergeModel model; 51 private final VersionInfoPanel mineVersionInfo = new VersionInfoPanel(); 52 private final VersionInfoPanel theirVersionInfo = new VersionInfoPanel(); 50 53 51 54 /** … … 78 81 gc.weightx = 0.0; 79 82 gc.weighty = 0.0; 80 gc.insets = new Insets(10, 0, 10, 0);83 gc.insets = new Insets(10, 0, 0, 0); 81 84 JLabel lblMyVersion = new JLabel(tr("My version")); 82 85 lblMyVersion.setToolTipText(tr("Properties in my dataset, i.e. the local dataset")); … … 84 87 85 88 gc.gridx = 3; 86 gc.gridy = 0;87 89 JLabel lblMergedVersion = new JLabel(tr("Merged version")); 88 90 lblMergedVersion.setToolTipText( … … 91 93 92 94 gc.gridx = 5; 93 gc.gridy = 0;94 95 JLabel lblTheirVersion = new JLabel(tr("Their version")); 95 96 lblTheirVersion.setToolTipText(tr("Properties in their dataset, i.e. the server dataset")); 96 97 add(lblTheirVersion, gc); 98 99 gc.gridx = 1; 100 gc.gridy = 1; 101 gc.fill = GridBagConstraints.HORIZONTAL; 102 gc.anchor = GridBagConstraints.LINE_START; 103 gc.insets = new Insets(0, 0, 20, 0); 104 add(mineVersionInfo, gc); 105 106 gc.gridx = 5; 107 add(theirVersionInfo, gc); 108 97 109 } 98 110 … … 101 113 102 114 gc.gridx = 0; 103 gc.gridy = 1;115 gc.gridy = 2; 104 116 gc.gridwidth = 1; 105 117 gc.gridheight = 1; … … 112 124 113 125 gc.gridx = 1; 114 gc.gridy = 1;115 126 gc.fill = GridBagConstraints.BOTH; 116 127 gc.anchor = GridBagConstraints.CENTER; … … 120 131 121 132 gc.gridx = 2; 122 gc.gridy = 1;123 133 gc.fill = GridBagConstraints.NONE; 124 134 gc.anchor = GridBagConstraints.CENTER; … … 132 142 133 143 gc.gridx = 3; 134 gc.gridy = 1;135 144 gc.fill = GridBagConstraints.BOTH; 136 145 gc.anchor = GridBagConstraints.CENTER; … … 140 149 141 150 gc.gridx = 4; 142 gc.gridy = 1;143 151 gc.fill = GridBagConstraints.NONE; 144 152 gc.anchor = GridBagConstraints.CENTER; … … 151 159 152 160 gc.gridx = 5; 153 gc.gridy = 1;154 161 gc.fill = GridBagConstraints.BOTH; 155 162 gc.anchor = GridBagConstraints.CENTER; … … 160 167 // --------------------------------------------------- 161 168 gc.gridx = 3; 162 gc.gridy = 2;169 gc.gridy = 3; 163 170 gc.fill = GridBagConstraints.NONE; 164 171 gc.anchor = GridBagConstraints.CENTER; … … 175 182 176 183 gc.gridx = 0; 177 gc.gridy = 3;184 gc.gridy = 4; 178 185 gc.gridwidth = 1; 179 186 gc.gridheight = 1; … … 186 193 187 194 gc.gridx = 1; 188 gc.gridy = 3;189 195 gc.fill = GridBagConstraints.BOTH; 190 196 gc.anchor = GridBagConstraints.CENTER; … … 194 200 195 201 gc.gridx = 2; 196 gc.gridy = 3;197 202 gc.fill = GridBagConstraints.NONE; 198 203 gc.anchor = GridBagConstraints.CENTER; … … 206 211 207 212 gc.gridx = 3; 208 gc.gridy = 3;209 213 gc.fill = GridBagConstraints.BOTH; 210 214 gc.anchor = GridBagConstraints.CENTER; … … 214 218 215 219 gc.gridx = 4; 216 gc.gridy = 3;217 220 gc.fill = GridBagConstraints.NONE; 218 221 gc.anchor = GridBagConstraints.CENTER; … … 226 229 227 230 gc.gridx = 5; 228 gc.gridy = 3;229 231 gc.fill = GridBagConstraints.BOTH; 230 232 gc.anchor = GridBagConstraints.CENTER; … … 235 237 // --------------------------------------------------- 236 238 gc.gridx = 3; 237 gc.gridy = 4;239 gc.gridy = 5; 238 240 gc.fill = GridBagConstraints.NONE; 239 241 gc.anchor = GridBagConstraints.CENTER; … … 507 509 public void populate(Conflict<? extends OsmPrimitive> conflict) { 508 510 model.populate(conflict); 511 mineVersionInfo.update(conflict.getMy(), true); 512 theirVersionInfo.update(conflict.getTheir(), false); 509 513 } 510 514 -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r9078 r9468 13 13 import java.text.DateFormat; 14 14 import java.util.Collections; 15 import java.util.Date; 15 16 import java.util.Observable; 16 17 import java.util.Observer; … … 134 135 } 135 136 136 protected String getInfoText() { 137 HistoryOsmPrimitive primitive = getPrimitive(); 138 if (primitive == null) 139 return ""; 137 protected String getInfoText(final Date timestamp, final long version, final boolean isLatest) { 140 138 String text; 141 if ( model.isLatest(primitive)) {139 if (isLatest) { 142 140 OsmDataLayer editLayer = Main.main.getEditLayer(); 143 141 text = tr("<html>Version <strong>{0}</strong> currently edited in layer ''{1}''</html>", 144 Long.toString( primitive.getVersion()),142 Long.toString(version), 145 143 editLayer == null ? tr("unknown") : editLayer.getName() 146 144 ); 147 145 } else { 148 146 String date = "?"; 149 if ( primitive.getTimestamp()!= null) {150 date = DateUtils.formatDateTime( primitive.getTimestamp(), DateFormat.SHORT, DateFormat.SHORT);147 if (timestamp != null) { 148 date = DateUtils.formatDateTime(timestamp, DateFormat.SHORT, DateFormat.SHORT); 151 149 } 152 150 text = tr( 153 151 "<html>Version <strong>{0}</strong> created on <strong>{1}</strong></html>", 154 Long.toString( primitive.getVersion()), date);152 Long.toString(version), date); 155 153 } 156 154 return text; … … 190 188 @Override 191 189 public void update(Observable o, Object arg) { 192 lblInfo.setText(getInfoText());193 194 190 HistoryOsmPrimitive primitive = getPrimitive(); 195 191 Changeset cs = primitive.getChangeset(); 196 197 if (!model.isLatest(primitive)) { 198 User user = primitive.getUser(); 199 String url = Main.getBaseBrowseUrl() + "/changeset/" + primitive.getChangesetId(); 192 update(cs, model.isLatest(primitive), primitive.getTimestamp(), primitive.getVersion()); 193 } 194 195 public void update(final OsmPrimitive primitive, final boolean isLatest) { 196 update(Changeset.fromPrimitive(primitive), isLatest, primitive.getTimestamp(), primitive.getVersion()); 197 } 198 199 public void update(final Changeset cs, final boolean isLatest, final Date timestamp, final long version) { 200 lblInfo.setText(getInfoText(timestamp, version, isLatest)); 201 202 if (!isLatest) { 203 User user = cs.getUser(); 204 String url = Main.getBaseBrowseUrl() + "/changeset/" + cs.getId(); 200 205 lblChangeset.setUrl(url); 201 lblChangeset.setDescription(Long.toString( primitive.getChangesetId()));202 changesetDialogAction.setId( (int) primitive.getChangesetId());206 lblChangeset.setDescription(Long.toString(cs.getId())); 207 changesetDialogAction.setId(cs.getId()); 203 208 changesetButton.setEnabled(true); 204 209 … … 228 233 } 229 234 230 final Changeset oppCs = model .getPointInTime(pointInTimeType.opposite()).getChangeset();235 final Changeset oppCs = model != null ? model.getPointInTime(pointInTimeType.opposite()).getChangeset() : null; 231 236 updateText(cs, "comment", texChangesetComment, null, oppCs, texChangesetComment); 232 237 updateText(cs, "source", texChangesetSource, lblSource, oppCs, pnlChangesetSource);
Note:
See TracChangeset
for help on using the changeset viewer.