- Timestamp:
- 2011-08-08T00:26:59+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r4172 r4300 23 23 import java.net.URLEncoder; 24 24 import java.util.ArrayList; 25 import java.util.Arrays; 25 26 import java.util.Collection; 26 27 import java.util.Collections; … … 249 250 values.setEditable(true); 250 251 251 List<AutoCompletionListItem> valueList = autocomplete.getValues( key);252 List<AutoCompletionListItem> valueList = autocomplete.getValues(getAutocompletionKeys(key)); 252 253 Collections.sort(valueList, defaultACItemComparator); 253 254 … … 369 370 370 371 /** 372 * For a given key k, return a list of keys which are used as keys for 373 * auto-completing values to increase the search space. 374 * @param key the key k 375 * @return a list of keys 376 */ 377 static List<String> getAutocompletionKeys(String key) { 378 if ("name".equals(key) || "addr:street".equals(key)) { 379 return Arrays.asList("addr:street", "name"); 380 } else { 381 return Arrays.asList(key); 382 } 383 } 384 385 /** 371 386 * This simply fires up an relation editor for the relation shown; everything else 372 387 * is the editor's business. … … 478 493 String key = keys.getEditor().getItem().toString(); 479 494 480 List<AutoCompletionListItem> valueList = autocomplete.getValues( key);495 List<AutoCompletionListItem> valueList = autocomplete.getValues(getAutocompletionKeys(key)); 481 496 Collections.sort(valueList, defaultACItemComparator); 482 497 -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java
r3214 r4300 258 258 } 259 259 260 List<AutoCompletionListItem> getList() { 260 ArrayList<AutoCompletionListItem> getList() { 261 return list; 262 } 263 264 List<AutoCompletionListItem> getUnmodifiableList() { 261 265 return Collections.unmodifiableList(list); 262 266 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r4223 r4300 3 3 4 4 import java.util.ArrayList; 5 import java.util.Arrays; 5 6 import java.util.Collection; 6 7 import java.util.Collections; … … 243 244 * 244 245 * @param list the list to populate 245 * @param append true to add the keys to the list; false, to replace the keys246 * in the list by the keys in the cache247 246 */ 248 247 public void populateWithKeys(AutoCompletionList list) { … … 257 256 * @param list the list to populate 258 257 * @param key the tag key 259 * @param append true to add the values to the list; false, to replace the values260 * in the list by the tag values261 258 */ 262 259 public void populateWithTagValues(AutoCompletionList list, String key) { 263 list.add(getPresetValues(key), AutoCompletionItemPritority.IS_IN_STANDARD); 264 list.add(getDataValues(key), AutoCompletionItemPritority.IS_IN_DATASET); 265 } 266 260 populateWithTagValues(list, Arrays.asList(key)); 261 } 262 263 /** 264 * Populates the an {@see AutoCompletionList} with the currently cached 265 * values for some given tags 266 * 267 * @param list the list to populate 268 * @param key the tag keys 269 */ 270 public void populateWithTagValues(AutoCompletionList list, List<String> keys) { 271 for (String key : keys) { 272 list.add(getPresetValues(key), AutoCompletionItemPritority.IS_IN_STANDARD); 273 list.add(getDataValues(key), AutoCompletionItemPritority.IS_IN_DATASET); 274 } 275 } 276 277 /** 278 * Returns the currently cached tag keys. 279 * @return a list of tag keys 280 */ 267 281 public List<AutoCompletionListItem> getKeys() { 268 282 AutoCompletionList list = new AutoCompletionList(); 269 283 populateWithKeys(list); 270 return new ArrayList<AutoCompletionListItem>(list.getList()); 271 } 272 284 return list.getList(); 285 } 286 287 /** 288 * Returns the currently cached tag values for a given tag key. 289 * @param key the tag key 290 * @return a list of tag values 291 */ 273 292 public List<AutoCompletionListItem> getValues(String key) { 293 return getValues(Arrays.asList(key)); 294 } 295 296 /** 297 * Returns the currently cached tag values for a given list of tag keys. 298 * @param keys the tag keys 299 * @return a list of tag values 300 */ 301 public List<AutoCompletionListItem> getValues(List<String> keys) { 274 302 AutoCompletionList list = new AutoCompletionList(); 275 populateWithTagValues(list, key );276 return new ArrayList<AutoCompletionListItem>(list.getList());303 populateWithTagValues(list, keys); 304 return list.getList(); 277 305 } 278 306
Note:
See TracChangeset
for help on using the changeset viewer.