- Timestamp:
- 2013-01-27T14:36:50+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r5643 r5675 513 513 } 514 514 515 private static String getValue(Component comp) { 516 if (comp instanceof JosmComboBox) { 517 return ((JosmComboBox) comp).getEditor().getItem().toString(); 518 } else if (comp instanceof JTextField) { 519 return ((JTextField) comp).getText(); 520 } else if (comp instanceof JPanel) { 521 return getValue(((JPanel)comp).getComponent(0)); 522 } else { 523 return null; 524 } 525 } 526 515 527 @Override 516 528 public void addCommands(List<Tag> changedTags) { 517 529 518 530 // return if unchanged 519 String v = null; 520 if (value instanceof JosmComboBox) { 521 v = ((JosmComboBox) value).getEditor().getItem().toString(); 522 } else if (value instanceof JTextField) { 523 v = ((JTextField) value).getText(); 524 } else if (value instanceof JPanel) { 525 // this is what was alluded to with "ugly fashion" above. 526 v = ((JTextField) (((JPanel)value).getComponent(0))).getText(); 527 } else { 531 String v = getValue(value); 532 if (v == null) { 528 533 System.err.println("No 'last value' support for component " + value); 529 534 return; 530 535 } 531 536 532 537 v = v.trim(); 533 538
Note:
See TracChangeset
for help on using the changeset viewer.