Changeset 17745 in osm for applications
- Timestamp:
- 2009-09-21T20:15:26+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/addrinterpolation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/addrinterpolation/build.xml
r17735 r17745 91 91 <attribute name="Plugin-Description" value="Group common Address Interpolation inputs in a single dialog,"/> 92 92 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AddrInterpolation"/> 93 <attribute name="Plugin-Mainversion" value="21 61"/>93 <attribute name="Plugin-Mainversion" value="2100"/> 94 94 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 95 95 </manifest> -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java
r17735 r17745 79 79 private JTextField postCodeTextField = null; 80 80 private JTextField countryTextField = null; 81 private JTextField allTextField = null;81 private JTextField fullTextField = null; 82 82 83 83 private boolean relationChanged = false; // Whether to re-trigger data changed for relation … … 134 134 lastPostCode = postCodeTextField.getText(); 135 135 lastCountry = countryTextField.getText(); 136 lastFullAddress = allTextField.getText();136 lastFullAddress = fullTextField.getText(); 137 137 138 138 } … … 201 201 AddEditControlRows(textLabels, editFields, editControlsPane); 202 202 203 JPanel optionPanel = new JPanel(new BorderLayout());204 205 Border dividerBorder = BorderFactory.createEtchedBorder();206 TitledBorder titleBorder = BorderFactory.createTitledBorder(dividerBorder, tr("Optional Information:"),207 TitledBorder.LEFT, TitledBorder.BOTTOM);208 209 optionPanel.setBorder(titleBorder);210 editControlsPane.add(optionPanel, c);211 212 203 // Address interpolation fields not valid if Way not selected 213 204 if (addrInterpolationWay == null) { … … 217 208 } 218 209 210 211 212 JPanel optionPanel = CreateOptionalFields(); 213 c.gridx = 0; 214 c.gridwidth = 2; // # of columns to span 215 c.fill = GridBagConstraints.BOTH; // Full width 216 c.gridwidth = GridBagConstraints.REMAINDER; //end row 217 218 editControlsPane.add(optionPanel, c); 219 220 221 KeyAdapter enterProcessor = new KeyAdapter() { 222 @Override 223 public void keyPressed(KeyEvent e) { 224 if (e.getKeyCode() == KeyEvent.VK_ENTER) { 225 if (ValidateAndSave()) { 226 dialog.dispose(); 227 } 228 229 } 230 } 231 }; 232 233 // Make Enter == OK click on fields using this adapter 234 endTextField.addKeyListener(enterProcessor); 235 cityTextField.addKeyListener(enterProcessor); 236 237 238 239 if (houseNumberNodes.size() > 0) { 240 JLabel houseNumberNodeNote = new JLabel(tr("Will associate {0} additional house number nodes", 241 houseNumberNodes.size() )); 242 editControlsPane.add(houseNumberNodeNote, c); 243 } 244 245 editControlsPane.add(new UrlLabel("http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AddrInterpolation", 246 tr("More information about this feature")), c); 247 248 249 c.gridx = 0; 250 c.gridwidth = 1; //next-to-last 251 c.fill = GridBagConstraints.NONE; //reset to default 252 c.weightx = 0.0; 253 c.insets = new Insets(15, 0, 0, 0); 254 c.anchor = GridBagConstraints.LINE_END; 255 JButton okButton = new JButton(tr("OK"), ImageProvider.get("ok")); 256 editControlsPane.add(okButton, c); 257 258 c.gridx = 1; 259 c.gridwidth = GridBagConstraints.REMAINDER; //end row 260 c.weightx = 1.0; 261 c.anchor = GridBagConstraints.LINE_START; 262 263 JButton cancelButton = new JButton(tr("Cancel"), ImageProvider.get("cancel")); 264 editControlsPane.add(cancelButton, c); 265 266 okButton.setActionCommand("ok"); 267 okButton.addActionListener(this); 268 cancelButton.setActionCommand("cancel"); 269 cancelButton.addActionListener(this); 270 271 return editControlsPane; 272 } 273 274 275 276 // Create optional control fields in a group box 277 private JPanel CreateOptionalFields() { 278 279 JPanel editControlsPane = new JPanel(); 280 GridBagLayout gridbag = new GridBagLayout(); 281 282 editControlsPane.setLayout(gridbag); 283 284 editControlsPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 285 219 286 JLabel[] optionalTextLabels = {new JLabel(tr("City:")), 220 287 new JLabel(tr("State:")), 221 288 new JLabel(tr("Post Code:")), 222 289 new JLabel(tr("Country:")), 223 new JLabel(tr(" All:"))};290 new JLabel(tr("Full Address:"))}; 224 291 cityTextField = new JTextField(lastCity, 100); 225 292 stateTextField = new JTextField(lastState, 100); 226 293 postCodeTextField = new JTextField(lastPostCode, 20); 227 294 countryTextField = new JTextField(lastCountry, 2); 228 allTextField = new JTextField(lastFullAddress, 300);295 fullTextField = new JTextField(lastFullAddress, 300); 229 296 230 297 // Special processing for addr:country code, max length and uppercase … … 239 306 } else if (length > jtextfield.getColumns()) { 240 307 // show error message ?? 308 e.consume(); 241 309 } else { 242 310 // Accept key; convert to upper case … … 248 316 }); 249 317 250 251 KeyAdapter enterProcessor = new KeyAdapter() { 252 @Override 253 public void keyPressed(KeyEvent e) { 254 if (e.getKeyCode() == KeyEvent.VK_ENTER) { 255 if (ValidateAndSave()) { 256 dialog.dispose(); 257 } 258 259 } 260 } 261 }; 262 263 // Make Enter == OK click on fields using this adapter 264 endTextField.addKeyListener(enterProcessor); 265 cityTextField.addKeyListener(enterProcessor); 266 267 268 Component[] optionalEditFields = {cityTextField, stateTextField, postCodeTextField, countryTextField, allTextField}; 318 Component[] optionalEditFields = {cityTextField, stateTextField, postCodeTextField, countryTextField, fullTextField}; 269 319 AddEditControlRows(optionalTextLabels, optionalEditFields, editControlsPane); 270 320 271 321 272 322 273 c.gridx = 0; 274 c.gridwidth = 2; // # of columns to span 275 c.fill = GridBagConstraints.BOTH; // Full width 276 c.gridwidth = GridBagConstraints.REMAINDER; //end row 277 278 if (houseNumberNodes.size() > 0) { 279 JLabel houseNumberNodeNote = new JLabel(tr("Will associate {0} additional house number nodes", 280 houseNumberNodes.size() )); 281 editControlsPane.add(houseNumberNodeNote, c); 282 } 283 284 editControlsPane.add(new UrlLabel("http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AddrInterpolation", 285 tr("More information about this feature")), c); 286 287 288 c.gridx = 0; 289 c.gridwidth = 1; //next-to-last 290 c.fill = GridBagConstraints.NONE; //reset to default 291 c.weightx = 0.0; 292 c.insets = new Insets(15, 0, 0, 0); 293 c.anchor = GridBagConstraints.LINE_END; 294 JButton okButton = new JButton(tr("OK"), ImageProvider.get("ok")); 295 editControlsPane.add(okButton, c); 296 297 c.gridx = 1; 298 c.gridwidth = GridBagConstraints.REMAINDER; //end row 299 c.weightx = 1.0; 300 c.anchor = GridBagConstraints.LINE_START; 301 302 JButton cancelButton = new JButton(tr("Cancel"), ImageProvider.get("cancel")); 303 editControlsPane.add(cancelButton, c); 304 305 okButton.setActionCommand("ok"); 306 okButton.addActionListener(this); 307 cancelButton.setActionCommand("cancel"); 308 cancelButton.addActionListener(this); 309 310 return editControlsPane; 323 JPanel optionPanel = new JPanel(new BorderLayout()); 324 Border groupBox = BorderFactory.createEtchedBorder(); 325 TitledBorder titleBorder = BorderFactory.createTitledBorder(groupBox, tr("Optional Information:"), 326 TitledBorder.LEFT, TitledBorder.TOP); 327 328 optionPanel.setBorder(titleBorder); 329 optionPanel.add(editControlsPane, BorderLayout.CENTER); 330 331 return optionPanel; 311 332 } 312 333 … … 591 612 String postCode = ReadTextField(postCodeTextField); 592 613 String country = ReadTextField(countryTextField); 593 String fullAddress = ReadTextField( allTextField);614 String fullAddress = ReadTextField(fullTextField); 594 615 595 616 String selectedMethod = GetInterpolationMethod();
Note:
See TracChangeset
for help on using the changeset viewer.