Changeset 8254 in josm
- Timestamp:
- 2015-04-23T21:26:41+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r7861 r8254 206 206 // -- launch changeset manager action 207 207 launchChangesetManagerAction = new LaunchChangesetManagerAction(); 208 cbInSelectionOnly.addItemListener(launchChangesetManagerAction);209 208 210 209 popupMenu = new ChangesetDialogPopup(lstInActiveDataLayer, lstInSelection); … … 462 461 * 463 462 */ 464 class LaunchChangesetManagerAction extends AbstractAction implements ListSelectionListener, ItemListener{463 class LaunchChangesetManagerAction extends AbstractAction { 465 464 public LaunchChangesetManagerAction() { 466 465 putValue(NAME, tr("Details")); … … 469 468 } 470 469 471 protected void launchChangesetManager(Collection<Integer> toSelect) { 470 @Override 471 public void actionPerformed(ActionEvent arg0) { 472 ChangesetListModel model = getCurrentChangesetListModel(); 473 Set<Integer> sel = model.getSelectedChangesetIds(); 474 LaunchChangesetManager.displayChangesets(sel); 475 } 476 } 477 478 /** 479 * A utility class to fetch changesets and display the changeset dialog. 480 */ 481 public static class LaunchChangesetManager { 482 483 protected static void launchChangesetManager(Collection<Integer> toSelect) { 472 484 ChangesetCacheManager cm = ChangesetCacheManager.getInstance(); 473 485 if (cm.isVisible()) { … … 483 495 } 484 496 485 @Override 486 public void actionPerformed(ActionEvent arg0) { 487 ChangesetListModel model = getCurrentChangesetListModel(); 488 Set<Integer> sel = model.getSelectedChangesetIds(); 497 /** 498 * Fetches changesets and display the changeset dialog. 499 * @param sel the changeset ids to fetch and display. 500 */ 501 public static void displayChangesets(final Set<Integer> sel) { 489 502 final Set<Integer> toDownload = new HashSet<>(); 490 503 if (!Main.isOffline(OnlineResource.OSM_API)) { … … 534 547 @Override 535 548 public void run() { 536 launchChangesetManager( toDownload);549 launchChangesetManager(sel); 537 550 } 538 551 }); … … 540 553 }; 541 554 Main.worker.submit(r); 542 }543 544 @Override545 public void itemStateChanged(ItemEvent arg0) {546 }547 548 @Override549 public void valueChanged(ListSelectionEvent e) {550 555 } 551 556 } -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r8226 r8254 5 5 6 6 import java.awt.BorderLayout; 7 import java.awt.Dimension; 7 8 import java.awt.GridBagConstraints; 8 9 import java.awt.GridBagLayout; 9 10 import java.awt.GridLayout; 11 import java.awt.Insets; 12 import java.awt.event.ActionEvent; 10 13 import java.io.UnsupportedEncodingException; 11 14 import java.net.URLEncoder; 12 15 import java.text.DateFormat; 16 import java.util.Collections; 13 17 import java.util.Observable; 14 18 import java.util.Observer; 15 19 20 import javax.swing.AbstractAction; 21 import javax.swing.JButton; 16 22 import javax.swing.JComponent; 17 23 import javax.swing.JLabel; … … 25 31 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; 26 32 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 33 import org.openstreetmap.josm.gui.dialogs.ChangesetDialog; 27 34 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 35 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; … … 30 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 31 38 import org.openstreetmap.josm.tools.GBC; 39 import org.openstreetmap.josm.tools.ImageProvider; 32 40 import org.openstreetmap.josm.tools.Utils; 33 41 import org.openstreetmap.josm.tools.date.DateUtils; … … 44 52 private UrlLabel lblUser; 45 53 private UrlLabel lblChangeset; 54 private final OpenChangesetDialogAction changesetDialogAction = new OpenChangesetDialogAction(); 55 private final JButton changesetButton = new JButton(changesetDialogAction); 46 56 private JPanel pnlChangesetSource; 47 57 private JPanel pnlChangesetImageryUsed; … … 87 97 pnlUserAndChangeset.add(new JLabel(tr("User:"))); 88 98 pnlUserAndChangeset.add(lblUser); 89 pnlUserAndChangeset.add(new JLabel(tr("Changeset:"))); 99 changesetButton.setMargin(new Insets(0, 0, 0, 0)); 100 pnlUserAndChangeset.add(changesetButton); 90 101 lblChangeset = new UrlLabel("", 2); 91 102 pnlUserAndChangeset.add(lblChangeset); … … 191 202 lblChangeset.setUrl(url); 192 203 lblChangeset.setDescription(Long.toString(primitive.getChangesetId())); 204 changesetDialogAction.setId((int) primitive.getChangesetId()); 205 changesetButton.setEnabled(true); 193 206 194 207 String username = ""; … … 223 236 lblChangeset.setDescription(tr("none")); 224 237 lblChangeset.setUrl(null); 238 changesetDialogAction.setId(null); 239 changesetButton.setEnabled(false); 225 240 } 226 241 … … 241 256 container.setVisible(text != null || (oppCs != null && oppCs.get(attr) != null)); 242 257 } 258 259 static class OpenChangesetDialogAction extends AbstractAction { 260 private Integer id; 261 262 public OpenChangesetDialogAction() { 263 super(tr("Changeset"), new ImageProvider("dialogs/changeset", "changesetmanager").resetMaxSize(new Dimension(16, 16)).get()); 264 putValue(SHORT_DESCRIPTION, tr("Opens the Changeset Manager window for the selected changesets")); 265 } 266 267 public void setId(Integer id) { 268 this.id = id; 269 } 270 271 @Override 272 public void actionPerformed(ActionEvent e) { 273 ChangesetDialog.LaunchChangesetManager.displayChangesets(Collections.singleton(id)); 274 } 275 } 243 276 }
Note:
See TracChangeset
for help on using the changeset viewer.