Changeset 12432 in josm for trunk


Ignore:
Timestamp:
2017-06-25T11:53:30+02:00 (7 years ago)
Author:
Don-vip
Message:

see #14929 - remember button pressed state

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilter.java

    r12400 r12432  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.autofilter;
     3
     4import java.util.Objects;
    35
    46import org.openstreetmap.josm.data.osm.Filter;
     
    4850        return filter;
    4951    }
     52
     53    @Override
     54    public int hashCode() {
     55        return Objects.hash(filter);
     56    }
     57
     58    @Override
     59    public boolean equals(Object obj) {
     60        if (this == obj)
     61            return true;
     62        if (obj == null || getClass() != obj.getClass())
     63            return false;
     64        AutoFilter other = (AutoFilter) obj;
     65        return Objects.equals(filter, other.filter);
     66    }
    5067}
  • trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterManager.java

    r12413 r12432  
    141141            filter.text = enabledRule.getKey() + "=" + value;
    142142            String label = enabledRule.getValueFormatter().apply(value);
    143             AutoFilterButton button = new AutoFilterButton(new AutoFilter(label, filter.text, filter));
     143            AutoFilter autoFilter = new AutoFilter(label, filter.text, filter);
     144            AutoFilterButton button = new AutoFilterButton(autoFilter);
     145            if (autoFilter.equals(currentAutoFilter)) {
     146                button.getModel().setPressed(true);
     147            }
    144148            buttons.put(value, button);
    145149            maxWidth = Math.max(maxWidth, button.getPreferredSize().width);
Note: See TracChangeset for help on using the changeset viewer.