Changeset 12474 in josm for trunk/src/org
- Timestamp:
- 2017-07-13T22:05:49+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/autofilter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilter.java
r12432 r12474 65 65 return Objects.equals(filter, other.filter); 66 66 } 67 68 @Override 69 public String toString() { 70 return "AutoFilter [label=" + label + ", description=" + description + ", filter=" + filter + ']'; 71 } 67 72 } -
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterButton.java
r12400 r12474 34 34 public synchronized void actionPerformed(ActionEvent e) { 35 35 AutoFilterManager afm = AutoFilterManager.getInstance(); 36 if ( afm.getCurrentAutoFilter() == filter) {36 if (filter.equals(afm.getCurrentAutoFilter())) { 37 37 afm.setCurrentAutoFilter(null); 38 38 Main.map.filterDialog.getFilterModel().executeFilters(); -
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterManager.java
r12471 r12474 47 47 import org.openstreetmap.josm.gui.NavigatableComponent; 48 48 import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener; 49 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 50 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; 51 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 52 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 49 53 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 50 54 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; … … 56 60 * @since 12400 57 61 */ 58 public final class AutoFilterManager implements ZoomChangeListener, MapModeChangeListener, DataSetListener, PreferenceChangedListener {62 public final class AutoFilterManager implements ZoomChangeListener, MapModeChangeListener, DataSetListener, PreferenceChangedListener, LayerChangeListener { 59 63 60 64 /** … … 118 122 Main.pref.addPreferenceChangeListener(this); 119 123 NavigatableComponent.addZoomChangeListener(this); 124 Main.getLayerManager().addLayerChangeListener(this); 120 125 DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT_CONSOLIDATED); 121 126 registerAutoFilterRules(AutoFilterRule.defaultRules()); … … 125 130 if (enabledRule != null && Main.map != null 126 131 && enabledRule.getMinZoomLevel() <= Selector.GeneralSelector.scale2level(Main.map.mapView.getDist100Pixel())) { 132 // Retrieve the values from current rule visible on screen 127 133 NavigableSet<String> values = getNumericValues(enabledRule.getKey(), enabledRule.getValueComparator()); 134 // Make sure current auto filter button remains visible even if no data is found, to allow user to disable it 135 if (currentAutoFilter != null) { 136 values.add(currentAutoFilter.getFilter().text.split("=")[1]); 137 } 128 138 if (!values.equals(buttons.keySet())) { 129 139 removeAllButtons(); … … 397 407 } 398 408 } 409 410 @Override 411 public void layerAdded(LayerAddEvent e) { 412 // Do nothing 413 } 414 415 @Override 416 public void layerRemoving(LayerRemoveEvent e) { 417 if (Main.getLayerManager().getEditLayer() == null) { 418 resetCurrentAutoFilter(); 419 } 420 } 421 422 @Override 423 public void layerOrderChanged(LayerOrderChangeEvent e) { 424 // Do nothing 425 } 399 426 }
Note:
See TracChangeset
for help on using the changeset viewer.