Changeset 6114 in josm
- Timestamp:
- 2013-08-06T23:48:20+02:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/defaultpresets.xml
r6044 r6114 89 89 match: none/key/key!/keyvalue (default is "none", see below for more information) 90 90 91 checkgroup: group of checks 92 columns: number of columns 93 91 94 check: checkbox 92 95 key: key to set … … 2427 2430 <combo key="shop" text="With shop" values="yes,convenience,kiosk,no" /> 2428 2431 <label text="Fuel types:" /> 2429 <check key="fuel:diesel" text="Diesel" default="off" /> 2430 <check key="fuel:biodiesel" text="Bio Diesel" default="off" /> 2431 <check key="fuel:GTL_diesel" text="Diesel (Gas To Liquid - ultimate diesel)" default="off" /> 2432 <check key="fuel:HGV_diesel" text="Diesel for Heavy Good Vehicles" default="off" /> 2433 <check key="fuel:octane_80" text="Octane 80" default="off" /> 2434 <check key="fuel:octane_91" text="Octane 91" default="off" /> 2435 <check key="fuel:octane_92" text="Octane 92" default="off" /> 2436 <check key="fuel:octane_95" text="Octane 95" default="off" /> 2437 <check key="fuel:octane_98" text="Octane 98" default="off" /> 2438 <check key="fuel:octane_100" text="Octane 100" default="off" /> 2439 <check key="fuel:e10" text="E10 (10% Ethanol mix)" default="off" /> 2440 <check key="fuel:e85" text="E85 (85% Ethanol mix)" default="off" /> 2441 <check key="fuel:lpg" text="LPG (Liquefied petroleum gas)" default="off" /> 2442 <check key="fuel:cng" text="CNG (Compressed Natural Gas)" default="off" /> 2443 <check key="fuel:1_25" text="1/25 mix (mofa/moped)" default="off" /> 2444 <check key="fuel:1_50" text="1/50 mix (mofa/moped)" default="off" /> 2432 <checkgroup columns="2"> 2433 <check key="fuel:diesel" text="Diesel" default="off" /> 2434 <check key="fuel:biodiesel" text="Bio Diesel" default="off" /> 2435 <check key="fuel:GTL_diesel" text="Diesel (Gas To Liquid - ultimate diesel)" default="off" /> 2436 <check key="fuel:HGV_diesel" text="Diesel for Heavy Good Vehicles" default="off" /> 2437 <check key="fuel:octane_80" text="Octane 80" default="off" /> 2438 <check key="fuel:octane_91" text="Octane 91" default="off" /> 2439 <check key="fuel:octane_92" text="Octane 92" default="off" /> 2440 <check key="fuel:octane_95" text="Octane 95" default="off" /> 2441 <check key="fuel:octane_98" text="Octane 98" default="off" /> 2442 <check key="fuel:octane_100" text="Octane 100" default="off" /> 2443 <check key="fuel:e10" text="E10 (10% Ethanol mix)" default="off" /> 2444 <check key="fuel:e85" text="E85 (85% Ethanol mix)" default="off" /> 2445 <check key="fuel:lpg" text="LPG (Liquefied petroleum gas)" default="off" /> 2446 <check key="fuel:cng" text="CNG (Compressed Natural Gas)" default="off" /> 2447 <check key="fuel:1_25" text="1/25 mix (mofa/moped)" default="off" /> 2448 <check key="fuel:1_50" text="1/50 mix (mofa/moped)" default="off" /> 2449 </checkgroup> 2445 2450 </optional> 2446 2451 </item> -
trunk/data/tagging-preset.xsd
r6057 r6114 81 81 <element name="combo" type="tns:combo" /> 82 82 <element name="multiselect" type="tns:multiselect" /> 83 <element name="checkgroup" type="tns:checkgroup" /> 83 84 <element name="check" type="tns:check" /> 84 85 </choice> … … 189 190 </complexType> 190 191 192 <complexType name="checkgroup"> 193 <sequence> 194 <choice minOccurs="1" maxOccurs="unbounded"> 195 <element name="check" type="tns:check" /> 196 </choice> 197 </sequence> 198 <attribute name="columns" type="positiveInteger" /> 199 <anyAttribute processContents="skip" /> 200 </complexType> 201 191 202 <complexType name="check"> 192 203 <attribute name="key" type="string" use="required" /> -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r6093 r6114 6 6 import java.awt.Font; 7 7 import java.awt.GridBagLayout; 8 import java.awt.GridLayout; 8 9 import java.awt.event.ActionEvent; 9 10 import java.awt.event.ActionListener; … … 24 25 import java.util.Map; 25 26 import java.util.TreeSet; 27 26 28 import javax.swing.ButtonGroup; 27 29 import javax.swing.ImageIcon; … … 35 37 import javax.swing.ListCellRenderer; 36 38 import javax.swing.ListModel; 39 37 40 import org.xml.sax.SAXException; 38 39 41 import org.openstreetmap.josm.Main; 40 42 import org.openstreetmap.josm.actions.search.SearchCompiler; … … 315 317 public void addCommands(List<Tag> changedTags) { 316 318 } 319 320 @Override 321 public String toString() { 322 return "Label [" 323 + (text != null ? "text=" + text + ", " : "") 324 + (text_context != null ? "text_context=" + text_context 325 + ", " : "") 326 + (locale_text != null ? "locale_text=" + locale_text : "") 327 + "]"; 328 } 317 329 } 318 330 … … 391 403 public void addCommands(List<Tag> changedTags) { 392 404 } 405 406 @Override 407 public String toString() { 408 return "Optional"; 409 } 393 410 } 394 411 … … 403 420 @Override 404 421 public void addCommands(List<Tag> changedTags) { 422 } 423 424 @Override 425 public String toString() { 426 return "Space"; 405 427 } 406 428 } … … 643 665 return Collections.emptyList(); 644 666 return Collections.singleton(default_); 667 } 668 } 669 670 /** 671 * A group of {@link Check}s. 672 * @since 6114 673 */ 674 public static class CheckGroup extends TaggingPresetItem { 675 676 /** 677 * Number of columns (positive integer) 678 */ 679 public String columns; 680 681 /** 682 * List of checkboxes 683 */ 684 public final List<Check> checks = new LinkedList<Check>(); 685 686 @Override 687 boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) { 688 Integer cols = new Integer(columns); 689 int rows = (int) Math.ceil((double)checks.size()/cols.doubleValue()); 690 JPanel panel = new JPanel(new GridLayout(rows, cols)); 691 692 for (Check check : checks) { 693 check.addToPanel(panel, sel); 694 } 695 696 p.add(panel, GBC.eol()); 697 return false; 698 } 699 700 @Override 701 void addCommands(List<Tag> changedTags) { 702 } 703 704 @Override 705 public String toString() { 706 return "CheckGroup [columns=" + columns + "]"; 645 707 } 646 708 } … … 734 796 public Collection<String> getValues() { 735 797 return Arrays.asList(value_on, value_off); 798 } 799 800 @Override 801 public String toString() { 802 return "Check [" 803 + (locale_text != null ? "locale_text=" + locale_text + ", " : "") 804 + (value_on != null ? "value_on=" + value_on + ", " : "") 805 + (value_off != null ? "value_off=" + value_off + ", " : "") 806 + "default_=" + default_ + ", " 807 + (check != null ? "check=" + check + ", " : "") 808 + (initialState != null ? "initialState=" + initialState 809 + ", " : "") + "def=" + def + "]"; 736 810 } 737 811 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetReader.java
r6093 r6114 12 12 import java.util.LinkedList; 13 13 import java.util.List; 14 14 15 import javax.swing.JOptionPane; 16 15 17 import org.xml.sax.SAXException; 16 17 18 import org.openstreetmap.josm.Main; 18 19 import org.openstreetmap.josm.gui.preferences.SourceEntry; … … 58 59 parser.mapOnStart("roles", TaggingPresetItems.Roles.class); 59 60 parser.map("role", TaggingPresetItems.Role.class); 61 parser.map("checkgroup", TaggingPresetItems.CheckGroup.class); 60 62 parser.map("check", TaggingPresetItems.Check.class); 61 63 parser.map("combo", TaggingPresetItems.Combo.class); … … 69 71 TaggingPresetMenu lastmenu = null; 70 72 TaggingPresetItems.Roles lastrole = null; 73 final List<TaggingPresetItems.Check> checks = new LinkedList<TaggingPresetItems.Check>(); 71 74 List<TaggingPresetItems.PresetListEntry> listEntries = new LinkedList<TaggingPresetItems.PresetListEntry>(); 72 75 … … 113 116 throw new SAXException(tr("Preset role element without parent")); 114 117 lastrole.roles.add((TaggingPresetItems.Role) o); 118 } else if (o instanceof TaggingPresetItems.Check) { 119 checks.add((TaggingPresetItems.Check) o); 115 120 } else if (o instanceof TaggingPresetItems.PresetListEntry) { 116 121 listEntries.add((TaggingPresetItems.PresetListEntry) o); 122 } else if (o instanceof TaggingPresetItems.CheckGroup) { 123 all.getLast().data.add((TaggingPresetItem) o); 124 ((TaggingPresetItems.CheckGroup) o).checks.addAll(checks); 125 checks.clear(); 117 126 } else { 127 if (!checks.isEmpty()) { 128 all.getLast().data.addAll(checks); 129 checks.clear(); 130 } 118 131 all.getLast().data.add((TaggingPresetItem) o); 119 132 if (o instanceof TaggingPresetItems.ComboMultiSelect) {
Note:
See TracChangeset
for help on using the changeset viewer.