Changeset 4874 in josm
- Timestamp:
- 2012-01-26T21:52:34+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 24 edited
-
actions/SessionLoadAction.java (modified) (6 diffs)
-
actions/ValidateAction.java (modified) (4 diffs)
-
actions/downloadtasks/DownloadOsmChangeTask.java (modified) (4 diffs)
-
data/APIDataSet.java (modified) (4 diffs)
-
data/ServerSidePreferences.java (modified) (8 diffs)
-
data/validation/tests/DeprecatedTags.java (modified) (5 diffs)
-
data/validation/tests/DuplicateNode.java (modified) (1 diff)
-
data/validation/tests/DuplicateRelation.java (modified) (1 diff)
-
data/validation/tests/DuplicateWay.java (modified) (2 diffs)
-
data/validation/tests/RelationChecker.java (modified) (1 diff)
-
gui/NavigatableComponent.java (modified) (1 diff)
-
gui/dialogs/MapPaintDialog.java (modified) (2 diffs)
-
gui/dialogs/relation/RelationNodeMap.java (modified) (9 diffs)
-
gui/oauth/OsmOAuthAuthorizationClient.java (modified) (3 diffs)
-
gui/preferences/AddWMSLayerPanel.java (modified) (8 diffs)
-
gui/preferences/ImageryPreference.java (modified) (8 diffs)
-
gui/preferences/MapPaintPreference.java (modified) (7 diffs)
-
gui/preferences/PreferenceTabbedPane.java (modified) (4 diffs)
-
gui/preferences/SourceEditor.java (modified) (3 diffs)
-
gui/preferences/TaggingPresetPreference.java (modified) (4 diffs)
-
gui/preferences/advanced/AdvancedPreference.java (modified) (7 diffs)
-
io/GpxImporter.java (modified) (4 diffs)
-
io/imagery/ImageryReader.java (modified) (5 diffs)
-
io/session/SessionReader.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r4733 r4874 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 7 7 import java.awt.event.ActionEvent; … … 16 16 17 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.actions.ExtensionFileFilter;19 18 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 20 19 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 57 56 } 58 57 59 public class Loader extends PleaseWaitRunnable { 58 public static class Loader extends PleaseWaitRunnable { 60 59 61 60 private boolean canceled; … … 89 88 for (Runnable task : postLoadTasks) { 90 89 if (canceled) return; 91 if (task == null) continue; 90 if (task == null) { 91 continue; 92 } 92 93 task.run(); 93 94 } … … 112 113 JOptionPane.ERROR_MESSAGE, 113 114 null 114 ); 115 ); 115 116 cancel(); 116 117 } catch (IOException e) { … … 122 123 JOptionPane.ERROR_MESSAGE, 123 124 null 124 ); 125 ); 125 126 cancel(); 126 127 } catch (RuntimeException e) { -
trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
r4076 r4874 34 34 */ 35 35 public class ValidateAction extends JosmAction { 36 36 37 37 /** Serializable ID */ 38 38 private static final long serialVersionUID = -2304521273582574603L; … … 46 46 public ValidateAction() { 47 47 super(tr("Validation"), "dialogs/validator", tr("Performs the data validation"), 48 Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true); 48 Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true); 49 49 } 50 50 … … 106 106 * 107 107 */ 108 class ValidationTask extends PleaseWaitRunnable { 108 static class ValidationTask extends PleaseWaitRunnable { 109 109 private Collection<Test> tests; 110 110 private Collection<OsmPrimitive> validatedPrimitives; … … 154 154 @Override 155 155 protected void realRun() throws SAXException, IOException, 156 OsmTransferException {156 OsmTransferException { 157 157 if (tests == null || tests.isEmpty()) 158 158 return; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java
r4734 r4874 57 57 return Main.worker.submit(downloadTask); 58 58 } 59 59 60 60 protected class DownloadTask extends DownloadOsmTask.DownloadTask { 61 61 … … 114 114 * 115 115 */ 116 private class HistoryListener implements HistoryDataSetListener { 116 private static class HistoryListener implements HistoryDataSetListener { 117 117 118 118 private final List<Pair<OsmPrimitive, Date>> toMonitor; 119 119 120 120 public HistoryListener(List<Pair<OsmPrimitive, Date>> toMonitor) { 121 121 this.toMonitor = toMonitor; … … 133 133 if (hp != null) { 134 134 PrimitiveData data = null; 135 135 136 136 switch (pair.a.getType()) { 137 case NODE:138 data = new NodeData();139 ((NodeData)data).setCoor(((HistoryNode)hp).getCoords());140 break;141 case WAY:142 data = new WayData();143 ((WayData)data).setNodes(((HistoryWay)hp).getNodes());144 break;145 case RELATION:146 data = new RelationData();147 ((RelationData)data).setMembers(((HistoryRelation)hp).getMembers());148 break;149 default: throw new AssertionError();137 case NODE: 138 data = new NodeData(); 139 ((NodeData)data).setCoor(((HistoryNode)hp).getCoords()); 140 break; 141 case WAY: 142 data = new WayData(); 143 ((WayData)data).setNodes(((HistoryWay)hp).getNodes()); 144 break; 145 case RELATION: 146 data = new RelationData(); 147 ((RelationData)data).setMembers(((HistoryRelation)hp).getMembers()); 148 break; 149 default: throw new AssertionError(); 150 150 } 151 151 152 152 data.setUser(hp.getUser()); 153 153 data.setVisible(hp.isVisible()); … … 155 155 data.setKeys(hp.getTags()); 156 156 data.setOsmId(hp.getChangesetId(), (int) hp.getVersion()); 157 157 158 158 // Load the history data 159 159 pair.a.load(data); -
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r4534 r4874 73 73 OsmPrimitiveComparator c = new OsmPrimitiveComparator(); 74 74 c.relationsFirst = true; 75 Collections.sort(toDelete, c); 76 Collections.sort(toAdd, c); 77 Collections.sort(toUpdate, c); 75 Collections.sort(toDelete, c); 76 Collections.sort(toAdd, c); 77 Collections.sort(toUpdate, c); 78 78 } 79 79 … … 154 154 OsmPrimitiveComparator c = new OsmPrimitiveComparator(); 155 155 c.relationsFirst = true; 156 Collections.sort(toDelete, c); 157 Collections.sort(toAdd, c); 158 Collections.sort(toUpdate, c); 156 Collections.sort(toDelete, c); 157 Collections.sort(toAdd, c); 158 Collections.sort(toUpdate, c); 159 159 } 160 160 … … 278 278 * 279 279 */ 280 private class RelationUploadDependencyGraph { 280 private static class RelationUploadDependencyGraph { 281 281 private HashMap<Relation, Set<Relation>> children; 282 282 private Collection<Relation> relations; … … 353 353 } 354 354 } 355 ); 355 ); 356 356 return ret; 357 357 } -
trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
r4612 r4874 15 15 import java.net.URL; 16 16 import java.net.URLConnection; 17 import java.util.Collection;18 import java.util.Collections;19 import java.util.LinkedList;20 import java.util.StringTokenizer;21 import java.util.Map.Entry;22 17 23 18 import javax.swing.JOptionPane; … … 26 21 import org.openstreetmap.josm.Main; 27 22 import org.openstreetmap.josm.io.OsmConnection; 28 import org.openstreetmap.josm.io.OsmTransferException;29 23 import org.openstreetmap.josm.tools.Base64; 30 24 … … 36 30 */ 37 31 public class ServerSidePreferences extends Preferences { 38 public class MissingPassword extends Exception{ 32 public static class MissingPassword extends Exception{ 39 33 public String realm; 40 34 public MissingPassword(String r) { … … 56 50 String username = get("applet.username"); 57 51 String password = get("applet.password"); 58 if(password.isEmpty() && username.isEmpty()) 52 if(password.isEmpty() && username.isEmpty()) { 59 53 con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password)); 54 } 60 55 con.connect(); 61 56 if(username.isEmpty() && con instanceof HttpURLConnection 62 && ((HttpURLConnection) con).getResponseCode() 63 == HttpURLConnection.HTTP_UNAUTHORIZED) { 57 && ((HttpURLConnection) con).getResponseCode() 58 == HttpURLConnection.HTTP_UNAUTHORIZED) { 64 59 String t = ((HttpURLConnection) con).getHeaderField("WWW-Authenticate"); 65 60 t = t.replace("Basic realm=\"","").replace("\"",""); … … 88 83 String username = get("applet.username"); 89 84 String password = get("applet.password"); 90 if(password.isEmpty() && username.isEmpty()) 85 if(password.isEmpty() && username.isEmpty()) { 91 86 con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password)); 87 } 92 88 con.setRequestMethod("POST"); 93 89 con.setDoOutput(true); … … 103 99 tr("Information"), 104 100 JOptionPane.INFORMATION_MESSAGE 105 ); 101 ); 106 102 } catch (Exception e) { 107 103 e.printStackTrace(); … … 111 107 tr("Error"), 112 108 JOptionPane.ERROR_MESSAGE 113 ); 109 ); 114 110 } 115 111 } … … 127 123 tr("Error"), 128 124 JOptionPane.ERROR_MESSAGE 129 ); 125 ); 130 126 } 131 127 this.connection = connection; -
trunk/src/org/openstreetmap/josm/data/validation/tests/DeprecatedTags.java
r4806 r4874 1 1 package org.openstreetmap.josm.data.validation.tests; 2 2 3 import org.openstreetmap.josm.data.osm.Node;4 import org.openstreetmap.josm.data.osm.Relation;5 import org.openstreetmap.josm.data.osm.Way;6 3 import static org.openstreetmap.josm.tools.I18n.tr; 7 4 … … 9 6 import java.util.LinkedList; 10 7 import java.util.List; 8 11 9 import org.openstreetmap.josm.command.ChangePropertyCommand; 12 10 import org.openstreetmap.josm.command.Command; 13 11 import org.openstreetmap.josm.command.SequenceCommand; 12 import org.openstreetmap.josm.data.osm.Node; 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 import org.openstreetmap.josm.data.osm.Relation; 15 15 import org.openstreetmap.josm.data.osm.Tag; 16 import org.openstreetmap.josm.data.osm.Way; 16 17 import org.openstreetmap.josm.data.validation.Severity; 17 18 import org.openstreetmap.josm.data.validation.Test; … … 97 98 } 98 99 99 private class DeprecationCheck { 100 private static class DeprecationCheck { 100 101 101 102 int code; … … 148 149 String key = tag.getKey(); 149 150 String value = tag.getValue(); 150 if (value.isEmpty() && !p.hasKey(key)) {151 if (value.isEmpty() && !p.hasKey(key)) 151 152 return false; 152 } 153 if (!value.isEmpty() && !value.equals(p.get(key))) { 153 if (!value.isEmpty() && !value.equals(p.get(key))) 154 154 return false; 155 }156 155 } 157 156 return true; … … 167 166 168 167 String getDescription() { 169 if (alternatives.isEmpty()) {168 if (alternatives.isEmpty()) 170 169 return tr("{0} is deprecated", Utils.join(", ", test)); 171 } else {170 else 172 171 return tr("{0} is deprecated, use {1} instead", Utils.join(", ", test), Utils.join(tr(" or "), alternatives)); 173 }174 172 } 175 173 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r4869 r4874 39 39 public class DuplicateNode extends Test { 40 40 41 private class NodeHash implements Hash<Object, Object> { 41 private static class NodeHash implements Hash<Object, Object> { 42 42 43 43 double precision = Main.pref.getDouble("validator.duplicatenodes.precision", 0.); -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r4869 r4874 34 34 { 35 35 36 public class RelMember { 36 public static class RelMember { 37 37 private String role; 38 38 private OsmPrimitiveType type; -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r4869 r4874 34 34 { 35 35 36 private class WayPair { 36 private static class WayPair { 37 37 public List<LatLon> coor; 38 38 public Map<String, String> keys; … … 56 56 } 57 57 58 private class WayPairNoTags { 58 private static class WayPairNoTags { 59 59 public List<LatLon> coor; 60 60 public WayPairNoTags(List<LatLon> _coor) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r4869 r4874 70 70 } 71 71 72 public class RoleInfo { 72 public static class RoleInfo { 73 73 int total = 0; 74 74 Collection<Node> nodes = new LinkedList<Node>(); -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r4869 r4874 1217 1217 } 1218 1218 1219 private class CursorInfo { 1219 private static class CursorInfo { 1220 1220 public Cursor cursor; 1221 1221 public Object object; -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r4363 r4874 143 143 144 144 createLayout(p, true, Arrays.asList(new SideButton[] { 145 new SideButton(onoffAction), 146 new SideButton(upAction), 147 new SideButton(downAction), 148 new SideButton(new LaunchMapPaintPreferencesAction()) 145 new SideButton(onoffAction), 146 new SideButton(upAction), 147 new SideButton(downAction), 148 new SideButton(new LaunchMapPaintPreferencesAction()) 149 149 })); 150 150 } … … 359 359 * Opens preferences window and selects the mappaint tab. 360 360 */ 361 class LaunchMapPaintPreferencesAction extends AbstractAction { 361 static class LaunchMapPaintPreferencesAction extends AbstractAction { 362 362 public LaunchMapPaintPreferencesAction() { 363 363 putValue(SMALL_ICON, ImageProvider.get("dialogs", "mappaintpreference")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationNodeMap.java
r3788 r4874 30 30 */ 31 31 public class RelationNodeMap { 32 private class NodesWays{ 32 private static class NodesWays{ 33 33 public Map<Node, Set<Integer>> nodes = new TreeMap<Node, Set<Integer>>(); 34 34 public Map<Integer, Set<Node>> ways = new TreeMap<Integer, Set<Node>>(); … … 108 108 * cannot be used in future. (only for performance) 109 109 */ 110 // Iterator<Map.Entry<Node,TreeSet<Integer>>> it = map.nodes.entrySet().iterator(); 111 // while (it.hasNext()) { 112 // Map.Entry<Node,TreeSet<Integer>> nodeLinks = it.next(); 113 // 114 // if (nodeLinks.getValue().size() < 2) { 115 // if (nodeLinks.getValue().size() != 1) throw new AssertionError(); 116 // 117 // Integer d_way = nodeLinks.getValue().iterator().next(); 118 // TreeSet<Node> d_way_nodes = map.ways.get(d_way); 119 // d_way_nodes.remove(nodeLinks.getKey()); 120 // 121 // it.remove(); 122 // continue; 123 // } 124 // } 125 }110 // Iterator<Map.Entry<Node,TreeSet<Integer>>> it = map.nodes.entrySet().iterator(); 111 // while (it.hasNext()) { 112 // Map.Entry<Node,TreeSet<Integer>> nodeLinks = it.next(); 113 // 114 // if (nodeLinks.getValue().size() < 2) { 115 // if (nodeLinks.getValue().size() != 1) throw new AssertionError(); 116 // 117 // Integer d_way = nodeLinks.getValue().iterator().next(); 118 // TreeSet<Node> d_way_nodes = map.ways.get(d_way); 119 // d_way_nodes.remove(nodeLinks.getKey()); 120 // 121 // it.remove(); 122 // continue; 123 // } 124 // } 125 } 126 126 127 127 private void addPair(Node n, int i) { … … 211 211 } 212 212 } 213 213 214 214 firstOneway = way; 215 215 return popForwardOnewayPart(way); … … 220 220 for (Node n : onewayMap.ways.get(way)) { 221 221 Integer i = findAdjacentWay(onewayMap, n); 222 if(i == null) continue; 222 if(i == null) { 223 continue; 224 } 223 225 224 226 lastOnewayNode = processBackwardIfEndOfLoopReached(i); 225 if(lastOnewayNode != null) {227 if(lastOnewayNode != null) 226 228 return popBackwardOnewayPart(firstOneway); 227 }228 229 229 230 deleteWayNode(onewayMap, i, n); … … 231 232 } 232 233 } 233 234 234 235 firstOneway = null; 235 236 return null; … … 240 241 for (Node n : onewayReverseMap.ways.get(way)) { 241 242 if((map.nodes.containsKey(n)) 242 || (onewayMap.nodes.containsKey(n) && onewayMap.nodes.get(n).size() > 1)) {243 || (onewayMap.nodes.containsKey(n) && onewayMap.nodes.get(n).size() > 1)) 243 244 return n; 244 } 245 if(firstCircular != null && firstCircular == n) { 245 if(firstCircular != null && firstCircular == n) 246 246 return firstCircular; 247 }248 247 } 249 248 } 250 249 return null; 251 250 } 252 251 253 252 private Integer popBackwardOnewayPart(int way){ 254 253 if (lastOnewayNode != null) { 255 254 TreeSet<Node> nodes = new TreeSet<Node>(); 256 if (onewayReverseMap.ways.containsKey(way)) nodes.addAll(onewayReverseMap.ways.get(way)); 257 if (map.ways.containsKey(way)) nodes.addAll(map.ways.get(way)); 255 if (onewayReverseMap.ways.containsKey(way)) { 256 nodes.addAll(onewayReverseMap.ways.get(way)); 257 } 258 if (map.ways.containsKey(way)) { 259 nodes.addAll(map.ways.get(way)); 260 } 258 261 for (Node n : nodes) { 259 262 if(n == lastOnewayNode) { //if oneway part ends … … 277 280 firstOneway = null; 278 281 lastOnewayNode = null; 279 282 280 283 return null; 281 284 } … … 302 305 303 306 private void deleteWayNode(NodesWays nw, Integer way, Node n){ 304 if(nw.oneWay) 307 if(nw.oneWay) { 305 308 doneOneway(way); 306 else309 } else { 307 310 done(way); 311 } 308 312 nw.ways.get(way).remove(n); 309 313 } … … 343 347 Set<Node> nodesForward = remainingOneway.get(i); 344 348 for (Node n : nodesForward) { 345 if(onewayMap.nodes.containsKey(n)) onewayMap.nodes.get(n).remove(i); 346 if(onewayReverseMap.nodes.containsKey(n)) onewayReverseMap.nodes.get(n).remove(i); 349 if(onewayMap.nodes.containsKey(n)) { 350 onewayMap.nodes.get(n).remove(i); 351 } 352 if(onewayReverseMap.nodes.containsKey(n)) { 353 onewayReverseMap.nodes.get(n).remove(i); 354 } 347 355 } 348 356 remainingOneway.remove(i); -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r4729 r4874 6 6 import java.io.BufferedReader; 7 7 import java.io.DataOutputStream; 8 import java.io.IOException; 8 9 import java.io.InputStreamReader; 9 import java.io.IOException;10 10 import java.io.UnsupportedEncodingException; 11 11 import java.lang.reflect.Field; … … 46 46 private HttpURLConnection connection; 47 47 48 private class SessionId { 48 private static class SessionId { 49 49 String id; 50 50 String token; … … 209 209 while((c = r.readLine()) != null) { 210 210 Matcher m = p.matcher(c); 211 if(m.find()) {211 if(m.find()) 212 212 return m.group(1); 213 }214 213 } 215 214 } catch (IOException e) { -
trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java
r4802 r4874 147 147 if(!previouslyShownUnsupportedCrsError) { 148 148 JOptionPane.showMessageDialog(null, tr("That layer does not support any of JOSM''s projections,\n" + 149 "so you can not use it. This message will not show again."), 150 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 149 "so you can not use it. This message will not show again."), 150 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 151 151 previouslyShownUnsupportedCrsError = true; 152 152 } … … 223 223 resultingLayerField = new JTextArea(3, 40); 224 224 resultingLayerField.setLineWrap(true); 225 JScrollPane bottomScrollPane = new JScrollPane(resultingLayerField, 225 JScrollPane bottomScrollPane = new JScrollPane(resultingLayerField, 226 226 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 227 227 bottomScrollPane.setMinimumSize(new Dimension(60, 60)); … … 250 250 StringBuilder a = new StringBuilder("tms"); 251 251 String z = sanitize(tmsZoom.getText()); 252 if(!z.isEmpty()) 252 if(!z.isEmpty()) { 253 253 a.append("["+z+"]"); 254 } 254 255 a.append(":"); 255 256 a.append(sanitize(tmsURL.getText())); … … 493 494 for (Projection proj : Projections.getProjections()) { 494 495 if (proj instanceof ProjectionSubPrefs) { 495 if (((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null) {496 if (((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null) 496 497 return true; 497 }498 498 } else { 499 if (proj.toCode().equals(crs)) {499 if (proj.toCode().equals(crs)) 500 500 return true; 501 }502 501 } 503 502 } … … 511 510 } else if (selectedLayers != null) { 512 511 HashSet<String> proj = new HashSet<String>(); 513 for(LayerDetails l : selectedLayers) 512 for(LayerDetails l : selectedLayers) { 514 513 proj.addAll(l.getProjections()); 514 } 515 515 info.setServerProjections(proj); 516 516 } … … 520 520 private static String getChildContent(Element parent, String name, String missing, String empty) { 521 521 Element child = getChild(parent, name); 522 if (child == null) {522 if (child == null) 523 523 return missing; 524 }else {524 else { 525 525 String content = (String) getContent(child); 526 526 return (content != null) ? content : empty; … … 556 556 557 557 private static Element getChild(Element parent, String name) { 558 if (parent == null) {558 if (parent == null) 559 559 return null; 560 }561 560 for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) { 562 if (child instanceof Element && name.equals(child.getNodeName())) {561 if (child instanceof Element && name.equals(child.getNodeName())) 563 562 return (Element) child; 564 }565 563 } 566 564 return null; 567 565 } 568 566 569 class LayerDetails { 567 static class LayerDetails { 570 568 571 569 private String name; … … 597 595 @Override 598 596 public String toString() { 599 if(this.name == null || this.name.isEmpty()) {597 if(this.name == null || this.name.isEmpty()) 600 598 return this.ident; 601 } else {599 else 602 600 return this.name; 603 } 604 } 605 606 } 607 608 class LayerTreeCellRenderer extends DefaultTreeCellRenderer { 601 } 602 603 } 604 605 static class LayerTreeCellRenderer extends DefaultTreeCellRenderer { 609 606 @Override 610 607 public Component getTreeCellRendererComponent(JTree tree, Object value, -
trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java
r4577 r4874 282 282 p.add(pane,GBC.std().fill(GBC.BOTH)); 283 283 } 284 284 285 285 public ImageryProvidersPanel getProvidersPanel() { 286 286 return imageryProviders; … … 391 391 public final ImageryLayerTableModel activeModel; 392 392 public final ImageryDefaultLayerTableModel defaultModel; 393 393 394 394 // Public JToolbars 395 395 public final JToolBar activeToolbar; … … 400 400 private final PreferenceTabbedPane gui; 401 401 private final ImageryLayerInfo layerInfo; 402 403 private class ImageryTableCellRenderer extends DefaultTableCellRenderer { 404 402 403 private static class ImageryTableCellRenderer extends DefaultTableCellRenderer { 404 405 405 private List<ImageryInfo> layers; 406 406 407 407 public ImageryTableCellRenderer(List<ImageryInfo> layers) { 408 408 this.layers = layers; 409 409 } 410 410 411 411 @Override 412 412 public Component getTableCellRendererComponent(JTable table, Object value, boolean 413 isSelected, boolean hasFocus, int row, int column) { 413 isSelected, boolean hasFocus, int row, int column) { 414 414 JLabel label = (JLabel) super.getTableCellRendererComponent( 415 table, value, isSelected, hasFocus, row, column); 415 table, value, isSelected, hasFocus, row, column); 416 416 String t = value.toString(); 417 417 label.setBackground(Main.pref.getUIColor("Table.background")); … … 423 423 if(l.getExtendedUrl().equals(t)) { 424 424 label.setBackground(Main.pref.getColor( 425 marktr("Imagery Background: Default"), 426 new Color(200,255,200))); 425 marktr("Imagery Background: Default"), 426 new Color(200,255,200))); 427 427 break; 428 428 } … … 456 456 457 457 defaultModel.addTableModelListener( 458 new TableModelListener() { 459 @Override 460 public void tableChanged(TableModelEvent e) { 461 activeTable.repaint(); 462 } 463 } 464 ); 458 new TableModelListener() { 459 @Override 460 public void tableChanged(TableModelEvent e) { 461 activeTable.repaint(); 462 } 463 } 464 ); 465 465 466 466 activeModel.addTableModelListener( 467 new TableModelListener() { 468 @Override 469 public void tableChanged(TableModelEvent e) { 470 defaultTable.repaint(); 471 } 472 } 473 ); 467 new TableModelListener() { 468 @Override 469 public void tableChanged(TableModelEvent e) { 470 defaultTable.repaint(); 471 } 472 } 473 ); 474 474 475 475 TableColumnModel mod = defaultTable.getColumnModel(); … … 592 592 mapPolygons.remove(i); 593 593 } 594 // Only display bounds when no polygons (shapes) are defined for this provider 594 // Only display bounds when no polygons (shapes) are defined for this provider 595 595 } else { 596 596 if (defaultTable.getSelectionModel().isSelectedIndex(i)) { … … 643 643 activeModel.addRow(p.getImageryInfo()); 644 644 } catch (IllegalArgumentException ex) { 645 if (ex.getMessage() == null || ex.getMessage().isEmpty()) {645 if (ex.getMessage() == null || ex.getMessage().isEmpty()) 646 646 throw ex; 647 }else {647 else { 648 648 JOptionPane.showMessageDialog(Main.parent, 649 649 ex.getMessage(), tr("Error"), … … 709 709 return; 710 710 } 711 711 712 712 Set<String> acceptedEulas = new HashSet<String>(); 713 713 -
trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java
r4839 r4874 32 32 33 33 public static final boolean registerSourceProvider(SourceProvider provider) { 34 if (provider != null) {34 if (provider != null) 35 35 return styleSourceProviders.add(provider); 36 }37 36 return false; 38 37 } 39 38 40 39 public static class Factory implements PreferenceSettingFactory { 41 40 public PreferenceSetting createPreferenceSetting() { … … 69 68 } 70 69 } 71 ); 72 } 73 74 class MapPaintSourceEditor extends SourceEditor { 70 ); 71 } 72 73 static class MapPaintSourceEditor extends SourceEditor { 75 74 76 75 final private String iconpref = "mappaint.icon.sources"; … … 118 117 public String getStr(I18nString ident) { 119 118 switch (ident) { 120 case AVAILABLE_SOURCES:121 return tr("Available styles:");122 case ACTIVE_SOURCES:123 return tr("Active styles:");124 case NEW_SOURCE_ENTRY_TOOLTIP:125 return tr("Add a new style by entering filename or URL");126 case NEW_SOURCE_ENTRY:127 return tr("New style entry:");128 case REMOVE_SOURCE_TOOLTIP:129 return tr("Remove the selected styles from the list of active styles");130 case EDIT_SOURCE_TOOLTIP:131 return tr("Edit the filename or URL for the selected active style");132 case ACTIVATE_TOOLTIP:133 return tr("Add the selected available styles to the list of active styles");134 case RELOAD_ALL_AVAILABLE:135 return marktr("Reloads the list of available styles from ''{0}''");136 case LOADING_SOURCES_FROM:137 return marktr("Loading style sources from ''{0}''");138 case FAILED_TO_LOAD_SOURCES_FROM:139 return marktr("<html>Failed to load the list of style sources from<br>"140 + "''{0}''.<br>"141 + "<br>"142 + "Details (untranslated):<br>{1}</html>");143 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:144 return "/Preferences/Styles#FailedToLoadStyleSources";145 case ILLEGAL_FORMAT_OF_ENTRY:146 return marktr("Warning: illegal format of entry in style list ''{0}''. Got ''{1}''");147 default: throw new AssertionError();119 case AVAILABLE_SOURCES: 120 return tr("Available styles:"); 121 case ACTIVE_SOURCES: 122 return tr("Active styles:"); 123 case NEW_SOURCE_ENTRY_TOOLTIP: 124 return tr("Add a new style by entering filename or URL"); 125 case NEW_SOURCE_ENTRY: 126 return tr("New style entry:"); 127 case REMOVE_SOURCE_TOOLTIP: 128 return tr("Remove the selected styles from the list of active styles"); 129 case EDIT_SOURCE_TOOLTIP: 130 return tr("Edit the filename or URL for the selected active style"); 131 case ACTIVATE_TOOLTIP: 132 return tr("Add the selected available styles to the list of active styles"); 133 case RELOAD_ALL_AVAILABLE: 134 return marktr("Reloads the list of available styles from ''{0}''"); 135 case LOADING_SOURCES_FROM: 136 return marktr("Loading style sources from ''{0}''"); 137 case FAILED_TO_LOAD_SOURCES_FROM: 138 return marktr("<html>Failed to load the list of style sources from<br>" 139 + "''{0}''.<br>" 140 + "<br>" 141 + "Details (untranslated):<br>{1}</html>"); 142 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC: 143 return "/Preferences/Styles#FailedToLoadStyleSources"; 144 case ILLEGAL_FORMAT_OF_ENTRY: 145 return marktr("Warning: illegal format of entry in style list ''{0}''. Got ''{1}''"); 146 default: throw new AssertionError(); 148 147 } 149 148 } … … 177 176 public MapPaintPrefMigration() { 178 177 super("mappaint.style.sources", 179 "mappaint.style.enable-defaults", 180 "mappaint.style.sources-list"); 178 "mappaint.style.enable-defaults", 179 "mappaint.style.sources-list"); 181 180 } 182 181 … … 215 214 private boolean insertNewDefaults(List<SourceEntry> list) { 216 215 boolean changed = false; 217 216 218 217 Collection<String> knownDefaults = new TreeSet<String>(Main.pref.getCollection("mappaint.style.known-defaults")); 219 218 … … 223 222 int i = Utils.indexOf(list, 224 223 new Predicate<SourceEntry>() { 225 @Override226 public boolean evaluate(SourceEntry se) {227 return Utils.equal(def.url, se.url);228 }229 });224 @Override 225 public boolean evaluate(SourceEntry se) { 226 return Utils.equal(def.url, se.url); 227 } 228 }); 230 229 if (i == -1 && !knownDefaults.contains(def.url)) { 231 230 list.add(insertionIdx, def); … … 268 267 entry.url, 269 268 entry.name == null ? "" : entry.name, 270 entry.title == null ? "" : entry.title, 271 Boolean.toString(entry.active) 269 entry.title == null ? "" : entry.title, 270 Boolean.toString(entry.active) 272 271 }); 273 272 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r4843 r4874 12 12 import java.util.ArrayList; 13 13 import java.util.Collection; 14 import java.util.HashMap;15 14 import java.util.Iterator; 16 15 import java.util.LinkedList; 17 16 import java.util.List; 18 import java.util.Map;19 17 20 18 import javax.swing.BorderFactory; … … 58 56 } 59 57 60 private class TabData { 58 private static class TabData { 61 59 public String icon; 62 60 public JComponent tab; … … 217 215 tr("Warning"), 218 216 JOptionPane.WARNING_MESSAGE 219 ); 217 ); 220 218 } 221 219 Main.parent.repaint(); … … 234 232 } 235 233 } 236 ); 234 ); 237 235 } else { 238 236 // no need for asynchronous activities. Simply run the remaining "save preference" -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r4839 r4874 1146 1146 try { 1147 1147 sources.addAll(getDefault()); 1148 1148 1149 1149 for (SourceProvider provider : sourceProviders) { 1150 1150 for (SourceEntry src : provider.getSources()) { … … 1154 1154 } 1155 1155 } 1156 1156 1157 1157 MirroredInputStream stream = new MirroredInputStream(url); 1158 1158 InputStreamReader r; … … 1233 1233 } 1234 1234 1235 class SourceEntryTableCellRenderer extends DefaultTableCellRenderer { 1235 static class SourceEntryTableCellRenderer extends DefaultTableCellRenderer { 1236 1236 @Override 1237 1237 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { -
trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java
r4839 r4874 50 50 private SourceEditor sources; 51 51 private JCheckBox sortMenu; 52 52 53 53 public static final boolean registerSourceProvider(SourceProvider provider) { 54 if (provider != null) {54 if (provider != null) 55 55 return presetSourceProviders.add(provider); 56 }57 56 return false; 58 57 } … … 166 165 } 167 166 } 168 ); 167 ); 169 168 gui.addValidationListener(validationListener); 170 169 } 171 170 172 class TaggingPresetSourceEditor extends SourceEditor { 171 static class TaggingPresetSourceEditor extends SourceEditor { 173 172 174 173 final private String iconpref = "taggingpreset.icon.sources"; … … 216 215 public String getStr(I18nString ident) { 217 216 switch (ident) { 218 case AVAILABLE_SOURCES:219 return tr("Available presets:");220 case ACTIVE_SOURCES:221 return tr("Active presets:");222 case NEW_SOURCE_ENTRY_TOOLTIP:223 return tr("Add a new preset by entering filename or URL");224 case NEW_SOURCE_ENTRY:225 return tr("New preset entry:");226 case REMOVE_SOURCE_TOOLTIP:227 return tr("Remove the selected presets from the list of active presets");228 case EDIT_SOURCE_TOOLTIP:229 return tr("Edit the filename or URL for the selected active preset");230 case ACTIVATE_TOOLTIP:231 return tr("Add the selected available presets to the list of active presets");232 case RELOAD_ALL_AVAILABLE:233 return marktr("Reloads the list of available presets from ''{0}''");234 case LOADING_SOURCES_FROM:235 return marktr("Loading preset sources from ''{0}''");236 case FAILED_TO_LOAD_SOURCES_FROM:237 return marktr("<html>Failed to load the list of preset sources from<br>"238 + "''{0}''.<br>"239 + "<br>"240 + "Details (untranslated):<br>{1}</html>");241 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:242 return "/Preferences/Presets#FailedToLoadPresetSources";243 case ILLEGAL_FORMAT_OF_ENTRY:244 return marktr("Warning: illegal format of entry in preset list ''{0}''. Got ''{1}''");245 default: throw new AssertionError();217 case AVAILABLE_SOURCES: 218 return tr("Available presets:"); 219 case ACTIVE_SOURCES: 220 return tr("Active presets:"); 221 case NEW_SOURCE_ENTRY_TOOLTIP: 222 return tr("Add a new preset by entering filename or URL"); 223 case NEW_SOURCE_ENTRY: 224 return tr("New preset entry:"); 225 case REMOVE_SOURCE_TOOLTIP: 226 return tr("Remove the selected presets from the list of active presets"); 227 case EDIT_SOURCE_TOOLTIP: 228 return tr("Edit the filename or URL for the selected active preset"); 229 case ACTIVATE_TOOLTIP: 230 return tr("Add the selected available presets to the list of active presets"); 231 case RELOAD_ALL_AVAILABLE: 232 return marktr("Reloads the list of available presets from ''{0}''"); 233 case LOADING_SOURCES_FROM: 234 return marktr("Loading preset sources from ''{0}''"); 235 case FAILED_TO_LOAD_SOURCES_FROM: 236 return marktr("<html>Failed to load the list of preset sources from<br>" 237 + "''{0}''.<br>" 238 + "<br>" 239 + "Details (untranslated):<br>{1}</html>"); 240 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC: 241 return "/Preferences/Presets#FailedToLoadPresetSources"; 242 case ILLEGAL_FORMAT_OF_ENTRY: 243 return marktr("Warning: illegal format of entry in preset list ''{0}''. Got ''{1}''"); 244 default: throw new AssertionError(); 246 245 } 247 246 } … … 304 303 public PresetPrefMigration() { 305 304 super("taggingpreset.sources", 306 "taggingpreset.enable-defaults", 307 "taggingpreset.sources-list"); 305 "taggingpreset.enable-defaults", 306 "taggingpreset.sources-list"); 308 307 } 309 308 -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
r4840 r4874 13 13 import java.awt.event.MouseEvent; 14 14 import java.util.ArrayList; 15 import java.util.Collection; 16 import java.util.Collections; 15 17 import java.util.List; 16 18 import java.util.Map; 17 19 import java.util.Map.Entry; 18 import java.util.Collection;19 import java.util.Collections;20 20 21 21 import javax.swing.Box; 22 22 import javax.swing.ButtonGroup; 23 import javax.swing.DefaultCellEditor; 23 24 import javax.swing.JButton; 24 25 import javax.swing.JLabel; … … 33 34 import javax.swing.table.DefaultTableCellRenderer; 34 35 import javax.swing.table.DefaultTableModel; 35 import javax.swing.DefaultCellEditor;36 36 37 37 import org.openstreetmap.josm.Main; 38 import org.openstreetmap.josm.gui.ExtendedDialog;39 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;40 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;41 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;42 38 import org.openstreetmap.josm.data.Preferences; 43 39 import org.openstreetmap.josm.data.Preferences.ListListSetting; … … 46 42 import org.openstreetmap.josm.data.Preferences.Setting; 47 43 import org.openstreetmap.josm.data.Preferences.StringSetting; 44 import org.openstreetmap.josm.gui.ExtendedDialog; 45 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 46 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 47 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 48 48 import org.openstreetmap.josm.tools.CheckParameterUtil; 49 49 import org.openstreetmap.josm.tools.GBC; … … 244 244 } 245 245 246 private class SettingCellRenderer extends DefaultTableCellRenderer { 246 private static class SettingCellRenderer extends DefaultTableCellRenderer { 247 247 @Override 248 248 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { … … 264 264 } 265 265 266 private class SettingCellEditor extends DefaultCellEditor { 266 private static class SettingCellEditor extends DefaultCellEditor { 267 267 public SettingCellEditor() { 268 268 super(new JTextField()); 269 269 } 270 270 271 @Override 271 272 public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 272 273 PrefEntry pe = (PrefEntry) value; … … 322 323 tr("Warning"), 323 324 JOptionPane.WARNING_MESSAGE 324 ); 325 ); 325 326 return; 326 327 } … … 430 431 tr("Warning"), 431 432 JOptionPane.WARNING_MESSAGE 432 ); 433 ); 433 434 return; 434 435 } -
trunk/src/org/openstreetmap/josm/io/GpxImporter.java
r4759 r4874 6 6 import java.io.File; 7 7 import java.io.FileInputStream; 8 import java.io.FileNotFoundException;9 8 import java.io.IOException; 10 9 import java.io.InputStream; … … 12 11 13 12 import javax.swing.JOptionPane; 14 import javax.swing.SwingUtilities;15 13 16 14 import org.openstreetmap.josm.Main; … … 24 22 public class GpxImporter extends FileImporter { 25 23 26 protected class GpxImporterData { 24 protected static class GpxImporterData { 27 25 public GpxLayer gpxLayer; 28 26 public MarkerLayer markerLayer; … … 59 57 60 58 public GpxImporterData loadLayers(InputStream is, final File associatedFile, 61 final String gpxLayerName, String markerLayerName, ProgressMonitor progressMonitor) throws IOException {59 final String gpxLayerName, String markerLayerName, ProgressMonitor progressMonitor) throws IOException { 62 60 final GpxImporterData data = new GpxImporterData(); 63 61 try { -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r4713 r4874 30 30 private String source; 31 31 32 private enum State { 32 private enum State { 33 33 INIT, // initial state, should always be at the bottom of the stack 34 34 IMAGERY, // inside the imagery element … … 63 63 } 64 64 65 private class Parser extends DefaultHandler { 65 private static class Parser extends DefaultHandler { 66 66 private StringBuffer accumulator = new StringBuffer(); 67 67 … … 97 97 State newState = null; 98 98 switch (states.peek()) { 99 case INIT:100 if (qName.equals("imagery")) {101 newState = State.IMAGERY;102 }103 break;104 case IMAGERY:105 if (qName.equals("entry")) {106 entry = new ImageryInfo();107 skipEntry = false;108 newState = State.ENTRY;109 }110 break;111 case ENTRY:112 if (Arrays.asList(new String[] {99 case INIT: 100 if (qName.equals("imagery")) { 101 newState = State.IMAGERY; 102 } 103 break; 104 case IMAGERY: 105 if (qName.equals("entry")) { 106 entry = new ImageryInfo(); 107 skipEntry = false; 108 newState = State.ENTRY; 109 } 110 break; 111 case ENTRY: 112 if (Arrays.asList(new String[] { 113 113 "name", 114 114 "type", … … 126 126 "country-code", 127 127 "icon", 128 }).contains(qName)) {129 newState = State.ENTRY_ATTRIBUTE;130 } else if (qName.equals("bounds")) {131 try {132 bounds = new ImageryBounds(133 atts.getValue("min-lat") + "," +134 atts.getValue("min-lon") + "," + 135 atts.getValue("max-lat") + "," + 136 atts.getValue("max-lon"), ","); 137 } catch (IllegalArgumentException e) {138 break;139 }140 newState = State.BOUNDS;141 } else if (qName.equals("projections")) {142 projections = new ArrayList<String>();143 newState = State.PROJECTIONS;144 }145 break;146 case BOUNDS:147 if (qName.equals("shape")) {148 shape = new Shape();149 newState = State.SHAPE;150 }151 break;152 case SHAPE:153 if (qName.equals("point")) {154 try {155 shape.addPoint(atts.getValue("lat"), atts.getValue("lon"));156 } catch (IllegalArgumentException e) {157 break;158 }159 }160 break;161 case PROJECTIONS:162 if (qName.equals("code")) {163 newState = State.CODE;164 }165 break;128 }).contains(qName)) { 129 newState = State.ENTRY_ATTRIBUTE; 130 } else if (qName.equals("bounds")) { 131 try { 132 bounds = new ImageryBounds( 133 atts.getValue("min-lat") + "," + 134 atts.getValue("min-lon") + "," + 135 atts.getValue("max-lat") + "," + 136 atts.getValue("max-lon"), ","); 137 } catch (IllegalArgumentException e) { 138 break; 139 } 140 newState = State.BOUNDS; 141 } else if (qName.equals("projections")) { 142 projections = new ArrayList<String>(); 143 newState = State.PROJECTIONS; 144 } 145 break; 146 case BOUNDS: 147 if (qName.equals("shape")) { 148 shape = new Shape(); 149 newState = State.SHAPE; 150 } 151 break; 152 case SHAPE: 153 if (qName.equals("point")) { 154 try { 155 shape.addPoint(atts.getValue("lat"), atts.getValue("lon")); 156 } catch (IllegalArgumentException e) { 157 break; 158 } 159 } 160 break; 161 case PROJECTIONS: 162 if (qName.equals("code")) { 163 newState = State.CODE; 164 } 165 break; 166 166 } 167 167 /** … … 189 189 public void endElement(String namespaceURI, String qName, String rqName) { 190 190 switch (states.pop()) { 191 case INIT: 192 throw new RuntimeException("parsing error: more closing than opening elements"); 193 case ENTRY: 194 if (qName.equals("entry")) { 195 if (!skipEntry) { 196 entries.add(entry); 191 case INIT: 192 throw new RuntimeException("parsing error: more closing than opening elements"); 193 case ENTRY: 194 if (qName.equals("entry")) { 195 if (!skipEntry) { 196 entries.add(entry); 197 } 198 entry = null; 199 } 200 break; 201 case ENTRY_ATTRIBUTE: 202 if (qName.equals("name")) { 203 entry.setName(tr(accumulator.toString())); 204 } else if (qName.equals("type")) { 205 boolean found = false; 206 for (ImageryType type : ImageryType.values()) { 207 if (equal(accumulator.toString(), type.getUrlString())) { 208 entry.setImageryType(type); 209 found = true; 210 break; 197 211 } 198 entry = null; 199 } 200 break; 201 case ENTRY_ATTRIBUTE: 202 if (qName.equals("name")) { 203 entry.setName(tr(accumulator.toString())); 204 } else if (qName.equals("type")) { 205 boolean found = false; 206 for (ImageryType type : ImageryType.values()) { 207 if (equal(accumulator.toString(), type.getUrlString())) { 208 entry.setImageryType(type); 209 found = true; 210 break; 211 } 212 } 213 if (!found) { 214 skipEntry = true; 215 } 216 } else if (qName.equals("default")) { 217 if (accumulator.toString().equals("true")) { 218 entry.setDefaultEntry(true); 219 } else if (accumulator.toString().equals("false")) { 220 entry.setDefaultEntry(false); 221 } else { 222 skipEntry = true; 223 } 224 } else if (qName.equals("url")) { 225 entry.setUrl(accumulator.toString()); 226 } else if (qName.equals("eula")) { 227 entry.setEulaAcceptanceRequired(accumulator.toString()); 228 } else if (qName.equals("min-zoom") || qName.equals("max-zoom")) { 229 Integer val = null; 230 try { 231 val = Integer.parseInt(accumulator.toString()); 232 } catch(NumberFormatException e) { 233 val = null; 234 } 235 if (val == null) { 236 skipEntry = true; 237 } else { 238 if (qName.equals("min-zoom")) { 239 entry.setDefaultMinZoom(val); 240 } else { 241 entry.setDefaultMaxZoom(val); 212 242 } 213 if (!found) { 214 skipEntry = true; 215 } 216 } else if (qName.equals("default")) { 217 if (accumulator.toString().equals("true")) { 218 entry.setDefaultEntry(true); 219 } else if (accumulator.toString().equals("false")) { 220 entry.setDefaultEntry(false); 221 } else { 222 skipEntry = true; 223 } 224 } else if (qName.equals("url")) { 225 entry.setUrl(accumulator.toString()); 226 } else if (qName.equals("eula")) { 227 entry.setEulaAcceptanceRequired(accumulator.toString()); 228 } else if (qName.equals("min-zoom") || qName.equals("max-zoom")) { 229 Integer val = null; 230 try { 231 val = Integer.parseInt(accumulator.toString()); 232 } catch(NumberFormatException e) { 233 val = null; 234 } 235 if (val == null) { 236 skipEntry = true; 237 } else { 238 if (qName.equals("min-zoom")) { 239 entry.setDefaultMinZoom(val); 240 } else { 241 entry.setDefaultMaxZoom(val); 242 } 243 } 244 } else if (qName.equals("attribution-text")) { 245 entry.setAttributionText(accumulator.toString()); 246 } else if (qName.equals("attribution-url")) { 247 entry.setAttributionLinkURL(accumulator.toString()); 248 } else if (qName.equals("logo-image")) { 249 entry.setAttributionImage(accumulator.toString()); 250 } else if (qName.equals("logo-url")) { 251 entry.setAttributionImageURL(accumulator.toString()); 252 } else if (qName.equals("terms-of-use-text")) { 253 entry.setTermsOfUseText(accumulator.toString()); 254 } else if (qName.equals("terms-of-use-url")) { 255 entry.setTermsOfUseURL(accumulator.toString()); 256 } else if (qName.equals("country-code")) { 257 entry.setCountryCode(accumulator.toString()); 258 } else if (qName.equals("icon")) { 259 entry.setIcon(accumulator.toString()); 260 } else { 261 } 262 break; 263 case BOUNDS: 264 entry.setBounds(bounds); 265 bounds = null; 266 break; 267 case SHAPE: 268 bounds.addShape(shape); 269 shape = null; 270 break; 271 case CODE: 272 projections.add(accumulator.toString()); 273 break; 274 case PROJECTIONS: 275 entry.setServerProjections(projections); 276 projections = null; 277 break; 243 } 244 } else if (qName.equals("attribution-text")) { 245 entry.setAttributionText(accumulator.toString()); 246 } else if (qName.equals("attribution-url")) { 247 entry.setAttributionLinkURL(accumulator.toString()); 248 } else if (qName.equals("logo-image")) { 249 entry.setAttributionImage(accumulator.toString()); 250 } else if (qName.equals("logo-url")) { 251 entry.setAttributionImageURL(accumulator.toString()); 252 } else if (qName.equals("terms-of-use-text")) { 253 entry.setTermsOfUseText(accumulator.toString()); 254 } else if (qName.equals("terms-of-use-url")) { 255 entry.setTermsOfUseURL(accumulator.toString()); 256 } else if (qName.equals("country-code")) { 257 entry.setCountryCode(accumulator.toString()); 258 } else if (qName.equals("icon")) { 259 entry.setIcon(accumulator.toString()); 260 } else { 261 } 262 break; 263 case BOUNDS: 264 entry.setBounds(bounds); 265 bounds = null; 266 break; 267 case SHAPE: 268 bounds.addShape(shape); 269 shape = null; 270 break; 271 case CODE: 272 projections.add(accumulator.toString()); 273 break; 274 case PROJECTIONS: 275 entry.setServerProjections(projections); 276 projections = null; 277 break; 278 278 } 279 279 } -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r4868 r4874 407 407 * needed to block the current thread and wait for the result of the modal dialog from EDT. 408 408 */ 409 private class CancelOrContinueDialog { 409 private static class CancelOrContinueDialog { 410 410 411 411 private boolean cancel;
Note:
See TracChangeset
for help on using the changeset viewer.
