Changeset 25656 in osm for applications


Ignore:
Timestamp:
2011-03-21T11:25:29+01:00 (13 years ago)
Author:
beata.jancso
Message:

fix for: Ticket 6116 and 6115

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  
    4444import javax.swing.ImageIcon;
    4545import javax.swing.JToolTip;
    46 import org.openstreetmap.josm.Main;
    4746import org.openstreetmap.josm.actions.RenameLayerAction;
    4847import org.openstreetmap.josm.data.Bounds;
     
    170169    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
    171170        JToolTip tooltip = new JToolTip();
    172         if (mapdustBugList != null) {
     171        if (mapdustBugList != null && mapdustBugList.size()>0) {
    173172            /* draw the current visible bugs */
    174173            for (MapdustBug bug : mapdustBugList) {
     
    200199            /* draw the selected bug description */
    201200            /* selected by clicking */
    202             MapdustBug bug1 = getBugSelected();
     201            MapdustBug clickedBug = getBugSelected();
    203202            /* selected from the list */
    204203            MapdustBug bugSelected = getMapdustGUI().getSelectedBug();
    205204            if (bugSelected == null) {
    206                 if (Main.map.mapView.getActiveLayer() == this) {
    207                     bugSelected = bug1;
    208                 }
     205                    bugSelected = clickedBug;
    209206            }
    210207            setBugSelected(bugSelected);
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java

    r25591 r25656  
    126126        String longTxt = tr("Toggle: {0}", tr("Open MapDust"));
    127127        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);
    129129        String name = "MapDust bug reports";
    130130        String tooltip = "Activates the MapDust bug reporter plugin";
     
    132132                shortcut, 150, this);
    133133        /* 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());
    135136        Main.pref.put("mapdust.nickname", "");
    136137        Main.pref.put("mapdust.showError", true);
     
    294295            }
    295296            if (filter.getDescr() != null && filter.getDescr()) {
    296                 if (!mapdustBug.getIsDefaultDescription()) {
     297                /* show only bugs with isDefaultDescription = false */
     298                if (mapdustBug.getIsDefaultDescription()) {
    297299                    result = false;
     300                } else {
     301                    result = containsStatus && containsType;
    298302                }
    299303            } else {
     
    436440            Main.pref.put("mapdust.pluginState",
    437441                    MapdustPluginState.ONLINE.getValue());
    438             MapView.removeLayerChangeListener(this);
    439442            NavigatableComponent.removeZoomChangeListener(this);
    440443            Main.map.mapView.removeLayer(layer);
    441444            Main.map.remove(mapdustGUI);
    442445            if (mapdustGUI != null) {
    443                 mapdustGUI.update(new ArrayList<MapdustBug>(), this);
    444                 mapdustGUI.setVisible(false);
    445446                mapdustGUI.destroy();
    446447            }
     
    576577            Main.map.mapView.moveLayer(this.mapdustLayer, 0);
    577578            Main.map.mapView.addMouseListener(this);
    578             MapView.addLayerChangeListener(this);
    579579            NavigatableComponent.addZoomChangeListener(this);
    580580        } else {
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java

    r25591 r25656  
    9696    private boolean downloaded = false;
    9797
     98    /** Specifies if the MapDust layer was or not before deleted */
     99    boolean wasDeleted = false;
     100
    98101    /**
    99102     * Builds a <code>MapdustGUi</code> based on the given parameters.
     
    114117    /**
    115118     * 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.
    119121     */
    120122    @Override
     
    124126            downloaded = true;
    125127        }
     128        if (wasDeleted) {
     129            notifyObservers(null, true);
     130            wasDeleted = false;
     131        }
    126132        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();
    127157    }
    128158
     
    138168        actionList.add(action);
    139169        List<MapdustBug> mapdustBugs = panel.getMapdustBugsList();
    140         boolean showBug = shouldDisplay(action.getMapdustBug(),
    141                 mapdustPlugin.getFilter());
     170        boolean showBug =
     171                shouldDisplay(action.getMapdustBug(), mapdustPlugin.getFilter());
    142172        mapdustBugs = modifyBug(mapdustBugs, action.getMapdustBug(), showBug);
    143173
     
    145175        updateMapdustPanel(mapdustBugs);
    146176        updateMapdustActionPanel(actionList);
    147         if (showBug &&
    148                 !action.getCommand().equals(MapdustServiceCommand.ADD_BUG)) {
     177        if (showBug
     178                && !action.getCommand().equals(MapdustServiceCommand.ADD_BUG)) {
    149179            panel.resetSelectedBug(0);
    150180        } else {
     
    242272        }
    243273        if (panel == null) {
    244             panel = new MapdustBugListPanel(mapdustBugs, "Bug reports",
    245                     mapdustPlugin);
     274            panel =
     275                    new MapdustBugListPanel(mapdustBugs, "Bug reports",
     276                            mapdustPlugin);
    246277            panel.addObserver(detailsPanel);
    247278        } else {
     
    258289    private void updateMapdustActionPanel(List<MapdustAction> actionList) {
    259290        if (actionPanel == null) {
    260             actionPanel = new MapdustActionPanel(actionList,
    261                     "Offline Contribution", mapdustPlugin);
     291            actionPanel =
     292                    new MapdustActionPanel(actionList, "Offline Contribution",
     293                            mapdustPlugin);
    262294        } else {
    263295            actionPanel.updateComponents(actionList);
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java

    r25591 r25656  
    250250                    getMenuFixed().setEnabled(false);
    251251                }
     252
     253                btnPanel.getBtnAddComment().setSelected(false);
     254                btnPanel.getBtnReOpenBugReport().setSelected(false);
     255                btnPanel.getBtnFixBugReport().setSelected(false);
     256                btnPanel.getBtnInvalidateBugReport().setSelected(false);
    252257                notifyObservers(selectedBug);
    253258            } else {
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustButtonPanel.java

    r25591 r25656  
    245245    public void enableBasicComponents(boolean onlyBasic) {
    246246        btnWorkOffline.setEnabled(true);
     247        btnWorkOffline.setSelected(false);
    247248        btnFilter.setEnabled(true);
     249        btnFilter.setSelected(false);
    248250        btnRefresh.setEnabled(true);
     251        btnRefresh.setSelected(false);
    249252        if (onlyBasic) {
    250253            btnAddComment.setEnabled(false);
Note: See TracChangeset for help on using the changeset viewer.