Changeset 12825 in josm for trunk/src/org/openstreetmap/josm/data/preferences
- Timestamp:
- 2017-09-11T20:43:41+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/preferences/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/sources/ExtendedSourceEntry.java
r12649 r12825 28 28 /** 29 29 * Constructs a new {@code ExtendedSourceEntry}. 30 * @param type type of source entry 30 31 * @param simpleFileName file name used for display 31 32 * @param url URL that {@link org.openstreetmap.josm.io.CachedFile} understands 33 * @since 12825 32 34 */ 33 public ExtendedSourceEntry(String simpleFileName, String url) { 34 super(url, null, null, true); 35 public ExtendedSourceEntry(SourceType type, String simpleFileName, String url) { 36 super(type, url, null, null, true); 35 37 this.simpleFileName = simpleFileName; 36 38 } -
trunk/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
r12649 r12825 30 30 */ 31 31 public MapPaintPrefHelper() { 32 super("mappaint.style.entries"); 32 super("mappaint.style.entries", SourceType.MAP_PAINT_STYLE); 33 33 } 34 34 … … 80 80 @Override 81 81 public Collection<ExtendedSourceEntry> getDefault() { 82 ExtendedSourceEntry defJosmMapcss = new ExtendedSourceEntry("elemstyles.mapcss", "resource://styles/standard/elemstyles.mapcss"); 82 ExtendedSourceEntry defJosmMapcss = new ExtendedSourceEntry(type, "elemstyles.mapcss", "resource://styles/standard/elemstyles.mapcss"); 83 83 defJosmMapcss.active = true; 84 84 defJosmMapcss.name = "standard"; 85 85 defJosmMapcss.title = tr("JOSM default (MapCSS)"); 86 86 defJosmMapcss.description = tr("Internal style to be used as base for runtime switchable overlay styles"); 87 ExtendedSourceEntry defPL2 = new ExtendedSourceEntry("potlatch2.mapcss", "resource://styles/standard/potlatch2.mapcss"); 87 ExtendedSourceEntry defPL2 = new ExtendedSourceEntry(type, "potlatch2.mapcss", "resource://styles/standard/potlatch2.mapcss"); 88 88 defPL2.active = false; 89 89 defPL2.name = "standard"; … … 108 108 @Override 109 109 public SourceEntry deserialize(Map<String, String> s) { 110 return new SourceEntry(s.get("url"), s.get("ptoken"), s.get("title"), Boolean.parseBoolean(s.get("active"))); 110 return new SourceEntry(type, s.get("url"), s.get("ptoken"), s.get("title"), Boolean.parseBoolean(s.get("active"))); 111 111 } 112 112 } -
trunk/src/org/openstreetmap/josm/data/preferences/sources/PresetPrefHelper.java
r12649 r12825 24 24 */ 25 25 public PresetPrefHelper() { 26 super("taggingpreset.entries"); 26 super("taggingpreset.entries", SourceType.TAGGING_PRESET); 27 27 } 28 28 29 29 @Override 30 30 public Collection<ExtendedSourceEntry> getDefault() { 31 ExtendedSourceEntry i = new ExtendedSourceEntry("defaultpresets.xml", "resource://data/defaultpresets.xml"); 31 ExtendedSourceEntry i = new ExtendedSourceEntry(type, "defaultpresets.xml", "resource://data/defaultpresets.xml"); 32 32 i.title = tr("Internal Preset"); 33 33 i.description = tr("The default preset for JOSM"); … … 45 45 @Override 46 46 public SourceEntry deserialize(Map<String, String> s) { 47 return new SourceEntry(s.get("url"), null, s.get("title"), true); 47 return new SourceEntry(type, s.get("url"), null, s.get("title"), true); 48 48 } 49 49 } -
trunk/src/org/openstreetmap/josm/data/preferences/sources/SourceEntry.java
r12649 r12825 19 19 20 20 /** 21 * The type of source entry. 22 * @since 12825 23 **/ 24 public final SourceType type; 25 26 /** 21 27 * A URL can be anything that CachedFile understands, i.e. 22 28 * a local file, http://, or a file from the current jar … … 58 64 /** 59 65 * Constructs a new {@code SourceEntry}. 66 * @param type type of source entry 60 67 * @param url URL that {@link org.openstreetmap.josm.io.CachedFile} understands 61 68 * @param isZip if url is a zip file and the resource is inside the zip file … … 70 77 * @see #title 71 78 * @see #active 72 */ 73 public SourceEntry(String url, boolean isZip, String zipEntryPath, String name, String title, boolean active) { 79 * @since 12825 80 */ 81 public SourceEntry(SourceType type, String url, boolean isZip, String zipEntryPath, String name, String title, boolean active) { 82 this.type = type; 74 83 this.url = url; 75 84 this.isZip = isZip; … … 82 91 /** 83 92 * Constructs a new {@code SourceEntry}. 93 * @param type type of source entry 84 94 * @param url URL that {@link org.openstreetmap.josm.io.CachedFile} understands 85 95 * @param name Source name … … 90 100 * @see #title 91 101 * @see #active 92 */ 93 public SourceEntry(String url, String name, String title, boolean active) { 94 this(url, false, null, name, title, active); 102 * @since 12825 103 */ 104 public SourceEntry(SourceType type, String url, String name, String title, boolean active) { 105 this(type, url, false, null, name, title, active); 95 106 } 96 107 … … 100 111 */ 101 112 public SourceEntry(SourceEntry e) { 113 this.type = e.type; 102 114 this.url = e.url; 103 115 this.isZip = e.isZip; -
trunk/src/org/openstreetmap/josm/data/preferences/sources/SourcePrefHelper.java
r12649 r12825 19 19 20 20 private final String pref; 21 protected final SourceType type; 21 22 22 23 /** 23 24 * Constructs a new {@code SourcePrefHelper} for the given preference key. 24 25 * @param pref The preference key 26 * @param type The source type 27 * @since 12825 25 28 */ 26 public SourcePrefHelper(String pref) { 29 public SourcePrefHelper(String pref, SourceType type) { 27 30 this.pref = pref; 31 this.type = type; 28 32 } 29 33 -
trunk/src/org/openstreetmap/josm/data/preferences/sources/ValidatorPrefHelper.java
r12649 r12825 55 55 */ 56 56 public ValidatorPrefHelper() { 57 super(MapCSSTagChecker.ENTRIES_PREF_KEY); 57 super(MapCSSTagChecker.ENTRIES_PREF_KEY, SourceType.TAGCHECKER_RULE); 58 58 } 59 59 … … 80 80 } 81 81 82 private staticvoid addDefault(List<ExtendedSourceEntry> defaults, String filename, String title, String description) {83 ExtendedSourceEntry i = new ExtendedSourceEntry(filename+".mapcss", "resource://data/validator/"+filename+".mapcss"); 82 private void addDefault(List<ExtendedSourceEntry> defaults, String filename, String title, String description) { 83 ExtendedSourceEntry i = new ExtendedSourceEntry(type, filename+".mapcss", "resource://data/validator/"+filename+".mapcss"); 84 84 i.title = title; 85 85 i.description = description; … … 98 98 @Override 99 99 public SourceEntry deserialize(Map<String, String> s) { 100 return new SourceEntry(s.get("url"), null, s.get("title"), Boolean.parseBoolean(s.get("active"))); 100 return new SourceEntry(type, s.get("url"), null, s.get("title"), Boolean.parseBoolean(s.get("active"))); 101 101 } 102 102 }
Note:
See TracChangeset
for help on using the changeset viewer.