- Timestamp:
- 2013-10-25T18:39:02+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r5143 r6324 36 36 /** 37 37 * Key and value pairs. If value is <code>null</code>, delete all key references with the given 38 * key. Otherwise, change the properties of all objects to the given value or create keys of38 * key. Otherwise, change the tags of all objects to the given value or create keys of 39 39 * those objects that do not have the key yet. 40 40 */ … … 42 42 43 43 /** 44 * Creates a command to change multiple properties of multiple objects44 * Creates a command to change multiple tags of multiple objects 45 45 * 46 46 * @param objects the objects to modify 47 * @param tags the properties to set47 * @param tags the tags to set 48 48 */ 49 49 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, AbstractMap<String, String> tags) { … … 55 55 56 56 /** 57 * Creates a command to change one propertyof multiple objects57 * Creates a command to change one tag of multiple objects 58 58 * 59 59 * @param objects the objects to modify 60 * @param key the key of the propertyto set60 * @param key the key of the tag to set 61 61 * @param value the value of the key to set 62 62 */ … … 69 69 70 70 /** 71 * Creates a command to change on propertyof one object71 * Creates a command to change one tag of one object 72 72 * 73 73 * @param object the object to modify 74 * @param key the key of the propertyto set74 * @param key the key of the tag to set 75 75 * @param value the value of the key to set 76 76 */ … … 180 180 181 181 if (allnull) { 182 text = tr("Deleted {0} properties for {1} objects", tags.size(), objects.size());182 text = tr("Deleted {0} tags for {1} objects", tags.size(), objects.size()); 183 183 } else 184 text = tr("Set {0} properties for {1} objects", tags.size(), objects.size());184 text = tr("Set {0} tags for {1} objects", tags.size(), objects.size()); 185 185 } 186 186 return text; -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRenderer.java
r6314 r6324 19 19 20 20 /** 21 * Cell renderer of properties table.21 * Cell renderer of tags table. 22 22 * @since 6314 23 23 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r6314 r6324 99 99 100 100 /** 101 * This dialog displays the properties of the current selected primitives.101 * This dialog displays the tags of the current selected primitives. 102 102 * 103 103 * If no object is selected, the dialog list is empty. 104 * If only one is selected, all properties of this object are selected.105 * If more than one object are selected, the sum of all properties are displayed. If the106 * different objects share the same property, the shared value is displayed. If they have104 * If only one is selected, all tags of this object are selected. 105 * If more than one object are selected, the sum of all tags are displayed. If the 106 * different objects share the same tag, the shared value is displayed. If they have 107 107 * different values, all of them are put in a combo box and the string "<different>" 108 108 * is displayed in italic. 109 109 * 110 * Below the list, the user can click on an add, modify and delete propertybutton to110 * Below the list, the user can click on an add, modify and delete tag button to 111 111 * edit the table selection value. 112 112 * … … 123 123 124 124 /** 125 * The propertydata of selected objects.126 */ 127 private final DefaultTableModel propertyData = new ReadOnlyTableModel();125 * The tag data of selected objects. 126 */ 127 private final DefaultTableModel tagData = new ReadOnlyTableModel(); 128 128 129 129 /** … … 133 133 134 134 /** 135 * The properties table. 136 */ 137 private final JTable propertyTable = new JTable(propertyData); 135 * The tags table. 136 */ 137 private final JTable tagTable = new JTable(tagData); 138 138 139 /** 139 140 * The membership table. … … 142 143 143 144 // Popup menus 144 private final JPopupMenu propertyMenu = new JPopupMenu();145 private final JPopupMenu tagMenu = new JPopupMenu(); 145 146 private final JPopupMenu membershipMenu = new JPopupMenu(); 146 147 147 148 // Popup menu handlers 148 private final PopupMenuHandler propertyMenuHandler = new PopupMenuHandler(propertyMenu);149 private final PopupMenuHandler tagMenuHandler = new PopupMenuHandler(tagMenu); 149 150 private final PopupMenuHandler membershipMenuHandler = new PopupMenuHandler(membershipMenu); 150 151 151 152 private final Map<String, Map<String, Integer>> valueCount = new TreeMap<String, Map<String, Integer>>(); 152 153 /** 153 * This sub-object is responsible for all adding and editing of properties154 */ 155 private final TagEditHelper editHelper = new TagEditHelper( propertyData, valueCount);154 * This sub-object is responsible for all adding and editing of tags 155 */ 156 private final TagEditHelper editHelper = new TagEditHelper(tagData, valueCount); 156 157 157 158 private final DataSetListenerAdapter dataChangedAdapter = new DataSetListenerAdapter(this); … … 202 203 */ 203 204 private final JLabel selectSth = new JLabel("<html><p>" 204 + tr("Select objects for which to change properties.") + "</p></html>");205 + tr("Select objects for which to change tags.") + "</p></html>"); 205 206 206 207 private PresetHandler presetHandler = new PresetHandler() { … … 224 225 */ 225 226 public PropertiesDialog(MapFrame mapFrame) { 226 super(tr(" Properties/Memberships"), "propertiesdialog", tr("Properties for selected objects."),227 Shortcut.registerShortcut("subwindow:properties", tr("Toggle: {0}", tr(" Properties/Memberships")), KeyEvent.VK_P,227 super(tr("Tags/Memberships"), "propertiesdialog", tr("Tags for selected objects."), 228 Shortcut.registerShortcut("subwindow:properties", tr("Toggle: {0}", tr("Tags/Memberships")), KeyEvent.VK_P, 228 229 Shortcut.ALT_SHIFT), 150, true); 229 230 230 setup PropertiesMenu();231 build PropertiesTable();231 setupTagsMenu(); 232 buildTagsTable(); 232 233 233 234 setupMembershipMenu(); … … 244 245 } 245 246 bothTables.add(selectSth, GBC.eol().fill().insets(10, 10, 10, 10)); 246 bothTables.add( propertyTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL));247 bothTables.add( propertyTable, GBC.eol().fill(GBC.BOTH));247 bothTables.add(tagTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL)); 248 bothTables.add(tagTable, GBC.eol().fill(GBC.BOTH)); 248 249 bothTables.add(membershipTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL)); 249 250 bothTables.add(membershipTable, GBC.eol().fill(GBC.BOTH)); … … 255 256 256 257 // Let the action know when selection in the tables change 257 propertyTable.getSelectionModel().addListSelectionListener(editAction);258 tagTable.getSelectionModel().addListSelectionListener(editAction); 258 259 membershipTable.getSelectionModel().addListSelectionListener(editAction); 259 propertyTable.getSelectionModel().addListSelectionListener(deleteAction);260 tagTable.getSelectionModel().addListSelectionListener(deleteAction); 260 261 membershipTable.getSelectionModel().addListSelectionListener(deleteAction); 261 262 … … 266 267 267 268 MouseClickWatch mouseClickWatch = new MouseClickWatch(); 268 propertyTable.addMouseListener(mouseClickWatch);269 tagTable.addMouseListener(mouseClickWatch); 269 270 membershipTable.addMouseListener(mouseClickWatch); 270 271 scrollPane.addMouseListener(mouseClickWatch); … … 278 279 } 279 280 280 private void build PropertiesTable() {281 // setting up the properties table282 283 propertyData.setColumnIdentifiers(new String[]{tr("Key"),tr("Value")});284 propertyTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);285 propertyTable.getTableHeader().setReorderingAllowed(false);281 private void buildTagsTable() { 282 // setting up the tags table 283 284 tagData.setColumnIdentifiers(new String[]{tr("Key"),tr("Value")}); 285 tagTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 286 tagTable.getTableHeader().setReorderingAllowed(false); 286 287 287 288 PropertiesCellRenderer cellRenderer = new PropertiesCellRenderer(); 288 propertyTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer);289 propertyTable.getColumnModel().getColumn(1).setCellRenderer(cellRenderer);289 tagTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); 290 tagTable.getColumnModel().getColumn(1).setCellRenderer(cellRenderer); 290 291 } 291 292 … … 415 416 416 417 /** 417 * creates the popup menu @field propertyMenu and its launcher on propertytable418 */ 419 private void setup PropertiesMenu() {420 propertyMenu.add(pasteValueAction);421 propertyMenu.add(copyValueAction);422 propertyMenu.add(copyKeyValueAction);423 propertyMenu.add(copyAllKeyValueAction);424 propertyMenu.addSeparator();425 propertyMenu.add(searchActionAny);426 propertyMenu.add(searchActionSame);427 propertyMenu.addSeparator();428 propertyMenu.add(helpAction);429 propertyTable.addMouseListener(new PopupMenuLauncher(propertyMenu));418 * creates the popup menu @field tagMenu and its launcher on tag table 419 */ 420 private void setupTagsMenu() { 421 tagMenu.add(pasteValueAction); 422 tagMenu.add(copyValueAction); 423 tagMenu.add(copyKeyValueAction); 424 tagMenu.add(copyAllKeyValueAction); 425 tagMenu.addSeparator(); 426 tagMenu.add(searchActionAny); 427 tagMenu.add(searchActionSame); 428 tagMenu.addSeparator(); 429 tagMenu.add(helpAction); 430 tagTable.addMouseListener(new PopupMenuLauncher(tagMenu)); 430 431 } 431 432 … … 436 437 437 438 // ENTER = editAction, open "edit" dialog 438 propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)439 tagTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 439 440 .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),"onTableEnter"); 440 propertyTable.getActionMap().put("onTableEnter",editAction);441 tagTable.getActionMap().put("onTableEnter",editAction); 441 442 membershipTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 442 443 .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),"onTableEnter"); 443 444 membershipTable.getActionMap().put("onTableEnter",editAction); 444 445 445 // INSERT button = addAction, open "add property" dialog446 propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)446 // INSERT button = addAction, open "add tag" dialog 447 tagTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 447 448 .put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0),"onTableInsert"); 448 propertyTable.getActionMap().put("onTableInsert",addAction);449 tagTable.getActionMap().put("onTableInsert",addAction); 449 450 450 451 // unassign some standard shortcuts for JTable to allow upload / download 451 InputMapUtils.unassignCtrlShiftUpDown( propertyTable, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);452 InputMapUtils.unassignCtrlShiftUpDown(tagTable, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 452 453 453 454 // unassign some standard shortcuts for correct copy-pasting, fix #8508 454 propertyTable.setTransferHandler(null);455 456 propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)455 tagTable.setTransferHandler(null); 456 457 tagTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 457 458 .put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),"onCopy"); 458 propertyTable.getActionMap().put("onCopy",copyKeyValueAction);459 tagTable.getActionMap().put("onCopy",copyKeyValueAction); 459 460 460 461 // allow using enter to add tags for all look&feel configurations … … 557 558 if (!isVisible()) 558 559 return; 559 if ( propertyTable == null)560 if (tagTable == null) 560 561 return; // selection changed may be received in base class constructor before init 561 if ( propertyTable.getCellEditor() != null) {562 propertyTable.getCellEditor().cancelCellEditing();562 if (tagTable.getCellEditor() != null) { 563 tagTable.getCellEditor().cancelCellEditing(); 563 564 } 564 565 … … 566 567 Relation selectedRelation = null; 567 568 selectedTag = editHelper.getChangedKey(); // select last added or last edited key by default 568 if (selectedTag == null && propertyTable.getSelectedRowCount() == 1) {569 selectedTag = (String) propertyData.getValueAt(propertyTable.getSelectedRow(), 0);569 if (selectedTag == null && tagTable.getSelectedRowCount() == 1) { 570 selectedTag = (String)tagData.getValueAt(tagTable.getSelectedRow(), 0); 570 571 } 571 572 if (membershipTable.getSelectedRowCount() == 1) { … … 573 574 } 574 575 575 // re-load propertydata576 propertyData.setRowCount(0);576 // re-load tag data 577 tagData.setRowCount(0); 577 578 578 579 final boolean displayDiscardableKeys = Main.pref.getBoolean("display.discardable-keys", false); … … 606 607 e.getValue().put("", newSelection.size() - count); 607 608 } 608 propertyData.addRow(new Object[]{e.getKey(), e.getValue()});609 tagData.addRow(new Object[]{e.getKey(), e.getValue()}); 609 610 tags.put(e.getKey(), e.getValue().size() == 1 610 611 ? e.getValue().keySet().iterator().next() : tr("<different>")); … … 655 656 656 657 boolean hasSelection = !newSelection.isEmpty(); 657 boolean hasTags = hasSelection && propertyData.getRowCount() > 0;658 boolean hasTags = hasSelection && tagData.getRowCount() > 0; 658 659 boolean hasMemberships = hasSelection && membershipData.getRowCount() > 0; 659 660 btnAdd.setEnabled(hasSelection); 660 661 btnEdit.setEnabled(hasTags || hasMemberships); 661 662 btnDel.setEnabled(hasTags || hasMemberships); 662 propertyTable.setVisible(hasTags);663 propertyTable.getTableHeader().setVisible(hasTags);663 tagTable.setVisible(hasTags); 664 tagTable.getTableHeader().setVisible(hasTags); 664 665 selectSth.setVisible(!hasSelection); 665 666 pluginHook.setVisible(hasSelection); 666 667 667 668 int selectedIndex; 668 if (selectedTag != null && (selectedIndex = findRow( propertyData, selectedTag)) != -1) {669 propertyTable.changeSelection(selectedIndex, 0, false, false);669 if (selectedTag != null && (selectedIndex = findRow(tagData, selectedTag)) != -1) { 670 tagTable.changeSelection(selectedIndex, 0, false, false); 670 671 } else if (selectedRelation != null && (selectedIndex = findRow(membershipData, selectedRelation)) != -1) { 671 672 membershipTable.changeSelection(selectedIndex, 0, false, false); 672 673 } else if(hasTags) { 673 propertyTable.changeSelection(0, 0, false, false);674 tagTable.changeSelection(0, 0, false, false); 674 675 } else if(hasMemberships) { 675 676 membershipTable.changeSelection(0, 0, false, false); 676 677 } 677 678 678 if( propertyData.getRowCount() != 0 || membershipData.getRowCount() != 0) {679 setTitle(tr(" Properties: {0} / Memberships: {1}",680 propertyData.getRowCount(), membershipData.getRowCount()));679 if(tagData.getRowCount() != 0 || membershipData.getRowCount() != 0) { 680 setTitle(tr("Tags: {0} / Memberships: {1}", 681 tagData.getRowCount(), membershipData.getRowCount())); 681 682 } else { 682 setTitle(tr(" Properties / Memberships"));683 setTitle(tr("Tags / Memberships")); 683 684 } 684 685 } … … 708 709 709 710 /** 710 * Replies the propertypopup menu handler.711 * @return The propertypopup menu handler711 * Replies the tag popup menu handler. 712 * @return The tag popup menu handler 712 713 */ 713 714 public PopupMenuHandler getPropertyPopupMenuHandler() { 714 return propertyMenuHandler;715 return tagMenuHandler; 715 716 } 716 717 717 718 @SuppressWarnings("unchecked") 718 719 public Tag getSelectedProperty() { 719 int row = propertyTable.getSelectedRow();720 int row = tagTable.getSelectedRow(); 720 721 if (row == -1) return null; 721 TreeMap<String, Integer> map = (TreeMap<String, Integer>) propertyData.getValueAt(row, 1);722 TreeMap<String, Integer> map = (TreeMap<String, Integer>) tagData.getValueAt(row, 1); 722 723 return new Tag( 723 propertyData.getValueAt(row, 0).toString(),724 tagData.getValueAt(row, 0).toString(), 724 725 map.size() > 1 ? "" : map.keySet().iterator().next()); 725 726 } … … 749 750 { 750 751 // single click, clear selection in other table not clicked in 751 if (e.getSource() == propertyTable) {752 if (e.getSource() == tagTable) { 752 753 membershipTable.clearSelection(); 753 754 } else if (e.getSource() == membershipTable) { 754 propertyTable.clearSelection();755 } 756 } 757 // double click, edit or add property758 else if (e.getSource() == propertyTable)755 tagTable.clearSelection(); 756 } 757 } 758 // double click, edit or add tag 759 else if (e.getSource() == tagTable) 759 760 { 760 int row = propertyTable.rowAtPoint(e.getPoint());761 int row = tagTable.rowAtPoint(e.getPoint()); 761 762 if (row > -1) { 762 boolean focusOnKey = ( propertyTable.columnAtPoint(e.getPoint()) == 0);763 editHelper.edit Property(row, focusOnKey);763 boolean focusOnKey = (tagTable.columnAtPoint(e.getPoint()) == 0); 764 editHelper.editTag(row, focusOnKey); 764 765 } else { 765 editHelper.add Property();766 editHelper.addTag(); 766 767 btnAdd.requestFocusInWindow(); 767 768 } … … 774 775 else 775 776 { 776 editHelper.add Property();777 editHelper.addTag(); 777 778 btnAdd.requestFocusInWindow(); 778 779 } 779 780 } 780 781 @Override public void mousePressed(MouseEvent e) { 781 if (e.getSource() == propertyTable) {782 if (e.getSource() == tagTable) { 782 783 membershipTable.clearSelection(); 783 784 } else if (e.getSource() == membershipTable) { 784 propertyTable.clearSelection();785 tagTable.clearSelection(); 785 786 } 786 787 } … … 845 846 public DeleteAction() { 846 847 super(tr("Delete"), "dialogs/delete", tr("Delete the selected key in all objects"), 847 Shortcut.registerShortcut("properties:delete", tr("Delete Properties"), KeyEvent.VK_D,848 Shortcut.registerShortcut("properties:delete", tr("Delete Tags"), KeyEvent.VK_D, 848 849 Shortcut.ALT_CTRL_SHIFT), false); 849 850 updateEnabledState(); 850 851 } 851 852 852 protected void delete Properties(int[] rows){853 protected void deleteTags(int[] rows){ 853 854 // convert list of rows to HashMap (and find gap for nextKey) 854 855 HashMap<String, String> tags = new HashMap<String, String>(rows.length); 855 856 int nextKeyIndex = rows[0]; 856 857 for (int row : rows) { 857 String key = propertyData.getValueAt(row, 0).toString();858 String key = tagData.getValueAt(row, 0).toString(); 858 859 if (row == nextKeyIndex + 1) { 859 860 nextKeyIndex = row; // no gap yet … … 862 863 } 863 864 864 // find key to select after deleting other properties865 // find key to select after deleting other tags 865 866 String nextKey = null; 866 int rowCount = propertyData.getRowCount();867 int rowCount = tagData.getRowCount(); 867 868 if (rowCount > rows.length) { 868 869 if (nextKeyIndex == rows[rows.length-1]) { … … 873 874 nextKeyIndex++; 874 875 } 875 nextKey = (String) propertyData.getValueAt(nextKeyIndex, 0);876 nextKey = (String)tagData.getValueAt(nextKeyIndex, 0); 876 877 } 877 878 … … 881 882 membershipTable.clearSelection(); 882 883 if (nextKey != null) { 883 propertyTable.changeSelection(findRow(propertyData, nextKey), 0, false, false);884 tagTable.changeSelection(findRow(tagData, nextKey), 0, false, false); 884 885 } 885 886 } … … 912 913 Main.main.undoRedo.add(new ChangeCommand(cur, rel)); 913 914 914 propertyTable.clearSelection();915 tagTable.clearSelection(); 915 916 if (nextRelation != null) { 916 917 membershipTable.changeSelection(findRow(membershipData, nextRelation), 0, false, false); … … 920 921 @Override 921 922 public void actionPerformed(ActionEvent e) { 922 if ( propertyTable.getSelectedRowCount() > 0) {923 int[] rows = propertyTable.getSelectedRows();924 delete Properties(rows);923 if (tagTable.getSelectedRowCount() > 0) { 924 int[] rows = tagTable.getSelectedRows(); 925 deleteTags(rows); 925 926 } else if (membershipTable.getSelectedRowCount() > 0) { 926 927 int[] rows = membershipTable.getSelectedRows(); … … 935 936 protected void updateEnabledState() { 936 937 setEnabled( 937 ( propertyTable != null && propertyTable.getSelectedRowCount() >= 1)938 (tagTable != null && tagTable.getSelectedRowCount() >= 1) 938 939 || (membershipTable != null && membershipTable.getSelectedRowCount() > 0) 939 940 ); … … 952 953 public AddAction() { 953 954 super(tr("Add"), "dialogs/add", tr("Add a new key/value pair to all objects"), 954 Shortcut.registerShortcut("properties:add", tr("Add Property"), KeyEvent.VK_A,955 Shortcut.registerShortcut("properties:add", tr("Add Tag"), KeyEvent.VK_A, 955 956 Shortcut.ALT), false); 956 957 } … … 958 959 @Override 959 960 public void actionPerformed(ActionEvent e) { 960 editHelper.add Property();961 editHelper.addTag(); 961 962 btnAdd.requestFocusInWindow(); 962 963 } … … 969 970 public EditAction() { 970 971 super(tr("Edit"), "dialogs/edit", tr("Edit the value of the selected key for all objects"), 971 Shortcut.registerShortcut("properties:edit", tr("Edit Properties"), KeyEvent.VK_S,972 Shortcut.registerShortcut("properties:edit", tr("Edit Tags"), KeyEvent.VK_S, 972 973 Shortcut.ALT), false); 973 974 updateEnabledState(); … … 978 979 if (!isEnabled()) 979 980 return; 980 if ( propertyTable.getSelectedRowCount() == 1) {981 int row = propertyTable.getSelectedRow();982 editHelper.edit Property(row, false);981 if (tagTable.getSelectedRowCount() == 1) { 982 int row = tagTable.getSelectedRow(); 983 editHelper.editTag(row, false); 983 984 } else if (membershipTable.getSelectedRowCount() == 1) { 984 985 int row = membershipTable.getSelectedRow(); … … 990 991 protected void updateEnabledState() { 991 992 setEnabled( 992 ( propertyTable != null && propertyTable.getSelectedRowCount() == 1)993 (tagTable != null && tagTable.getSelectedRowCount() == 1) 993 994 ^ (membershipTable != null && membershipTable.getSelectedRowCount() == 1) 994 995 ); … … 1015 1016 final List<URI> uris = new ArrayList<URI>(); 1016 1017 int row; 1017 if ( propertyTable.getSelectedRowCount() == 1) {1018 row = propertyTable.getSelectedRow();1019 String key = URLEncoder.encode( propertyData.getValueAt(row, 0).toString(), "UTF-8");1018 if (tagTable.getSelectedRowCount() == 1) { 1019 row = tagTable.getSelectedRow(); 1020 String key = URLEncoder.encode(tagData.getValueAt(row, 0).toString(), "UTF-8"); 1020 1021 @SuppressWarnings("unchecked") 1021 Map<String, Integer> m = (Map<String, Integer>) propertyData.getValueAt(row, 1);1022 Map<String, Integer> m = (Map<String, Integer>) tagData.getValueAt(row, 1); 1022 1023 String val = URLEncoder.encode(m.entrySet().iterator().next().getKey(), "UTF-8"); 1023 1024 … … 1106 1107 @Override 1107 1108 public void actionPerformed(ActionEvent ae) { 1108 if ( propertyTable.getSelectedRowCount() != 1)1109 if (tagTable.getSelectedRowCount() != 1) 1109 1110 return; 1110 String key = propertyData.getValueAt(propertyTable.getSelectedRow(), 0).toString();1111 String key = tagData.getValueAt(tagTable.getSelectedRow(), 0).toString(); 1111 1112 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); 1112 1113 String clipboard = Utils.getClipboardContent(); … … 1123 1124 @Override 1124 1125 public void actionPerformed(ActionEvent ae) { 1125 int[] rows = propertyTable.getSelectedRows();1126 int[] rows = tagTable.getSelectedRows(); 1126 1127 Set<String> values = new TreeSet<String>(); 1127 1128 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); … … 1129 1130 1130 1131 for (int row: rows) { 1131 String key = propertyData.getValueAt(row, 0).toString();1132 String key = tagData.getValueAt(row, 0).toString(); 1132 1133 if (sel.isEmpty()) 1133 1134 return; … … 1206 1207 @Override 1207 1208 public void actionPerformed(ActionEvent e) { 1208 if ( propertyTable.getSelectedRowCount() != 1)1209 if (tagTable.getSelectedRowCount() != 1) 1209 1210 return; 1210 String key = propertyData.getValueAt(propertyTable.getSelectedRow(), 0).toString();1211 String key = tagData.getValueAt(tagTable.getSelectedRow(), 0).toString(); 1211 1212 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); 1212 1213 if (sel.isEmpty()) -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r6316 r6324 82 82 */ 83 83 class TagEditHelper { 84 private final DefaultTableModel propertyData;84 private final DefaultTableModel tagData; 85 85 private final Map<String, Map<String, Integer>> valueCount; 86 86 … … 113 113 114 114 TagEditHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { 115 this. propertyData = propertyData;115 this.tagData = propertyData; 116 116 this.valueCount = valueCount; 117 117 } … … 121 121 * to the dataset, of course). 122 122 */ 123 public void add Property() {123 public void addTag() { 124 124 changedKey = null; 125 125 if (Main.map.mapMode instanceof DrawAction) { … … 144 144 145 145 /** 146 * Edit the value in the properties table row146 * Edit the value in the tags table row 147 147 * @param row The row of the table from which the value is edited. 148 148 * @param focusOnKey Determines if the initial focus should be set on key instead of value 149 149 * @since 5653 150 150 */ 151 public void edit Property(final int row, boolean focusOnKey) {151 public void editTag(final int row, boolean focusOnKey) { 152 152 changedKey = null; 153 153 sel = Main.main.getCurrentDataSet().getSelected(); 154 154 if (sel.isEmpty()) return; 155 155 156 String key = propertyData.getValueAt(row, 0).toString();156 String key = tagData.getValueAt(row, 0).toString(); 157 157 objKey=key; 158 158 159 159 @SuppressWarnings("unchecked") 160 160 final EditTagDialog editDialog = new EditTagDialog(key, row, 161 (Map<String, Integer>) propertyData.getValueAt(row, 1), focusOnKey);161 (Map<String, Integer>) tagData.getValueAt(row, 1), focusOnKey); 162 162 editDialog.showDialog(); 163 163 if (editDialog.getValue() !=1 ) return; … … 540 540 itemToSelect = item; 541 541 } 542 for (int i = 0; i < propertyData.getRowCount(); ++i) {543 if (item.getValue().equals( propertyData.getValueAt(i, 0))) {542 for (int i = 0; i < tagData.getRowCount(); ++i) { 543 if (item.getValue().equals(tagData.getValueAt(i, 0))) { 544 544 if (itemToSelect == item) { 545 545 itemToSelect = null; … … 748 748 // Disable action if its key is already set on the object (the key being absent from the keys list for this reason 749 749 // performing this action leads to autocomplete to the next key (see #7671 comments) 750 for (int j = 0; j < propertyData.getRowCount(); ++j) {751 if (t.getKey().equals( propertyData.getValueAt(j, 0))) {750 for (int j = 0; j < tagData.getRowCount(); ++j) { 751 if (t.getKey().equals(tagData.getValueAt(j, 0))) { 752 752 action.setEnabled(false); 753 753 break;
Note:
See TracChangeset
for help on using the changeset viewer.