Changeset 9360 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-09T20:37:51+01:00 (4 years ago)
Author:
simon04
Message:

fix #12286 - Preset dialog: display the related key in a tooltip for every component

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java

    r8863 r9360  
    8282        check = new QuadStateCheckBox(locale_text, initialState,
    8383                allowedStates.toArray(new QuadStateCheckBox.State[allowedStates.size()]));
     84        check.setPropertyText(key);
     85        check.setState(check.getState()); // to update the tooltip text
    8486
    8587        p.add(check, GBC.eol().fill(GBC.HORIZONTAL));
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r9231 r9360  
    321321        }
    322322
    323         p.add(new JLabel(tr("{0}:", locale_text)), GBC.std().insets(0, 0, 10, 0));
     323        final JLabel label = new JLabel(tr("{0}:", locale_text));
     324        label.setToolTipText(getKeyTooltipText());
     325        p.add(label, GBC.std().insets(0, 0, 10, 0));
    324326        addToPanelAnchor(p, default_, presetInitiallyMatches);
     327        component.setToolTipText(getKeyTooltipText());
    325328
    326329        return true;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java

    r8863 r9360  
    136136    public abstract Collection<String> getValues();
    137137
     138    protected String getKeyTooltipText() {
     139        return tr("This corresponds to the key ''{0}''", key);
     140    }
     141
    138142    @Override
    139143    protected Boolean matches(Map<String, String> tags) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java

    r8863 r9360  
    167167            value = pnl;
    168168        }
    169         p.add(new JLabel(locale_text+':'), GBC.std().insets(0, 0, 10, 0));
     169        final JLabel label = new JLabel(locale_text + ':');
     170        label.setToolTipText(getKeyTooltipText());
     171        p.add(label, GBC.std().insets(0, 0, 10, 0));
    170172        p.add(value, GBC.eol().fill(GBC.HORIZONTAL));
     173        value.setToolTipText(getKeyTooltipText());
    171174        return true;
    172175    }
  • trunk/src/org/openstreetmap/josm/gui/widgets/QuadStateCheckBox.java

    r9059 r9360  
    9595
    9696    /**
     97     * Sets a text describing this property in the tooltip text
     98     * @param propertyText a description for the modelled property
     99     */
     100    public final void setPropertyText(final String propertyText) {
     101        model.setPropertyText(propertyText);
     102    }
     103
     104    /**
    97105     * Set the new state.
    98106     * @param state The new state
     
    121129    private final class QuadStateDecorator implements ButtonModel {
    122130        private final ButtonModel other;
     131        private String propertyText = null;
    123132
    124133        private QuadStateDecorator(ButtonModel other) {
     
    131140                other.setPressed(false);
    132141                other.setSelected(false);
    133                 setToolTipText(tr("false: the property is explicitly switched off"));
     142                setToolTipText(propertyText == null
     143                        ? tr("false: the property is explicitly switched off")
     144                        : tr("false: the property ''{0}'' is explicitly switched off", propertyText));
    134145            } else if (state == State.SELECTED) {
    135146                other.setArmed(false);
    136147                other.setPressed(false);
    137148                other.setSelected(true);
    138                 setToolTipText(tr("true: the property is explicitly switched on"));
     149                setToolTipText(propertyText == null
     150                        ? tr("true: the property is explicitly switched on")
     151                        : tr("true: the property ''{0}'' is explicitly switched on", propertyText));
    139152            } else if (state == State.PARTIAL) {
    140153                other.setArmed(true);
    141154                other.setPressed(true);
    142155                other.setSelected(true);
    143                 setToolTipText(tr("partial: different selected objects have different values, do not change"));
     156                setToolTipText(propertyText == null
     157                        ? tr("partial: different selected objects have different values, do not change")
     158                        : tr("partial: different selected objects have different values for ''{0}'', do not change", propertyText));
    144159            } else {
    145160                other.setArmed(true);
    146161                other.setPressed(true);
    147162                other.setSelected(false);
    148                 setToolTipText(tr("unset: do not set this property on the selected objects"));
    149             }
     163                setToolTipText(propertyText == null
     164                        ? tr("unset: do not set this property on the selected objects")
     165                        : tr("unset: do not set the property ''{0}'' on the selected objects", propertyText));
     166            }
     167        }
     168
     169        protected void setPropertyText(String propertyText) {
     170            this.propertyText = propertyText;
    150171        }
    151172
Note: See TracChangeset for help on using the changeset viewer.