Changeset 20839 in osm for applications/editors
- Timestamp:
- 2010-04-08T14:26:34+02:00 (15 years ago)
- Location:
- applications/editors/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java
r20835 r20839 281 281 282 282 //Prepare Stoplist 283 dialog. getStoplistTable().setModel283 dialog.setStoplistTableModel 284 284 (((TrackReference)tracksListModel.elementAt(selectedPos)).stoplistTM); 285 285 } -
applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java
r20835 r20839 621 621 } 622 622 623 public void setStoplistTableModel(TrackStoplistTableModel model) 624 { 625 stoplistTable.setModel(model); 626 JComboBox comboBox = new JComboBox(); 627 comboBox.addItem(""); 628 comboBox.addItem("yes"); 629 comboBox.addItem("no"); 630 comboBox.addItem("implicit"); 631 stoplistTable.getColumnModel().getColumn(2) 632 .setCellEditor(new DefaultCellEditor(comboBox)); 633 int width = stoplistTable.getPreferredSize().width; 634 stoplistTable.getColumnModel().getColumn(0).setPreferredWidth((int)(width * 0.4)); 635 stoplistTable.getColumnModel().getColumn(1).setPreferredWidth((int)(width * 0.5)); 636 stoplistTable.getColumnModel().getColumn(2).setPreferredWidth((int)(width * 0.1)); 637 } 638 623 639 public JTable getWaypointsTable() 624 640 { -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackReference.java
r20815 r20839 117 117 118 118 Main.main.undoRedo.add(new TrackStoplistNameCommand 119 (this, e.getFirstRow(), 120 (String)stoplistTM.getValueAt(e.getFirstRow(), 0), 121 (String)stoplistTM.getValueAt(e.getFirstRow(), 1))); 119 (this, e.getFirstRow())); 122 120 stoplistTM.setTimeAt 123 121 (e.getFirstRow(), (String)stoplistTM.getValueAt(e.getFirstRow(), 0)); -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java
r20815 r20839 15 15 private class NodeTimeName 16 16 { 17 NodeTimeName(Node node, String time, String name) 17 NodeTimeName(Node node, String time, String name, String shelter) 18 18 { 19 19 this.node = node; 20 20 this.time = time; 21 21 this.name = name; 22 this.shelter = shelter; 22 23 } 23 24 … … 25 26 public String time; 26 27 public String name; 28 public String shelter; 27 29 }; 28 30 … … 62 64 nodesForUndo.add(new NodeTimeName 63 65 (node, (String)stoplistTM.getValueAt(j, 0), 64 (String)stoplistTM.getValueAt(j, 1))); 66 (String)stoplistTM.getValueAt(j, 1), 67 (String)stoplistTM.getValueAt(j, 2))); 65 68 stoplistTM.removeRow(j); 66 69 if (node == null) … … 78 81 int j = workingLines.elementAt(i).intValue(); 79 82 NodeTimeName ntn = nodesForUndo.elementAt(workingLines.size() - i - 1); 80 stoplistTM.insertRow(j, ntn.node, ntn.time, ntn.name); 83 stoplistTM.insertRow(j, ntn.node, ntn.time, ntn.name, ntn.shelter); 81 84 if (ntn.node == null) 82 85 continue; -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java
r20815 r20839 20 20 private String oldTime = null; 21 21 private String time = null; 22 private String oldShelter = null; 23 private String shelter = null; 22 24 private LatLon oldLatLon = null; 23 25 24 26 @SuppressWarnings("unchecked") 25 public TrackStoplistNameCommand 26 (TrackReference trackref, int workingLine, String time, String name) 27 public TrackStoplistNameCommand(TrackReference trackref, int workingLine) 27 28 { 28 29 this.trackref = trackref; … … 33 34 oldName = node.get("name"); 34 35 oldTime = trackref.stoplistTM.timeAt(workingLine); 36 oldShelter = node.get("shelter"); 35 37 oldLatLon = (LatLon)node.getCoor().clone(); 36 System.out.println("Setze oldLatLon: " + oldLatLon);37 38 } 38 this.name = name; 39 this.time = time; 39 this.time = (String)trackref.stoplistTM.getValueAt(workingLine, 0); 40 this.name = (String)trackref.stoplistTM.getValueAt(workingLine, 1); 41 this.shelter = (String)trackref.stoplistTM.getValueAt(workingLine, 2); 40 42 } 41 43 … … 46 48 { 47 49 node.put("name", name); 50 node.put("shelter", shelter); 48 51 double dTime = StopImporterDialog.parseTime(time); 49 52 node.setCoor(trackref.computeCoor(dTime)); 50 trackref.inEvent = true; 53 } 54 trackref.inEvent = true; 55 if (time == null) 56 trackref.stoplistTM.setValueAt("", workingLine, 0); 57 else 51 58 trackref.stoplistTM.setValueAt(time, workingLine, 0); 59 if (name == null) 60 trackref.stoplistTM.setValueAt("", workingLine, 1); 61 else 52 62 trackref.stoplistTM.setValueAt(name, workingLine, 1); 53 trackref.inEvent = false; 54 } 63 if (shelter == null) 64 trackref.stoplistTM.setValueAt("", workingLine, 2); 65 else 66 trackref.stoplistTM.setValueAt(shelter, workingLine, 2); 67 trackref.inEvent = false; 55 68 return true; 56 69 } … … 62 75 { 63 76 node.put("name", oldName); 64 System.out.println("Verwende oldLatLon: " + oldLatLon);77 node.put("shelter", oldShelter); 65 78 node.setCoor(oldLatLon); 66 trackref.inEvent = true; 79 } 80 trackref.inEvent = true; 81 if (oldTime == null) 82 trackref.stoplistTM.setValueAt("", workingLine, 0); 83 else 67 84 trackref.stoplistTM.setValueAt(oldTime, workingLine, 0); 85 if (oldName == null) 86 trackref.stoplistTM.setValueAt("", workingLine, 1); 87 else 68 88 trackref.stoplistTM.setValueAt(oldName, workingLine, 1); 69 trackref.inEvent = false; 70 } 89 if (oldShelter == null) 90 trackref.stoplistTM.setValueAt("", workingLine, 2); 91 else 92 trackref.stoplistTM.setValueAt(oldShelter, workingLine, 2); 93 trackref.inEvent = false; 71 94 } 72 95 -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java
r20815 r20839 60 60 (stoplistTM.nodeAt(j), (String)stoplistTM.getValueAt(j, 0), 61 61 (String)stoplistTM.getValueAt(j, 1), 62 (String)stoplistTM.getValueAt(j, 2), 62 63 StopImporterDialog.parseTime(stopwatchStart))); 63 64 stoplistTM.removeRow(j); … … 71 72 { 72 73 NodeSortEntry nse = iter.next(); 73 stoplistTM.insertRow(insPos, nse.node, nse.time, nse.name); 74 stoplistTM.insertRow(insPos, nse.node, nse.time, nse.name, nse.shelter); 74 75 if (insPos >= 0) 75 76 ++insPos; … … 101 102 public String time = null; 102 103 public String name = null; 104 public String shelter = null; 103 105 public double startTime = 0; 104 106 105 public NodeSortEntry(Node node, String time, String name, double startTime) 107 public NodeSortEntry 108 (Node node, String time, String name, String shelter, double startTime) 106 109 { 107 110 this.node = node; 108 111 this.time = time; 109 112 this.name = name; 113 this.shelter = shelter; 110 114 } 111 115 -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistTableModel.java
r20815 r20839 13 13 private Vector< Node > nodes = null; 14 14 private Vector< String > times = null; 15 private Vector< String > columns = null; 15 private static Vector< String > columns = null; 16 16 17 17 public TrackStoplistTableModel(TrackReference tr) … … 22 22 columns.add("Time"); 23 23 columns.add("Name"); 24 columns.add("Shelter"); 24 25 } 25 26 nodes = new Vector< Node >(); … … 48 49 public void insertRow(int insPos, String time) 49 50 { 50 insertRow(insPos, null, time, ""); 51 insertRow(insPos, null, time, "", ""); 51 52 } 52 53 … … 98 99 } 99 100 100 public void insertRow(int insPos, Node node, String time, String name) 101 public void insertRow 102 (int insPos, Node node, String time, String name, String shelter) 101 103 { 102 String[] buf = { "", "" }; 104 String[] buf = { "", "", "" }; 103 105 buf[0] = time; 104 106 buf[1] = name; -
applications/editors/josm/plugins/public_transport/src/public_transport/TrackSuggestStopsCommand.java
r20815 r20839 157 157 time -= timeDelta; 158 158 Node node = StopImporterAction.createNode(latLon, type, ""); 159 stoplistTM.insertRow(-1, node, StopImporterAction.timeOf(time), ""); 159 stoplistTM.insertRow(-1, node, StopImporterAction.timeOf(time), "", ""); 160 160 } 161 161 -
applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java
r20835 r20839 42 42 waypointTM.nodes.elementAt(workingLine).put("name", name); 43 43 waypointTM.nodes.elementAt(workingLine).put("shelter", shelter); 44 waypointTM.inEvent = true; 44 } 45 waypointTM.inEvent = true; 46 if (name == null) 47 waypointTM.setValueAt("", workingLine, 1); 48 else 45 49 waypointTM.setValueAt(name, workingLine, 1); 46 if (shelter == null) 47 waypointTM.setValueAt("", workingLine, 2); 48 else 49 waypointTM.setValueAt(shelter, workingLine, 2); 50 waypointTM.inEvent = false; 51 } 50 if (shelter == null) 51 waypointTM.setValueAt("", workingLine, 2); 52 else 53 waypointTM.setValueAt(shelter, workingLine, 2); 54 waypointTM.inEvent = false; 52 55 return true; 53 56 } … … 59 62 waypointTM.nodes.elementAt(workingLine).put("name", oldName); 60 63 waypointTM.nodes.elementAt(workingLine).put("shelter", oldShelter); 61 waypointTM.inEvent = true; 64 } 65 waypointTM.inEvent = true; 66 if (oldName == null) 67 waypointTM.setValueAt("", workingLine, 1); 68 else 62 69 waypointTM.setValueAt(oldName, workingLine, 1); 63 if (oldShelter == null) 64 waypointTM.setValueAt("", workingLine, 2); 65 else 66 waypointTM.setValueAt(oldShelter, workingLine, 2); 67 waypointTM.inEvent = false; 68 } 70 if (oldShelter == null) 71 waypointTM.setValueAt("", workingLine, 2); 72 else 73 waypointTM.setValueAt(oldShelter, workingLine, 2); 74 waypointTM.inEvent = false; 69 75 } 70 76
Note:
See TracChangeset
for help on using the changeset viewer.