Пример #1
0
 /**
  * Builds a default tooltip text for the primitive <code>primitive</code>.
  *
  * @param primitive the primitmive
  * @return the tooltip text
  */
 public String buildDefaultToolTip(IPrimitive primitive) {
   StringBuilder sb = new StringBuilder();
   sb.append("<html>");
   sb.append("<strong>id</strong>=").append(primitive.getId()).append("<br>");
   List<String> keyList = new ArrayList<String>(primitive.keySet());
   Collections.sort(keyList);
   for (int i = 0; i < keyList.size(); i++) {
     if (i > 0) {
       sb.append("<br>");
     }
     String key = keyList.get(i);
     sb.append("<strong>").append(key).append("</strong>").append("=");
     String value = primitive.get(key);
     while (value.length() != 0) {
       sb.append(value.substring(0, Math.min(50, value.length())));
       if (value.length() > 50) {
         sb.append("<br>");
         value = value.substring(50);
       } else {
         value = "";
       }
     }
   }
   sb.append("</html>");
   return sb.toString();
 }
Пример #2
0
 /**
  * Decorates the name of primitive with its id, if the preference <tt>osm-primitives.showid</tt>
  * is set. Shows unique id if osm-primitives.showid.new-primitives is set
  *
  * @param name the name without the id
  * @param primitive the primitive
  */
 protected void decorateNameWithId(StringBuilder name, IPrimitive primitive) {
   if (Main.pref.getBoolean("osm-primitives.showid")) {
     if (Main.pref.getBoolean("osm-primitives.showid.new-primitives")) {
       name.append(tr(" [id: {0}]", primitive.getUniqueId()));
     } else {
       name.append(tr(" [id: {0}]", primitive.getId()));
     }
   }
 }