Changeset 14449 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2018-11-25T15:00:02+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
-
gui/tagging/presets/TaggingPreset.java (modified) (4 diffs)
-
tools/XmlObjectParser.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r14319 r14449 21 21 import java.util.Map; 22 22 import java.util.Set; 23 import java.util.concurrent.CompletableFuture; 23 24 import java.util.function.Predicate; 24 25 … … 128 129 private boolean originalSelectionEmpty; 129 130 131 /** The completable future task of asynchronous icon loading */ 132 private CompletableFuture<Void> iconFuture; 133 130 134 /** 131 135 * Create an empty tagging preset. This will not have any items and … … 215 219 File arch = TaggingPresetReader.getZipIcons(); 216 220 final Collection<String> s = Config.getPref().getList("taggingpreset.icon.sources", null); 217 ImageProvider imgProv= new ImageProvider(iconName);218 imgProv.setDirs(s);219 imgProv.setId("presets");220 imgProv.setArchive(arch);221 imgProv.setOptional(true);222 imgProv.getResourceAsync(result -> {223 if (result != null) { 224 GuiHelper.runInEDT(() -> result.attachImageIcon(this)); 225 } else { 226 Logging.warn(toString() + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName); 227 } 228 }); 221 this.iconFuture = new ImageProvider(iconName) 222 .setDirs(s) 223 .setId("presets") 224 .setArchive(arch) 225 .setOptional(true) 226 .getResourceAsync(result -> { 227 if (result != null) { 228 GuiHelper.runInEDT(() -> result.attachImageIcon(this)); 229 } else { 230 Logging.warn(toString() + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName); 231 } 232 }); 229 233 } 230 234 … … 648 652 return actionParser.saveAction(new ToolbarPreferences.ActionDefinition(this)); 649 653 } 654 655 /** 656 * Returns the completable future task that performs icon loading, if any. 657 * @return the completable future task that performs icon loading, or null 658 * @since 14449 659 */ 660 public CompletableFuture<Void> getIconLoadingTask() { 661 return iconFuture; 662 } 650 663 } -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r13901 r14449 146 146 f.set(c, getValueForClass(f.getType(), value)); 147 147 } else { 148 String setter; 148 149 if (fieldName.startsWith(lang)) { 149 150 int l = lang.length(); 150 fieldName= "set" + fieldName.substring(l, l + 1).toUpperCase(Locale.ENGLISH) + fieldName.substring(l + 1);151 setter = "set" + fieldName.substring(l, l + 1).toUpperCase(Locale.ENGLISH) + fieldName.substring(l + 1); 151 152 } else { 152 fieldName= "set" + fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH) + fieldName.substring(1);153 setter = "set" + fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH) + fieldName.substring(1); 153 154 } 154 Method m = entry.getMethod( fieldName);155 Method m = entry.getMethod(setter); 155 156 if (m != null) { 156 157 m.invoke(c, getValueForClass(m.getParameterTypes()[0], value));
Note:
See TracChangeset
for help on using the changeset viewer.
