- Timestamp:
- 2014-01-19T21:51:35+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r6679 r6743 6 6 7 7 import java.awt.event.ActionEvent; 8 import java.net.URL;9 8 import java.util.ArrayList; 10 9 import java.util.Collection; … … 73 72 } 74 73 75 protected void launchBrowser(URL url) {76 OpenBrowser.displayUrl(77 url.toString()78 );79 }80 81 protected void launchBrowser(String url) {82 OpenBrowser.displayUrl(83 url84 );85 }86 87 74 public static boolean confirmLaunchMultiple(int numBrowsers) { 88 75 String msg = /* for correct i18n of plural forms - see #9110 */ trn( … … 149 136 return; 150 137 for(int i = 0; i < max; i++) { 151 launchBrowser(createInfoUrl(primitivesToShow.get(i)));138 OpenBrowser.displayUrl(createInfoUrl(primitivesToShow.get(i))); 152 139 } 153 140 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r6643 r6743 44 44 import org.openstreetmap.josm.gui.util.GuiHelper; 45 45 import org.openstreetmap.josm.tools.ImageProvider; 46 import org.openstreetmap.josm.tools.OpenBrowser; 46 47 import org.openstreetmap.josm.tools.Shortcut; 47 48 … … 212 213 break; 213 214 } 214 launchBrowser(url);215 OpenBrowser.displayUrl(url); 215 216 num--; 216 217 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
r6084 r6743 89 89 90 90 HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/HistoryBrowser")); 91 92 setSize(800, 500);93 91 } 94 92 -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r6448 r6743 16 16 17 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.data.osm.OsmPrimitive;19 18 import org.openstreetmap.josm.data.osm.PrimitiveId; 20 19 import org.openstreetmap.josm.data.osm.history.History; … … 73 72 } 74 73 74 final String WINDOW_GEOMETRY_PREF = getClass().getName() + ".geometry"; 75 75 76 public void placeOnScreen(HistoryBrowserDialog dialog) { 76 WindowGeometry geometry = WindowGeometry.centerOnScreen(new Dimension(800,500));77 WindowGeometry geometry = new WindowGeometry(WINDOW_GEOMETRY_PREF, WindowGeometry.centerOnScreen(new Dimension(850, 500))); 77 78 geometry.applySafe(dialog); 78 79 Point p = dialog.getLocation(); 79 80 while(hasDialogWithCloseUpperLeftCorner(p)) { 80 p.x += 20;81 p.x += 20; 81 82 p.y += 20; 82 83 } … … 94 95 if (id > 0) { 95 96 dialogs.remove(id); 97 if (dialogs.isEmpty()) { 98 new WindowGeometry(dialog).remember(WINDOW_GEOMETRY_PREF); 99 } 96 100 } 97 101 dialog.setVisible(false); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r6524 r6743 45 45 import org.openstreetmap.josm.gui.layer.Layer; 46 46 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 47 import org.openstreetmap.josm.io.XmlWriter;48 47 import org.openstreetmap.josm.tools.CheckParameterUtil; 49 48 … … 439 438 User user = p.getUser(); 440 439 if (user != null) 441 return "<html>" + XmlWriter.encode(user.getName(), true) + " <font color=gray>(" + user.getId() + ")</font></html>";440 return user.getName(); 442 441 } 443 442 return null; -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r6623 r6743 31 31 import org.openstreetmap.josm.Main; 32 32 import org.openstreetmap.josm.actions.AbstractInfoAction; 33 import org.openstreetmap.josm.data.osm.User; 33 34 import org.openstreetmap.josm.data.osm.history.History; 34 35 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; 35 36 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 37 import org.openstreetmap.josm.io.XmlWriter; 36 38 import org.openstreetmap.josm.tools.ImageProvider; 39 import org.openstreetmap.josm.tools.OpenBrowser; 37 40 38 41 /** … … 161 164 return; 162 165 String url = createInfoUrl(primitive); 163 launchBrowser(url);166 OpenBrowser.displayUrl(url); 164 167 } 165 168 … … 170 173 } 171 174 175 static class UserInfoAction extends AbstractInfoAction { 176 private HistoryOsmPrimitive primitive; 177 178 public UserInfoAction() { 179 super(true); 180 putValue(NAME, tr("User info")); 181 putValue(SHORT_DESCRIPTION, tr("Launch browser with information about the user")); 182 putValue(SMALL_ICON, ImageProvider.get("about")); 183 } 184 185 @Override 186 protected String createInfoUrl(Object infoObject) { 187 HistoryOsmPrimitive primitive = (HistoryOsmPrimitive) infoObject; 188 return primitive.getUser() == null ? null : getBaseBrowseUrl() + "/user/" + primitive.getUser().getName(); 189 } 190 191 @Override 192 public void actionPerformed(ActionEvent e) { 193 if (!isEnabled()) 194 return; 195 String url = createInfoUrl(primitive); 196 OpenBrowser.displayUrl(url); 197 } 198 199 public void prepare(HistoryOsmPrimitive primitive) { 200 final User user = primitive.getUser(); 201 putValue(NAME, "<html>" + tr("Show user {0}", user == null ? "?" : 202 XmlWriter.encode(user.getName(), true) + " <font color=gray>(" + user.getId() + ")</font>") + "</html>"); 203 this.primitive = primitive; 204 } 205 } 206 172 207 static class VersionTablePopupMenu extends JPopupMenu { 173 208 174 209 private ChangesetInfoAction changesetInfoAction; 210 private UserInfoAction userInfoAction; 175 211 176 212 protected void build() { 177 213 changesetInfoAction = new ChangesetInfoAction(); 178 214 add(changesetInfoAction); 215 userInfoAction = new UserInfoAction(); 216 add(userInfoAction); 179 217 } 180 218 public VersionTablePopupMenu() { … … 185 223 public void prepare(HistoryOsmPrimitive primitive) { 186 224 changesetInfoAction.prepare(primitive); 225 userInfoAction.prepare(primitive); 187 226 invalidate(); 188 227 }
Note:
See TracChangeset
for help on using the changeset viewer.