Changeset 18258 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2021-10-08T13:42:59+02:00 (3 years ago)
Author:
Don-vip
Message:

see #21408 - fixups (patch by marcello)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompTextField.java

    r18221 r18258  
    3838    private boolean autocompleteEnabled = true;
    3939    /** a filter to enforce max. text length */
    40     private MaxLengthDocumentFilter docFilter;
     40    private transient MaxLengthDocumentFilter docFilter;
    4141    /** the model */
    4242    protected AutoCompComboBoxModel<E> model;
     
    203203     * @param l the autoComp listener to be removed
    204204     */
    205     public synchronized void removeActionListener(AutoCompListener l) {
    206         if ((l != null) && (getAction() == l)) {
    207             setAction(null);
    208         } else {
    209             listenerList.remove(AutoCompListener.class, l);
    210         }
     205    public synchronized void removeAutoCompListener(AutoCompListener l) {
     206        listenerList.remove(AutoCompListener.class, l);
    211207    }
    212208
     
    245241                        ((AutoCompListener) listeners[i + 1]).autoCompBefore(e);
    246242                        break;
     243                    default:
     244                        break;
    247245                }
    248246            }
     
    261259    @Override
    262260    public void keyTyped(KeyEvent e) {
    263         if (autocompleteEnabled) {
    264             // if selection is at the end
    265             if (getSelectionEnd() == getText().length()) {
    266                 final String oldText = getText().substring(0, getSelectionStart());
    267                 // We got the event before the editor component could see it. Let the editor do its job first.
    268                 SwingUtilities.invokeLater(() -> autocomplete(oldText));
    269             }
     261        // if selection is at the end
     262        if (autocompleteEnabled && getSelectionEnd() == getText().length()) {
     263            final String oldText = getText().substring(0, getSelectionStart());
     264            // We got the event before the editor component could see it. Let the editor do its job first.
     265            SwingUtilities.invokeLater(() -> autocomplete(oldText));
    270266        }
    271267    }
     
    273269    @Override
    274270    public void keyPressed(KeyEvent e) {
     271        // not interested
    275272    }
    276273
    277274    @Override
    278275    public void keyReleased(KeyEvent e) {
     276        // not interested
    279277    }
    280278
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java

    r18221 r18258  
    4343     * Display OSM keys as {@linkplain org.openstreetmap.josm.gui.widgets.OsmIdTextField#setHint hint}
    4444     */
    45     protected static BooleanProperty DISPLAY_KEYS_AS_HINT = new BooleanProperty("taggingpreset.display-keys-as-hint", true);
     45    protected static final BooleanProperty DISPLAY_KEYS_AS_HINT = new BooleanProperty("taggingpreset.display-keys-as-hint", true);
    4646
    4747    protected void initAutoCompletionField(AutoCompletingTextField field, String... key) {
     
    9797     */
    9898    public Boolean matches(Map<String, String> tags) {
    99         return null;
     99        return null; // NOSONAR
    100100    }
    101101
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java

    r17651 r18258  
    5353     * Sort presets menu alphabetically
    5454     */
    55     public static BooleanProperty SORT_MENU = new BooleanProperty("taggingpreset.sortvalues", true);
     55    public static final BooleanProperty SORT_MENU = new BooleanProperty("taggingpreset.sortvalues", true);
    5656    /**
    5757     * Custom icon sources
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r18257 r18258  
    260260    private List<String> checkListsSameLength(List<String> a, List<String> b, String name) {
    261261        if (a != null && a.size() != b.size()) {
    262             Logging.error(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''{2}List'' must be the same as in ''values''",
     262            Logging.error(tr("Broken tagging preset \"{0}-{1}\" - number of items in ''{2}'' must be the same as in ''values''",
    263263                            key, text, name));
    264264            Logging.error(tr("Detailed information: {0} <> {1}", a, b));
     
    292292        List<String> shortDescriptionsList = splitEscaped(delimiter, short_descriptions);
    293293
    294         displayList = checkListsSameLength(displayList, valueList, "display");
    295         localeDisplayList = checkListsSameLength(localeDisplayList, valueList, "localeDisplay");
    296         shortDescriptionsList = checkListsSameLength(shortDescriptionsList, valueList, "shortDescriptions");
    297         localeShortDescriptionsList = checkListsSameLength(localeShortDescriptionsList, valueList, "localeShortDescriptions");
     294        displayList = checkListsSameLength(displayList, valueList, "display_values");
     295        localeDisplayList = checkListsSameLength(localeDisplayList, valueList, "locale_display_values");
     296        shortDescriptionsList = checkListsSameLength(shortDescriptionsList, valueList, "short_descriptions");
     297        localeShortDescriptionsList = checkListsSameLength(localeShortDescriptionsList, valueList, "locale_short_descriptions");
    298298
    299299        for (int i = 0; i < valueList.size(); i++) {
  • trunk/src/org/openstreetmap/josm/gui/widgets/OrientationAction.java

    r18221 r18258  
    3535public class OrientationAction extends AbstractAction implements PropertyChangeListener {
    3636    /** Default for {@link #RTL_LANGUAGES} */
    37     public static final List<String> DEFAULT_RTL_LANGUAGES = Arrays.asList("ar", "he", "fa", "iw", "ur", "lld");
     37    private static final List<String> DEFAULT_RTL_LANGUAGES = Arrays.asList("ar", "he", "fa", "iw", "ur");
    3838
    3939    /** Default for {@link #LOCALIZED_KEYS} */
    40     public static final List<String> DEFAULT_LOCALIZED_KEYS = Arrays.asList(
     40    private static final List<String> DEFAULT_LOCALIZED_KEYS = Arrays.asList(
    4141        "(\\p{Alnum}+_)?name", "addr", "description", "fixme", "note", "source", "strapline", "operator");
    4242
     
    5757
    5858    private static final Pattern LANG_PATTERN = Pattern.compile(":([a-z]{2,3})$");
     59    private static final String NEW_STATE = "newState";
    5960
    6061    private Component component;
    6162    private ImageIcon iconRTL;
    6263    private ImageIcon iconLTR;
    63     protected static Set<String> RTLLanguages = new HashSet<>(RTL_LANGUAGES.get());
    64     protected static Pattern localizedKeys = compile_localized_keys();
     64    protected static final Set<String> RTLLanguages = new HashSet<>(RTL_LANGUAGES.get());
     65    protected static final Pattern localizedKeys = compileLocalizedKeys();
    6566
    6667    /**
     
    8485    @Override
    8586    public void actionPerformed(ActionEvent e) {
    86         firePropertyChange("orientationAction", null, getValue("newState"));
     87        firePropertyChange("orientationAction", null, getValue(NEW_STATE));
    8788    }
    8889
     
    9596            putValue(Action.SMALL_ICON, iconRTL);
    9697            putValue(Action.SHORT_DESCRIPTION, tr("Switch the text orientation to Right-to-Left."));
    97             putValue("newState", ComponentOrientation.RIGHT_TO_LEFT);
     98            putValue(NEW_STATE, ComponentOrientation.RIGHT_TO_LEFT);
    9899        } else {
    99100            putValue(Action.NAME, tr("Left to Right"));
    100101            putValue(Action.SMALL_ICON, iconLTR);
    101102            putValue(Action.SHORT_DESCRIPTION, tr("Switch the text orientation to Left-to-Right."));
    102             putValue("newState", ComponentOrientation.LEFT_TO_RIGHT);
     103            putValue(NEW_STATE, ComponentOrientation.LEFT_TO_RIGHT);
    103104        }
    104105    }
     
    206207    }
    207208
    208     private static Pattern compile_localized_keys() {
     209    private static Pattern compileLocalizedKeys() {
    209210        return Pattern.compile("^(" + String.join("|", LOCALIZED_KEYS.get()) + ")$");
    210211    }
Note: See TracChangeset for help on using the changeset viewer.