Changeset 26116 in osm for applications/editors/josm/plugins/public_transport
- Timestamp:
- 2011-06-10T16:37:51+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java
r23192 r26116 61 61 public class RoutePatternAction extends JosmAction { 62 62 63 public static int STOPLIST_ROLE_COLUMN = 2; 64 63 65 private class RoutesLSL implements ListSelectionListener { 64 66 RoutePatternAction root = null; … … 261 263 262 264 private class StoplistTableModel extends DefaultTableModel { 265 263 266 public Vector<Node> nodes = new Vector<Node>(); 264 267 265 268 public boolean isCellEditable(int row, int column) { 266 if (column != 1)267 return false;269 if (column != STOPLIST_ROLE_COLUMN) 270 return false; 268 271 return true; 269 272 } … … 282 285 283 286 public void insertRow(int insPos, Node node, String role) { 284 String[] buf = { "", "" };287 String[] buf = { "", "", "" }; 285 288 String curName = node.get("name"); 286 289 if (curName != null) 287 290 { 288 buf[0] = curName;291 buf[0] = curName; 289 292 } 290 293 else 291 294 { 292 buf[0] = "[ID] " + (new Long(node.getId())).toString(); 293 } 294 buf[1] = role; 295 buf[0] = "[ID] " + (new Long(node.getId())).toString(); 296 } 297 String curRef = node.get("ref"); 298 if (curRef != null) 299 { 300 buf[1] = curRef; 301 } 302 buf[STOPLIST_ROLE_COLUMN] = role; 295 303 if (insPos == -1) 296 304 { 297 nodes.addElement(node);298 super.addRow(buf);305 nodes.addElement(node); 306 super.addRow(buf); 299 307 } 300 308 else 301 309 { 302 nodes.insertElementAt(node, insPos);303 super.insertRow(insPos, buf);310 nodes.insertElementAt(node, insPos); 311 super.insertRow(insPos, buf); 304 312 } 305 313 } … … 839 847 stoplistData = new StoplistTableModel(); 840 848 stoplistData.addColumn("Name/Id"); 849 stoplistData.addColumn("Ref"); 841 850 stoplistData.addColumn("Role"); 842 851 stoplistTable.setModel(stoplistData); … … 846 855 comboBox.addItem("forward_stop"); 847 856 comboBox.addItem("backward_stop"); 848 stoplistTable.getColumnModel().getColumn( 1)849 .setCellEditor(new DefaultCellEditor(comboBox));857 stoplistTable.getColumnModel().getColumn(STOPLIST_ROLE_COLUMN) 858 .setCellEditor(new DefaultCellEditor(comboBox)); 850 859 stoplistData.addTableModelListener(new StoplistTableModelListener()); 851 860
Note:
See TracChangeset
for help on using the changeset viewer.