Changeset 20867 in osm for applications
- Timestamp:
- 2010-04-09T11:15:11+02:00 (15 years ago)
- Location:
- applications/editors/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java
r20839 r20867 21 21 import java.util.zip.GZIPInputStream; 22 22 23 import javax.swing.AbstractAction; 24 import javax.swing.Action; 23 25 import javax.swing.DefaultListModel; 24 26 import javax.swing.JButton; … … 415 417 + formatS.format(second)); 416 418 } 419 420 public Action getFocusWaypointNameAction() 421 { 422 return new FocusWaypointNameAction(); 423 } 424 425 public Action getFocusWaypointShelterAction(String shelter) 426 { 427 return new FocusWaypointShelterAction(shelter); 428 } 429 430 public Action getFocusWaypointDeleteAction() 431 { 432 return new AbstractAction() 433 { 434 public void actionPerformed(ActionEvent e) 435 { 436 JTable table = dialog.getWaypointsTable(); 437 int row = table.getEditingRow(); 438 if (row < 0) 439 return; 440 table.clearSelection(); 441 table.addRowSelectionInterval(row, row); 442 Main.main.undoRedo.add 443 (new WaypointsDisableCommand(StopImporterAction.this)); 444 } 445 }; 446 } 447 448 public Action getFocusTrackStoplistNameAction() 449 { 450 return new FocusTrackStoplistNameAction(); 451 } 452 453 public Action getFocusTrackStoplistShelterAction(String shelter) 454 { 455 return new FocusTrackStoplistShelterAction(shelter); 456 } 457 458 public Action getFocusStoplistDeleteAction() 459 { 460 return new AbstractAction() 461 { 462 public void actionPerformed(ActionEvent e) 463 { 464 JTable table = dialog.getStoplistTable(); 465 int row = table.getEditingRow(); 466 if (row < 0) 467 return; 468 table.clearSelection(); 469 table.addRowSelectionInterval(row, row); 470 Main.main.undoRedo.add 471 (new TrackStoplistDeleteCommand(StopImporterAction.this)); 472 } 473 }; 474 } 475 476 private class FocusWaypointNameAction extends AbstractAction 477 { 478 public void actionPerformed(ActionEvent e) 479 { 480 JTable table = dialog.getWaypointsTable(); 481 showNodesFromTable(table, waypointTM.nodes); 482 markNodesFromTable(table, waypointTM.nodes); 483 int row = table.getEditingRow(); 484 if (row < 0) 485 row = 0; 486 waypointTM.inEvent = true; 487 if (table.getCellEditor() != null) 488 { 489 if (!table.getCellEditor().stopCellEditing()) 490 table.getCellEditor().cancelCellEditing(); 491 } 492 table.editCellAt(row, 1); 493 table.getCellEditor().getTableCellEditorComponent 494 (table, "", true, row, 1); 495 waypointTM.inEvent = false; 496 } 497 }; 498 499 private class FocusWaypointShelterAction extends AbstractAction 500 { 501 private String defaultShelter = null; 502 503 public FocusWaypointShelterAction(String defaultShelter) 504 { 505 this.defaultShelter = defaultShelter; 506 } 507 508 public void actionPerformed(ActionEvent e) 509 { 510 JTable table = dialog.getWaypointsTable(); 511 showNodesFromTable(table, waypointTM.nodes); 512 markNodesFromTable(table, waypointTM.nodes); 513 int row = table.getEditingRow(); 514 if (row < 0) 515 row = 0; 516 waypointTM.inEvent = true; 517 if (table.getCellEditor() != null) 518 { 519 if (!table.getCellEditor().stopCellEditing()) 520 table.getCellEditor().cancelCellEditing(); 521 } 522 table.editCellAt(row, 2); 523 waypointTM.inEvent = false; 524 table.getCellEditor().getTableCellEditorComponent 525 (table, defaultShelter, true, row, 2); 526 } 527 }; 528 529 private class FocusTrackStoplistNameAction extends AbstractAction 530 { 531 public void actionPerformed(ActionEvent e) 532 { 533 JTable table = dialog.getStoplistTable(); 534 showNodesFromTable(table, currentTrack.stoplistTM.getNodes()); 535 markNodesFromTable(table, currentTrack.stoplistTM.getNodes()); 536 int row = table.getEditingRow(); 537 if (row < 0) 538 row = 0; 539 currentTrack.inEvent = true; 540 if (table.getCellEditor() != null) 541 { 542 if (!table.getCellEditor().stopCellEditing()) 543 table.getCellEditor().cancelCellEditing(); 544 } 545 table.editCellAt(row, 1); 546 table.getCellEditor().getTableCellEditorComponent 547 (table, "", true, row, 1); 548 currentTrack.inEvent = false; 549 } 550 }; 551 552 private class FocusTrackStoplistShelterAction extends AbstractAction 553 { 554 private String defaultShelter = null; 555 556 public FocusTrackStoplistShelterAction(String defaultShelter) 557 { 558 this.defaultShelter = defaultShelter; 559 } 560 561 public void actionPerformed(ActionEvent e) 562 { 563 JTable table = dialog.getStoplistTable(); 564 showNodesFromTable(table, currentTrack.stoplistTM.getNodes()); 565 markNodesFromTable(table, currentTrack.stoplistTM.getNodes()); 566 int row = table.getEditingRow(); 567 if (row < 0) 568 row = 0; 569 currentTrack.inEvent = true; 570 if (table.getCellEditor() != null) 571 { 572 if (!table.getCellEditor().stopCellEditing()) 573 table.getCellEditor().cancelCellEditing(); 574 } 575 table.editCellAt(row, 2); 576 currentTrack.inEvent = false; 577 table.getCellEditor().getTableCellEditorComponent 578 (table, defaultShelter, true, row, 2); 579 } 580 }; 417 581 } -
applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java
r20839 r20867 25 25 import javax.swing.JButton; 26 26 import javax.swing.JComboBox; 27 import javax.swing.JComponent; 27 28 import javax.swing.JDialog; 28 29 import javax.swing.JFileChooser; … … 35 36 import javax.swing.JTable; 36 37 import javax.swing.JTextField; 38 import javax.swing.KeyStroke; 37 39 import javax.swing.ListSelectionModel; 38 40 import javax.swing.event.ListSelectionEvent; … … 93 95 94 96 //Tracks Tab 95 ContainercontentPane = tabTracks;97 JPanel contentPane = tabTracks; 96 98 GridBagLayout gridbag = new GridBagLayout(); 97 99 GridBagConstraints layoutCons = new GridBagConstraints(); … … 315 317 contentPane.add(bSuggestStops); 316 318 317 319 //Stops Tab 318 320 contentPane = tabStops; 319 321 gridbag = new GridBagLayout(); 320 322 layoutCons = new GridBagConstraints(); 321 323 contentPane.setLayout(gridbag); 324 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 325 (KeyStroke.getKeyStroke("alt N"), "stopImporter.focusName"); 326 contentPane.getActionMap().put 327 ("stopImporter.focusName", controller.getFocusTrackStoplistNameAction()); 328 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 329 (KeyStroke.getKeyStroke("alt S"), "stopImporter.focusShelterYes"); 330 contentPane.getActionMap().put 331 ("stopImporter.focusShelterYes", 332 controller.getFocusTrackStoplistShelterAction("yes")); 333 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 334 (KeyStroke.getKeyStroke("alt T"), "stopImporter.focusShelterNo"); 335 contentPane.getActionMap().put 336 ("stopImporter.focusShelterNo", 337 controller.getFocusTrackStoplistShelterAction("no")); 338 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 339 (KeyStroke.getKeyStroke("alt U"), "stopImporter.focusShelterImplicit"); 340 contentPane.getActionMap().put 341 ("stopImporter.focusShelterImplicit", 342 controller.getFocusTrackStoplistShelterAction("implicit")); 343 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 344 (KeyStroke.getKeyStroke("alt D"), "stopImporter.stoplistDelete"); 345 contentPane.getActionMap().put 346 ("stopImporter.stoplistDelete", 347 controller.getFocusStoplistDeleteAction()); 322 348 323 349 stoplistTable = new JTable(); 324 350 JScrollPane tableSP = new JScrollPane(stoplistTable); 325 351 326 352 layoutCons.gridx = 0; 327 353 layoutCons.gridy = 0; … … 428 454 contentPane.add(bSort); 429 455 430 456 //Waypoints Tab 431 457 contentPane = tabWaypoints; 432 458 gridbag = new GridBagLayout(); 433 459 layoutCons = new GridBagConstraints(); 434 460 contentPane.setLayout(gridbag); 461 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 462 (KeyStroke.getKeyStroke("alt N"), "stopImporter.focusName"); 463 contentPane.getActionMap().put 464 ("stopImporter.focusName", controller.getFocusWaypointNameAction()); 465 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 466 (KeyStroke.getKeyStroke("alt S"), "stopImporter.focusShelterYes"); 467 contentPane.getActionMap().put 468 ("stopImporter.focusShelterYes", 469 controller.getFocusWaypointShelterAction("yes")); 470 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 471 (KeyStroke.getKeyStroke("alt T"), "stopImporter.focusShelterNo"); 472 contentPane.getActionMap().put 473 ("stopImporter.focusShelterNo", 474 controller.getFocusWaypointShelterAction("no")); 475 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 476 (KeyStroke.getKeyStroke("alt U"), "stopImporter.focusShelterImplicit"); 477 contentPane.getActionMap().put 478 ("stopImporter.focusShelterImplicit", 479 controller.getFocusWaypointShelterAction("implicit")); 480 contentPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put 481 (KeyStroke.getKeyStroke("alt D"), "stopImporter.waypointsDelete"); 482 contentPane.getActionMap().put 483 ("stopImporter.waypointsDelete", 484 controller.getFocusWaypointDeleteAction()); 435 485 436 486 waypointTable = new JTable(); -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java
r20839 r20867 40 40 this.name = (String)trackref.stoplistTM.getValueAt(workingLine, 1); 41 41 this.shelter = (String)trackref.stoplistTM.getValueAt(workingLine, 2); 42 if ("".equals(this.shelter)) 43 this.shelter = null; 42 44 } 43 45 -
applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java
r20839 r20867 33 33 this.shelter = shelter; 34 34 if ("".equals(shelter)) 35 shelter = null;35 this.shelter = null; 36 36 } 37 37
Note:
See TracChangeset
for help on using the changeset viewer.