- Timestamp:
- 2021-03-23T23:31:56+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r17648 r17651 170 170 @Override 171 171 public void addGui(PreferenceTabbedPane gui) { 172 sortMenu = new JCheckBox(tr("Sort presets menu alphabetically"), 173 Config.getPref().getBoolean("taggingpreset.sortmenu", false)); 172 sortMenu = new JCheckBox(tr("Sort presets menu alphabetically"), TaggingPresets.SORT_MENU.get()); 174 173 175 174 final JPanel panel = new JPanel(new GridBagLayout()); … … 186 185 public static class TaggingPresetSourceEditor extends SourceEditor { 187 186 188 private static final String ICONPREF = "taggingpreset.icon.sources";189 190 187 public TaggingPresetSourceEditor() { 191 188 super(SourceType.TAGGING_PRESET, Config.getUrls().getJOSMWebsite()+"/presets", presetSourceProviders, true); … … 199 196 @Override 200 197 public boolean finish() { 201 return doFinish(PresetPrefHelper.INSTANCE, ICONPREF);198 return doFinish(PresetPrefHelper.INSTANCE, TaggingPresets.ICON_SOURCES.getKey()); 202 199 } 203 200 … … 209 206 @Override 210 207 public Collection<String> getInitialIconPathsList() { 211 return Config.getPref().getList(ICONPREF, null);208 return TaggingPresets.ICON_SOURCES.get(); 212 209 } 213 210 … … 249 246 @Override 250 247 public boolean ok() { 251 if (sources.finish() 252 || Config.getPref().putBoolean("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null)) { 248 if (sources.finish() || TaggingPresets.SORT_MENU.put(sortMenu.getSelectedObjects() != null)) { 253 249 TaggingPresets.destroy(); 254 250 TaggingPresets.initialize(); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r17643 r17651 52 52 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match; 53 53 import org.openstreetmap.josm.data.osm.search.SearchParseError; 54 import org.openstreetmap.josm.data.preferences.BooleanProperty; 54 55 import org.openstreetmap.josm.gui.ExtendedDialog; 55 56 import org.openstreetmap.josm.gui.MainApplication; … … 67 68 import org.openstreetmap.josm.gui.tagging.presets.items.Space; 68 69 import org.openstreetmap.josm.gui.util.GuiHelper; 69 import org.openstreetmap.josm.spi.preferences.Config;70 70 import org.openstreetmap.josm.tools.GBC; 71 71 import org.openstreetmap.josm.tools.ImageProvider; … … 100 100 101 101 /** 102 * Defines whether the validator should be active in the preset dialog 103 * @see TaggingPresetValidation 104 */ 105 public static final BooleanProperty USE_VALIDATOR = new BooleanProperty("taggingpreset.validator", false); 106 107 /** 102 108 * The preset group this preset belongs to. 103 109 */ … … 228 234 } 229 235 File arch = TaggingPresetReader.getZipIcons(); 230 final Collection<String> s = Config.getPref().getList("taggingpreset.icon.sources", null);236 final Collection<String> s = TaggingPresets.ICON_SOURCES.get(); 231 237 this.iconFuture = new CompletableFuture<>(); 232 238 new ImageProvider(iconName) … … 359 365 } 360 366 361 if (selected.size() == 1 && Config.getPref().getBoolean("taggingpreset.validator", false)) {367 if (selected.size() == 1 && USE_VALIDATOR.get()) { 362 368 itemGuiSupport.addListener((source, key, newValue) -> 363 369 TaggingPresetValidation.validateAsync(selected.iterator().next(), validationLabel, getChangedTags())); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r17609 r17651 20 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 21 import org.openstreetmap.josm.data.osm.Tag; 22 import org.openstreetmap.josm.data.preferences.BooleanProperty; 22 23 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 23 24 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 24 25 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 25 26 import org.openstreetmap.josm.gui.util.LruCache; 26 import org.openstreetmap.josm.spi.preferences.Config;27 27 import org.openstreetmap.josm.tools.ImageProvider; 28 28 import org.openstreetmap.josm.tools.Logging; … … 37 37 // cache the parsing of types using a LRU cache 38 38 private static final Map<String, Set<TaggingPresetType>> TYPE_CACHE = new LruCache<>(16); 39 /** 40 * Display OSM keys as {@linkplain org.openstreetmap.josm.gui.widgets.OsmIdTextField#setHint hint} 41 */ 42 protected static BooleanProperty DISPLAY_KEYS_AS_HINT = new BooleanProperty("taggingpreset.display-keys-as-hint", true); 39 43 40 44 protected void initAutoCompletionField(AutoCompletingTextField field, String... key) { … … 132 136 */ 133 137 public static ImageIcon loadImageIcon(String iconName, File zipIcons, Integer maxSize) { 134 final Collection<String> s = Config.getPref().getList("taggingpreset.icon.sources", null);138 final Collection<String> s = TaggingPresets.ICON_SOURCES.get(); 135 139 ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true); 136 140 if (maxSize != null && maxSize > 0) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r17161 r17651 18 18 import org.openstreetmap.josm.actions.PreferencesAction; 19 19 import org.openstreetmap.josm.data.osm.IPrimitive; 20 import org.openstreetmap.josm.data.preferences.BooleanProperty; 21 import org.openstreetmap.josm.data.preferences.IntegerProperty; 22 import org.openstreetmap.josm.data.preferences.ListProperty; 20 23 import org.openstreetmap.josm.gui.MainApplication; 21 24 import org.openstreetmap.josm.gui.MainMenu; … … 27 30 import org.openstreetmap.josm.gui.tagging.presets.items.Roles; 28 31 import org.openstreetmap.josm.gui.tagging.presets.items.Roles.Role; 29 import org.openstreetmap.josm.spi.preferences.Config;30 32 import org.openstreetmap.josm.tools.Logging; 31 33 import org.openstreetmap.josm.tools.MultiMap; … … 48 50 /** The collection of listeners */ 49 51 private static final Collection<TaggingPresetListener> listeners = new ArrayList<>(); 52 /** 53 * Sort presets menu alphabetically 54 */ 55 public static BooleanProperty SORT_MENU = new BooleanProperty("taggingpreset.sortvalues", true); 56 /** 57 * Custom icon sources 58 */ 59 public static final ListProperty ICON_SOURCES = new ListProperty("taggingpreset.icon.sources", null); 60 private static final IntegerProperty MIN_ELEMENTS_FOR_SCROLLER = new IntegerProperty("taggingpreset.min-elements-for-scroller", 15); 50 61 51 62 private TaggingPresets() { … … 107 118 } 108 119 for (JMenu submenu : submenus.values()) { 109 if (submenu.getItemCount() >= Config.getPref().getInt("taggingpreset.min-elements-for-scroller", 15)) {120 if (submenu.getItemCount() >= MIN_ELEMENTS_FOR_SCROLLER.get()) { 110 121 MenuScroller.setScrollerFor(submenu); 111 122 } 112 123 } 113 124 } 114 if ( Config.getPref().getBoolean("taggingpreset.sortmenu")) {125 if (SORT_MENU.get()) { 115 126 TaggingPresetMenu.sortMenu(presetsMenu); 116 127 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java
r17639 r17651 19 19 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 20 20 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 21 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 21 22 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 22 23 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 23 import org.openstreetmap.josm.spi.preferences.Config;24 24 import org.openstreetmap.josm.tools.ColorHelper; 25 25 import org.openstreetmap.josm.tools.GBC; … … 67 67 AutoCompletingTextField tf = new AutoCompletingTextField(); 68 68 initAutoCompletionField(tf, key); 69 if ( Config.getPref().getBoolean("taggingpreset.display-keys-as-hint", true)) {69 if (TaggingPresetItem.DISPLAY_KEYS_AS_HINT.get()) { 70 70 tf.setHint(key); 71 71 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r17639 r17651 31 31 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 32 32 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector; 33 import org.openstreetmap.josm. spi.preferences.Config;33 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 34 34 import org.openstreetmap.josm.tools.GBC; 35 35 import org.openstreetmap.josm.tools.Logging; … … 332 332 } 333 333 334 if (values_sort && Config.getPref().getBoolean("taggingpreset.sortvalues", true)) {334 if (values_sort && TaggingPresets.SORT_MENU.get()) { 335 335 Collections.sort(entries); 336 336 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r17610 r17651 28 28 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 29 29 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 30 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 30 31 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; 31 32 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 32 33 import org.openstreetmap.josm.gui.widgets.JosmTextField; 33 import org.openstreetmap.josm.spi.preferences.Config;34 34 import org.openstreetmap.josm.tools.GBC; 35 35 import org.openstreetmap.josm.tools.Logging; … … 79 79 initAutoCompletionField(textField, key); 80 80 } 81 if ( Config.getPref().getBoolean("taggingpreset.display-keys-as-hint", true)) {81 if (TaggingPresetItem.DISPLAY_KEYS_AS_HINT.get()) { 82 82 textField.setHint(key); 83 83 }
Note:
See TracChangeset
for help on using the changeset viewer.