Changeset 34726 in osm
- Timestamp:
- 2018-11-18T20:27:55+01:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/CustomizePublicTransportStop
- Files:
-
- 8 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CreateStopAreaFromSelectedObjectOperation.java
r34501 r34726 10 10 import org.openstreetmap.josm.data.osm.Relation; 11 11 import org.openstreetmap.josm.data.osm.RelationMember; 12 import sun.security.provider.certpath.IndexedCollectionCertStore; 12 13 13 14 /** … … 95 96 * Setting of stop area from selected josm object 96 97 * 97 * @param s electedObject Selected josm object98 * @param stopArea Selected stop area 98 99 */ 99 100 public void fromSelectedObject(StopArea stopArea) { … … 156 157 if (getCurrentDataSet() == null) 157 158 return null; 158 OsmPrimitive selectedObject = getCurrentDataSet().getSelectedNodesAndWays().iterator().next(); 159 Collection<OsmPrimitive> selectedObjects = getCurrentDataSet().getSelectedNodesAndWays(); 160 if(!(null != selectedObjects && !selectedObjects.isEmpty())) 161 return null; 162 OsmPrimitive selectedObject = selectedObjects.iterator().next(); 159 163 if (selectedObject == null) 160 164 return null; -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CustomizePublicTransportStopDialog.java
r34501 r34726 8 8 import java.awt.GridBagLayout; 9 9 import java.awt.Insets; 10 import java.awt.event.ActionEvent; 11 import java.awt.event.ActionListener; 12 import java.awt.event.ItemEvent; 13 import java.awt.event.ItemListener; 10 import java.awt.event.*; 14 11 import java.util.HashMap; 15 12 … … 25 22 import org.openstreetmap.josm.gui.MainApplication; 26 23 24 27 25 /** 28 26 * Dialog for setting stop area properties … … 30 28 * @author Rodion Scherbakov 31 29 */ 32 public class CustomizePublicTransportStopDialog implements ActionListener, ItemListener {30 public class CustomizePublicTransportStopDialog implements ActionListener, ItemListener, KeyListener { 33 31 private static final String CANCEL_COMMAND = "cancel"; 34 32 private static final String SAVE_COMMAND = "save"; … … 37 35 private static final String AREA_CAPTION = "Area"; 38 36 private static final String COVER_CAPTION = "Cover"; 39 private static final String SHEL DER_CAPTION = "Shelder";37 private static final String SHELTER_CAPTION = "Shelter"; 40 38 private static final String BENCH_CAPTION = "Bench"; 41 39 private static final String RAILWAY_STOP_CAPTION = "Railway stop"; … … 80 78 private JCheckBox checkBoxIsTrainStop; 81 79 private JCheckBox checkBoxIsBench; 82 private JCheckBox checkBoxIsShel der;80 private JCheckBox checkBoxIsShelter; 83 81 private JCheckBox checkBoxIsCover; 84 82 private JCheckBox checkBoxIsArea; … … 152 150 jDialog.pack(); 153 151 jDialog.setLocationRelativeTo(frame); 152 153 jDialog.addKeyListener(this); 154 contentPane.addKeyListener(this); 155 154 156 } 155 157 … … 165 167 layoutCons.fill = GridBagConstraints.HORIZONTAL; 166 168 gridbag.setConstraints(label, layoutCons); 169 label.addKeyListener(this); 167 170 contentPane.add(label); 168 171 … … 173 176 layoutCons.fill = GridBagConstraints.HORIZONTAL; 174 177 gridbag.setConstraints(textFieldName, layoutCons); 178 textFieldName.addKeyListener(this); 175 179 contentPane.add(textFieldName); 176 180 … … 181 185 layoutCons.fill = GridBagConstraints.HORIZONTAL; 182 186 gridbag.setConstraints(labelNameEn, layoutCons); 187 labelNameEn.addKeyListener(this); 183 188 contentPane.add(labelNameEn); 184 189 … … 189 194 layoutCons.fill = GridBagConstraints.HORIZONTAL; 190 195 gridbag.setConstraints(textFieldNameEn, layoutCons); 196 textFieldNameEn.addKeyListener(this); 191 197 contentPane.add(textFieldNameEn); 192 198 … … 197 203 layoutCons.fill = GridBagConstraints.HORIZONTAL; 198 204 gridbag.setConstraints(labelNetwork, layoutCons); 205 labelNetwork.addKeyListener(this); 199 206 contentPane.add(labelNetwork); 200 207 … … 205 212 layoutCons.fill = GridBagConstraints.HORIZONTAL; 206 213 gridbag.setConstraints(textFieldNetwork, layoutCons); 214 textFieldNetwork.addKeyListener(this); 207 215 contentPane.add(textFieldNetwork); 208 216 … … 213 221 layoutCons.fill = GridBagConstraints.HORIZONTAL; 214 222 gridbag.setConstraints(labelOperator, layoutCons); 223 labelOperator.addKeyListener(this); 215 224 contentPane.add(labelOperator); 216 225 … … 221 230 layoutCons.fill = GridBagConstraints.HORIZONTAL; 222 231 gridbag.setConstraints(textFieldOperator, layoutCons); 232 textFieldOperator.addKeyListener(this); 223 233 contentPane.add(textFieldOperator); 224 234 … … 229 239 layoutCons.fill = GridBagConstraints.HORIZONTAL; 230 240 gridbag.setConstraints(labelService, layoutCons); 241 labelService.addKeyListener(this); 231 242 contentPane.add(labelService); 232 243 … … 242 253 layoutCons.fill = GridBagConstraints.HORIZONTAL; 243 254 gridbag.setConstraints(comboBoxService, layoutCons); 255 comboBoxService.addKeyListener(this); 244 256 contentPane.add(comboBoxService); 245 257 … … 251 263 gridbag.setConstraints(checkBoxIsBus, layoutCons); 252 264 checkBoxIsBus.addItemListener(this); 265 checkBoxIsBus.addKeyListener(this); 253 266 contentPane.add(checkBoxIsBus); 254 267 … … 260 273 gridbag.setConstraints(checkBoxIsShareTaxi, layoutCons); 261 274 checkBoxIsShareTaxi.addItemListener(this); 275 checkBoxIsShareTaxi.addKeyListener(this); 262 276 contentPane.add(checkBoxIsShareTaxi); 263 277 … … 269 283 gridbag.setConstraints(checkBoxIsTrolleybus, layoutCons); 270 284 checkBoxIsTrolleybus.addItemListener(this); 285 checkBoxIsTrolleybus.addKeyListener(this); 271 286 contentPane.add(checkBoxIsTrolleybus); 272 287 … … 278 293 gridbag.setConstraints(checkBoxIsBusStation, layoutCons); 279 294 checkBoxIsBusStation.addItemListener(this); 295 checkBoxIsBusStation.addKeyListener(this); 280 296 contentPane.add(checkBoxIsBusStation); 281 297 … … 287 303 gridbag.setConstraints(checkBoxIsTram, layoutCons); 288 304 checkBoxIsTram.addItemListener(this); 305 checkBoxIsTram.addKeyListener(this); 289 306 contentPane.add(checkBoxIsTram); 290 307 … … 296 313 gridbag.setConstraints(checkBoxIsTrainStation, layoutCons); 297 314 checkBoxIsTrainStation.addItemListener(this); 315 checkBoxIsTrainStation.addKeyListener(this); 298 316 contentPane.add(checkBoxIsTrainStation); 299 317 … … 305 323 gridbag.setConstraints(checkBoxIsTrainStop, layoutCons); 306 324 checkBoxIsTrainStop.addItemListener(this); 325 checkBoxIsTrainStop.addKeyListener(this); 307 326 contentPane.add(checkBoxIsTrainStop); 308 327 … … 314 333 gridbag.setConstraints(checkBoxIsAssignTransportType, layoutCons); 315 334 checkBoxIsAssignTransportType.addItemListener(this); 335 checkBoxIsAssignTransportType.addKeyListener(this); 316 336 contentPane.add(checkBoxIsAssignTransportType); 317 337 … … 323 343 gridbag.setConstraints(checkBoxIsBench, layoutCons); 324 344 checkBoxIsBench.addItemListener(this); 345 checkBoxIsBench.addKeyListener(this); 325 346 contentPane.add(checkBoxIsBench); 326 347 327 checkBoxIsShel der = new JCheckBox(tr(SHELDER_CAPTION));348 checkBoxIsShelter = new JCheckBox(tr(SHELTER_CAPTION)); 328 349 layoutCons.gridx = 1; 329 350 layoutCons.gridy = 10; 330 351 layoutCons.weightx = 0.5; 331 352 layoutCons.fill = GridBagConstraints.HORIZONTAL; 332 gridbag.setConstraints(checkBoxIsShelder, layoutCons); 333 checkBoxIsShelder.addItemListener(this); 334 contentPane.add(checkBoxIsShelder); 353 gridbag.setConstraints(checkBoxIsShelter, layoutCons); 354 checkBoxIsShelter.addItemListener(this); 355 checkBoxIsShelter.addKeyListener(this); 356 contentPane.add(checkBoxIsShelter); 335 357 336 358 checkBoxIsCover = new JCheckBox(tr(COVER_CAPTION)); … … 341 363 gridbag.setConstraints(checkBoxIsCover, layoutCons); 342 364 checkBoxIsCover.addItemListener(this); 365 checkBoxIsCover.addKeyListener(this); 343 366 contentPane.add(checkBoxIsCover); 344 367 … … 350 373 gridbag.setConstraints(checkBoxIsArea, layoutCons); 351 374 checkBoxIsArea.addItemListener(this); 375 checkBoxIsArea.addKeyListener(this); 352 376 contentPane.add(checkBoxIsArea); 353 377 … … 361 385 buttonSave.setActionCommand(SAVE_COMMAND); 362 386 buttonSave.addActionListener(this); 387 buttonSave.addKeyListener(this); 363 388 contentPane.add(buttonSave); 364 389 … … 372 397 buttonCancel.setActionCommand(CANCEL_COMMAND); 373 398 buttonCancel.addActionListener(this); 399 buttonCancel.addKeyListener(this); 374 400 contentPane.add(buttonCancel); 375 401 return contentPane; … … 528 554 setCheckBoxValue(checkBoxIsTrainStop, stopArea.isTrainStop); 529 555 setCheckBoxValue(checkBoxIsBench, stopArea.isBench); 530 setCheckBoxValue(checkBoxIsShel der, stopArea.isShelter);556 setCheckBoxValue(checkBoxIsShelter, stopArea.isShelter); 531 557 setCheckBoxValue(checkBoxIsCover, stopArea.isCovered); 532 558 setCheckBoxValue(checkBoxIsArea, stopArea.isArea); … … 573 599 stopArea.isTrainStop = getCheckBoxValue(checkBoxIsTrainStop); 574 600 stopArea.isBench = getCheckBoxValue(checkBoxIsBench); 575 stopArea.isShelter = getCheckBoxValue(checkBoxIsShel der);601 stopArea.isShelter = getCheckBoxValue(checkBoxIsShelter); 576 602 stopArea.isCovered = getCheckBoxValue(checkBoxIsCover); 577 603 stopArea.isArea = getCheckBoxValue(checkBoxIsArea); … … 598 624 } 599 625 626 @Override 627 public void keyTyped(KeyEvent e) { 628 629 } 630 631 @Override 632 public void keyPressed(KeyEvent e) { 633 if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { 634 setVisible(false); 635 } 636 } 637 638 @Override 639 public void keyReleased(KeyEvent e) { 640 641 } 600 642 } -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAreaOperation.java
r34501 r34726 149 149 "".equals(stopArea.operator) ? null : stopArea.operator); 150 150 commands = assignTag(commands, target, OSMTags.SERVICE_TAG, 151 null == stopArea.service || OSMTags.CITY_NETWORK_TAG_VALUE.equals(stopArea.service) ? null 151 null == stopArea.service || OSMTags.CITY_NETWORK_TAG_VALUE.equals(stopArea.service) 152 || OSMTags.CITY_NETWORK_TAG_VALUE_OLD.equals(stopArea.service) ? null 152 153 : stopArea.service); 153 154 -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/OSMTags.java
r34501 r34726 58 58 public static final String SERVICE_TAG = "service"; 59 59 60 public static final String CITY_NETWORK_TAG_VALUE = "city"; 60 public static final String CITY_NETWORK_TAG_VALUE_OLD = "city"; 61 public static final String CITY_NETWORK_TAG_VALUE = "urban"; 61 62 public static final String COMMUTER_NETWORK_TAG_VALUE = "commuter"; 62 63 public static final String LOCAL_NETWORK_TAG_VALUE = "local";
Note:
See TracChangeset
for help on using the changeset viewer.