Changeset 3825 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/xml
- Timestamp:
- 2011-01-27T21:36:30+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint/xml
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r3824 r3825 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.mappaint ;2 package org.openstreetmap.josm.gui.mappaint.xml; 3 3 4 4 import java.util.Collection; … … 8 8 import java.util.LinkedList; 9 9 import java.util.List; 10 import java.util.regex.Matcher;11 import java.util.regex.Pattern;12 10 13 11 import org.openstreetmap.josm.data.osm.Node; … … 16 14 import org.openstreetmap.josm.data.osm.Way; 17 15 import org.openstreetmap.josm.gui.mappaint.ElemStyles.WayPrototypesRecord; 18 import org.openstreetmap.josm.gui.mappaint.xml.AreaPrototype;19 import org.openstreetmap.josm.gui.mappaint.xml.IconPrototype;20 import org.openstreetmap.josm.gui.mappaint.xml.LinePrototype;21 import org.openstreetmap.josm.gui.mappaint.xml.LinemodPrototype;22 import org.openstreetmap.josm.gui.mappaint.xml.Prototype;23 import org.openstreetmap.josm.gui.mappaint.xml.XmlCondition;24 16 import org.openstreetmap.josm.gui.preferences.SourceEntry; 25 17 26 public class StyleSource extends SourceEntry {18 public class XmlStyleSource extends SourceEntry { 27 19 28 20 public final HashMap<String, IconPrototype> icons = new HashMap<String, IconPrototype>(); … … 37 29 public boolean hasError = false; 38 30 39 public StyleSource(String url, String name, String shortdescription) {31 public XmlStyleSource(String url, String name, String shortdescription) { 40 32 super(url, name, shortdescription, true); 41 33 } 42 34 43 public StyleSource(SourceEntry entry) {35 public XmlStyleSource(SourceEntry entry) { 44 36 super(entry.url, entry.name, entry.shortdescription, entry.active); 45 37 } … … 217 209 return name == null ? "standard" : name; 218 210 } 219 220 /**221 * String to show in menus and error messages.222 * @return Usually the shortdescription, but can be the file name223 * if no shortdescription is available.224 */225 public String getDisplayString() {226 if (shortdescription != null)227 return shortdescription;228 /**229 * extract file part from url, e.g.:230 * http://www.test.com/file.xml?format=text --> file.xml231 */232 Pattern p = Pattern.compile("([^/\\\\]*?)([?].*)?$");233 Matcher m = p.matcher(url);234 if (m.find()) {235 return m.group(1);236 } else {237 System.err.println("Warning: Unexpected URL format: "+url);238 return url;239 }240 }241 211 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java
r3824 r3825 10 10 import org.openstreetmap.josm.Main; 11 11 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 12 import org.openstreetmap.josm.gui.mappaint.StyleSource;13 12 import org.openstreetmap.josm.tools.ColorHelper; 14 13 import org.xml.sax.Attributes; … … 21 20 private RuleElem rule = new RuleElem(); 22 21 23 StyleSource style;22 XmlStyleSource style; 24 23 25 24 static class RuleElem { … … 45 44 } 46 45 47 public XmlStyleSourceHandler( StyleSource style) {46 public XmlStyleSourceHandler(XmlStyleSource style) { 48 47 this.style = style; 49 48 inDoc=inRule=inCondition=inLine=inIcon=inArea=false;
Note:
See TracChangeset
for help on using the changeset viewer.