Changeset 4151 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-06-19T23:27:21+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r4043 r4151 44 44 import org.openstreetmap.josm.tools.GBC; 45 45 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 46 import org.openstreetmap.josm.tools.WindowGeometry; 46 47 47 48 /** … … 63 64 super(Main.parent, tr("Advanced object info"), new String[] {tr("Close")}); 64 65 this.primitives = primitives; 65 setPreferredSize(new Dimension(750, 550)); 66 setRememberWindowGeometry(getClass().getName() + ".geometry", 67 WindowGeometry.centerInWindow(Main.parent, new Dimension(750, 550))); 66 68 67 69 setButtonIcons(new String[] {"ok.png"}); … … 101 103 StringBuilder s = new StringBuilder(); 102 104 for (Node n : new SubclassFilteredCollection<OsmPrimitive, Node>(primitives, OsmPrimitive.nodePredicate)) { 103 s.append( "Node id="+n.getUniqueId());105 s.append(tr("Node id={0}", n.getUniqueId())); 104 106 if (!checkDataSet(n)) { 105 s.append( " not in data set");107 s.append(tr(" not in data set")); 106 108 continue; 107 109 } 108 110 if (n.isIncomplete()) { 109 s.append( " incomplete\n");111 s.append(tr(" incomplete\n")); 110 112 addWayReferrer(s, n); 111 113 addRelationReferrer(s, n); 112 114 continue; 113 115 } 114 s.append( String.format(" lat=%s lon=%s (projected: x=%s, y=%s); ",116 s.append(tr(" lat={0} lon={0} (projected: x={0}, y={0}); ", 115 117 Double.toString(n.getCoor().lat()), Double.toString(n.getCoor().lon()), 116 118 Double.toString(n.getEastNorth().east()), Double.toString(n.getEastNorth().north()))); … … 123 125 124 126 for (Way w : new SubclassFilteredCollection<OsmPrimitive, Way>(primitives, OsmPrimitive.wayPredicate)) { 125 s.append( "Way id="+ w.getUniqueId());127 s.append(tr("Way id={0}", w.getUniqueId())); 126 128 if (!checkDataSet(w)) { 127 s.append( " not in data set");129 s.append(tr(" not in data set")); 128 130 continue; 129 131 } 130 132 if (w.isIncomplete()) { 131 s.append( " incomplete\n");133 s.append(tr(" incomplete\n")); 132 134 addRelationReferrer(s, w); 133 135 continue; 134 136 } 135 s.append( String.format(" %dnodes; ", w.getNodes().size()));137 s.append(tr(" {0} nodes; ", w.getNodes().size())); 136 138 addCommon(s, w); 137 139 addAttributes(s, w); 138 140 addRelationReferrer(s, w); 139 141 140 s.append( " nodes:\n");142 s.append(tr(" nodes:\n")); 141 143 for (Node n : w.getNodes()) { 142 144 s.append(String.format(" %d\n", n.getUniqueId())); … … 146 148 147 149 for (Relation r : new SubclassFilteredCollection<OsmPrimitive, Relation>(primitives, OsmPrimitive.relationPredicate)) { 148 s.append( "Relation id="+r.getUniqueId());150 s.append(tr("Relation id={0}",r.getUniqueId())); 149 151 if (!checkDataSet(r)) { 150 s.append( " not in data set");152 s.append(tr(" not in data set")); 151 153 continue; 152 154 } 153 155 if (r.isIncomplete()) { 154 s.append( " incomplete\n");156 s.append(tr(" incomplete\n")); 155 157 addRelationReferrer(s, r); 156 158 continue; 157 159 } 158 s.append( String.format(" %dmembers; ",r.getMembersCount()));160 s.append(tr(" {0} members; ",r.getMembersCount())); 159 161 addCommon(s, r); 160 162 addAttributes(s, r); 161 163 addRelationReferrer(s, r); 162 164 163 s.append( " members:\n");165 s.append(tr(" members:\n")); 164 166 for (RelationMember m : r.getMembers() ) { 165 167 s.append(String.format(" %s%d '%s'\n", m.getMember().getType().getAPIName().substring(0,1), m.getMember().getUniqueId(), m.getRole())); … … 172 174 173 175 protected void addCommon(StringBuilder s, OsmPrimitive o) { 174 s.append( String.format("Data set: %X; User: [%s]; ChangeSet id: %d; Timestamp: %s, Version: %d",175 o.getDataSet().hashCode(),176 s.append(tr("Data set: {0}; User: [{1}]; ChangeSet id: {2}; Timestamp: {3}, Version: {4}", 177 Integer.toHexString(o.getDataSet().hashCode()), 176 178 userString(o.getUser()), 177 179 o.getChangesetId(), 178 DateUtils.fromDate(o.getTimestamp()),180 o.isTimestampEmpty() ? tr("<new object>") : DateUtils.fromDate(o.getTimestamp()), 179 181 o.getVersion())); 180 182 181 183 /* selected state is left out: not interesting as it is always selected */ 182 184 if (o.isDeleted()) { 183 s.append( "; deleted");185 s.append(tr("; deleted")); 184 186 } 185 187 if (!o.isVisible()) { 186 s.append( "; deleted-on-server");188 s.append(tr("; deleted-on-server")); 187 189 } 188 190 if (o.isModified()) { 189 s.append( "; modified");191 s.append(tr("; modified")); 190 192 } 191 193 if (o.isDisabledAndHidden()) { 192 s.append( "; filtered/hidden");194 s.append(tr("; filtered/hidden")); 193 195 } 194 196 if (o.isDisabled()) { 195 s.append( "; filtered/disabled");197 s.append(tr("; filtered/disabled")); 196 198 } 197 199 if (o.hasDirectionKeys()) { 198 s.append( "; has direction keys");200 s.append(tr("; has direction keys")); 199 201 if (o.reversedDirection()) { 200 s.append( " (reversed)");202 s.append(tr(" (reversed)")); 201 203 } 202 204 } … … 206 208 protected void addAttributes(StringBuilder s, OsmPrimitive o) { 207 209 if (o.hasKeys()) { 208 s.append( " tags:\n");210 s.append(tr(" tags:\n")); 209 211 for (String key: o.keySet()) { 210 212 s.append(String.format(" \"%s\"=\"%s\"\n", key, o.get(key))); … … 218 220 Collection<Way> wayRefs = new SubclassFilteredCollection<OsmPrimitive, Way>(refs, OsmPrimitive.wayPredicate); 219 221 if (wayRefs.size() > 0) { 220 s.append( " way referrer:\n");222 s.append(tr(" way referrer:\n")); 221 223 for (Way w : wayRefs) { 222 224 s.append(" "+w.getUniqueId()+"\n"); … … 229 231 Collection<Relation> relRefs = new SubclassFilteredCollection<OsmPrimitive, Relation>(refs, OsmPrimitive.relationPredicate); 230 232 if (relRefs.size() > 0) { 231 s.append( " relation referrer:\n");233 s.append(tr(" relation referrer:\n")); 232 234 for (Relation r : relRefs) { 233 235 s.append(" "+r.getUniqueId()+"\n"); … … 249 251 protected String userString(User user) { 250 252 if (user == null) 251 return "<null>";253 return tr("<new object>"); 252 254 253 255 List<String> names = user.getNames(); … … 255 257 StringBuilder us = new StringBuilder(); 256 258 257 us.append( "id:"+user.getId());259 us.append(tr("id: {0}",user.getId())); 258 260 if (names.size() == 1) { 259 us.append( " name:"+user.getName());261 us.append(tr(" name: {0}",user.getName())); 260 262 } 261 263 else if (names.size() > 1) { 262 us.append( String.format(" %d names:%s", names.size(), user.getName()));264 us.append(tr(" {0} names: {1}", names.size(), user.getName())); 263 265 } 264 266 return us.toString(); … … 281 283 282 284 for (OsmPrimitive osm : sel) { 283 txtMappaint.append( "Styles Cache for \""+osm.getDisplayName(DefaultNameFormatter.getInstance())+"\":");285 txtMappaint.append(tr("Styles Cache for \"{0}\":",osm.getDisplayName(DefaultNameFormatter.getInstance()))); 284 286 285 287 MultiCascade mc = new MultiCascade(); … … 287 289 for (StyleSource s : elemstyles.getStyleSources()) { 288 290 if (s.active) { 289 txtMappaint.append( "\n\n> applying "+getSort(s)+" style \""+s.getDisplayString()+"\n");291 txtMappaint.append(tr("\n\n> applying {0} style \"{1}\"\n",getSort(s), s.getDisplayString())); 290 292 s.apply(mc, osm, scale, null, false); 291 txtMappaint.append( "\nRange:"+mc.range);293 txtMappaint.append(tr("\nRange:{0}",mc.range)); 292 294 for (Entry<String, Cascade> e : mc.getLayers()) { 293 295 txtMappaint.append("\n "+e.getKey()+": \n"+e.getValue()); 294 296 } 295 297 } else { 296 txtMappaint.append( "\n\n> skipping \""+s.getDisplayString()+"\" (not active)");298 txtMappaint.append(tr("\n\n> skipping \"{0}\" (not active)",s.getDisplayString())); 297 299 } 298 300 } 299 txtMappaint.append( "\n\nList of generated Styles:\n");301 txtMappaint.append(tr("\n\nList of generated Styles:\n")); 300 302 StyleList sl = elemstyles.get(osm, scale, nc); 301 303 for (ElemStyle s : sl) { … … 310 312 StyleCache sc2 = selList.get(1).mappaintStyle; 311 313 if (sc1 == sc2) { 312 txtMappaint.append( "The 2 selected Objects have identical style caches.");314 txtMappaint.append(tr("The 2 selected objects have identical style caches.")); 313 315 } 314 316 if (!sc1.equals(sc2)) { 315 txtMappaint.append( "The 2 selected Objects have different style caches.");317 txtMappaint.append(tr("The 2 selected objects have different style caches.")); 316 318 } 317 319 if (sc1.equals(sc2) && sc1 != sc2) { 318 txtMappaint.append( "Warning: The 2 selected Objects have equal, but not identical style caches.");320 txtMappaint.append(tr("Warning: The 2 selected objects have equal, but not identical style caches.")); 319 321 } 320 322 } … … 323 325 private String getSort(StyleSource s) { 324 326 if (s instanceof XmlStyleSource) 325 return "xml";327 return tr("xml"); 326 328 if (s instanceof MapCSSStyleSource) 327 return "mapcss";328 return "unkown";329 return tr("mapcss"); 330 return tr("unkown"); 329 331 } 330 332
Note:
See TracChangeset
for help on using the changeset viewer.