Changeset 3518 in josm
- Timestamp:
- 2010-09-10T07:45:16+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r3501 r3518 7 7 import java.awt.BorderLayout; 8 8 import java.awt.Component; 9 import java.awt.Cursor;10 import java.awt.Dialog.ModalityType;11 import java.awt.Dimension;12 9 import java.awt.Font; 13 10 import java.awt.GridBagLayout; 14 11 import java.awt.Point; 12 import java.awt.Dialog.ModalityType; 15 13 import java.awt.event.ActionEvent; 16 14 import java.awt.event.ActionListener; … … 20 18 import java.awt.event.MouseAdapter; 21 19 import java.awt.event.MouseEvent; 22 import java.awt.event.MouseListener;23 20 import java.util.ArrayList; 24 21 import java.util.Collection; … … 66 63 import org.openstreetmap.josm.data.osm.Relation; 67 64 import org.openstreetmap.josm.data.osm.RelationMember; 65 import org.openstreetmap.josm.data.osm.Tag; 68 66 import org.openstreetmap.josm.data.osm.Way; 69 67 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; … … 78 76 import org.openstreetmap.josm.gui.SideButton; 79 77 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 78 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.PresetHandler; 80 79 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; 81 80 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 82 import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;83 81 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 84 82 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; … … 480 478 private final SideButton btnEdit; 481 479 private final SideButton btnDel; 482 private final JPanel presets = newJPanel(new GridBagLayout());480 private final PresetListPanel presets = new PresetListPanel(); 483 481 484 482 private final JLabel selectSth = new JLabel("<html><p>" … … 716 714 } 717 715 718 private void checkPresets(int nodes, int ways, int relations, int closedways)719 {720 /**721 * Small helper class that manages the highlighting of the label on hover as well as opening722 * the corresponding preset when clicked723 */724 class PresetLabelML implements MouseListener {725 JLabel label;726 Font bold;727 Font normal;728 TaggingPreset tag;729 PresetLabelML(JLabel lbl, TaggingPreset t) {730 super();731 label = lbl;732 lbl.setCursor(new Cursor(Cursor.HAND_CURSOR));733 normal = label.getFont();734 bold = normal.deriveFont(normal.getStyle() ^ Font.BOLD);735 tag = t;736 }737 public void mouseClicked(MouseEvent arg0) {738 tag.actionPerformed(null);739 }740 public void mouseEntered(MouseEvent arg0) {741 label.setFont(bold);742 }743 public void mouseExited(MouseEvent arg0) {744 label.setFont(normal);745 }746 public void mousePressed(MouseEvent arg0) {}747 public void mouseReleased(MouseEvent arg0) {}748 }749 750 presets.removeAll();751 int total = nodes+ways+relations+closedways;752 if(total == 0) {753 presets.setVisible(false);754 return;755 }756 757 for(TaggingPreset t : TaggingPresetPreference.taggingPresets) {758 if((t.types == null || !((relations > 0 && !t.types.contains("relation")) &&759 (nodes > 0 && !t.types.contains("node")) &&760 (ways+closedways > 0 && !t.types.contains("way")) &&761 (closedways > 0 && !t.types.contains("closedway")))) && t.isShowable())762 {763 int found = 0;764 for(TaggingPreset.Item i : t.data) {765 if(!(i instanceof TaggingPreset.Key)) {766 continue;767 }768 String val = ((TaggingPreset.Key)i).value;769 String key = ((TaggingPreset.Key)i).key;770 // we subtract 100 if not found and add 1 if found771 found -= 100;772 if(key == null || !valueCount.containsKey(key)) {773 continue;774 }775 776 Map<String, Integer> v = valueCount.get(key);777 if(v.size() == 1 && val != null && v.containsKey(val) && v.get(val) == total) {778 found += 101;779 }780 }781 782 if(found <= 0) {783 continue;784 }785 786 JLabel lbl = new JLabel(t.getName());787 lbl.addMouseListener(new PresetLabelML(lbl, t));788 presets.add(lbl, GBC.eol().fill(GBC.HORIZONTAL));789 }790 }791 792 if(presets.getComponentCount() > 0) {793 presets.setVisible(true);794 // This ensures the presets are exactly as high as needed.795 int height = presets.getComponentCount() * presets.getComponent(0).getHeight();796 Dimension size = new Dimension(presets.getWidth(), height);797 presets.setMaximumSize(size);798 presets.setMinimumSize(size);799 } else {800 presets.setVisible(false);801 }802 }803 804 716 private int findRow(TableModel model, Object value) { 805 717 for (int i=0; i<model.getRowCount(); i++) { … … 809 721 return -1; 810 722 } 723 724 private PresetHandler presetHandler = new PresetHandler() { 725 726 @Override 727 public void updateTags(List<Tag> tags) { 728 Command command = TaggingPreset.createCommand(getSelection(), tags); 729 if (command != null) { 730 Main.main.undoRedo.add(command); 731 } 732 } 733 734 @Override 735 public Collection<OsmPrimitive> getSelection() { 736 if (Main.main == null) return null; 737 if (Main.main.getCurrentDataSet() == null) return null; 738 739 return Main.main.getCurrentDataSet().getSelected(); 740 } 741 }; 811 742 812 743 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { … … 870 801 propertyData.addRow(new Object[]{e.getKey(), e.getValue()}); 871 802 } 872 873 // re-load membership data874 // this is rather expensive since we have to walk through all members of all existing relationships.875 // could use back references here for speed if necessary.876 803 877 804 membershipData.setRowCount(0); … … 913 840 } 914 841 915 checkPresets(nodes, ways, relations, closedways);842 presets.updatePresets(nodes, ways, relations, closedways, valueCount, presetHandler); 916 843 917 844 membershipTable.getTableHeader().setVisible(membershipData.getRowCount() > 0); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r3508 r3518 24 24 import java.util.Collection; 25 25 import java.util.Collections; 26 import java.util.HashMap; 26 27 import java.util.HashSet; 27 28 import java.util.Iterator; 28 29 import java.util.List; 30 import java.util.Map; 29 31 import java.util.Set; 30 32 import java.util.logging.Logger; … … 61 63 import org.openstreetmap.josm.data.osm.Relation; 62 64 import org.openstreetmap.josm.data.osm.RelationMember; 65 import org.openstreetmap.josm.data.osm.Tag; 63 66 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 64 67 import org.openstreetmap.josm.gui.DefaultNameFormatter; … … 66 69 import org.openstreetmap.josm.gui.SideButton; 67 70 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 71 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.PresetHandler; 68 72 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 69 73 import org.openstreetmap.josm.gui.help.HelpUtil; 70 74 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 71 75 import org.openstreetmap.josm.gui.tagging.TagEditorPanel; 76 import org.openstreetmap.josm.gui.tagging.TagModel; 72 77 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 73 78 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; … … 123 128 referrerModel = new ReferringRelationsBrowserModel(relation); 124 129 125 tagEditorPanel = new TagEditorPanel(); 130 tagEditorPanel = new TagEditorPanel(new PresetHandler() { 131 132 @Override 133 public void updateTags(List<Tag> tags) { 134 Map<String, TagModel> modelTags = new HashMap<String, TagModel>(); 135 for (int i=0; i<tagEditorPanel.getModel().getRowCount(); i++) { 136 TagModel tagModel = tagEditorPanel.getModel().get(i); 137 modelTags.put(tagModel.getName(), tagModel); 138 } 139 for (Tag tag: tags) { 140 TagModel existing = modelTags.get(tag.getKey()); 141 142 if (tag.getValue().isEmpty()) { 143 if (existing != null) { 144 tagEditorPanel.getModel().delete(tag.getKey()); 145 } 146 } else { 147 if (existing != null) { 148 tagEditorPanel.getModel().updateTagValue(existing, tag.getValue()); 149 } else { 150 tagEditorPanel.getModel().add(tag.getKey(), tag.getValue()); 151 } 152 } 153 154 } 155 } 156 157 @Override 158 public Collection<OsmPrimitive> getSelection() { 159 Relation relation = new Relation(); 160 tagEditorPanel.getModel().applyToPrimitive(relation); 161 return Collections.<OsmPrimitive>singletonList(relation); 162 } 163 }); 164 126 165 // populate the models 127 166 // -
trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
r3133 r3518 27 27 protected void build() { 28 28 setLayout(new BorderLayout()); 29 add(pnlTagEditor = new TagEditorPanel(), BorderLayout.CENTER); 29 add(pnlTagEditor = new TagEditorPanel(null), BorderLayout.CENTER); 30 30 } 31 31 32 32 /** 33 33 * Creates a new panel 34 * 34 * 35 35 * @param changesetCommentModel the changeset comment model. Must not be null. 36 36 * @throws IllegalArgumentException thrown if {@code changesetCommentModel} is null -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r3141 r3518 50 50 * Creates a new tag editor model. Internally allocates two selection models 51 51 * for row selection and column selection. 52 * 52 * 53 53 * To create a {@see JTable} with this model: 54 54 * <pre> … … 56 56 * TagTable tbl = new TagTabel(model); 57 57 * </pre> 58 * 58 * 59 59 * @see #getRowSelectionModel() 60 60 * @see #getColumnSelectionModel() … … 66 66 /** 67 67 * Creates a new tag editor model. 68 * 68 * 69 69 * @param rowSelectionModel the row selection model. Must not be null. 70 70 * @param colSelectionModel the column selection model. Must not be null. … … 85 85 /** 86 86 * Replies the row selection model used by this tag editor model 87 * 87 * 88 88 * @return the row selection model used by this tag editor model 89 89 */ … … 94 94 /** 95 95 * Replies the column selection model used by this tag editor model 96 * 96 * 97 97 * @return the column selection model used by this tag editor model 98 98 */ … … 355 355 tags.add(tag); 356 356 setDirty(false); 357 fireTableDataChanged(); 357 358 } 358 359 … … 441 442 /** 442 443 * Replies the the tags in this tag editor model as {@see TagCollection}. 443 * 444 * 444 445 * @return the the tags in this tag editor model as {@see TagCollection} 445 446 */ -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java
r3210 r3518 6 6 import java.awt.GridBagLayout; 7 7 import java.awt.Insets; 8 import java.util.HashMap; 9 import java.util.Map; 10 import java.util.Map.Entry; 8 11 import java.util.logging.Logger; 9 12 … … 12 15 import javax.swing.JPanel; 13 16 import javax.swing.JScrollPane; 17 import javax.swing.event.TableModelEvent; 18 import javax.swing.event.TableModelListener; 14 19 20 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel; 21 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.PresetHandler; 15 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 23 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; … … 33 40 private TagTable tagTable; 34 41 42 private PresetListPanel presetListPanel; 43 private final PresetHandler presetHandler; 44 35 45 private AutoCompletionManager autocomplete; 36 46 private AutoCompletionList acList; … … 46 56 pnl.setLayout(new BorderLayout()); 47 57 pnl.add(new JScrollPane(tagTable), BorderLayout.CENTER); 58 if (presetHandler != null) { 59 presetListPanel = new PresetListPanel(); 60 pnl.add(presetListPanel, BorderLayout.NORTH); 61 } 48 62 return pnl; 49 63 } … … 98 112 gc.anchor = GridBagConstraints.CENTER; 99 113 add(tablePanel,gc); 114 115 if (presetHandler != null) { 116 model.addTableModelListener(new TableModelListener() { 117 @Override 118 public void tableChanged(TableModelEvent e) { 119 updatePresets(); 120 } 121 }); 122 } 100 123 } 101 124 … … 104 127 * internally and can be retrieved with {@see #getModel()}. 105 128 */ 106 public TagEditorPanel() { 107 this(null); 129 public TagEditorPanel(PresetHandler presetHandler) { 130 this(null, presetHandler); 108 131 } 109 132 … … 111 134 * Creates a new tag editor panel with a supplied model. If 112 135 * {@code model} is null, a new model is created. 113 * 136 * 114 137 * @param model the tag editor model 115 138 */ 116 public TagEditorPanel(TagEditorModel model) { 139 public TagEditorPanel(TagEditorModel model, PresetHandler presetHandler) { 117 140 this.model = model; 141 this.presetHandler = presetHandler; 118 142 if (this.model == null) { 119 143 this.model = new TagEditorModel(); … … 135 159 * tag editor panel. {@code layer} is the data layer from whose data set 136 160 * tag values are proposed as auto completion items. 137 * 161 * 138 162 * @param layer the data layer. Must not be null. 139 163 * @throws IllegalArgumentException thrown if {@code layer} is null … … 158 182 super.setEnabled(enabled); 159 183 } 184 185 private void updatePresets() { 186 Map<String, Map<String, Integer>> valuesCount = new HashMap<String, Map<String,Integer>>(); 187 for (Entry<String, String> entry: model.getTags().entrySet()) { 188 Map<String, Integer> values = new HashMap<String, Integer>(); 189 values.put(entry.getValue(), 1); 190 valuesCount.put(entry.getKey(), values); 191 } 192 presetListPanel.updatePresets(0, 0, 1, 0, valuesCount, presetHandler); 193 validate(); 194 } 160 195 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r3486 r3518 19 19 import java.io.Reader; 20 20 import java.io.UnsupportedEncodingException; 21 import java.util.ArrayList; 21 22 import java.util.Arrays; 22 23 import java.util.Collection; 24 import java.util.Collections; 23 25 import java.util.EnumSet; 24 26 import java.util.HashMap; … … 37 39 import javax.swing.JPanel; 38 40 import javax.swing.JTextField; 41 import javax.swing.SwingUtilities; 39 42 import javax.xml.transform.stream.StreamSource; 40 43 41 44 import org.openstreetmap.josm.Main; 45 import org.openstreetmap.josm.command.AddCommand; 42 46 import org.openstreetmap.josm.command.ChangePropertyCommand; 43 47 import org.openstreetmap.josm.command.Command; … … 47 51 import org.openstreetmap.josm.data.osm.OsmUtils; 48 52 import org.openstreetmap.josm.data.osm.Relation; 53 import org.openstreetmap.josm.data.osm.Tag; 49 54 import org.openstreetmap.josm.data.osm.Way; 50 55 import org.openstreetmap.josm.gui.ExtendedDialog; … … 88 93 return name().toLowerCase(); 89 94 } 90 91 } 95 } 96 97 public static final int DIALOG_ANSWER_APPLY = 1; 98 public static final int DIALOG_ANSWER_NEW_RELATION = 2; 99 public static final int DIALOG_ANSWER_CANCEL = 3; 92 100 93 101 public TaggingPresetMenu group = null; … … 109 117 public boolean focus = false; 110 118 abstract boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel); 111 abstract void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds);119 abstract void addCommands(List<Tag> changedTags); 112 120 boolean requestFocusInWindow() {return false;} 113 121 } … … 175 183 public boolean use_last_as_default = false; 176 184 public boolean delete_if_empty = false; 185 public boolean required = false; 177 186 178 187 private JComponent value; … … 220 229 } 221 230 222 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {231 @Override public void addCommands(List<Tag> changedTags) { 223 232 224 233 // return if unchanged … … 235 244 v = null; 236 245 } 237 c mds.add(newChangePropertyCommand(sel,key, v));246 changedTags.add(new Tag(key, v)); 238 247 } 239 248 @Override boolean requestFocusInWindow() {return value.requestFocusInWindow();} … … 250 259 public boolean default_ = false; // only used for tagless objects 251 260 public boolean use_last_as_default = false; 261 public boolean required = false; 252 262 253 263 private QuadStateCheckBox check; … … 312 322 } 313 323 314 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {324 @Override public void addCommands(List<Tag> changedTags) { 315 325 // if the user hasn't changed anything, don't create a command. 316 326 if (check.getState() == initialState && !def) return; 317 327 318 328 // otherwise change things according to the selected value. 319 c mds.add(newChangePropertyCommand(sel,key,329 changedTags.add(new Tag(key, 320 330 check.getState() == QuadStateCheckBox.State.SELECTED ? value_on : 321 331 check.getState() == QuadStateCheckBox.State.NOT_SELECTED ? value_off : … … 339 349 public boolean editable = true; 340 350 public boolean use_last_as_default = false; 351 public boolean required = false; 341 352 342 353 private JComboBox combo; … … 432 443 return true; 433 444 } 434 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {445 @Override public void addCommands(List<Tag> changedTags) { 435 446 Object obj = combo.getSelectedItem(); 436 447 String display = (obj == null) ? null : obj.toString(); … … 464 475 lastValue.put(key, value); 465 476 } 466 c mds.add(newChangePropertyCommand(sel,key, value));477 changedTags.add(new Tag(key, value)); 467 478 } 468 479 @Override boolean requestFocusInWindow() {return combo.requestFocusInWindow();} … … 485 496 return false; 486 497 } 487 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {}498 @Override public void addCommands(List<Tag> changedTags) {} 488 499 } 489 500 … … 514 525 return false; 515 526 } 516 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {}527 @Override public void addCommands(List<Tag> changedTags) {} 517 528 } 518 529 … … 603 614 return false; 604 615 } 605 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {}616 @Override public void addCommands(List<Tag> changedTags) {} 606 617 } 607 618 … … 614 625 return false; 615 626 } 616 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {}627 @Override public void addCommands(List<Tag> changedTags) {} 617 628 } 618 629 … … 622 633 return false; 623 634 } 624 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {}635 @Override public void addCommands(List<Tag> changedTags) {} 625 636 } 626 637 … … 630 641 631 642 @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) { return false; } 632 @Override public void addCommands( Collection<OsmPrimitive> sel, List<Command> cmds) {633 c mds.add(newChangePropertyCommand(sel,key, value != null && !value.equals("") ? value : null));643 @Override public void addCommands(List<Tag> changedTags) { 644 changedTags.add(new Tag(key, value != null && !value.equals("") ? value : null)); 634 645 } 635 646 } … … 885 896 } 886 897 p.add(items, GBC.eol().fill()); 887 if (selected.size() == 0) { 898 if (selected.size() == 0 && !supportsRelation()) { 888 899 setEnabledRec(items, false); 889 900 } … … 924 935 if (Main.main == null) return; 925 936 if (Main.main.getCurrentDataSet() == null) return; 926 Collection<OsmPrimitive> sel = createSelection(Main.main.getCurrentDataSet().getSelected()); 937 938 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); 939 int answer = showDialog(sel, supportsRelation()); 940 941 if (sel.size() != 0 && answer == DIALOG_ANSWER_APPLY) { 942 Command cmd = createCommand(sel, getChangedTags()); 943 if (cmd != null) { 944 Main.main.undoRedo.add(cmd); 945 } 946 } else if (answer == DIALOG_ANSWER_NEW_RELATION) { 947 List<Command> cmds = new ArrayList<Command>(2); 948 final Relation r = new Relation(); 949 cmds.add(new AddCommand(r)); 950 Command cmd = createCommand(Collections.<OsmPrimitive>singletonList(r), getChangedTags()); 951 if (cmd != null) { 952 cmds.add(cmd); 953 } 954 Main.main.undoRedo.add(new SequenceCommand(tr("Add relation"), cmds)); 955 SwingUtilities.invokeLater(new Runnable() { 956 @Override 957 public void run() { 958 // Relation list dialog has to be updated first for selectRelation to work 959 Main.map.relationListDialog.selectRelation(r); 960 } 961 }); 962 } 963 Main.main.getCurrentDataSet().setSelected(Main.main.getCurrentDataSet().getSelected()); // force update 964 965 } 966 967 public int showDialog(Collection<OsmPrimitive> selection, final boolean showNewRelation) { 968 Collection<OsmPrimitive> sel = createSelection(selection); 927 969 PresetPanel p = createPanel(sel); 928 970 if (p == null) 929 return; 971 return DIALOG_ANSWER_CANCEL; 930 972 931 973 int answer = 1; … … 944 986 super(Main.parent, 945 987 title, 946 new String[] { tr("Apply Preset"), tr("Cancel") }, 947 true); 988 showNewRelation? 989 new String[] { tr("Apply Preset"), tr("New relation"), tr("Cancel") }: 990 new String[] { tr("Apply Preset"), tr("Cancel") }, 991 true); 948 992 contentInsets = new Insets(10,5,0,5); 949 setButtonIcons(new String[] {"ok.png", "cancel.png" }); 993 if (showNewRelation) { 994 setButtonIcons(new String[] {"ok.png", "dialogs/addrelation.png", "cancel.png" }); 995 } else { 996 setButtonIcons(new String[] {"ok.png", "cancel.png" }); 997 } 950 998 setContent(content); 951 999 setDefaultButton(1); … … 959 1007 answer = new PresetDialog(p, title, (sel.size() == 0)).getValue(); 960 1008 } 961 if (sel.size() != 0 && answer == 1) { 962 Command cmd = createCommand(sel); 963 if (cmd != null) { 964 Main.main.undoRedo.add(cmd); 965 } 966 } 967 Main.main.getCurrentDataSet().setSelected(Main.main.getCurrentDataSet().getSelected()); // force update 1009 if (!showNewRelation && answer == 2) 1010 return DIALOG_ANSWER_CANCEL; 1011 else 1012 return answer; 968 1013 } 969 1014 … … 1010 1055 } 1011 1056 1012 private Command createCommand(Collection<OsmPrimitive> sel) { 1013 List<Command> cmds = new LinkedList<Command>(); 1014 for (Item i : data) { 1015 i.addCommands(sel, cmds); 1016 } 1057 public List<Tag> getChangedTags() { 1058 List<Tag> result = new ArrayList<Tag>(); 1059 for (Item i: data) { 1060 i.addCommands(result); 1061 } 1062 return result; 1063 } 1064 1065 public static Command createCommand(Collection<OsmPrimitive> sel, List<Tag> changedTags) { 1066 List<Command> cmds = new ArrayList<Command>(); 1067 for (Tag tag: changedTags) { 1068 if (!tag.getValue().isEmpty()) { 1069 cmds.add(new ChangePropertyCommand(sel, tag.getKey(), tag.getValue())); 1070 } 1071 } 1072 1017 1073 if (cmds.size() == 0) 1018 1074 return null; … … 1023 1079 } 1024 1080 1081 private boolean supportsRelation() { 1082 return types == null || types.contains(PresetType.RELATION); 1083 } 1084 1025 1085 protected void updateEnabledState() { 1026 1086 setEnabled(Main.main != null && Main.main.getCurrentDataSet() != null); … … 1038 1098 updateEnabledState(); 1039 1099 } 1100 1101 @Override 1102 public String toString() { 1103 return (types == null?"":types) + " " + name; 1104 } 1040 1105 } -
trunk/src/org/openstreetmap/josm/gui/tagging/tagging-preset.xsd
r3479 r3518 105 105 <attribute name="delete_if_empty" type="boolean" /> 106 106 <attribute name="use_last_as_default" type="boolean" /> 107 <attribute name="required" type="boolean"/> 107 108 108 109 <attribute name="type" use="prohibited"/> … … 121 122 <attribute name="delete_if_empty" type="boolean" /> 122 123 <attribute name="display_values" type="string"/> 124 <attribute name="required" type="boolean"/> 123 125 124 126 <attribute name="type" use="prohibited"/> … … 136 138 <attribute name="delete_if_empty" type="boolean" /> 137 139 <attribute name="use_last_as_default" type="boolean" /> 140 <attribute name="required" type="boolean"/> 138 141 139 142 <attribute name="name" use="prohibited"/>
Note:
See TracChangeset
for help on using the changeset viewer.