Changeset 10784 in josm for trunk


Ignore:
Timestamp:
2016-08-11T17:17:36+02:00 (4 years ago)
Author:
simon04
Message:

see #11823 - Delay minimap initialization until first use

This does no longer cause the JCSCacheManager to be initialized when creating the MapFrame.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MinimapDialog.java

    r8732 r10784  
    1212import org.openstreetmap.josm.gui.MapView;
    1313import org.openstreetmap.josm.gui.NavigatableComponent;
    14 import org.openstreetmap.josm.gui.SideButton;
    1514import org.openstreetmap.josm.gui.bbox.BBoxChooser;
    1615import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser;
     
    2120public class MinimapDialog extends ToggleDialog implements NavigatableComponent.ZoomChangeListener, PropertyChangeListener {
    2221
    23     protected final SlippyMapBBoxChooser slippyMap = new SlippyMapBBoxChooser();
    24     protected boolean skipEvents;
     22    private SlippyMapBBoxChooser slippyMap;
     23    private boolean skipEvents;
    2524
    2625    /**
     
    2928    public MinimapDialog() {
    3029        super(tr("Mini map"), "minimap", tr("Displays a small map of the current edit location"), null, 150);
    31         createLayout(slippyMap, false, Collections.<SideButton>emptyList());
     30    }
     31
     32    private synchronized void initialize() {
     33        if (slippyMap != null) {
     34            return;
     35        }
     36        slippyMap = new SlippyMapBBoxChooser();
     37        createLayout(slippyMap, false, Collections.emptyList());
    3238        slippyMap.setSizeButtonVisible(false);
    3339        slippyMap.addPropertyChangeListener(BBoxChooser.BBOX_PROP, this);
     
    3642    @Override
    3743    public void showDialog() {
     44        initialize();
    3845        NavigatableComponent.addZoomChangeListener(this);
    3946        super.showDialog();
Note: See TracChangeset for help on using the changeset viewer.