Changeset 35814 in osm
- Timestamp:
- 2021-08-31T23:36:28+02:00 (3 years ago)
- Location:
- applications/editors/josm/plugins/HouseNumberTaggingTool
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/HouseNumberTaggingTool/.settings/org.eclipse.core.resources.prefs
r34069 r35814 1 1 eclipse.preferences.version=1 2 encoding/<project>=UTF-8 3 encoding/src=UTF-8 2 4 encoding/test=UTF-8 3 encoding/src=UTF-8 -
applications/editors/josm/plugins/HouseNumberTaggingTool/build.xml
r35467 r35814 4 4 <property name="commit.message" value="Initial version."/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 3007"/>6 <property name="plugin.main.version" value="18173"/> 7 7 <!-- Configure these properties (replace "..." accordingly). 8 8 See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/TagDialog.java
r35508 r35814 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.housenumbertool; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn; 6 7 import java.awt.Dimension; 8 import java.awt.Font; 9 import java.awt.GridBagConstraints; 10 import java.awt.GridBagLayout; 11 import java.awt.Insets; 12 import java.awt.event.ActionEvent; 13 import java.awt.event.ItemEvent; 14 import java.awt.event.ItemListener; 15 import java.io.File; 16 import java.io.FileInputStream; 17 import java.io.FileOutputStream; 18 import java.io.ObjectInputStream; 19 import java.io.ObjectOutputStream; 20 import java.util.ArrayList; 21 import java.util.Arrays; 22 import java.util.Collection; 23 import java.util.List; 24 import java.util.Set; 25 import java.util.TreeSet; 26 import java.util.logging.Level; 27 import java.util.logging.Logger; 28 29 import javax.swing.ButtonGroup; 30 import javax.swing.JButton; 31 import javax.swing.JCheckBox; 32 import javax.swing.JComboBox; 33 import javax.swing.JLabel; 34 import javax.swing.JPanel; 35 import javax.swing.JRadioButton; 36 import javax.swing.JSlider; 37 import javax.swing.JTextField; 38 import javax.swing.SwingUtilities; 3 39 4 40 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 10 46 import org.openstreetmap.josm.gui.ExtendedDialog; 11 47 import org.openstreetmap.josm.gui.MainApplication; 12 import org.openstreetmap.josm.gui.tagging.ac.AutoComp letingComboBox;48 import org.openstreetmap.josm.gui.tagging.ac.AutoCompComboBox; 13 49 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 14 15 import javax.swing.*;16 import java.awt.*;17 import java.awt.event.ActionEvent;18 import java.awt.event.ItemEvent;19 import java.awt.event.ItemListener;20 import java.io.*;21 import java.util.List;22 import java.util.*;23 import java.util.logging.Level;24 import java.util.logging.Logger;25 26 import static org.openstreetmap.josm.tools.I18n.tr;27 import static org.openstreetmap.josm.tools.I18n.trn;28 50 29 51 /** … … 47 69 48 70 private static final String[] BUILDING_STRINGS = { 49 "yes", "apartments", "chapel", "church", "commercial", "dormitory", "hotel", "house", "residential", "terrace", 50 "industrial", "retail", "warehouse", "cathedral", "civic", "hospital", "school", "train_station", "transportation", 51 "university", "public", "bridge", "bunker", "cabin", "construction", "farm_auxiliary", "garage", "garages", 71 "yes", "apartments", "chapel", "church", "commercial", "dormitory", "hotel", "house", "residential", "terrace", 72 "industrial", "retail", "warehouse", "cathedral", "civic", "hospital", "school", "train_station", "transportation", 73 "university", "public", "bridge", "bunker", "cabin", "construction", "farm_auxiliary", "garage", "garages", 52 74 "greenhouse", "hangar", "hut", "roof", "shed", "stable"}; 53 75 … … 63 85 private static final String TEMPLATE_DATA = "/template.data"; 64 86 65 private AutoComp letingComboBoxsource;66 private AutoComp letingComboBoxcountry;67 private AutoComp letingComboBoxstate;68 private AutoComp letingComboBoxsuburb;69 private AutoComp letingComboBoxcity;70 private AutoComp letingComboBoxpostcode;71 private AutoComp letingComboBoxstreet;87 private AutoCompComboBox<AutoCompletionItem> source; 88 private AutoCompComboBox<AutoCompletionItem> country; 89 private AutoCompComboBox<AutoCompletionItem> state; 90 private AutoCompComboBox<AutoCompletionItem> suburb; 91 private AutoCompComboBox<AutoCompletionItem> city; 92 private AutoCompComboBox<AutoCompletionItem> postcode; 93 private AutoCompComboBox<AutoCompletionItem> street; 72 94 private JTextField housnumber; 73 95 private JCheckBox buildingEnabled; … … 221 243 editPanel.add(sourceEnabled, c); 222 244 223 source = new AutoComp letingComboBox();224 source. setPossibleAcItems(acm.getTagValues(TAG_SOURCE));245 source = new AutoCompComboBox<>(); 246 source.getModel().addAllElements(acm.getTagValues(TAG_SOURCE)); 225 247 source.setPreferredSize(new Dimension(200, 24)); 226 248 source.setEditable(true); … … 271 293 editPanel.add(countryEnabled, c); 272 294 273 country = new AutoComp letingComboBox();274 country. setPossibleAcItems(acm.getTagValues(TAG_ADDR_COUNTRY));295 country = new AutoCompComboBox<>(); 296 country.getModel().addAllElements(acm.getTagValues(TAG_ADDR_COUNTRY)); 275 297 country.setPreferredSize(new Dimension(200, 24)); 276 298 country.setEditable(true); … … 321 343 editPanel.add(stateEnabled, c); 322 344 323 state = new AutoComp letingComboBox();324 state. setPossibleAcItems(acm.getTagValues(TAG_ADDR_STATE));345 state = new AutoCompComboBox<>(); 346 state.getModel().addAllElements(acm.getTagValues(TAG_ADDR_STATE)); 325 347 state.setPreferredSize(new Dimension(200, 24)); 326 348 state.setEditable(true); … … 371 393 editPanel.add(suburbEnabled, c); 372 394 373 suburb = new AutoComp letingComboBox();374 suburb. setPossibleAcItems(acm.getTagValues(TAG_ADDR_SUBURB));395 suburb = new AutoCompComboBox<>(); 396 suburb.getModel().addAllElements(acm.getTagValues(TAG_ADDR_SUBURB)); 375 397 suburb.setPreferredSize(new Dimension(200, 24)); 376 398 suburb.setEditable(true); … … 421 443 editPanel.add(cityEnabled, c); 422 444 423 city = new AutoComp letingComboBox();424 city. setPossibleAcItems(acm.getTagValues(TAG_ADDR_CITY));445 city = new AutoCompComboBox<>(); 446 city.getModel().addAllElements(acm.getTagValues(TAG_ADDR_CITY)); 425 447 city.setPreferredSize(new Dimension(200, 24)); 426 448 city.setEditable(true); … … 471 493 editPanel.add(zipEnabled, c); 472 494 473 postcode = new AutoComp letingComboBox();474 postcode. setPossibleAcItems(acm.getTagValues(TAG_ADDR_POSTCODE));495 postcode = new AutoCompComboBox<>(); 496 postcode.getModel().addAllElements(acm.getTagValues(TAG_ADDR_POSTCODE)); 475 497 postcode.setPreferredSize(new Dimension(200, 24)); 476 498 postcode.setEditable(true); … … 549 571 g.add(placeRadio); 550 572 551 street = new AutoComp letingComboBox();573 street = new AutoCompComboBox<>(); 552 574 if (dto.isTagStreet()) { 553 street. setPossibleItems(getPossibleStreets());575 street.getModel().addAllElements(getPossibleStreets()); 554 576 } else { 555 street. setPossibleAcItems(acm.getTagValues(TAG_ADDR_PLACE));577 street.getModel().addAllElements(acm.getTagValues(TAG_ADDR_PLACE)); 556 578 } 557 579 street.setPreferredSize(new Dimension(200, 24)); … … 756 778 } 757 779 758 private String getAutoCompletingComboBoxValue(AutoComp letingComboBoxbox) {780 private String getAutoCompletingComboBoxValue(AutoCompComboBox<AutoCompletionItem> box) { 759 781 Object item = box.getSelectedItem(); 760 782 if (item != null) { … … 886 908 if (!commands.isEmpty()) { 887 909 SequenceCommand sequenceCommand = new SequenceCommand( 888 trn("Updating properties of up to {0} object", 910 trn("Updating properties of up to {0} object", 889 911 "Updating properties of up to {0} objects", commands.size(), commands.size()), commands); 890 912 … … 894 916 } 895 917 896 private Collection<String> getPossibleStreets() {897 /**898 * Generates a list of all visible names of highways in order to do autocompletion on the road name.899 */900 Set< String> names = new TreeSet<>();918 /** 919 * Generates a list of all visible names of highways in order to do autocompletion on the road name. 920 */ 921 private Collection<AutoCompletionItem> getPossibleStreets() { 922 Set<AutoCompletionItem> names = new TreeSet<>(); 901 923 for (OsmPrimitive osm : MainApplication.getLayerManager().getEditDataSet().allNonDeletedPrimitives()) { 902 924 if (osm.getKeys() != null && osm.keySet().contains("highway") && osm.keySet().contains("name")) { 903 names.add( osm.get("name"));925 names.add(new AutoCompletionItem(osm.get("name"))); 904 926 } 905 927 } … … 946 968 public void itemStateChanged(ItemEvent e) { 947 969 if (streetRadio.isSelected()) { 948 street. setPossibleItems(getPossibleStreets());970 street.getModel().addAllElements(getPossibleStreets()); 949 971 } else { 950 street. setPossibleAcItems(acm.getTagValues(TAG_ADDR_PLACE));972 street.getModel().addAllElements(acm.getTagValues(TAG_ADDR_PLACE)); 951 973 } 952 974 }
Note:
See TracChangeset
for help on using the changeset viewer.