Changeset 7860 in josm
- Timestamp:
- 2014-12-20T20:32:54+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r7719 r7860 205 205 /** The table of default providers **/ 206 206 public final JTable defaultTable; 207 /** The selection listener synchronizing map display with table of default providers **/ 208 private final DefListSelectionListener defaultTableListener; 207 209 /** The map displaying imagery bounds of selected default providers **/ 208 210 public final JMapViewer defaultMap; … … 331 333 add(defaultMap, GBC.std().insets(5, 5, 0, 0).fill(GridBagConstraints.BOTH).weight(0.33, 0.6).insets(5, 0, 0, 0)); 332 334 333 defaultTable.getSelectionModel().addListSelectionListener(new DefListSelectionListener()); 335 defaultTableListener = new DefListSelectionListener(); 336 defaultTable.getSelectionModel().addListSelectionListener(defaultTableListener); 334 337 335 338 defaultToolbar = new JToolBar(JToolBar.VERTICAL); … … 367 370 activeToolbar.add(remove); 368 371 add(activeToolbar, GBC.eol().anchor(GBC.NORTH).insets(0, 0, 5, 5)); 369 370 372 } 371 373 … … 381 383 } 382 384 385 private void clearMap() { 386 defaultMap.removeAllMapRectangles(); 387 defaultMap.removeAllMapPolygons(); 388 mapRectangles.clear(); 389 mapPolygons.clear(); 390 } 391 383 392 @Override 384 393 public void valueChanged(ListSelectionEvent e) { 385 // First index isset to -1 when the list is refreshed, so discard all map rectangles and polygons394 // First index can be set to -1 when the list is refreshed, so discard all map rectangles and polygons 386 395 if (e.getFirstIndex() == -1) { 387 defaultMap.removeAllMapRectangles(); 388 defaultMap.removeAllMapPolygons(); 389 mapRectangles.clear(); 390 mapPolygons.clear(); 396 clearMap(); 397 } else if (!e.getValueIsAdjusting()) { 391 398 // Only process complete (final) selection events 392 } else if (!e.getValueIsAdjusting()) {393 399 for (int i = e.getFirstIndex(); i<=e.getLastIndex(); i++) { 394 400 updateBoundsAndShapes(i); … … 494 500 private class RemoveEntryAction extends AbstractAction implements ListSelectionListener { 495 501 502 /** 503 * Constructs a new {@code RemoveEntryAction}. 504 */ 496 505 public RemoveEntryAction() { 497 506 putValue(NAME, tr("Remove")); … … 520 529 521 530 private class ActivateAction extends AbstractAction implements ListSelectionListener { 531 532 /** 533 * Constructs a new {@code ActivateAction}. 534 */ 522 535 public ActivateAction() { 523 536 putValue(NAME, tr("Activate")); … … 583 596 584 597 private class ReloadAction extends AbstractAction { 598 599 /** 600 * Constructs a new {@code ReloadAction}. 601 */ 585 602 public ReloadAction() { 586 603 putValue(SHORT_DESCRIPTION, tr("reload defaults")); … … 592 609 layerInfo.loadDefaults(true); 593 610 defaultModel.fireTableDataChanged(); 611 defaultTable.getSelectionModel().clearSelection(); 612 defaultTableListener.clearMap(); 594 613 /* loading new file may change active layers */ 595 614 activeModel.fireTableDataChanged(); … … 742 761 scrollPane.setPreferredSize(new Dimension(400, 400)); 743 762 box.add(scrollPane); 744 int option = JOptionPane.showConfirmDialog(Main.parent, box, tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION,745 JOptionPane. WARNING_MESSAGE);763 int option = JOptionPane.showConfirmDialog(Main.parent, box, tr("Please abort if you are not sure"), 764 JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); 746 765 if (option == JOptionPane.YES_OPTION) 747 766 return true; … … 811 830 * The table model for imagery offsets list 812 831 */ 813 class OffsetsBookmarksModel extends DefaultTableModel { 832 private class OffsetsBookmarksModel extends DefaultTableModel { 833 834 /** 835 * Constructs a new {@code OffsetsBookmarksModel}. 836 */ 814 837 public OffsetsBookmarksModel() { 815 838 setColumnIdentifiers(new String[] { tr("Projection"), tr("Layer"), tr("Name"), tr("Easting"), tr("Northing"),});
Note:
See TracChangeset
for help on using the changeset viewer.