Changeset 16043 in josm


Ignore:
Timestamp:
2020-03-06T00:23:33+01:00 (5 years ago)
Author:
simon04
Message:

see #18864 - TaggingPreset: use char for separator field

Retained size of TaggingPreset is unchanged at 1_750_272 (de).

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r16042 r16043  
    3030     */
    3131    public Combo() {
    32         delimiter = ",";
     32        delimiter = ',';
    3333    }
    3434
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r16042 r16043  
    9090     * In case of {@link MultiSelect} the default is semicolon and this will also be used to separate selected values in the tag.
    9191     */
    92     public String delimiter = ";"; // NOSONAR
     92    public char delimiter = ';'; // NOSONAR
    9393    /** whether the last value is used as default. Using "force" enforces this behaviour also for already tagged objects. Default is "false".*/
    9494    public String use_last_as_default = "false"; // NOSONAR
     
    158158     */
    159159    protected static class ConcatenatingJList extends JList<PresetListEntry> {
    160         private final String delimiter;
    161 
    162         protected ConcatenatingJList(String del, PresetListEntry... o) {
     160        private final char delimiter;
     161
     162        protected ConcatenatingJList(char del, PresetListEntry... o) {
    163163            super(o);
    164164            delimiter = del;
     
    170170            } else {
    171171                String s = o.toString();
    172                 Set<String> parts = new TreeSet<>(Arrays.asList(s.split(delimiter)));
     172                Set<String> parts = new TreeSet<>(Arrays.asList(s.split(String.valueOf(delimiter))));
    173173                ListModel<PresetListEntry> lm = getModel();
    174174                int[] intParts = new int[lm.getSize()];
     
    351351    protected abstract void addToPanelAnchor(JPanel p, String def, boolean presetInitiallyMatches);
    352352
    353     protected char getDelChar() {
    354         return delimiter.isEmpty() ? ';' : delimiter.charAt(0);
    355     }
    356 
    357353    @Override
    358354    public Collection<String> getValues() {
     
    423419
    424420    private void initListEntriesFromAttributes() {
    425         char delChar = getDelChar();
    426421
    427422        String[] valueArray = null;
     
    450445
    451446        if (valueArray == null) {
    452             valueArray = splitEscaped(delChar, values);
     447            valueArray = splitEscaped(delimiter, values);
    453448        }
    454449
     
    456451        if (!values_no_i18n) {
    457452            final String displ = Utils.firstNonNull(locale_display_values, display_values);
    458             displayArray = displ == null ? valueArray : splitEscaped(delChar, displ);
     453            displayArray = displ == null ? valueArray : splitEscaped(delimiter, displ);
    459454        }
    460455
    461456        final String descr = Utils.firstNonNull(locale_short_descriptions, short_descriptions);
    462         String[] shortDescriptionsArray = descr == null ? null : splitEscaped(delChar, descr);
     457        String[] shortDescriptionsArray = descr == null ? null : splitEscaped(delimiter, descr);
    463458
    464459        if (displayArray.length != valueArray.length) {
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r15902 r16043  
    126126            if (boolean.class.equals(klass))
    127127                return parseBoolean(value);
     128            else if (char.class.equals(klass))
     129                return value.charAt(0);
    128130            else if (Integer.class.equals(klass))
    129131                return Integer.valueOf(value);
     
    154156                }
    155157                if (f != null && Modifier.isPublic(f.getModifiers()) && (
    156                         String.class.equals(f.getType()) || boolean.class.equals(f.getType()) ||
     158                        String.class.equals(f.getType()) || boolean.class.equals(f.getType()) || char.class.equals(f.getType()) ||
    157159                        Float.class.equals(f.getType()) || Double.class.equals(f.getType()) ||
    158160                        Long.class.equals(f.getType()) || Integer.class.equals(f.getType()))) {
Note: See TracChangeset for help on using the changeset viewer.