Changeset 4301 in josm for trunk


Ignore:
Timestamp:
2011-08-08T00:32:38+02:00 (13 years ago)
Author:
stoecker
Message:

fix #6642 - patch by cmuelle8 - TMSLayer: put option in tile context menu to hide errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r4195 r4301  
    9090    public static final BooleanProperty PROP_DEFAULT_AUTOZOOM = new BooleanProperty(PREFERENCE_PREFIX + ".default_autozoom", true);
    9191    public static final BooleanProperty PROP_DEFAULT_AUTOLOAD = new BooleanProperty(PREFERENCE_PREFIX + ".default_autoload", true);
     92    public static final BooleanProperty PROP_DEFAULT_SHOWERRORS = new BooleanProperty(PREFERENCE_PREFIX + ".default_showerrors", true);
    9293    public static final IntegerProperty PROP_MIN_ZOOM_LVL = new IntegerProperty(PREFERENCE_PREFIX + ".min_zoom_lvl", DEFAULT_MIN_ZOOM);
    9394    public static final IntegerProperty PROP_MAX_ZOOM_LVL = new IntegerProperty(PREFERENCE_PREFIX + ".max_zoom_lvl", DEFAULT_MAX_ZOOM);
     
    156157    JCheckBoxMenuItem autoZoomPopup;
    157158    JCheckBoxMenuItem autoLoadPopup;
     159    JCheckBoxMenuItem showErrorsPopup;
    158160    Tile showMetadataTile;
    159161    private Image attrImage;
     
    171173    protected boolean autoZoom;
    172174    protected boolean autoLoad;
     175    protected boolean showErrors;
    173176
    174177    void redraw()
     
    321324
    322325        if(!isProjectionSupported(Main.getProjection())) {
    323               JOptionPane.showMessageDialog(Main.parent,
    324                   tr("TMS layers do not support the projection {0}.\n{1}\n"
    325                   + "Change the projection or remove the layer.",
    326                       Main.getProjection().toCode(), nameSupportedProjections()),
    327                       tr("Warning"),
    328                       JOptionPane.WARNING_MESSAGE);
     326            JOptionPane.showMessageDialog(Main.parent,
     327                tr("TMS layers do not support the projection {0}.\n{1}\n"
     328                + "Change the projection or remove the layer.",
     329                Main.getProjection().toCode(), nameSupportedProjections()),
     330                tr("Warning"),
     331                JOptionPane.WARNING_MESSAGE);
    329332        }
    330333
     
    360363        autoLoadPopup.setSelected(autoLoad);
    361364        tileOptionMenu.add(autoLoadPopup);
     365
     366        showErrors = PROP_DEFAULT_SHOWERRORS.get();
     367        showErrorsPopup = new JCheckBoxMenuItem();
     368        showErrorsPopup.setAction(new AbstractAction(tr("Show Errors")) {
     369            @Override
     370            public void actionPerformed(ActionEvent ae) {
     371                showErrors = !showErrors;
     372            }
     373        });
     374        showErrorsPopup.setSelected(showErrors);
     375        tileOptionMenu.add(showErrorsPopup);
    362376
    363377        tileOptionMenu.add(new JMenuItem(new AbstractAction(tr("Load Tile")) {
     
    854868        }*/
    855869
    856         if (tile.hasError()) {
     870        if (tile.hasError() && showErrors) {
    857871            myDrawString(g, tr("Error") + ": " + tr(tile.getErrorMessage()), p.x + 2, texty);
    858872            texty += 1 + fontHeight;
Note: See TracChangeset for help on using the changeset viewer.