Changeset 212 in josm for src/org/openstreetmap
- Timestamp:
- 2007-04-04T16:44:02+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/annotation/AnnotationPreset.java
r202 r212 48 48 public class AnnotationPreset extends AbstractAction { 49 49 50 private static interface Item { 51 void addToPanel(JPanel p); 52 void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds); 50 public static abstract class Item { 51 public boolean focus = false; 52 abstract void addToPanel(JPanel p); 53 abstract void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds); 54 boolean requestFocusInWindow() {return false;} 53 55 } 54 56 55 public static class Text implements Item {57 public static class Text extends Item { 56 58 public String key; 57 59 public String text; … … 61 63 private JTextField value = new JTextField(); 62 64 63 public void addToPanel(JPanel p) { 65 @Override public void addToPanel(JPanel p) { 64 66 value.setText(default_ == null ? "" : default_); 65 67 p.add(new JLabel(text), GBC.std().insets(0,0,10,0)); 66 68 p.add(value, GBC.eol().fill(GBC.HORIZONTAL)); 67 69 } 68 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 70 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 69 71 String v = value.getText(); 70 72 if (delete_if_empty && v.length() == 0) … … 72 74 cmds.add(new ChangePropertyCommand(sel, key, v)); 73 75 } 74 } 75 76 public static class Check implements Item { 76 @Override boolean requestFocusInWindow() {return value.requestFocusInWindow();} 77 } 78 79 public static class Check extends Item { 77 80 public String key; 78 81 public String text; … … 81 84 private JCheckBox check = new JCheckBox(); 82 85 83 public void addToPanel(JPanel p) { 86 @Override public void addToPanel(JPanel p) { 84 87 check.setSelected(default_); 85 88 check.setText(text); 86 89 p.add(check, GBC.eol().fill(GBC.HORIZONTAL)); 87 90 } 88 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 91 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 89 92 cmds.add(new ChangePropertyCommand(sel, key, check.isSelected() ? "true" : null)); 90 93 } 91 } 92 93 public static class Combo implements Item { 94 @Override boolean requestFocusInWindow() {return check.requestFocusInWindow();} 95 } 96 97 public static class Combo extends Item { 94 98 public String key; 95 99 public String text; … … 102 106 private JComboBox combo; 103 107 104 public void addToPanel(JPanel p) { 108 @Override public void addToPanel(JPanel p) { 105 109 combo = new JComboBox((display_values != null ? display_values : values).split(",")); 106 110 combo.setEditable(editable); … … 109 113 p.add(combo, GBC.eol().fill(GBC.HORIZONTAL)); 110 114 } 111 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 115 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 112 116 String v = combo.getSelectedIndex() == -1 ? null : values.split(",")[combo.getSelectedIndex()]; 113 117 String str = combo.isEditable()?combo.getEditor().getItem().toString() : v; … … 116 120 cmds.add(new ChangePropertyCommand(sel, key, str)); 117 121 } 118 } 119 120 public static class Label implements Item { 122 @Override boolean requestFocusInWindow() {return combo.requestFocusInWindow();} 123 } 124 125 public static class Label extends Item { 121 126 public String text; 122 127 123 public void addToPanel(JPanel p) { 128 @Override public void addToPanel(JPanel p) { 124 129 p.add(new JLabel(text), GBC.eol()); 125 130 } 126 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) {} 127 } 128 129 public static class Key implements Item {131 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) {} 132 } 133 134 public static class Key extends Item { 130 135 public String key; 131 136 public String value; 132 137 133 public void addToPanel(JPanel p) {} 134 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 138 @Override public void addToPanel(JPanel p) {} 139 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 135 140 cmds.add(new ChangePropertyCommand(sel, key, value != null && !value.equals("") ? value : null)); 136 141 } … … 252 257 if (p == null) 253 258 return; 254 int answer; 255 if (p.getComponentCount() == 0) 256 answer = JOptionPane.OK_OPTION; 257 else 258 answer = JOptionPane.showConfirmDialog(Main.parent, p, trn("Change {0} object", "Change {0} objects", sel.size(), sel.size()), JOptionPane.OK_CANCEL_OPTION); 259 int answer = JOptionPane.OK_OPTION; 260 if (p.getComponentCount() != 0) { 261 final JOptionPane optionPane = new JOptionPane(p, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ 262 @Override public void selectInitialValue() { 263 for (Item i : data) { 264 if (i.focus) { 265 System.out.println(i.requestFocusInWindow()); 266 return; 267 } 268 } 269 } 270 }; 271 optionPane.createDialog(Main.parent, trn("Change {0} object", "Change {0} objects", sel.size(), sel.size())).setVisible(true); 272 Object answerObj = optionPane.getValue(); 273 if (answerObj == null || answerObj == JOptionPane.UNINITIALIZED_VALUE || 274 (answerObj instanceof Integer && (Integer)answerObj != JOptionPane.OK_OPTION)) 275 answer = JOptionPane.CANCEL_OPTION; 276 } 259 277 if (answer == JOptionPane.OK_OPTION) { 260 278 Command cmd = createCommand(Main.ds.getSelected()); -
src/org/openstreetmap/josm/io/IncompleteDownloader.java
r175 r212 45 45 46 46 public void parse() throws SAXException, IOException { 47 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading incomplete ways...")); 47 48 Main.pleaseWaitDlg.progress.setMaximum(toDownload.size()); 48 49 Main.pleaseWaitDlg.progress.setValue(0); -
src/org/openstreetmap/josm/io/RawCsvReader.java
r113 r212 34 34 Collection<GpsPoint> data = new LinkedList<GpsPoint>(); 35 35 String formatStr = Main.pref.get("csv.importstring"); 36 if (formatStr == null) 36 if (formatStr == null || formatStr.equals("")) 37 37 formatStr = in.readLine(); 38 if (formatStr == null) 38 if (formatStr == null || formatStr.equals("")) 39 39 throw new SAXException(tr("Could not detect data format string.")); 40 40 -
src/org/openstreetmap/josm/tools/XmlObjectParser.java
r195 r212 115 115 } 116 116 } catch (Exception e) { 117 e.printStackTrace(); // !"§%$!"§ SAXException does not dump inner exceptions. 117 118 throw new SAXException(e); 118 119 }
Note:
See TracChangeset
for help on using the changeset viewer.