- Timestamp:
- 2016-05-14T15:45:35+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java
r8840 r10210 17 17 import java.util.List; 18 18 import java.util.Map; 19 import java.util.Observable;20 19 import java.util.Set; 21 20 … … 36 35 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 37 36 import org.openstreetmap.josm.gui.help.HelpUtil; 37 import org.openstreetmap.josm.gui.util.ChangeNotifier; 38 38 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel; 39 39 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 72 72 * @see ListMerger 73 73 */ 74 public abstract class ListMergeModel<T extends PrimitiveId> extends Observable{74 public abstract class ListMergeModel<T extends PrimitiveId> extends ChangeNotifier { 75 75 public static final String FROZEN_PROP = ListMergeModel.class.getName() + ".frozen"; 76 76 … … 270 270 theirEntriesTableModel.fireTableDataChanged(); 271 271 mergedEntriesTableModel.fireTableDataChanged(); 272 setChanged(); 273 notifyObservers(); 272 fireStateChanged(); 274 273 } 275 274 … … 458 457 copy(source, rows, current + 1); 459 458 mergedEntriesSelectionModel.setSelectionInterval(current+1, current + rows.length-1); 460 notifyObservers();459 fireStateChanged(); 461 460 } 462 461 … … 505 504 } 506 505 fireModelDataChanged(); 507 notifyObservers();508 506 mergedEntriesSelectionModel.clearSelection(); 509 507 for (int row: rows) { … … 532 530 } 533 531 fireModelDataChanged(); 534 notifyObservers();535 532 mergedEntriesSelectionModel.clearSelection(); 536 533 for (int row: rows) { … … 555 552 } 556 553 fireModelDataChanged(); 557 notifyObservers();558 554 mergedEntriesSelectionModel.clearSelection(); 559 555 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r10001 r10210 15 15 import java.beans.PropertyChangeListener; 16 16 import java.util.Collection; 17 import java.util.Observable;18 import java.util.Observer;19 17 20 18 import javax.swing.AbstractAction; … … 28 26 import javax.swing.JTable; 29 27 import javax.swing.JToggleButton; 28 import javax.swing.event.ChangeEvent; 29 import javax.swing.event.ChangeListener; 30 30 import javax.swing.event.ListSelectionEvent; 31 31 import javax.swing.event.ListSelectionListener; … … 49 49 * @since 1631 50 50 */ 51 public abstract class ListMerger<T extends PrimitiveId> extends JPanel implements PropertyChangeListener, Observer, IConflictResolver {51 public abstract class ListMerger<T extends PrimitiveId> extends JPanel implements PropertyChangeListener, ChangeListener, IConflictResolver { 52 52 protected OsmPrimitivesTable myEntriesTable; 53 53 protected OsmPrimitivesTable mergedEntriesTable; … … 120 120 mergedEntriesTable.getSelectionModel().addListSelectionListener(removeMergedAction); 121 121 122 model.add Observer(copyAllLeft);123 model.add Observer(copyAllRight);122 model.addChangeListener(copyAllLeft); 123 model.addChangeListener(copyAllRight); 124 124 model.addPropertyChangeListener(copyAllLeft); 125 125 model.addPropertyChangeListener(copyAllRight); … … 408 408 public ListMerger(ListMergeModel<T> model) { 409 409 this.model = model; 410 model.add Observer(this);410 model.addChangeListener(this); 411 411 build(); 412 412 model.addPropertyChangeListener(this); … … 621 621 } 622 622 623 class CopyAllLeft extends AbstractAction implements Observer, PropertyChangeListener {623 class CopyAllLeft extends AbstractAction implements ChangeListener, PropertyChangeListener { 624 624 625 625 CopyAllLeft() { … … 640 640 641 641 @Override 642 public void update(Observable o, Object arg) {642 public void stateChanged(ChangeEvent e) { 643 643 updateEnabledState(); 644 644 } … … 650 650 } 651 651 652 class CopyAllRight extends AbstractAction implements Observer, PropertyChangeListener {652 class CopyAllRight extends AbstractAction implements ChangeListener, PropertyChangeListener { 653 653 654 654 CopyAllRight() { … … 669 669 670 670 @Override 671 public void update(Observable o, Object arg) {671 public void stateChanged(ChangeEvent e) { 672 672 updateEnabledState(); 673 673 } … … 871 871 872 872 @Override 873 public void update(Observable o, Object arg) {873 public void stateChanged(ChangeEvent e) { 874 874 lblMyVersion.setText( 875 875 trn("My version ({0} entry)", "My version ({0} entries)", model.getMyEntriesSize(), model.getMyEntriesSize()) -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
r9243 r10210 9 9 import java.util.Collections; 10 10 import java.util.List; 11 import java.util.Observable;12 11 13 12 import org.openstreetmap.josm.command.Command; … … 19 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 19 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 20 import org.openstreetmap.josm.gui.util.ChangeNotifier; 21 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 22 … … 26 26 * the deleted or visible state of {@link OsmPrimitive}s. 27 27 * 28 * This model is a n {@link Observable}. It notifies registered {@link java.util.Observer}s whenever the28 * This model is a {@link ChangeNotifier}. It notifies registered {@link javax.swing.event.ChangeListener}s whenever the 29 29 * internal state changes. 30 30 * … … 37 37 * 38 38 */ 39 public class PropertiesMergeModel extends Observable{39 public class PropertiesMergeModel extends ChangeNotifier { 40 40 41 41 public static final String RESOLVED_COMPLETELY_PROP = PropertiesMergeModel.class.getName() + ".resolvedCompletely"; … … 145 145 coordMergeDecision = UNDECIDED; 146 146 deletedMergeDecision = UNDECIDED; 147 setChanged(); 148 notifyObservers(); 147 fireStateChanged(); 149 148 fireCompletelyResolved(); 150 149 } … … 196 195 public void decideCoordsConflict(MergeDecisionType decision) { 197 196 coordMergeDecision = decision; 198 setChanged(); 199 notifyObservers(); 197 fireStateChanged(); 200 198 fireCompletelyResolved(); 201 199 } … … 271 269 272 270 this.deletedMergeDecision = decision; 273 setChanged(); 274 notifyObservers(); 271 fireStateChanged(); 275 272 fireCompletelyResolved(); 276 273 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r10179 r10210 10 10 import java.text.DecimalFormat; 11 11 import java.util.List; 12 import java.util.Observable;13 import java.util.Observer;14 12 15 13 import javax.swing.AbstractAction; … … 19 17 import javax.swing.JLabel; 20 18 import javax.swing.JPanel; 19 import javax.swing.event.ChangeEvent; 20 import javax.swing.event.ChangeListener; 21 21 22 22 import org.openstreetmap.josm.data.conflict.Conflict; … … 34 34 * @since 1654 35 35 */ 36 public class PropertiesMerger extends JPanel implements Observer, IConflictResolver {36 public class PropertiesMerger extends JPanel implements ChangeListener, IConflictResolver { 37 37 private static final DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000"); 38 38 … … 57 57 public PropertiesMerger() { 58 58 model = new PropertiesMergeModel(); 59 model.add Observer(this);59 model.addChangeListener(this); 60 60 build(); 61 61 } … … 137 137 gc.weighty = 0.0; 138 138 KeepMyCoordinatesAction actKeepMyCoordinates = new KeepMyCoordinatesAction(); 139 model.add Observer(actKeepMyCoordinates);139 model.addChangeListener(actKeepMyCoordinates); 140 140 JButton btnKeepMyCoordinates = new JButton(actKeepMyCoordinates); 141 141 btnKeepMyCoordinates.setName("button.keepmycoordinates"); … … 155 155 gc.weighty = 0.0; 156 156 KeepTheirCoordinatesAction actKeepTheirCoordinates = new KeepTheirCoordinatesAction(); 157 model.add Observer(actKeepTheirCoordinates);157 model.addChangeListener(actKeepTheirCoordinates); 158 158 JButton btnKeepTheirCoordinates = new JButton(actKeepTheirCoordinates); 159 159 add(btnKeepTheirCoordinates, gc); … … 174 174 gc.weighty = 0.0; 175 175 UndecideCoordinateConflictAction actUndecideCoordinates = new UndecideCoordinateConflictAction(); 176 model.add Observer(actUndecideCoordinates);176 model.addChangeListener(actUndecideCoordinates); 177 177 JButton btnUndecideCoordinates = new JButton(actUndecideCoordinates); 178 178 add(btnUndecideCoordinates, gc); … … 206 206 gc.weighty = 0.0; 207 207 KeepMyDeletedStateAction actKeepMyDeletedState = new KeepMyDeletedStateAction(); 208 model.add Observer(actKeepMyDeletedState);208 model.addChangeListener(actKeepMyDeletedState); 209 209 JButton btnKeepMyDeletedState = new JButton(actKeepMyDeletedState); 210 210 btnKeepMyDeletedState.setName("button.keepmydeletedstate"); … … 224 224 gc.weighty = 0.0; 225 225 KeepTheirDeletedStateAction actKeepTheirDeletedState = new KeepTheirDeletedStateAction(); 226 model.add Observer(actKeepTheirDeletedState);226 model.addChangeListener(actKeepTheirDeletedState); 227 227 JButton btnKeepTheirDeletedState = new JButton(actKeepTheirDeletedState); 228 228 btnKeepTheirDeletedState.setName("button.keeptheirdeletedstate"); … … 244 244 gc.weighty = 0.0; 245 245 UndecideDeletedStateConflictAction actUndecideDeletedState = new UndecideDeletedStateConflictAction(); 246 model.add Observer(actUndecideDeletedState);246 model.addChangeListener(actUndecideDeletedState); 247 247 JButton btnUndecideDeletedState = new JButton(actUndecideDeletedState); 248 248 btnUndecideDeletedState.setName("button.undecidedeletedstate"); … … 384 384 385 385 @Override 386 public void update(Observable o, Object arg) {386 public void stateChanged(ChangeEvent e) { 387 387 updateCoordinates(); 388 388 updateDeletedState(); … … 398 398 } 399 399 400 class KeepMyCoordinatesAction extends AbstractAction implements Observer {400 class KeepMyCoordinatesAction extends AbstractAction implements ChangeListener { 401 401 KeepMyCoordinatesAction() { 402 402 putValue(Action.SMALL_ICON, ImageProvider.get("dialogs/conflict", "tagkeepmine")); … … 410 410 411 411 @Override 412 public void update(Observable o, Object arg) {412 public void stateChanged(ChangeEvent e) { 413 413 setEnabled(model.hasCoordConflict() && !model.isDecidedCoord() && model.getMyCoords() != null); 414 414 } 415 415 } 416 416 417 class KeepTheirCoordinatesAction extends AbstractAction implements Observer {417 class KeepTheirCoordinatesAction extends AbstractAction implements ChangeListener { 418 418 KeepTheirCoordinatesAction() { 419 419 putValue(Action.SMALL_ICON, ImageProvider.get("dialogs/conflict", "tagkeeptheir")); … … 427 427 428 428 @Override 429 public void update(Observable o, Object arg) {429 public void stateChanged(ChangeEvent e) { 430 430 setEnabled(model.hasCoordConflict() && !model.isDecidedCoord() && model.getTheirCoords() != null); 431 431 } 432 432 } 433 433 434 class UndecideCoordinateConflictAction extends AbstractAction implements Observer {434 class UndecideCoordinateConflictAction extends AbstractAction implements ChangeListener { 435 435 UndecideCoordinateConflictAction() { 436 436 putValue(Action.SMALL_ICON, ImageProvider.get("dialogs/conflict", "tagundecide")); … … 444 444 445 445 @Override 446 public void update(Observable o, Object arg) {446 public void stateChanged(ChangeEvent e) { 447 447 setEnabled(model.hasCoordConflict() && model.isDecidedCoord()); 448 448 } 449 449 } 450 450 451 class KeepMyDeletedStateAction extends AbstractAction implements Observer {451 class KeepMyDeletedStateAction extends AbstractAction implements ChangeListener { 452 452 KeepMyDeletedStateAction() { 453 453 putValue(Action.SMALL_ICON, ImageProvider.get("dialogs/conflict", "tagkeepmine")); … … 461 461 462 462 @Override 463 public void update(Observable o, Object arg) {463 public void stateChanged(ChangeEvent e) { 464 464 setEnabled(model.hasDeletedStateConflict() && !model.isDecidedDeletedState()); 465 465 } 466 466 } 467 467 468 class KeepTheirDeletedStateAction extends AbstractAction implements Observer {468 class KeepTheirDeletedStateAction extends AbstractAction implements ChangeListener { 469 469 KeepTheirDeletedStateAction() { 470 470 putValue(Action.SMALL_ICON, ImageProvider.get("dialogs/conflict", "tagkeeptheir")); … … 478 478 479 479 @Override 480 public void update(Observable o, Object arg) {480 public void stateChanged(ChangeEvent e) { 481 481 setEnabled(model.hasDeletedStateConflict() && !model.isDecidedDeletedState()); 482 482 } 483 483 } 484 484 485 class UndecideDeletedStateConflictAction extends AbstractAction implements Observer {485 class UndecideDeletedStateConflictAction extends AbstractAction implements ChangeListener { 486 486 UndecideDeletedStateConflictAction() { 487 487 putValue(Action.SMALL_ICON, ImageProvider.get("dialogs/conflict", "tagundecide")); … … 495 495 496 496 @Override 497 public void update(Observable o, Object arg) {497 public void stateChanged(ChangeEvent e) { 498 498 setEnabled(model.hasDeletedStateConflict() && model.isDecidedDeletedState()); 499 499 } -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r9972 r10210 20 20 import java.nio.charset.StandardCharsets; 21 21 import java.util.Locale; 22 import java.util.Observable;23 import java.util.Observer;24 22 25 23 import javax.swing.AbstractAction; … … 35 33 import javax.swing.KeyStroke; 36 34 import javax.swing.SwingUtilities; 35 import javax.swing.event.ChangeEvent; 36 import javax.swing.event.ChangeListener; 37 37 import javax.swing.event.HyperlinkEvent; 38 38 import javax.swing.event.HyperlinkListener; … … 495 495 } 496 496 497 static class BackAction extends AbstractBrowserAction implements Observer {497 static class BackAction extends AbstractBrowserAction implements ChangeListener { 498 498 499 499 /** … … 503 503 BackAction(IHelpBrowser browser) { 504 504 super(browser); 505 browser.getHistory().add Observer(this);505 browser.getHistory().addChangeListener(this); 506 506 putValue(SHORT_DESCRIPTION, tr("Go to the previous page")); 507 507 putValue(SMALL_ICON, ImageProvider.get("help", "previous")); … … 515 515 516 516 @Override 517 public void update(Observable o, Object arg) {517 public void stateChanged(ChangeEvent e) { 518 518 setEnabled(browser.getHistory().canGoBack()); 519 519 } 520 520 } 521 521 522 static class ForwardAction extends AbstractBrowserAction implements Observer {522 static class ForwardAction extends AbstractBrowserAction implements ChangeListener { 523 523 524 524 /** … … 528 528 ForwardAction(IHelpBrowser browser) { 529 529 super(browser); 530 browser.getHistory().add Observer(this);530 browser.getHistory().addChangeListener(this); 531 531 putValue(SHORT_DESCRIPTION, tr("Go to the next page")); 532 532 putValue(SMALL_ICON, ImageProvider.get("help", "next")); … … 540 540 541 541 @Override 542 public void update(Observable o, Object arg) {542 public void stateChanged(ChangeEvent e) { 543 543 setEnabled(browser.getHistory().canGoForward()); 544 544 } -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowserHistory.java
r9644 r10210 5 5 import java.util.Collections; 6 6 import java.util.List; 7 import java.util.Observable; 7 8 import org.openstreetmap.josm.gui.util.ChangeNotifier; 8 9 9 10 /** … … 11 12 * @since 2274 12 13 */ 13 public class HelpBrowserHistory extends Observable{14 public class HelpBrowserHistory extends ChangeNotifier { 14 15 private final IHelpBrowser browser; 15 16 private List<String> history; … … 31 32 history.clear(); 32 33 historyPos = 0; 33 setChanged(); 34 notifyObservers(); 34 fireStateChanged(); 35 35 } 36 36 … … 60 60 String url = history.get(historyPos); 61 61 browser.openUrl(url); 62 setChanged(); 63 notifyObservers(); 62 fireStateChanged(); 64 63 } 65 64 … … 73 72 String url = history.get(historyPos); 74 73 browser.openUrl(url); 75 setChanged(); 76 notifyObservers(); 74 fireStateChanged(); 77 75 } 78 76 … … 99 97 historyPos = history.size()-1; 100 98 } 101 setChanged(); 102 notifyObservers(); 99 fireStateChanged(); 103 100 } 104 101 } -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r10179 r10210 7 7 import java.awt.GridBagLayout; 8 8 import java.awt.Insets; 9 import java.util.Observable;10 import java.util.Observer;11 9 12 10 import javax.swing.BorderFactory; … … 14 12 import javax.swing.JPanel; 15 13 import javax.swing.UIManager; 14 import javax.swing.event.ChangeEvent; 15 import javax.swing.event.ChangeListener; 16 16 17 17 import org.openstreetmap.gui.jmapviewer.JMapViewer; … … 127 127 setModel(model); 128 128 build(); 129 registerAs Observer(model);130 } 131 132 protected void unregisterAs Observer(HistoryBrowserModel model) {129 registerAsChangeListener(model); 130 } 131 132 protected void unregisterAsChangeListener(HistoryBrowserModel model) { 133 133 if (currentInfoPanel != null) { 134 model. deleteObserver(currentInfoPanel);134 model.removeChangeListener(currentInfoPanel); 135 135 } 136 136 if (referenceInfoPanel != null) { 137 model. deleteObserver(referenceInfoPanel);137 model.removeChangeListener(referenceInfoPanel); 138 138 } 139 139 if (currentLatLonViewer != null) { 140 model. deleteObserver(currentLatLonViewer);140 model.removeChangeListener(currentLatLonViewer); 141 141 } 142 142 if (referenceLatLonViewer != null) { 143 model. deleteObserver(referenceLatLonViewer);143 model.removeChangeListener(referenceLatLonViewer); 144 144 } 145 145 if (distanceViewer != null) { 146 model. deleteObserver(distanceViewer);146 model.removeChangeListener(distanceViewer); 147 147 } 148 148 if (mapViewer != null) { 149 model. deleteObserver(mapViewer);150 } 151 } 152 153 protected void registerAs Observer(HistoryBrowserModel model) {149 model.removeChangeListener(mapViewer); 150 } 151 } 152 153 protected void registerAsChangeListener(HistoryBrowserModel model) { 154 154 if (currentInfoPanel != null) { 155 model.add Observer(currentInfoPanel);155 model.addChangeListener(currentInfoPanel); 156 156 } 157 157 if (referenceInfoPanel != null) { 158 model.add Observer(referenceInfoPanel);158 model.addChangeListener(referenceInfoPanel); 159 159 } 160 160 if (currentLatLonViewer != null) { 161 model.add Observer(currentLatLonViewer);161 model.addChangeListener(currentLatLonViewer); 162 162 } 163 163 if (referenceLatLonViewer != null) { 164 model.add Observer(referenceLatLonViewer);164 model.addChangeListener(referenceLatLonViewer); 165 165 } 166 166 if (distanceViewer != null) { 167 model.add Observer(distanceViewer);167 model.addChangeListener(distanceViewer); 168 168 } 169 169 if (mapViewer != null) { 170 model.add Observer(mapViewer);170 model.addChangeListener(mapViewer); 171 171 } 172 172 } … … 179 179 public void setModel(HistoryBrowserModel model) { 180 180 if (this.model != null) { 181 unregisterAs Observer(model);181 unregisterAsChangeListener(model); 182 182 } 183 183 this.model = model; 184 184 if (this.model != null) { 185 registerAs Observer(model);185 registerAsChangeListener(model); 186 186 } 187 187 } … … 241 241 * A UI widgets which displays the Lan/Lon-coordinates of a {@link HistoryNode}. 242 242 */ 243 private static class LatLonViewer extends JPanel implements Observer {243 private static class LatLonViewer extends JPanel implements ChangeListener { 244 244 245 245 private final JosmTextArea lblLat = newTextArea(); … … 324 324 325 325 @Override 326 public void update(Observable o, Object arg) {326 public void stateChanged(ChangeEvent e) { 327 327 refresh(); 328 328 } 329 329 } 330 330 331 private static class MapViewer extends JMapViewer implements Observer {331 private static class MapViewer extends JMapViewer implements ChangeListener { 332 332 333 333 private final Updater updater; … … 339 339 340 340 @Override 341 public void update(Observable o, Object arg) {341 public void stateChanged(ChangeEvent e) { 342 342 final Pair<LatLon, LatLon> coordinates = updater.getCoordinates(); 343 343 if (coordinates == null) { … … 362 362 } 363 363 364 private static class DistanceViewer extends JPanel implements Observer {364 private static class DistanceViewer extends JPanel implements ChangeListener { 365 365 366 366 private final JosmTextArea lblDistance = newTextArea(); … … 417 417 418 418 @Override 419 public void update(Observable o, Object arg) {419 public void stateChanged(ChangeEvent e) { 420 420 refresh(); 421 421 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r10194 r10210 9 9 import java.util.HashSet; 10 10 import java.util.List; 11 import java.util.Observable;12 11 import java.util.Set; 13 12 … … 46 45 import org.openstreetmap.josm.gui.layer.Layer; 47 46 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 47 import org.openstreetmap.josm.gui.util.ChangeNotifier; 48 48 import org.openstreetmap.josm.tools.CheckParameterUtil; 49 49 import org.openstreetmap.josm.tools.date.DateUtils; … … 74 74 * @see HistoryBrowser 75 75 */ 76 public class HistoryBrowserModel extends Observableimplements LayerChangeListener, DataSetListener {76 public class HistoryBrowserModel extends ChangeNotifier implements LayerChangeListener, DataSetListener { 77 77 /** the history of an OsmPrimitive */ 78 78 private History history; … … 198 198 initNodeListTableModels(); 199 199 initMemberListTableModels(); 200 setChanged(); 201 notifyObservers(); 200 fireStateChanged(); 202 201 versionTableModel.fireTableDataChanged(); 203 202 } … … 317 316 initNodeListTableModels(); 318 317 initMemberListTableModels(); 319 setChanged(); 320 notifyObservers(); 318 fireStateChanged(); 321 319 } 322 320 … … 348 346 initNodeListTableModels(); 349 347 initMemberListTableModels(); 350 setChanged(); 351 notifyObservers(); 348 fireStateChanged(); 352 349 } 353 350 -
trunk/src/org/openstreetmap/josm/gui/history/HistoryViewerPanel.java
r8510 r10210 41 41 public final void setModel(HistoryBrowserModel model) { 42 42 if (this.model != null) { 43 unregisterAs Observer(model);43 unregisterAsChangeListener(model); 44 44 } 45 45 this.model = model; 46 46 if (this.model != null) { 47 registerAs Observer(model);47 registerAsChangeListener(model); 48 48 } 49 49 } 50 50 51 protected final void unregisterAs Observer(HistoryBrowserModel model) {51 protected final void unregisterAsChangeListener(HistoryBrowserModel model) { 52 52 if (currentInfoPanel != null) { 53 model. deleteObserver(currentInfoPanel);53 model.removeChangeListener(currentInfoPanel); 54 54 } 55 55 if (referenceInfoPanel != null) { 56 model. deleteObserver(referenceInfoPanel);56 model.removeChangeListener(referenceInfoPanel); 57 57 } 58 58 } 59 59 60 protected final void registerAs Observer(HistoryBrowserModel model) {60 protected final void registerAsChangeListener(HistoryBrowserModel model) { 61 61 if (currentInfoPanel != null) { 62 model.add Observer(currentInfoPanel);62 model.addChangeListener(currentInfoPanel); 63 63 } 64 64 if (referenceInfoPanel != null) { 65 model.add Observer(referenceInfoPanel);65 model.addChangeListener(referenceInfoPanel); 66 66 } 67 67 } -
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r9816 r10210 173 173 } 174 174 175 protected void unregisterAs Observer(HistoryBrowserModel model) {175 protected void unregisterAsChangeListener(HistoryBrowserModel model) { 176 176 if (currentInfoPanel != null) { 177 model. deleteObserver(currentInfoPanel);177 model.removeChangeListener(currentInfoPanel); 178 178 } 179 179 if (referenceInfoPanel != null) { 180 model. deleteObserver(referenceInfoPanel);181 } 182 } 183 184 protected void registerAs Observer(HistoryBrowserModel model) {180 model.removeChangeListener(referenceInfoPanel); 181 } 182 } 183 184 protected void registerAsChangeListener(HistoryBrowserModel model) { 185 185 if (currentInfoPanel != null) { 186 model.add Observer(currentInfoPanel);186 model.addChangeListener(currentInfoPanel); 187 187 } 188 188 if (referenceInfoPanel != null) { 189 model.add Observer(referenceInfoPanel);189 model.addChangeListener(referenceInfoPanel); 190 190 } 191 191 } … … 197 197 public void setModel(HistoryBrowserModel model) { 198 198 if (this.model != null) { 199 unregisterAs Observer(model);199 unregisterAsChangeListener(model); 200 200 } 201 201 this.model = model; 202 202 if (this.model != null) { 203 registerAs Observer(model);203 registerAsChangeListener(model); 204 204 } 205 205 } -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r9680 r10210 15 15 import java.util.Collections; 16 16 import java.util.Date; 17 import java.util.Observable;18 import java.util.Observer;19 17 20 18 import javax.swing.AbstractAction; … … 24 22 import javax.swing.JPanel; 25 23 import javax.swing.JTextArea; 24 import javax.swing.event.ChangeEvent; 25 import javax.swing.event.ChangeListener; 26 26 27 27 import org.openstreetmap.josm.Main; … … 48 48 * @since 1709 49 49 */ 50 public class VersionInfoPanel extends JPanel implements Observer {50 public class VersionInfoPanel extends JPanel implements ChangeListener { 51 51 private final PointInTimeType pointInTimeType; 52 52 private final transient HistoryBrowserModel model; … … 189 189 this.model = model; 190 190 this.pointInTimeType = pointInTimeType; 191 model.add Observer(this);191 model.addChangeListener(this); 192 192 build(); 193 193 } … … 198 198 199 199 @Override 200 public void update(Observable o, Object arg) {200 public void stateChanged(ChangeEvent e) { 201 201 HistoryOsmPrimitive primitive = getPrimitive(); 202 202 if (primitive != null) { -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r10021 r10210 14 14 import java.awt.event.KeyEvent; 15 15 import java.awt.event.MouseEvent; 16 import java.util.Observable;17 import java.util.Observer;18 16 19 17 import javax.swing.DefaultCellEditor; … … 25 23 import javax.swing.SwingConstants; 26 24 import javax.swing.UIManager; 25 import javax.swing.event.ChangeEvent; 26 import javax.swing.event.ChangeListener; 27 27 import javax.swing.event.TableModelEvent; 28 28 import javax.swing.event.TableModelListener; … … 45 45 * @since 1709 46 46 */ 47 public class VersionTable extends JTable implements Observer {47 public class VersionTable extends JTable implements ChangeListener { 48 48 private VersionTablePopupMenu popupMenu; 49 49 private final transient HistoryBrowserModel model; … … 55 55 public VersionTable(HistoryBrowserModel model) { 56 56 super(model.getVersionTableModel(), new VersionTableColumnModel()); 57 model.add Observer(this);57 model.addChangeListener(this); 58 58 build(); 59 59 this.model = model; … … 117 117 118 118 @Override 119 public void update(Observable o, Object arg) {119 public void stateChanged(ChangeEvent e) { 120 120 repaint(); 121 121 } -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r10173 r10210 16 16 import java.util.LinkedList; 17 17 import java.util.List; 18 import java.util.Observable;19 import java.util.Observer;20 18 21 19 import javax.swing.Action; … … 23 21 import javax.swing.JEditorPane; 24 22 import javax.swing.JPanel; 23 import javax.swing.event.ChangeEvent; 24 import javax.swing.event.ChangeListener; 25 25 import javax.swing.event.HyperlinkEvent; 26 26 import javax.swing.event.HyperlinkListener; … … 122 122 this.changesetCommentModel = changesetCommentModel; 123 123 this.changesetSourceModel = changesetSourceModel; 124 changesetCommentModel.add Observer(new ChangesetCommentObserver(hcbUploadComment));125 changesetSourceModel.add Observer(new ChangesetCommentObserver(hcbUploadSource));124 changesetCommentModel.addChangeListener(new ChangesetCommentChangeListener(hcbUploadComment)); 125 changesetSourceModel.addChangeListener(new ChangesetCommentChangeListener(hcbUploadSource)); 126 126 build(); 127 127 } … … 215 215 * in sync with the current changeset comment 216 216 */ 217 static class ChangesetComment Observer implements Observer {217 static class ChangesetCommentChangeListener implements ChangeListener { 218 218 219 219 private final HistoryComboBox destination; 220 220 221 ChangesetComment Observer(HistoryComboBox destination) {221 ChangesetCommentChangeListener(HistoryComboBox destination) { 222 222 this.destination = destination; 223 223 } 224 224 225 225 @Override 226 public void update(Observable o, Object arg) {227 if (!( oinstanceof ChangesetCommentModel)) return;228 String newComment = ( String) arg;226 public void stateChanged(ChangeEvent e) { 227 if (!(e.getSource() instanceof ChangesetCommentModel)) return; 228 String newComment = ((ChangesetCommentModel) e.getSource()).getComment(); 229 229 if (!destination.getText().equals(newComment)) { 230 230 destination.setText(newComment); -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetCommentModel.java
r8510 r10210 3 3 4 4 import java.util.Objects; 5 import java.util.Observable; 5 6 import org.openstreetmap.josm.gui.util.ChangeNotifier; 6 7 7 8 /** … … 10 11 * @since 3133 11 12 */ 12 public class ChangesetCommentModel extends Observable{13 public class ChangesetCommentModel extends ChangeNotifier { 13 14 private String comment = ""; 14 15 … … 22 23 this.comment = comment == null ? "" : comment; 23 24 if (!Objects.equals(oldValue, this.comment)) { 24 setChanged(); 25 notifyObservers(this.comment); 25 fireStateChanged(); 26 26 } 27 27 } -
trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
r9685 r10210 4 4 import java.awt.BorderLayout; 5 5 import java.util.Map; 6 import java.util.Observable;7 import java.util.Observer;8 6 9 7 import javax.swing.JPanel; 8 import javax.swing.event.ChangeEvent; 9 import javax.swing.event.ChangeListener; 10 10 import javax.swing.event.TableModelEvent; 11 11 import javax.swing.event.TableModelListener; … … 41 41 this.changesetCommentModel = changesetCommentModel; 42 42 this.changesetSourceModel = changesetSourceModel; 43 this.changesetCommentModel.add Observer(new ChangesetCommentObserver("comment"));44 this.changesetSourceModel.add Observer(new ChangesetCommentObserver("source"));43 this.changesetCommentModel.addChangeListener(new ChangesetCommentChangeListener("comment")); 44 this.changesetSourceModel.addChangeListener(new ChangesetCommentChangeListener("source")); 45 45 build(); 46 46 pnlTagEditor.getModel().addTableModelListener(this); … … 113 113 * with the current changeset comment 114 114 */ 115 class ChangesetComment Observer implements Observer {115 class ChangesetCommentChangeListener implements ChangeListener { 116 116 117 117 private final String key; 118 118 119 ChangesetComment Observer(String key) {119 ChangesetCommentChangeListener(String key) { 120 120 this.key = key; 121 121 } 122 122 123 123 @Override 124 public void update(Observable o, Object arg) {125 if ( oinstanceof ChangesetCommentModel) {126 String newValue = ( String) arg;124 public void stateChanged(ChangeEvent e) { 125 if (e.getSource() instanceof ChangesetCommentModel) { 126 String newValue = ((ChangesetCommentModel) e.getSource()).getComment(); 127 127 String oldValue = getTagEditorValue(key); 128 128 if (oldValue == null) { … … 130 130 } 131 131 if (!oldValue.equals(newValue)) { 132 setProperty(key, (String) arg);132 setProperty(key, newValue); 133 133 } 134 134 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r9611 r10210 14 14 import java.util.Map; 15 15 import java.util.Map.Entry; 16 import java.util.Observable;17 16 import java.util.Set; 18 17 19 18 import org.openstreetmap.josm.Main; 19 import org.openstreetmap.josm.gui.util.ChangeNotifier; 20 20 import org.openstreetmap.josm.plugins.PluginException; 21 21 import org.openstreetmap.josm.plugins.PluginHandler; … … 25 25 * The plugin model behind a {@code PluginListPanel}. 26 26 */ 27 public class PluginPreferencesModel extends Observable{27 public class PluginPreferencesModel extends ChangeNotifier { 28 28 // remember the initial list of active plugins 29 29 private final Set<String> currentActivePlugins; … … 61 61 } 62 62 filterExpression = filter; 63 clearChanged(); 64 notifyObservers(); 63 fireStateChanged(); 65 64 } 66 65 … … 87 86 } 88 87 } 89 clearChanged(); 90 notifyObservers(); 88 fireStateChanged(); 91 89 } 92 90 -
trunk/src/org/openstreetmap/josm/gui/util/AdjustmentSynchronizer.java
r9231 r10210 12 12 import java.util.HashSet; 13 13 import java.util.Map; 14 import java.util.Observable;15 import java.util.Observer;16 14 import java.util.Set; 17 15 18 16 import javax.swing.JCheckBox; 17 import javax.swing.event.ChangeEvent; 18 import javax.swing.event.ChangeListener; 19 19 20 20 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 31 31 private final Map<Adjustable, Boolean> enabledMap; 32 32 33 private final Observableobservable;33 private final ChangeNotifier observable; 34 34 35 35 /** … … 39 39 synchronizedAdjustables = new HashSet<>(); 40 40 enabledMap = new HashMap<>(); 41 observable = new Observable();41 observable = new ChangeNotifier(); 42 42 } 43 43 … … 84 84 85 85 enabledMap.put(adjustable, isParticipating); 86 observable. notifyObservers();86 observable.fireStateChanged(); 87 87 } 88 88 … … 143 143 }); 144 144 145 observable.add Observer(146 new Observer() {145 observable.addChangeListener( 146 new ChangeListener() { 147 147 @Override 148 public void update(Observable o, Object arg) {148 public void stateChanged(ChangeEvent e) { 149 149 boolean sync = isParticipatingInSynchronizedScrolling(adjustable); 150 150 if (view.isSelected() != sync) {
Note:
See TracChangeset
for help on using the changeset viewer.