Ignore:
Timestamp:
2009-12-19T14:06:51+01:00 (12 years ago)
Author:
jttt
Message:

Do not update properties and selection dialogs when hidden

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/properties
Files:
2 edited

Legend:

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

    r2657 r2658  
    4747        else
    4848            return values;
     49    }
     50
     51    public void rebuildNecessary() {
     52        dirty = true;
    4953    }
    5054
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r2657 r2658  
    7171import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    7272import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    73 import org.openstreetmap.josm.gui.layer.Layer;
    7473import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    7574import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
     
    9796 * @author imi
    9897 */
    99 public class PropertiesDialog extends ToggleDialog implements SelectionChangedListener, MapView.LayerChangeListener {
     98public class PropertiesDialog extends ToggleDialog implements SelectionChangedListener, MapView.EditLayerChangeListener {
    10099    /**
    101100     * Watches for double clicks and from editing or new property, depending on the
     
    145144    public void showNotify() {
    146145        DatasetEventManager.getInstance().addDatasetListener(listOfUsedTags, false);
     146        listOfUsedTags.rebuildNecessary();
     147        DataSet.selListeners.add(this);
     148        updateSelection();
    147149    }
    148150
     
    150152    public void hideNotify() {
    151153        DatasetEventManager.getInstance().removeDatasetListener(listOfUsedTags);
     154        DataSet.selListeners.remove(this);
    152155    }
    153156
     
    568571        add(buttonPanel, BorderLayout.SOUTH);
    569572
    570         DataSet.selListeners.add(this);
    571         MapView.addLayerChangeListener(this);
     573        MapView.addEditLayerChangeListener(this);
    572574    }
    573575
    574576    @Override
    575577    public void tearDown() {
    576         MapView.removeLayerChangeListener(this);
     578        MapView.removeEditLayerChangeListener(this);
    577579    }
    578580
     
    776778    }
    777779
     780    private void updateSelection() {
     781        if (Main.main.getCurrentDataSet() == null) {
     782            selectionChanged(Collections.<OsmPrimitive>emptyList());
     783        } else {
     784            selectionChanged(Main.main.getCurrentDataSet().getSelected());
     785        }
     786    }
     787
    778788    /* ---------------------------------------------------------------------------------- */
    779     /* LayerChangeListener                                                                */
     789    /* EditLayerChangeListener                                                                */
    780790    /* ---------------------------------------------------------------------------------- */
    781     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    782         if (newLayer instanceof OsmDataLayer) {
    783             OsmDataLayer dataLayer = (OsmDataLayer)newLayer;
    784             selectionChanged(dataLayer.data.getSelected());
    785         } else {
    786             List<OsmPrimitive> selection = Collections.emptyList();
    787             selectionChanged(selection);
    788         }
    789     }
    790 
    791     public void layerAdded(Layer newLayer) {
    792         // do nothing
    793     }
    794 
    795     public void layerRemoved(Layer oldLayer) {
    796         // do nothing
     791    public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
     792        updateSelection();
    797793    }
    798794
Note: See TracChangeset for help on using the changeset viewer.