Ignore:
Timestamp:
2011-06-10T16:37:51+02:00 (14 years ago)
Author:
roland
Message:

Added a 'ref' column to the stoplist.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java

    r23192 r26116  
    6161public class RoutePatternAction extends JosmAction {
    6262
     63  public static int STOPLIST_ROLE_COLUMN = 2;
     64
    6365  private class RoutesLSL implements ListSelectionListener {
    6466    RoutePatternAction root = null;
     
    261263
    262264  private class StoplistTableModel extends DefaultTableModel {
     265
    263266    public Vector<Node> nodes = new Vector<Node>();
    264267
    265268    public boolean isCellEditable(int row, int column) {
    266       if (column != 1)
    267     return false;
     269      if (column != STOPLIST_ROLE_COLUMN)
     270        return false;
    268271      return true;
    269272    }
     
    282285
    283286    public void insertRow(int insPos, Node node, String role) {
    284       String[] buf = { "", "" };
     287      String[] buf = { "", "", "" };
    285288      String curName = node.get("name");
    286289      if (curName != null)
    287290      {
    288     buf[0] = curName;
     291        buf[0] = curName;
    289292      }
    290293      else
    291294      {
    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;
    295303      if (insPos == -1)
    296304      {
    297     nodes.addElement(node);
    298     super.addRow(buf);
     305        nodes.addElement(node);
     306        super.addRow(buf);
    299307      }
    300308      else
    301309      {
    302     nodes.insertElementAt(node, insPos);
    303     super.insertRow(insPos, buf);
     310        nodes.insertElementAt(node, insPos);
     311        super.insertRow(insPos, buf);
    304312      }
    305313    }
     
    839847      stoplistData = new StoplistTableModel();
    840848      stoplistData.addColumn("Name/Id");
     849      stoplistData.addColumn("Ref");
    841850      stoplistData.addColumn("Role");
    842851      stoplistTable.setModel(stoplistData);
     
    846855      comboBox.addItem("forward_stop");
    847856      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));
    850859      stoplistData.addTableModelListener(new StoplistTableModelListener());
    851860
Note: See TracChangeset for help on using the changeset viewer.