Changeset 190 in josm for src/org/openstreetmap


Ignore:
Timestamp:
2007-01-08T03:29:11+01:00 (18 years ago)
Author:
imi
Message:
  • fixed bug in annotation preset that inverted the logic of delete_if_empty
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/annotation/AnnotationPreset.java

    r178 r190  
    184184                                current.add(new Text(a.getValue("key"), a.getValue("text"), a.getValue("default"), parseBoolean(a.getValue("delete_if_empty"))));
    185185                        else if (qname.equals("check")) {
    186                                 String s = a.getValue("default");
    187                                 boolean clear = parseBoolean(s);
    188                                 current.add(new Check(a.getValue("key"), a.getValue("text"), !clear));
     186                                boolean checked = parseBoolean(a.getValue("default"));
     187                                current.add(new Check(a.getValue("key"), a.getValue("text"), checked));
    189188                        } else if (qname.equals("label"))
    190189                                current.add(new Label(a.getValue("text")));
     
    193192                                String s = a.getValue("readonly");
    194193                                String dvstr = a.getValue("display_values");
    195                                 boolean editable = parseBoolean(s);
     194                                boolean editable = !parseBoolean(s);
    196195                                if (dvstr != null) {
    197196                                        if (editable && s != null)
     
    212211
    213212                private boolean parseBoolean(String s) {
    214                         return s == null || s.equals("0") || s.startsWith("off") || s.startsWith("false") || s.startsWith("no");
     213                        return s != null &&
     214                                !s.equals("0") &&
     215                                !s.startsWith("off") &&
     216                                !s.startsWith("false") &&
     217                                !s.startsWith("no");
    215218                }
    216219
Note: See TracChangeset for help on using the changeset viewer.