Changeset 26174 in osm for applications/editors/josm/plugins/graphview/src
- Timestamp:
- 2011-06-25T19:02:31+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReader.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.core.access; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.IOException; … … 120 122 121 123 if (currentSection != Section.NONE) { 122 throw new SAXException( "classes element below root child level");124 throw new SAXException(tr("Classes element below root child level")); 123 125 } 124 126 … … 130 132 131 133 if (currentSection != Section.CLASSES) { 132 throw new SAXException( "class element (" + className + ") outside classes element");134 throw new SAXException(tr("Class element ({0}) outside classes element", className)); 133 135 } else if (className == null) { 134 throw new SAXException( "class element without name");136 throw new SAXException(tr("Class element without name")); 135 137 } 136 138 … … 144 146 145 147 if (currentSection != Section.NONE) { 146 throw new SAXException( "classes element below root child level");148 throw new SAXException(tr("Classes element below root child level")); 147 149 } 148 150 … … 154 156 baseTags.add(readTag(attributes)); 155 157 } else { 156 throw new SAXException( "tag element outside basetag and implication elements");158 throw new SAXException(tr("Tag element outside basetag and implication elements")); 157 159 } 158 160 … … 160 162 161 163 if (currentSection != Section.NONE) { 162 throw new SAXException( "implications element below root child level");164 throw new SAXException(tr("Implications element below root child level")); 163 165 } 164 166 … … 176 178 177 179 if (key == null) { 178 throw new SAXException( "tag without key");180 throw new SAXException(tr("Tag without key")); 179 181 } else if (value == null) { 180 throw new SAXException( "tag without value (key is" + key + ")");182 throw new SAXException(tr("Tag without value (key is {0})", key)); 181 183 } 182 184 … … 195 197 196 198 if (currentSection != Section.CLASSES) { 197 throw new SAXException( "closed classes while it wasn't open");199 throw new SAXException(tr("Closed classes while it was not open")); 198 200 } else if (currentAccessClass != null) { 199 throw new SAXException( "closed classes element before all class elements were closed");201 throw new SAXException(tr("Closed classes element before all class elements were closed")); 200 202 } 201 203 … … 205 207 206 208 if (currentAccessClass == null) { 207 throw new SAXException( "closed class element while none was open");209 throw new SAXException(tr("Closed class element while none was open")); 208 210 } 209 211 … … 213 215 214 216 if (currentSection != Section.BASETAGS) { 215 throw new SAXException( "closed basetags while it wasn't open");217 throw new SAXException(tr("Closed basetags while it was not open")); 216 218 } 217 219 … … 221 223 222 224 if (currentSection != Section.IMPLICATIONS) { 223 throw new SAXException( "closed implications while it wasn't open");225 throw new SAXException(tr("Closed implications while it was not open")); 224 226 } 225 227 -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/ImplicationXMLReader.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.core.access; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.ArrayList; … … 67 69 if ("tag".equals(name)) { 68 70 if (tagOpen) { 69 throw new SAXException( "tag element inside other tag element");71 throw new SAXException(tr("Tag element inside other tag element")); 70 72 } 71 73 currentImpliedTags.add(readTag(attributes)); … … 78 80 79 81 //all vaild paths end with return; reaching this indicates an invalid tag 80 throw new SAXException( "invalid opening xml tag <" + name + "> in state" + state);82 throw new SAXException(tr("Invalid opening xml tag <{0}> in state {1}", name, state)); 81 83 82 84 } … … 91 93 if (name.equals("condition")) { 92 94 if (!currentConditionReader.isFinished()) { 93 throw new SAXException( "condition isn't finished at </condition> tag");95 throw new SAXException(tr("Condition isn't finished at </condition> tag")); 94 96 } else { 95 97 currentCondition = currentConditionReader.getCondition(); … … 110 112 } else if (name.equals("tag")) { 111 113 if (!tagOpen) { 112 throw new SAXException( "closing tag element that was not open");114 throw new SAXException(tr("Closing tag element that was not open")); 113 115 } 114 116 tagOpen = false; … … 131 133 132 134 //all vaild paths end with return; reaching this indicates an invalid tag 133 throw new SAXException( "invalid closing xml tag </" + name + "> in state" + state);135 throw new SAXException(tr("Invalid closing xml tag </{0}> in state {1}", name, state)); 134 136 135 137 } … … 138 140 139 141 if (state != State.BEFORE_IMPLICATION) { 140 throw new SAXException( "some tags not been closed; now in state" + state);142 throw new SAXException(tr("Some tags not been closed; now in state {0}", state)); 141 143 } else { 142 144 return new ArrayList<Implication>(implications); … … 150 152 151 153 if (key == null) { 152 throw new SAXException( "tag without key");154 throw new SAXException(tr("Tag without key")); 153 155 } else if (value == null) { 154 throw new SAXException( "tag without value (key is" + key + ")");156 throw new SAXException(tr("Tag without value (key is {0})", key)); 155 157 } 156 158 … … 163 165 164 166 if (key == null) { 165 throw new SAXException( "key element without attribute k");167 throw new SAXException(tr("Key element without attribute k")); 166 168 } 167 169 … … 185 187 186 188 if (finished) { 187 throw new SAXException( "condition is already finished at <" + name + ">");189 throw new SAXException(tr("Condition is already finished at <{0}>", name)); 188 190 } 189 191 … … 203 205 condition = TagConditionLogic.key(readKey(attributes)); 204 206 } else if (!("or".equals(name)) && !("and".equals(name)) && !("not".equals(name))) { 205 throw new SAXException( "unknown tag for condition:" + name);207 throw new SAXException(tr("Unknown tag for condition: {0}", name)); 206 208 } 207 209 … … 210 212 211 213 if ("tag".equals(openingName) || "key".equals(openingName)) { 212 throw new SAXException( "element must not have childs:" +openingName);214 throw new SAXException(tr("Element must not have childs: {0}", openingName)); 213 215 } 214 216 … … 224 226 225 227 if (finished) { 226 throw new SAXException( "condition is already finished at </" + name + ">");228 throw new SAXException(tr("Condition is already finished at </{0}>", name)); 227 229 } 228 230 … … 250 252 condition = TagConditionLogic.and(childConditions); 251 253 } else { 252 throw new SAXException("<and> needs at least one child"); 254 throw new SAXException(tr("<and> needs at least one child")); 253 255 } 254 256 } else if ("or".equals(openingName)) { … … 256 258 condition = TagConditionLogic.or(childConditions); 257 259 } else { 258 throw new SAXException("<or> needs at least one child"); 260 throw new SAXException(tr("<or> needs at least one child")); 259 261 } 260 262 } else if ("not".equals(openingName)) { … … 262 264 condition = TagConditionLogic.not(childConditions.get(0)); 263 265 } else { 264 throw new SAXException("<not> needs at least one child"); 266 throw new SAXException(tr("<not> needs at least one child")); 265 267 } 266 268 } … … 269 271 270 272 } else { 271 throw new SAXException("wrong closing tag " + name + 272 " (</" + openingName + "> expected"); 273 throw new SAXException(tr("Wrong closing tag {0} (</{1}> expected)", name, openingName)); 273 274 } 274 275 … … 283 284 public TagCondition getCondition() { 284 285 if (!finished) { 285 throw new IllegalStateException( "condition" + openingName + "not yet finished");286 throw new IllegalStateException(tr("Condition {0} not yet finished", openingName)); 286 287 } else { 287 288 assert condition != null; -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/ConnectorEvaluationGroup.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.core.graph; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.ArrayList; … … 60 62 assert targetNode != null && borderNodes.contains(targetNode); 61 63 62 if (!evaluated) { throw new IllegalStateException( "group not yet evaluated"); }64 if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); } 63 65 64 66 int inboundIndex = borderNodes.indexOf(startNode); -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/JunctionEvaluationGroup.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.core.graph; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.ArrayList; … … 36 38 */ 37 39 public Collection<Segment> getInboundSegments() { 38 if (!evaluated) { throw new IllegalStateException( "group not yet evaluated"); }40 if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); } 39 41 return inboundSegments; 40 42 } … … 47 49 */ 48 50 public Collection<Segment> getOutboundSegments() { 49 if (!evaluated) { throw new IllegalStateException( "group not yet evaluated"); }51 if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); } 50 52 return outboundSegments; 51 53 } … … 66 68 assert outboundSegment != null && outboundSegments.contains(outboundSegment); 67 69 68 if (!evaluated) { throw new IllegalStateException( "group not yet evaluated"); }70 if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); } 69 71 70 72 int inboundIndex = inboundSegments.indexOf(inboundSegment); -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadValueLimit.java
r23189 r26174 67 67 case MINIMUM: return vehicleValue >= (Float) propertyValue; 68 68 case MAXIMUM: return vehicleValue <= (Float) propertyValue; 69 default: throw new Error(" unhandled LimitType");69 default: throw new Error("Unhandled LimitType"); 70 70 } 71 71 } else { -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogic.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.core.util; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.util.Collection; … … 88 90 public static TagCondition and(final Collection<TagCondition> conditions) { 89 91 if (conditions.size() == 0) { 90 throw new IllegalArgumentException( "collection must contain at least one condition");92 throw new IllegalArgumentException(tr("Collection must contain at least one condition")); 91 93 } 92 94 return new TagCondition() { … … 155 157 public static TagCondition or(final Collection<TagCondition> conditions) { 156 158 if (conditions.size() == 0) { 157 throw new IllegalArgumentException( "collection must contain at least one condition");159 throw new IllegalArgumentException(tr("Collection must contain at least one condition")); 158 160 } 159 161 return new TagCondition() { -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/GraphViewPlugin.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.io.File; … … 92 94 93 95 if (accessRuleset == null) { 94 JOptionPane.showMessageDialog(Main.parent, "No ruleset has been selected!" ,"No ruleset", JOptionPane.ERROR_MESSAGE);96 JOptionPane.showMessageDialog(Main.parent, tr("No ruleset has been selected!"), tr("No ruleset"), JOptionPane.ERROR_MESSAGE); 95 97 } else { 96 98 transitionStructure.setAccessParametersAndRuleset(preferences.getCurrentParameterBookmark(), accessRuleset); … … 103 105 104 106 if (accessRuleset == null) { 105 JOptionPane.showMessageDialog(Main.parent, "No ruleset has been selected!", 106 "No ruleset", JOptionPane.ERROR_MESSAGE); 107 JOptionPane.showMessageDialog(Main.parent, tr("No ruleset has been selected!"), 108 tr("No ruleset"), JOptionPane.ERROR_MESSAGE); 107 109 } else { 108 110 … … 126 128 127 129 } catch (AccessRulesetSyntaxException e) { 128 JOptionPane.showMessageDialog(Main.parent, "syntax exception in access ruleset:\n" + e);130 JOptionPane.showMessageDialog(Main.parent, tr("Syntax exception in access ruleset:\n{0}", e)); 129 131 e.printStackTrace(); 130 132 } catch (FileNotFoundException e) { 131 JOptionPane.showMessageDialog(Main.parent, "file not found:\n" + e);133 JOptionPane.showMessageDialog(Main.parent, tr("File not found:\n{0}", e)); 132 134 e.printStackTrace(); 133 135 } catch (IOException e) { 134 JOptionPane.showMessageDialog(Main.parent, "problem when accessing a file:\n" + e);136 JOptionPane.showMessageDialog(Main.parent, tr("Problem when accessing a file:\n{0}", e)); 135 137 e.printStackTrace(); 136 138 } … … 148 150 149 151 if (accessRuleset == null) { 150 JOptionPane.showMessageDialog(Main.parent, "No ruleset has been selected!", 151 "No ruleset", JOptionPane.ERROR_MESSAGE); 152 JOptionPane.showMessageDialog(Main.parent, tr("No ruleset has been selected!"), 153 tr("No ruleset"), JOptionPane.ERROR_MESSAGE); 152 154 } else { 153 155 transitionStructure.setAccessParametersAndRuleset( … … 159 161 160 162 } catch (AccessRulesetSyntaxException e) { 161 JOptionPane.showMessageDialog(Main.parent, "syntax exception in access ruleset:\n" + e);163 JOptionPane.showMessageDialog(Main.parent, tr("Syntax exception in access ruleset:\n{0}", e)); 162 164 e.printStackTrace(); 163 165 } catch (FileNotFoundException e) { 164 JOptionPane.showMessageDialog(Main.parent, "file not found:\n"+ e);166 JOptionPane.showMessageDialog(Main.parent, tr("File not found:\n", e)); 165 167 e.printStackTrace(); 166 168 } catch (IOException e) { 167 JOptionPane.showMessageDialog(Main.parent, "problem when accessing a file:\n" + e);169 JOptionPane.showMessageDialog(Main.parent, tr("Problem when accessing a file:\n{0}", e)); 168 170 e.printStackTrace(); 169 171 } … … 206 208 rulesetInputStream = rulesetURL.openStream(); 207 209 } else { 208 throw new FileNotFoundException( "couldn't find built-in ruleset" +ruleset);210 throw new FileNotFoundException(tr("Couldn't find built-in ruleset {0}", ruleset)); 209 211 } 210 212 -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/AccessParameterDialog.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import static org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes.MAX_INCLINE_DOWN; … … 50 52 static { 51 53 FLOAT_PROPERTIES = new LinkedHashMap<VehiclePropertyType<Float>, String>(); 52 FLOAT_PROPERTIES.put(VehiclePropertyTypes.HEIGHT, "height (m)"); 53 FLOAT_PROPERTIES.put(VehiclePropertyTypes.WIDTH, "width (m)"); 54 FLOAT_PROPERTIES.put(VehiclePropertyTypes.LENGTH, "length (m)"); 55 FLOAT_PROPERTIES.put(VehiclePropertyTypes.SPEED, "speed (km/h)"); 56 FLOAT_PROPERTIES.put(VehiclePropertyTypes.WEIGHT, "weight (t)"); 57 FLOAT_PROPERTIES.put(VehiclePropertyTypes.AXLELOAD, "axleload (t)"); 54 FLOAT_PROPERTIES.put(VehiclePropertyTypes.HEIGHT, tr("height (m)")); 55 FLOAT_PROPERTIES.put(VehiclePropertyTypes.WIDTH, tr("width (m)")); 56 FLOAT_PROPERTIES.put(VehiclePropertyTypes.LENGTH, tr("length (m)")); 57 FLOAT_PROPERTIES.put(VehiclePropertyTypes.SPEED, tr("speed (km/h)")); 58 FLOAT_PROPERTIES.put(VehiclePropertyTypes.WEIGHT, tr("weight (t)")); 59 FLOAT_PROPERTIES.put(VehiclePropertyTypes.AXLELOAD, tr("axleload (t)")); 58 60 } 59 61 … … 67 69 public BookmarkNamePanel(String initialName) { 68 70 super(); 69 this.setBorder(BorderFactory.createTitledBorder( "bookmark name"));71 this.setBorder(BorderFactory.createTitledBorder(tr("Bookmark name"))); 70 72 71 73 this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); … … 81 83 82 84 if (existingBookmarkNames.contains(name)) { 83 JOptionPane.showMessageDialog(this, "Bookmark name already exists!"); 85 JOptionPane.showMessageDialog(this, tr("Bookmark name already exists!")); 84 86 return null; 85 87 } … … 87 89 for (char nameChar : name.toCharArray()) { 88 90 if (FORBIDDEN_CHARS.contains(nameChar)) { 89 JOptionPane.showMessageDialog(this, "Bookmark name must not contain '" + 90 nameChar + "'!"); 91 JOptionPane.showMessageDialog(this, tr("Bookmark name must not contain ''{0}''!", nameChar)); 91 92 return null; 92 93 } … … 103 104 public AccessClassPanel(PreferenceAccessParameters initialParameters) { 104 105 super(); 105 this.setBorder(BorderFactory.createTitledBorder( "access class"));106 this.setBorder(BorderFactory.createTitledBorder(tr("Access class"))); 106 107 107 108 this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); … … 118 119 for (char nameChar : name.toCharArray()) { 119 120 if (FORBIDDEN_CHARS.contains(nameChar)) { 120 JOptionPane.showMessageDialog(this, "Access class must not contain '" + 121 nameChar + "'!"); 121 JOptionPane.showMessageDialog(this, tr("Access class must not contain ''{0}''!", nameChar)); 122 122 return null; 123 123 } … … 137 137 public AccessTypesPanel(PreferenceAccessParameters initialParameters) { 138 138 super(); 139 this.setBorder(BorderFactory.createTitledBorder( "access types"));139 this.setBorder(BorderFactory.createTitledBorder(tr("Access types"))); 140 140 141 141 this.setLayout( … … 174 174 public VehiclePropertiesPanel(PreferenceAccessParameters initialParameters) { 175 175 super(); 176 this.setBorder(BorderFactory.createTitledBorder( "vehicle properties"));176 this.setBorder(BorderFactory.createTitledBorder(tr("Vehicle properties"))); 177 177 178 178 this.setLayout(new GridLayout(((COLS-1 + FLOAT_PROPERTIES.size()) / COLS), … … 223 223 public RoadQualityPanel(PreferenceAccessParameters initialParameters) { 224 224 super(); 225 this.setBorder(BorderFactory.createTitledBorder( "road requirements"));225 this.setBorder(BorderFactory.createTitledBorder(tr("Road requirements"))); 226 226 227 227 … … 230 230 /* incline up */ 231 231 { 232 JLabel inclineUpLabel = new JLabel( "max. incline up (%, pos.)");233 inclineUpLabel.setToolTipText( "maximum incline the vehicle can go up");232 JLabel inclineUpLabel = new JLabel(tr("Max. incline up (%, pos.)")); 233 inclineUpLabel.setToolTipText(tr("Maximum incline the vehicle can go up")); 234 234 this.add(inclineUpLabel); 235 235 … … 241 241 inclineUpTextField.setText(vehiclePropertyString); 242 242 } 243 inclineUpTextField.setToolTipText( "maximum incline the vehicle can go up");243 inclineUpTextField.setToolTipText(tr("Maximum incline the vehicle can go up")); 244 244 245 245 this.add(inclineUpTextField); … … 248 248 /* incline down */ 249 249 { 250 JLabel inclineDownLabel = new JLabel( "max. incline down (%, pos.)");251 inclineDownLabel.setToolTipText( "maximum incline the vehicle can go down");250 JLabel inclineDownLabel = new JLabel(tr("Max. incline down (%, pos.)")); 251 inclineDownLabel.setToolTipText(tr("Maximum incline the vehicle can go down")); 252 252 this.add(inclineDownLabel); 253 253 … … 259 259 inclineDownTextField.setText(vehiclePropertyString); 260 260 } 261 inclineDownTextField.setToolTipText( "maximum incline the vehicle can go down");261 inclineDownTextField.setToolTipText(tr("Maximum incline the vehicle can go down")); 262 262 263 263 this.add(inclineDownTextField); … … 266 266 /* surface */ 267 267 { 268 JLabel surfaceLabel = new JLabel( "surface blacklist");269 surfaceLabel.setToolTipText( "list of surfaces the vehicle cannot use, "270 + "values are separated by semicolons (;)"); 268 JLabel surfaceLabel = new JLabel(tr("Surface blacklist")); 269 surfaceLabel.setToolTipText(tr("List of surfaces the vehicle cannot use, " 270 + "values are separated by semicolons (;)")); 271 271 this.add(surfaceLabel); 272 272 … … 280 280 } 281 281 282 surfaceTextField.setToolTipText( "list of surfaces the vehicle cannot use, "283 + "values are separated by semicolons (;)"); 282 surfaceTextField.setToolTipText(tr("List of surfaces the vehicle cannot use, " 283 + "values are separated by semicolons (;)")); 284 284 285 285 this.add(surfaceTextField); … … 288 288 /* tracktype */ 289 289 { 290 JLabel tracktypeLabel = new JLabel("max. tracktype grade"); 291 tracktypeLabel.setToolTipText( "worst tracktype (1-5) the vehicle can still use,"292 + " 0 for none"); 290 JLabel tracktypeLabel = new JLabel(tr("max. tracktype grade")); 291 tracktypeLabel.setToolTipText(tr("Worst tracktype (1-5) the vehicle can still use," 292 + " 0 for none")); 293 293 this.add(tracktypeLabel); 294 294 … … 300 300 tracktypeTextField.setText(vehiclePropertyString); 301 301 } 302 tracktypeTextField.setToolTipText( "worst tracktype (1-5) the vehicle can still use,"303 + " 0 for none"); 302 tracktypeTextField.setToolTipText(tr("Worst tracktype (1-5) the vehicle can still use," 303 + " 0 for none")); 304 304 305 305 this.add(tracktypeTextField); … … 343 343 new BoxLayout(this, BoxLayout.X_AXIS); 344 344 345 JButton okButton = new JButton(existingBookmark?"Change bookmark" :"Create bookmark");345 JButton okButton = new JButton(existingBookmark?tr("Change bookmark"):tr("Create bookmark")); 346 346 okButton.addActionListener(new ActionListener() { 347 347 public void actionPerformed(ActionEvent e) { … … 358 358 this.add(okButton); 359 359 360 JButton cancelButton = new JButton( "Cancel");360 JButton cancelButton = new JButton(tr("Cancel")); 361 361 cancelButton.addActionListener(new ActionListener() { 362 362 public void actionPerformed(ActionEvent e) { … … 384 384 Collection<String> existingBookmarkNames, 385 385 PreferenceAccessParameters initialAccessParameters, BookmarkAction okAction) { 386 super(owner, "edit access parameters", true);386 super(owner, tr("Edit access parameters"), true); 387 387 388 388 this.existingBookmark = existingBookmark; -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/GraphViewDialog.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.BorderLayout; … … 65 67 public GraphViewDialog(final GraphViewPlugin plugin) { 66 68 67 super("Graph View Dialog", "graphview", 68 "Open the dialog for graph view configuration.", (Shortcut)null, HEIGHT); 69 super(tr("Graph View Dialog"), "graphview", 70 tr("Open the dialog for graph view configuration."), (Shortcut)null, HEIGHT); 69 71 70 72 this.preferences = GraphViewPreferences.getInstance(); … … 73 75 availableColorSchemes = new LinkedHashMap<String, ColorScheme>(); 74 76 75 availableColorSchemes.put("default", 77 availableColorSchemes.put(tr("default"), 76 78 new PreferencesColorScheme(preferences)); 77 availableColorSchemes.put("end nodes", 79 availableColorSchemes.put(tr("end nodes"), 78 80 new EndNodeColorScheme(Color.GRAY, Color.RED, Color.GRAY)); 79 availableColorSchemes.put("maxspeed", 81 availableColorSchemes.put(tr("maxspeed"), 80 82 new MaxspeedColorScheme()); 81 availableColorSchemes.put("maxweight", 83 availableColorSchemes.put(tr("maxweight"), 82 84 new MaxweightColorScheme()); 83 availableColorSchemes.put("maxheight", 85 availableColorSchemes.put(tr("maxheight"), 84 86 new MaxheightColorScheme()); 85 availableColorSchemes.put("incline", 87 availableColorSchemes.put(tr("incline"), 86 88 new InclineColorScheme()); 87 89 … … 103 105 /* create ruleset label and combo box */ 104 106 { 105 JLabel rulesetLabel = new JLabel( "ruleset:");107 JLabel rulesetLabel = new JLabel(tr("Ruleset:")); 106 108 gbcLabel.gridy = 0; 107 109 selectionLayout.setConstraints(rulesetLabel, gbcLabel); … … 117 119 /* create bookmark label and combo box */ 118 120 { 119 JLabel bookmarkLabel = new JLabel( "parameters:");121 JLabel bookmarkLabel = new JLabel(tr("Parameters:")); 120 122 gbcLabel.gridy = 1; 121 123 selectionLayout.setConstraints(bookmarkLabel, gbcLabel); … … 131 133 /* create color scheme label and combo box */ 132 134 { 133 JLabel colorSchemeLabel = new JLabel( "coloring:");135 JLabel colorSchemeLabel = new JLabel(tr("Coloring:")); 134 136 gbcLabel.gridy = 2; 135 137 selectionLayout.setConstraints(colorSchemeLabel, gbcLabel); … … 154 156 155 157 JPanel buttonPanel = new JPanel(); 156 JButton showLayerButton = new JButton( "create/update graph");158 JButton showLayerButton = new JButton(tr("Create/update graph")); 157 159 showLayerButton.addActionListener(new ActionListener() { 158 160 public void actionPerformed(ActionEvent e) { -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/GraphViewPreferenceEditor.java
r23434 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.dialogs; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Color; … … 59 61 readPreferences(); 60 62 61 preferencePanel = gui.createPreferenceTab("graphview", "Graphview", 62 "Settings for the Graphview plugin that visualizes routing graphs."); 63 preferencePanel = gui.createPreferenceTab("graphview", tr("Graphview"), 64 tr("Settings for the Graphview plugin that visualizes routing graphs.")); 63 65 64 66 JPanel mainPanel = createMainPanel(); … … 123 125 124 126 JPanel rulesetPanel = new JPanel(); 125 rulesetPanel.setBorder(BorderFactory.createTitledBorder( "ruleset"));127 rulesetPanel.setBorder(BorderFactory.createTitledBorder(tr("Ruleset"))); 126 128 rulesetPanel.setLayout(new BoxLayout(rulesetPanel, BoxLayout.Y_AXIS)); 127 129 128 internalRulesetCheckBox = new JCheckBox( "use built-in rulesets");130 internalRulesetCheckBox = new JCheckBox(tr("Use built-in rulesets")); 129 131 internalRulesetCheckBox.setSelected(GraphViewPreferences.getInstance().getUseInternalRulesets()); 130 132 internalRulesetCheckBox.addActionListener(internalRulesetActionListener); 131 133 rulesetPanel.add(internalRulesetCheckBox); 132 134 133 rulesetFolderLabel = new JLabel( "external ruleset directory:");135 rulesetFolderLabel = new JLabel(tr("Wxternal ruleset directory:")); 134 136 rulesetPanel.add(rulesetFolderLabel); 135 137 … … 139 141 rulesetPanel.add(rulesetFolderTextField); 140 142 141 selectRulesetFolderButton = new JButton( "select directory");143 selectRulesetFolderButton = new JButton(tr("Select directory")); 142 144 selectRulesetFolderButton.addActionListener(selectRulesetFolderActionListener); 143 145 rulesetPanel.add(selectRulesetFolderButton); … … 151 153 152 154 JPanel vehiclePanel = new JPanel(); 153 vehiclePanel.setBorder(BorderFactory.createTitledBorder( "vehicle"));155 vehiclePanel.setBorder(BorderFactory.createTitledBorder(tr("Vehicle"))); 154 156 vehiclePanel.setLayout(new BoxLayout(vehiclePanel, BoxLayout.Y_AXIS)); 155 157 … … 160 162 buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); 161 163 162 JButton createButton = new JButton( "create");164 JButton createButton = new JButton(tr("Create")); 163 165 createButton.addActionListener(createVehicleActionListener); 164 166 buttonPanel.add(createButton); 165 167 166 editBookmarkButton = new JButton( "edit");168 editBookmarkButton = new JButton(tr("Edit")); 167 169 editBookmarkButton.addActionListener(editVehicleActionListener); 168 170 buttonPanel.add(editBookmarkButton); 169 171 170 deleteBookmarkButton = new JButton( "delete");172 deleteBookmarkButton = new JButton(tr("Delete")); 171 173 deleteBookmarkButton.addActionListener(deleteVehicleActionListener); 172 174 buttonPanel.add(deleteBookmarkButton); 173 175 174 JButton restoreDefaultsButton = new JButton( "restore defaults");176 JButton restoreDefaultsButton = new JButton(tr("Restore defaults")); 175 177 restoreDefaultsButton.addActionListener(restoreVehicleDefaultsActionListener); 176 178 buttonPanel.add(restoreDefaultsButton); … … 184 186 185 187 JPanel visualizationPanel = new JPanel(); 186 visualizationPanel.setBorder(BorderFactory.createTitledBorder( "visualization"));188 visualizationPanel.setBorder(BorderFactory.createTitledBorder(tr("Visualization"))); 187 189 visualizationPanel.setLayout(new BoxLayout(visualizationPanel, BoxLayout.Y_AXIS)); 188 190 189 separateDirectionsCheckBox = new JCheckBox( "draw directions separately");191 separateDirectionsCheckBox = new JCheckBox(tr("Draw directions separately")); 190 192 separateDirectionsCheckBox.setSelected(GraphViewPreferences.getInstance().getSeparateDirections()); 191 193 visualizationPanel.add(separateDirectionsCheckBox); … … 198 200 Color nodeColor = GraphViewPreferences.getInstance().getNodeColor(); 199 201 200 nodeColorButton = new JButton( "node color");202 nodeColorButton = new JButton(tr("Node color")); 201 203 nodeColorButton.addActionListener(chooseNodeColorActionListener); 202 204 colorPanel.add(nodeColorButton); … … 207 209 Color segmentColor = GraphViewPreferences.getInstance().getSegmentColor(); 208 210 209 segmentColorButton = new JButton( "arrow color");211 segmentColorButton = new JButton(tr("Arrow color")); 210 212 segmentColorButton.addActionListener(chooseSegmentColorActionListener); 211 213 colorPanel.add(segmentColorButton); … … 280 282 null, 281 283 false, 282 "new bookmark",284 tr("New bookmark"), 283 285 parameterBookmarks.keySet(), 284 286 defaultBookmarkParameters, … … 337 339 int userChoice = JOptionPane.showConfirmDialog( 338 340 preferencePanel, 339 "Really delete \" " +selectedBookmarkName+ "\"?",340 "Bookmark deletion", 341 tr("Really delete \"{0}\"?", selectedBookmarkName), 342 tr("Bookmark deletion"), 341 343 JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); 342 344 … … 355 357 int userChoice = JOptionPane.showConfirmDialog( 356 358 preferencePanel, 357 "Really restore default bookmarks?\n" 358 + "All manually added or edited bookmarks will be lost!", 359 "Bookmark reset", 359 tr("Really restore default bookmarks?\n" 360 + "All manually added or edited bookmarks will be lost!"), 361 tr("Bookmark reset"), 360 362 JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); 361 363 … … 374 376 375 377 Color selectedColor = JColorChooser.showDialog( 376 preferencePanel, "Choose node color", nodeColorField.getBackground()); 378 preferencePanel, tr("Choose node color"), nodeColorField.getBackground()); 377 379 378 380 if (selectedColor != null) { … … 387 389 388 390 Color selectedColor = JColorChooser.showDialog( 389 preferencePanel, "Choose arrow color", segmentColorField.getBackground()); 391 preferencePanel, tr("Choose arrow color"), segmentColorField.getBackground()); 390 392 391 393 if (selectedColor != null) { -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/GraphViewLayer.java
r23434 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.layer; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.BasicStroke; … … 251 253 private Point getNodePoint(LatLonCoords coords, MapView mv) { 252 254 LatLon latLon = new LatLon(coords.getLat(), coords.getLon()); 253 EastNorth eastNorth = Main. proj.latlon2eastNorth(latLon);255 EastNorth eastNorth = Main.getProjection().latlon2eastNorth(latLon); 254 256 return mv.getPoint(eastNorth); 255 257 } … … 300 302 @Override 301 303 public String getToolTipText() { 302 return "routing graph calculated by the GraphView plugin";304 return tr("Routing graph calculated by the GraphView plugin"); 303 305 } 304 306 305 307 @Override 306 308 public void mergeFrom(Layer from) { 307 throw new AssertionError("GraphView layer is not mergable"); 309 throw new AssertionError(tr("GraphView layer is not mergable")); 308 310 } 309 311 -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/GraphViewPreferences.java
r23434 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.preferences; 2 3 import static org.openstreetmap.josm.tools.I18n.marktr; 2 4 3 5 import static org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes.AXLELOAD; … … 216 218 currentInternalRuleset = null; 217 219 218 nodeColor = Color.WHITE;219 segmentColor = Color.WHITE;220 220 currentColorScheme = new PreferencesColorScheme(this); 221 221 … … 244 244 } 245 245 246 Main.pref.put ("graphview.defaultNodeColor", createColorString(nodeColor));247 Main.pref.put ("graphview.defaultSegmentColor", createColorString(segmentColor));246 Main.pref.putColor(marktr("GraphView default node"), nodeColor); 247 Main.pref.putColor(marktr("Graphview default segment"), segmentColor); 248 248 249 249 Main.pref.put("graphview.separateDirections", separateDirections); … … 289 289 } 290 290 291 if (Main.pref.hasKey("graphview.defaultNodeColor")) { 292 Color color = parseColorString(Main.pref.get("graphview.defaultNodeColor")); 293 if (color != null) { 294 nodeColor = color; 295 } 296 } 297 if (Main.pref.hasKey("graphview.defaultSegmentColor")) { 298 Color color = parseColorString(Main.pref.get("graphview.defaultSegmentColor")); 299 if (color != null) { 300 segmentColor = color; 301 } 302 } 303 291 nodeColor = Main.pref.getColor(marktr("GraphView default node"), Color.white); 292 segmentColor = Main.pref.getColor(marktr("Graphview default segment"), Color.white); 304 293 separateDirections = Main.pref.getBoolean("graphview.separateDirections", false); 305 294 … … 471 460 } 472 461 } 473 474 private static final Pattern COLOR_PATTERN =475 Pattern.compile("^(\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})$");476 private String createColorString(Color color) {477 return color.getRed() + ", " + color.getGreen() + ", " + color.getBlue();478 }479 480 private Color parseColorString(String string) {481 Matcher matcher = COLOR_PATTERN.matcher(string);482 if (!matcher.matches()) {483 return null;484 } else {485 int r = Integer.parseInt(matcher.group(1));486 int g = Integer.parseInt(matcher.group(2));487 int b = Integer.parseInt(matcher.group(3));488 return new Color(r, g, b);489 }490 }491 492 462 } -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/VehiclePropertyStringParser.java
r23189 r26174 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.preferences; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.security.InvalidParameterException; … … 31 33 32 34 public static final String ERROR_WEIGHT = 33 "Weights must be given as positive decimal numbers with unit \"t\" or without unit."; 35 tr("Weights must be given as positive decimal numbers with unit \"t\" or without unit."); 34 36 public static final String ERROR_LENGTH = 35 "Lengths must be given as positive decimal numbers with unit \"m\", \"km\", \"mi\"" + 36 " or without unit.\nAlternatively, the format FEET' INCHES\" can be used."; 37 tr("Lengths must be given as positive decimal numbers with unit \"m\", \"km\", \"mi\"" + 38 " or without unit.\nAlternatively, the format FEET' INCHES\" can be used."); 37 39 public static final String ERROR_SPEED = 38 "Speeds should be given as numbers without unit or " 39 + "as numbers followed by \"mph\"."; 40 tr("Speeds should be given as numbers without unit or " 41 + "as numbers followed by \"mph\"."); 40 42 public static final String ERROR_INCLINE = 41 "Inclines must be given as positive decimal numbers with followed by \"%\"."; 43 tr("Inclines must be given as positive decimal numbers with followed by \"%\"."); 42 44 public static final String ERROR_TRACKTYPE = 43 "Tracktype grades must be given as integers between 0 and 5."; 45 tr("Tracktype grades must be given as integers between 0 and 5."); 44 46 public static final String ERROR_SURFACE = 45 "Surface values must not contain any of the following characters: ',' '{' '}' '=' '|"; 47 tr("Surface values must not contain any of the following characters: ',' '{' '}' '=' '|"); 46 48 47 49 private static final List<Character> FORBIDDEN_SURFACE_CHARS = … … 145 147 146 148 } else { 147 throw new InvalidParameterException(" unknown property type: " + propertyType);149 throw new InvalidParameterException("Unknown property type: " + propertyType); 148 150 } 149 151
Note:
See TracChangeset
for help on using the changeset viewer.