Changeset 4373 in josm for trunk/src/org


Ignore:
Timestamp:
2011-08-28T13:55:54+02:00 (13 years ago)
Author:
simon04
Message:

reworked construction of description for search dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r4346 r4373  
    127127        } else {
    128128            searchWithoutHistory((SearchSetting) parameters.get(SEARCH_EXPRESSION));
     129        }
     130    }
     131
     132    private static class DescriptionTextBuilder {
     133
     134        StringBuilder s = new StringBuilder(4096);
     135
     136        public StringBuilder append(String string) {
     137            return s.append(string);
     138        }
     139
     140        StringBuilder appendItem(String item) {
     141            return append("<li>").append(item).append("</li>\n");
     142        }
     143
     144        StringBuilder appendItemHeader(String itemHeader) {
     145            return append("<li class=\"header\">").append(itemHeader).append("</li>\n");
     146        }
     147
     148        @Override
     149        public String toString() {
     150            return s.toString();
    129151        }
    130152    }
     
    178200
    179201        JPanel right = new JPanel();
    180         JLabel description =
    181             new JLabel("<html><ul>"
    182                     + "<li>"+tr("<b>Baker Street</b> - ''Baker'' and ''Street'' in any key or name.")+"</li>"
    183                     + "<li>"+tr("<b>\"Baker Street\"</b> - ''Baker Street'' in any key or name.")+"</li>"
    184                     + "<li>"+tr("<b>name:Bak</b> - ''Bak'' anywhere in the name.")+"</li>"
    185                     + "<li>"+tr("<b>type=route</b> - key ''type'' with value exactly ''route''.") + "</li>"
    186                     + "<li>"+tr("<b>type=*</b> - key ''type'' with any value. Try also <b>*=value</b>, <b>type=</b>, <b>*=*</b>, <b>*=</b>") + "</li>"
    187                     + "<li>"+tr("<b>-name:Bak</b> - not ''Bak'' in the name.")+"</li>"
    188                     + "<li>"+tr("<b>oneway?</b> - oneway=yes, true, 1 or on")+"</li>"
    189                     + "<li>"+tr("<b>foot:</b> - key=foot set to any value.")+"</li>"
    190                     + "<li>"+tr("<u>Special targets:</u>")+"</li>"
    191                     + "<li>"+tr("<b>type:</b> - type of the object (<b>node</b>, <b>way</b>, <b>relation</b>)")+"</li>"
    192                     + "<li>"+tr("<b>user:</b>... - all objects changed by user")+"</li>"
    193                     + "<li>"+tr("<b>user:anonymous</b> - all objects changed by anonymous users")+"</li>"
    194                     + "<li>"+tr("<b>id:</b>... - object with given ID (0 for new objects)")+"</li>"
    195                     + "<li>"+tr("<b>version:</b>... - object with given version (0 objects without an assigned version)")+"</li>"
    196                     + "<li>"+tr("<b>changeset:</b>... - object with given changeset id (0 objects without assigned changeset)")+"</li>"
    197                     + "<li>"+tr("<b>nodes:</b>... - object with given number of nodes (nodes:count, nodes:min-max, nodes:min- or nodes:-max)")+"</li>"
    198                     + "<li>"+tr("<b>tags:</b>... - object with given number of tags (nodes:count, nodes:min-max, nodes:min- or nodes:-max)")+"</li>"
    199                     + "<li>"+tr("<b>role:</b>... - object with given role in a relation")+"</li>"
    200                     + "<li>"+tr("<b>timestamp:</b>... -  objects with this timestamp (<b>2009-11-12T14:51:09Z</b>, <b>2009-11-12</b> or <b>T14:51</b> ...)")+"</li>"
    201                     + "<li>"+tr("<b>areasize:</b>... - closed ways with given area in m\u00b2 (areasize:min-max or areasize:max)")+"</li>"
    202                     + "<li>"+tr("<b>modified</b> - all changed objects")+"</li>"
    203                     + "<li>"+tr("<b>selected</b> - all selected objects")+"</li>"
    204                     + "<li>"+tr("<b>incomplete</b> - all incomplete objects")+"</li>"
    205                     + "<li>"+tr("<b>untagged</b> - all untagged objects")+"</li>"
    206                     + "<li>"+tr("<b>closed</b> - all closed ways (a node is not considered closed)")+"</li>"
    207                     + "<li>"+tr("<b>child <i>expr</i></b> - all children of objects matching the expression")+"</li>"
    208                     + "<li>"+tr("<b>parent <i>expr</i></b> - all parents of objects matching the expression")+"</li>"
    209                     + "<li>"+tr("Use <b>|</b> or <b>OR</b> to combine with logical or")+"</li>"
    210                     + "<li>"+tr("Use <b>\"</b> to quote operators (e.g. if key contains <b>:</b>)") + "<br/>"
    211                     + tr("Within quoted strings the <b>\"</b> and <b>\\</b> characters need to be escaped by a preceding <b>\\</b> (e.g. <b>\\\"</b> and <b>\\\\</b>).")+"</li>"
    212                     + "<li>"+tr("Use <b>(</b> and <b>)</b> to group expressions")+"</li>"
    213                     + "</ul></html>");
     202        DescriptionTextBuilder descriptionText = new DescriptionTextBuilder();
     203        descriptionText.append("<html><style>li.header{font-size:110%; list-style-type:none; margin-top:5px;}</style><ul>");
     204        descriptionText.appendItem(tr("<b>Baker Street</b> - ''Baker'' and ''Street'' in any key or name."));
     205        descriptionText.appendItem(tr("<b>\"Baker Street\"</b> - ''Baker Street'' in any key or name."));
     206        descriptionText.appendItem(tr("<b>name:Bak</b> - ''Bak'' anywhere in the name."));
     207        descriptionText.appendItem(tr("<b>type=route</b> - key ''type'' with value exactly ''route''.") + "</li>");
     208        descriptionText.appendItem(tr("<b>type=*</b> - key ''type'' with any value. Try also <b>*=value</b>, <b>type=</b>, <b>*=*</b>, <b>*=</b>") + "</li>");
     209        descriptionText.appendItem(tr("<b>-name:Bak</b> - not ''Bak'' in the name."));
     210        descriptionText.appendItem(tr("<b>oneway?</b> - oneway=yes, true, 1 or on"));
     211        descriptionText.appendItem(tr("<b>foot:</b> - key=foot set to any value."));
     212        descriptionText.appendItemHeader(tr("Special targets"));
     213        descriptionText.appendItem(tr("<b>type:</b> - objects with corresponding type (<b>node</b>, <b>way</b>, <b>relation</b>)"));
     214        descriptionText.appendItem(tr("<b>user:</b>... - objects changed by user"));
     215        descriptionText.appendItem(tr("<b>user:anonymous</b> - objects changed by anonymous users"));
     216        descriptionText.appendItem(tr("<b>id:</b>... - objects with given ID (0 for new objects)"));
     217        descriptionText.appendItem(tr("<b>version:</b>... - objects with given version (0 objects without an assigned version)"));
     218        descriptionText.appendItem(tr("<b>changeset:</b>... - objects with given changeset id (0 objects without assigned changeset)"));
     219        descriptionText.appendItem(tr("<b>nodes:</b>... - objects with given number of nodes (nodes:count, nodes:min-max, nodes:min- or nodes:-max)"));
     220        descriptionText.appendItem(tr("<b>tags:</b>... - objects with given number of tags (nodes:count, nodes:min-max, nodes:min- or nodes:-max)"));
     221        descriptionText.appendItem(tr("<b>role:</b>... - objects with given role in a relation"));
     222        descriptionText.appendItem(tr("<b>timestamp:</b>... -  objects with this timestamp (<b>2009-11-12T14:51:09Z</b>, <b>2009-11-12</b> or <b>T14:51</b> ...)"));
     223        descriptionText.appendItem(tr("<b>areasize:</b>... - closed ways with given area in m\u00b2 (areasize:min-max or areasize:max)"));
     224        descriptionText.appendItem(tr("<b>modified</b> - all changed objects"));
     225        descriptionText.appendItem(tr("<b>selected</b> - all selected objects"));
     226        descriptionText.appendItem(tr("<b>incomplete</b> - all incomplete objects"));
     227        descriptionText.appendItem(tr("<b>untagged</b> - all untagged objects"));
     228        descriptionText.appendItem(tr("<b>closed</b> - all closed ways (a node is not considered closed)"));
     229        descriptionText.appendItem(tr("<b>child <i>expr</i></b> - all children of objects matching the expression"));
     230        descriptionText.appendItem(tr("<b>parent <i>expr</i></b> - all parents of objects matching the expression"));
     231        descriptionText.appendItem(tr("<b>(all)inDownloadedArea</b> - objects (and all its way nodes / relation members) in downloaded area"));
     232        descriptionText.appendItem(tr("Use <b>|</b> or <b>OR</b> to combine with logical or"));
     233        descriptionText.appendItem(tr("Use <b>\"</b> to quote operators (e.g. if key contains <b>:</b>)")
     234                + "<br/>"
     235                + tr("Within quoted strings the <b>\"</b> and <b>\\</b> characters need to be escaped by a preceding <b>\\</b> (e.g. <b>\\\"</b> and <b>\\\\</b>)."));
     236        descriptionText.appendItem(tr("Use <b>(</b> and <b>)</b> to group expressions"));
     237        descriptionText.append("</ul></html>");
     238        JLabel description = new JLabel(descriptionText.toString());
    214239        description.setFont(description.getFont().deriveFont(Font.PLAIN));
    215240        right.add(description);
Note: See TracChangeset for help on using the changeset viewer.