Changeset 614 in josm
- Timestamp:
- 2008-04-19T17:55:29+02:00 (17 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.settings/org.eclipse.jdt.core.prefs
r444 r614 1 # Thu Nov 01 00:40:05 CET 20071 #Sat Apr 19 17:30:55 CEST 2008 2 2 eclipse.preferences.version=1 3 3 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning … … 21 21 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning 22 22 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning 23 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation= error23 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 24 24 org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore 25 25 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -
trunk/presets/presets.xml
r579 r614 7 7 8 8 <annotations> 9 10 9 <item name="Road" icon="presets/ways.png"> 11 10 <label text="Road" /> … … 118 117 </item> 119 118 119 <item name="Addresses" icon="presets/addresses.png"> 120 <label text="These attributes are used for nodes:" /> 121 <text key="addr:street" text="Street name" use_last_as_default="true" delete_if_empty="true" /> 122 <text key="addr:housenumber" text="House number" default="" delete_if_empty="true" /> 123 <text key="addr:housename" text="House name" default="" delete_if_empty="true" /> 124 <text key="addr:postcode" text="Post code" use_last_as_default="true" delete_if_empty="true" /> 125 <text key="addr:city" text="City" use_last_as_default="true" delete_if_empty="true" /> 126 <label text=" " /> 127 <label text="These attributes are used for ways:" /> 128 <combo key="addr:interpolation" text="Numbering scheme:" values="odd,even,all" default="odd" /> 129 </item> 130 120 131 <item name="Boundaries" icon="presets/boundaries.png"> 121 132 <label text="Boundaries" /> … … 123 134 <text key="name" text="Name:" default="" delete_if_empty="true" /> 124 135 </item> 136 137 125 138 126 139 <item name="Landuse" icon="presets/landuse.png"> -
trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java
r582 r614 9 9 import java.awt.event.ActionListener; 10 10 import java.util.Collection; 11 import java.util.HashMap; 11 12 import java.util.StringTokenizer; 12 13 … … 19 20 import javax.swing.JLabel; 20 21 import javax.swing.JList; 22 import javax.swing.JMenu; 21 23 import javax.swing.JMenuItem; 22 24 import javax.swing.JOptionPane; … … 125 127 else 126 128 { 129 HashMap<String,JMenu> submenus = new HashMap<String,JMenu>(); 127 130 for (final TaggingPreset p : taggingPresets) { 128 131 if (p.getValue(Action.NAME).equals(" ")) { 129 132 Main.main.menu.presetsMenu.add(new JSeparator()); 130 133 } else { 131 Main.main.menu.presetsMenu.add(new JMenuItem(p)); 134 String name = (String) p.getValue(Action.NAME); 135 String[] sp = name.split("/"); 136 if (sp.length <= 1) { 137 Main.main.menu.presetsMenu.add(new JMenuItem(p)); 138 } else { 139 p.setName(sp[1]); 140 JMenu submenu = submenus.get(sp[0]); 141 if (submenu == null) { 142 submenu = new JMenu(sp[0]); 143 submenus.put(sp[0], submenu); 144 Main.main.menu.presetsMenu.add(submenu); 145 } 146 submenu.add(new JMenuItem(p)); 147 } 132 148 } 133 149 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r593 r614 16 16 import java.net.URL; 17 17 import java.util.Collection; 18 import java.util.HashMap; 18 19 import java.util.HashSet; 19 20 import java.util.LinkedHashMap; … … 44 45 import org.xml.sax.SAXException; 45 46 46 47 47 /** 48 48 * This class read encapsulate one tagging preset. A class method can … … 53 53 */ 54 54 public class TaggingPreset extends AbstractAction { 55 55 56 56 public static abstract class Item { 57 57 public boolean focus = false; … … 71 71 returnValue.values = new HashSet<String>(); 72 72 for (OsmPrimitive s : sel) { 73 returnValue.values.add(s.get(key)); 73 String v = s.get(key); 74 /* if (v != null) */ returnValue.values.add(v); 74 75 } 75 76 return returnValue; … … 94 95 95 96 public static class Text extends Item { 97 96 98 public String key; 97 99 public String text; 98 100 public String default_; 99 101 public String originalValue; 102 public boolean use_last_as_default = false; 100 103 public boolean delete_if_empty = false; 101 104 … … 106 109 // find out if our key is already used in the selection. 107 110 Usage usage = determineTextUsage(sel, key); 108 109 if (usage.values.size() == 1) { 111 if (usage.values.size() == 1 && usage.values.toArray()[0] == null) { 112 value = new JTextField(); 113 if (use_last_as_default && lastValue.containsKey(key)) { 114 ((JTextField)value).setText(lastValue.get(key)); 115 } else { 116 ((JTextField)value).setText(default_); 117 } 118 } else if (usage.values.size() == 1) { 110 119 // all objects use the same value 111 120 value = new JTextField(); … … 130 139 ((JTextField)value).getText(); 131 140 141 if (use_last_as_default) lastValue.put(key, v); 132 142 if (v.equals(originalValue) || (originalValue == null && v.length() == 0)) return; 133 143 … … 144 154 public String text; 145 155 public boolean default_ = false; // not used! 156 public boolean use_last_as_default = false; 146 157 147 158 private QuadStateCheckBox check; … … 205 216 public boolean delete_if_empty = false; 206 217 public boolean editable = true; 218 public boolean use_last_as_default = false; 207 219 208 220 private JComboBox combo; … … 285 297 public Collection<Class<?>> types; 286 298 private List<Item> data = new LinkedList<Item>(); 299 private static HashMap<String,String> lastValue = new HashMap<String,String>(); 287 300 288 301 /**
Note:
See TracChangeset
for help on using the changeset viewer.