Changeset 2869 in josm
- Timestamp:
- 2010-01-17T11:56:07+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r2817 r2869 111 111 public static MapFrame map; 112 112 /** 113 * The dialog that gets displayed during background task execution.114 */115 //public static PleaseWaitDialog pleaseWaitDlg;116 117 /**118 113 * True, when in applet mode 119 114 */ … … 184 179 map.mapView.removeLayer(layer); 185 180 if (map.mapView.getAllLayers().isEmpty()) { 186 map.tearDownDialogsPane();187 181 setMapFrame(null); 188 182 } -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r2657 r2869 199 199 // MapFrame gets destroyed when the last layer is removed, but the status line background 200 200 // thread that collects the information doesn't get destroyed automatically. 201 if(statusLine.thread == null) return; 202 try { 203 statusLine.thread.interrupt(); 204 } catch (Exception e) {} 201 if(statusLine.thread != null) { 202 try { 203 statusLine.thread.interrupt(); 204 } catch (Exception e) { 205 e.printStackTrace(); 206 } 207 } 205 208 } 206 209 … … 214 217 public void initializeDialogsPane() { 215 218 dialogsPanel.initialize(allDialogs); 216 }217 218 /**219 *220 */221 public void tearDownDialogsPane() {222 dialogsPanel.tearDown();223 219 } 224 220 -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r2626 r2869 144 144 public void run() { 145 145 for (;;) { 146 146 147 MouseState ms = new MouseState(); 147 148 synchronized (this) { … … 595 596 596 597 @Override 597 public void addMouseListener(MouseListener ml) {598 public synchronized void addMouseListener(MouseListener ml) { 598 599 //super.addMouseListener(ml); 599 600 lonText.addMouseListener(ml); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r2801 r2869 142 142 MapView.removeEditLayerChangeListener(inSelectionModel); 143 143 DataSet.selListeners.remove(inSelectionModel); 144 }145 146 @Override147 public void tearDown() {148 unregisterAsListener();149 144 } 150 145 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r2711 r2869 119 119 120 120 build(); 121 refreshView(); 122 } 123 124 @Override 125 public void showNotify() { 121 126 DataSet.selListeners.add(this); 122 127 MapView.addLayerChangeListener(this); 123 refreshView();124 128 } 125 129 126 130 @Override 127 public void tearDown() {131 public void hideNotify() { 128 132 MapView.removeLayerChangeListener(this); 129 133 DataSet.selListeners.remove(this); -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r2749 r2869 46 46 this.add(mSpltPane); 47 47 reconstruct(Action.ELEMENT_SHRINKS, null); 48 }49 50 /**51 * Invoke before the panel is discarded. This will in turn call {@see ToggleDialog#tearDown()}52 * on every dialog.53 *54 */55 public void tearDown() {56 for(ToggleDialog dialog: allDialogs) {57 dialog.tearDown();58 }59 48 } 60 49 -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r2710 r2869 7 7 import java.awt.BorderLayout; 8 8 import java.awt.Component; 9 import java.awt.GridLayout;10 9 import java.awt.event.ActionEvent; 11 10 import java.awt.event.ActionListener; … … 15 14 import javax.swing.JCheckBox; 16 15 import javax.swing.JPanel; 17 import javax.swing.JPopupMenu;18 16 import javax.swing.JScrollPane; 19 17 import javax.swing.JTable; … … 47 45 private SideButton upButton; 48 46 private SideButton downButton; 49 private JPopupMenu popupMenu;50 47 51 48 public FilterDialog(){ 52 49 super(tr("Filter"), "filter", tr("Filter objects and hide/disable them."), 53 50 Shortcut.registerShortcut("subwindow:filter", tr("Toggle: {0}", tr("Filter")), KeyEvent.VK_F, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 162); 54 51 build(); 52 } 53 54 @Override 55 public void showNotify() { 55 56 MapView.addLayerChangeListener(this); 56 build();57 57 } 58 58 59 59 @Override 60 public void tearDown() {60 public void hideNotify() { 61 61 MapView.removeLayerChangeListener(this); 62 62 } … … 144 144 @Override 145 145 public String getToolTipText(MouseEvent e) { 146 String tip = null;147 146 java.awt.Point p = e.getPoint(); 148 147 int index = columnModel.getColumnIndexAtX(p.x); -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r2847 r2869 47 47 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 48 48 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 49 import org.openstreetmap.josm.tools.CheckParameterUtil; 49 50 import org.openstreetmap.josm.tools.ImageProvider; 50 51 import org.openstreetmap.josm.tools.Shortcut; 51 52 import org.openstreetmap.josm.tools.ImageProvider.OverlayPosition; 52 import org.openstreetmap.josm.tools.CheckParameterUtil;53 53 54 54 /** … … 70 70 */ 71 71 static public void createInstance(MapFrame mapFrame) { 72 if (instance != null) 73 throw new IllegalStateException("Dialog was already created"); 72 74 instance = new LayerListDialog(mapFrame); 73 75 } … … 115 117 activateLayerAction = new ActivateLayerAction(); 116 118 adaptTo(activateLayerAction, selectionModel); 117 MapView.addLayerChangeListener(activateLayerAction);118 119 buttonPanel.add(new SideButton(activateLayerAction)); 119 120 … … 153 154 selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 154 155 model = new LayerListModel(selectionModel); 155 MapView.addLayerChangeListener(model);156 156 157 157 // create the list control … … 185 185 186 186 @Override 187 public void tearDown() { 187 public void showNotify() { 188 MapView.addLayerChangeListener(activateLayerAction); 189 MapView.addLayerChangeListener(model); 190 } 191 192 @Override 193 public void hideNotify() { 188 194 MapView.removeLayerChangeListener(model); 189 195 MapView.removeLayerChangeListener(activateLayerAction); … … 240 246 } 241 247 ); 248 } 249 250 @Override 251 public void destroy() { 252 super.destroy(); 253 instance = null; 242 254 } 243 255 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r2710 r2869 159 159 } 160 160 161 MapView.addEditLayerChangeListener(this);162 }163 164 @Override165 public void tearDown() {166 MapView.removeEditLayerChangeListener(this);167 161 } 168 162 … … 170 164 public void showNotify() { 171 165 DataSet.selListeners.add(this); 166 MapView.addEditLayerChangeListener(this); 172 167 updateSelection(); 173 168 } … … 176 171 public void hideNotify() { 177 172 DataSet.selListeners.remove(this); 173 MapView.removeEditLayerChangeListener(this); 178 174 } 179 175 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r2770 r2869 7 7 import java.awt.Component; 8 8 import java.awt.Dimension; 9 import java.awt.FlowLayout; 9 10 import java.awt.Graphics; 10 import java.awt. FlowLayout;11 import java.awt.GridBagLayout; 11 12 import java.awt.GridLayout; 12 import java.awt.GridBagLayout;13 13 import java.awt.Image; 14 14 import java.awt.Rectangle; … … 560 560 } 561 561 562 /**563 * This method is called by hosting panel before the panel with the toggle dialogs564 * and the toggle dialogs themself are discared, for instance because no layer is565 * left in JOSM and the main screen turns from the map editor to the MOTD panel.566 *567 * Override in subclasses to unregister as listener. After tearDown() is invoked568 * the dialog should be registered as listener.569 *570 * The default implementation is empty.571 */572 public void tearDown() {}573 574 562 protected JPanel getButtonPanel(int columns) { 575 563 JPanel pnl = new JPanel(); 576 564 pnl.setLayout(Main.pref.getBoolean("dialog.align.left", false) 577 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1,columns));565 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1,columns)); 578 566 return pnl; 579 567 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r2803 r2869 67 67 68 68 build(); 69 } 70 71 @Override 72 public void showNotify() { 69 73 DataSet.selListeners.add(this); 70 74 MapView.addLayerChangeListener(this); … … 72 76 73 77 @Override 74 public void tearDown() {78 public void hideNotify() { 75 79 MapView.removeLayerChangeListener(this); 76 80 DataSet.selListeners.remove(this); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r2742 r2869 155 155 listOfUsedTags.rebuildNecessary(); 156 156 DataSet.selListeners.add(this); 157 MapView.addEditLayerChangeListener(this); 157 158 updateSelection(); 158 159 } … … 163 164 DatasetEventManager.getInstance().removeDatasetListener(dataChangedAdapter); 164 165 DataSet.selListeners.remove(this); 166 MapView.removeEditLayerChangeListener(this); 165 167 } 166 168 … … 587 589 buttonPanel.add(this.btnDel); 588 590 add(buttonPanel, BorderLayout.SOUTH); 589 590 MapView.addEditLayerChangeListener(this);591 }592 593 @Override594 public void tearDown() {595 MapView.removeEditLayerChangeListener(this);596 591 } 597 592
Note:
See TracChangeset
for help on using the changeset viewer.