- Timestamp:
- 2014-02-08T01:19:08+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r6822 r6827 390 390 this.url = url; 391 391 } catch(Exception e) { 392 Main.warn(e); 392 393 HelpAwareOptionPane.showOptionDialog( 393 394 Main.parent, -
trunk/src/org/openstreetmap/josm/gui/history/PointInTimeType.java
r5835 r6827 14 14 CURRENT_POINT_IN_TIME; 15 15 16 /** 17 * Returns the opposite point in time. 18 * @return the opposite point in time 19 */ 16 20 public PointInTimeType opposite() { 17 21 if (this.equals(REFERENCE_POINT_IN_TIME)) -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r6643 r6827 20 20 import org.openstreetmap.josm.Main; 21 21 import org.openstreetmap.josm.actions.AbstractInfoAction; 22 import org.openstreetmap.josm.data.osm.Changeset; 22 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 24 import org.openstreetmap.josm.data.osm.User; … … 41 42 private UrlLabel lblChangeset; 42 43 private JTextArea lblChangesetComment; 44 private JTextArea lblChangesetSource; 45 46 protected static JTextArea buildTextArea(String tooltip) { 47 JTextArea lbl = new JTextArea(); 48 lbl.setLineWrap(true); 49 lbl.setWrapStyleWord(true); 50 lbl.setEditable(false); 51 lbl.setOpaque(false); 52 lbl.setToolTipText(tooltip); 53 return lbl; 54 } 43 55 44 56 protected void build() { … … 57 69 pnlUserAndChangeset.add(lblChangeset); 58 70 59 lblChangesetComment = new JTextArea(); 60 lblChangesetComment.setLineWrap(true); 61 lblChangesetComment.setWrapStyleWord(true); 62 lblChangesetComment.setEditable(false); 63 lblChangesetComment.setOpaque(false); 71 lblChangesetComment = buildTextArea(tr("Changeset comment")); 72 lblChangesetSource = buildTextArea(tr("Changeset source")); 64 73 65 74 setLayout(new GridBagLayout()); … … 75 84 gc.gridy = 2; 76 85 add(lblChangesetComment, gc); 86 gc.gridy = 3; 87 add(lblChangesetSource, gc); 77 88 } 78 89 … … 134 145 } 135 146 147 protected static String getUserUrl(String username) throws UnsupportedEncodingException { 148 return AbstractInfoAction.getBaseUserUrl() + "/" + URLEncoder.encode(username, "UTF-8").replaceAll("\\+", "%20"); 149 } 150 136 151 @Override 137 152 public void update(Observable o, Object arg) { 138 153 lblInfo.setText(getInfoText()); 139 154 140 if (!model.isLatest(getPrimitive())) { 141 String url = AbstractInfoAction.getBaseBrowseUrl() + "/changeset/" + getPrimitive().getChangesetId(); 155 HistoryOsmPrimitive primitive = getPrimitive(); 156 Changeset cs = primitive.getChangeset(); 157 158 if (!model.isLatest(primitive)) { 159 User user = primitive.getUser(); 160 String url = AbstractInfoAction.getBaseBrowseUrl() + "/changeset/" + primitive.getChangesetId(); 142 161 lblChangeset.setUrl(url); 143 lblChangeset.setDescription(Long.toString(getPrimitive().getChangesetId())); 144 final String comment = getPrimitive().getChangeset() != null ? getPrimitive().getChangeset().get("comment") : null; 145 lblChangesetComment.setText(comment); 146 lblChangesetComment.setToolTipText(tr("Changeset comment")); 147 162 lblChangeset.setDescription(Long.toString(primitive.getChangesetId())); 163 164 String username = ""; 165 if (user != null) { 166 username = user.getName(); 167 } 168 lblUser.setDescription(username); 148 169 try { 149 if (getPrimitive().getUser() != null && getPrimitive().getUser() != User.getAnonymous()) { 150 url = AbstractInfoAction.getBaseUserUrl() + "/" + URLEncoder.encode(getPrimitive().getUser().getName(), "UTF-8").replaceAll("\\+", "%20"); 151 lblUser.setUrl(url); 170 if (user != null && user != User.getAnonymous()) { 171 lblUser.setUrl(getUserUrl(username)); 152 172 } else { 153 173 lblUser.setUrl(null); … … 157 177 lblUser.setUrl(null); 158 178 } 159 String username = "";160 if (getPrimitive().getUser() != null) {161 username = getPrimitive().getUser().getName();162 }163 lblUser.setDescription(username);164 179 } else { 165 String user = JosmUserIdentityManager.getInstance().getUserName();166 if (user == null) {180 String username = JosmUserIdentityManager.getInstance().getUserName(); 181 if (username == null) { 167 182 lblUser.setDescription(tr("anonymous")); 168 183 lblUser.setUrl(null); 169 184 } else { 185 lblUser.setDescription(username); 170 186 try { 171 String url = AbstractInfoAction.getBaseUserUrl() + "/" + URLEncoder.encode(user, "UTF-8").replaceAll("\\+", "%20"); 172 lblUser.setUrl(url); 187 lblUser.setUrl(getUserUrl(username)); 173 188 } catch(UnsupportedEncodingException e) { 174 189 Main.error(e); 175 190 lblUser.setUrl(null); 176 191 } 177 lblUser.setDescription(user);178 192 } 179 193 lblChangeset.setDescription(tr("none")); 180 194 lblChangeset.setUrl(null); 181 195 } 196 197 final String comment = cs != null ? cs.get("comment") : null; 198 final String source = cs != null ? cs.get("source") : null; 199 lblChangesetComment.setText(comment); 200 lblChangesetSource.setText(source); 201 202 // Hide comment / source if both values are empty 203 final Changeset oppCs = model.getPointInTime(pointInTimeType.opposite()).getChangeset(); 204 lblChangesetComment.setVisible(comment != null || (oppCs != null && oppCs.get("comment") != null)); 205 lblChangesetSource.setVisible(source != null || (oppCs != null && oppCs.get("source") != null)); 182 206 } 183 207 }
Note:
See TracChangeset
for help on using the changeset viewer.