Changeset 25656 in osm for applications/editors/josm
- Timestamp:
- 2011-03-21T11:25:29+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustLayer.java
r25591 r25656 44 44 import javax.swing.ImageIcon; 45 45 import javax.swing.JToolTip; 46 import org.openstreetmap.josm.Main;47 46 import org.openstreetmap.josm.actions.RenameLayerAction; 48 47 import org.openstreetmap.josm.data.Bounds; … … 170 169 public void paint(Graphics2D g, MapView mv, Bounds bounds) { 171 170 JToolTip tooltip = new JToolTip(); 172 if (mapdustBugList != null ) {171 if (mapdustBugList != null && mapdustBugList.size()>0) { 173 172 /* draw the current visible bugs */ 174 173 for (MapdustBug bug : mapdustBugList) { … … 200 199 /* draw the selected bug description */ 201 200 /* selected by clicking */ 202 MapdustBug bug1= getBugSelected();201 MapdustBug clickedBug = getBugSelected(); 203 202 /* selected from the list */ 204 203 MapdustBug bugSelected = getMapdustGUI().getSelectedBug(); 205 204 if (bugSelected == null) { 206 if (Main.map.mapView.getActiveLayer() == this) { 207 bugSelected = bug1; 208 } 205 bugSelected = clickedBug; 209 206 } 210 207 setBugSelected(bugSelected); -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java
r25591 r25656 126 126 String longTxt = tr("Toggle: {0}", tr("Open MapDust")); 127 127 Shortcut shortcut = Shortcut.registerShortcut(shortTxt, longTxt, 128 KeyEvent.VK_0, Shortcut.GROUP_ MENU, Shortcut.SHIFT_DEFAULT);128 KeyEvent.VK_0, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT); 129 129 String name = "MapDust bug reports"; 130 130 String tooltip = "Activates the MapDust bug reporter plugin"; … … 132 132 shortcut, 150, this); 133 133 /* add default values for static variables */ 134 Main.pref.put("mapdust.pluginState", MapdustPluginState.ONLINE.getValue()); 134 Main.pref.put("mapdust.pluginState", 135 MapdustPluginState.ONLINE.getValue()); 135 136 Main.pref.put("mapdust.nickname", ""); 136 137 Main.pref.put("mapdust.showError", true); … … 294 295 } 295 296 if (filter.getDescr() != null && filter.getDescr()) { 296 if (!mapdustBug.getIsDefaultDescription()) { 297 /* show only bugs with isDefaultDescription = false */ 298 if (mapdustBug.getIsDefaultDescription()) { 297 299 result = false; 300 } else { 301 result = containsStatus && containsType; 298 302 } 299 303 } else { … … 436 440 Main.pref.put("mapdust.pluginState", 437 441 MapdustPluginState.ONLINE.getValue()); 438 MapView.removeLayerChangeListener(this);439 442 NavigatableComponent.removeZoomChangeListener(this); 440 443 Main.map.mapView.removeLayer(layer); 441 444 Main.map.remove(mapdustGUI); 442 445 if (mapdustGUI != null) { 443 mapdustGUI.update(new ArrayList<MapdustBug>(), this);444 mapdustGUI.setVisible(false);445 446 mapdustGUI.destroy(); 446 447 } … … 576 577 Main.map.mapView.moveLayer(this.mapdustLayer, 0); 577 578 Main.map.mapView.addMouseListener(this); 578 MapView.addLayerChangeListener(this);579 579 NavigatableComponent.addZoomChangeListener(this); 580 580 } else { -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java
r25591 r25656 96 96 private boolean downloaded = false; 97 97 98 /** Specifies if the MapDust layer was or not before deleted */ 99 boolean wasDeleted = false; 100 98 101 /** 99 102 * Builds a <code>MapdustGUi</code> based on the given parameters. … … 114 117 /** 115 118 * Displays the <code>MapdustGUI</code> dialog window in the JOSM editor. If 116 * the MapDust data was not downloaded yet, it will donwload the data and 117 * also update the MapDust plugin with the data. If the MapDust data was 118 * already downloaded, then the <code>MapdustGUI</code> will be displayed. 119 * the MapDust data was not downloaded yet or the MapDust layer was added 120 * after a previous deletion, then the bug reports data will be deleted. 119 121 */ 120 122 @Override … … 124 126 downloaded = true; 125 127 } 128 if (wasDeleted) { 129 notifyObservers(null, true); 130 wasDeleted = false; 131 } 126 132 super.showDialog(); 133 } 134 135 /** 136 * Destroys the <code>MapdustGUI</code> dialog window. 137 */ 138 @Override 139 public void destroy() { 140 setVisible(false); 141 /* remove panels */ 142 if (tabbedPane != null) { 143 /* from offline to online */ 144 remove(mainPanel); 145 tabbedPane = null; 146 actionPanel = null; 147 mainPanel = null; 148 panel = null; 149 } else { 150 /* from online to offline */ 151 remove(mainPanel); 152 mainPanel = null; 153 panel = null; 154 } 155 wasDeleted = true; 156 super.destroy(); 127 157 } 128 158 … … 138 168 actionList.add(action); 139 169 List<MapdustBug> mapdustBugs = panel.getMapdustBugsList(); 140 boolean showBug = shouldDisplay(action.getMapdustBug(),141 mapdustPlugin.getFilter());170 boolean showBug = 171 shouldDisplay(action.getMapdustBug(), mapdustPlugin.getFilter()); 142 172 mapdustBugs = modifyBug(mapdustBugs, action.getMapdustBug(), showBug); 143 173 … … 145 175 updateMapdustPanel(mapdustBugs); 146 176 updateMapdustActionPanel(actionList); 147 if (showBug &&148 !action.getCommand().equals(MapdustServiceCommand.ADD_BUG)) {177 if (showBug 178 && !action.getCommand().equals(MapdustServiceCommand.ADD_BUG)) { 149 179 panel.resetSelectedBug(0); 150 180 } else { … … 242 272 } 243 273 if (panel == null) { 244 panel = new MapdustBugListPanel(mapdustBugs, "Bug reports", 245 mapdustPlugin); 274 panel = 275 new MapdustBugListPanel(mapdustBugs, "Bug reports", 276 mapdustPlugin); 246 277 panel.addObserver(detailsPanel); 247 278 } else { … … 258 289 private void updateMapdustActionPanel(List<MapdustAction> actionList) { 259 290 if (actionPanel == null) { 260 actionPanel = new MapdustActionPanel(actionList, 261 "Offline Contribution", mapdustPlugin); 291 actionPanel = 292 new MapdustActionPanel(actionList, "Offline Contribution", 293 mapdustPlugin); 262 294 } else { 263 295 actionPanel.updateComponents(actionList); -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java
r25591 r25656 250 250 getMenuFixed().setEnabled(false); 251 251 } 252 253 btnPanel.getBtnAddComment().setSelected(false); 254 btnPanel.getBtnReOpenBugReport().setSelected(false); 255 btnPanel.getBtnFixBugReport().setSelected(false); 256 btnPanel.getBtnInvalidateBugReport().setSelected(false); 252 257 notifyObservers(selectedBug); 253 258 } else { -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustButtonPanel.java
r25591 r25656 245 245 public void enableBasicComponents(boolean onlyBasic) { 246 246 btnWorkOffline.setEnabled(true); 247 btnWorkOffline.setSelected(false); 247 248 btnFilter.setEnabled(true); 249 btnFilter.setSelected(false); 248 250 btnRefresh.setEnabled(true); 251 btnRefresh.setSelected(false); 249 252 if (onlyBasic) { 250 253 btnAddComment.setEnabled(false);
Note:
See TracChangeset
for help on using the changeset viewer.