Changeset 20835 in osm for applications/editors/josm


Ignore:
Timestamp:
2010-04-08T09:01:03+02:00 (15 years ago)
Author:
roland
Message:

Public Transport Plugin: Shelter

Location:
applications/editors/josm
Files:
6 edited

Legend:

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

    r20834 r20835  
    131131      if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null))
    132132        Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));
    133 /*      {
    134         currentTrack.gpsSyncTime = dialog.getGpsTimeStart();
    135         currentTrack.relocateNodes();
    136       }*/
    137133    }
    138134    else if ("stopImporter.settingsStopwatchStart".equals(event.getActionCommand()))
     
    140136      if ((!inEvent) && (dialog.stopwatchStartValid()) && (currentTrack != null))
    141137        Main.main.undoRedo.add(new TrackStoplistRelocateCommand(this));
    142 /*      {
    143         currentTrack.stopwatchStart = dialog.getStopwatchStart();
    144         currentTrack.relocateNodes();
    145       }*/
    146138    }
    147139    else if ("stopImporter.settingsTimeWindow".equals(event.getActionCommand()))
     
    264256        waypointTM.addRow(waypoint);
    265257      }
    266       dialog.getWaypointsTable().setModel(waypointTM);
     258      dialog.setWaypointsTableModel(waypointTM);
    267259    }
    268260    else
  • applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java

    r20834 r20835  
    2121import java.util.zip.GZIPInputStream;
    2222
     23import javax.swing.DefaultCellEditor;
    2324import javax.swing.DefaultListModel;
    2425import javax.swing.JButton;
     
    435436    waypointTable = new JTable();
    436437    tableSP = new JScrollPane(waypointTable);
    437      
     438   
    438439    layoutCons.gridx = 0;
    439440    layoutCons.gridy = 0;
     
    623624  {
    624625    return waypointTable;
     626  }
     627 
     628  public void setWaypointsTableModel(WaypointTableModel model)
     629  {
     630    waypointTable.setModel(model);
     631    JComboBox comboBox = new JComboBox();
     632    comboBox.addItem("");
     633    comboBox.addItem("yes");
     634    comboBox.addItem("no");
     635    comboBox.addItem("implicit");
     636    waypointTable.getColumnModel().getColumn(2)
     637        .setCellEditor(new DefaultCellEditor(comboBox));
     638    int width = waypointTable.getPreferredSize().width;
     639    waypointTable.getColumnModel().getColumn(0).setPreferredWidth((int)(width * 0.4));
     640    waypointTable.getColumnModel().getColumn(1).setPreferredWidth((int)(width * 0.5));
     641    waypointTable.getColumnModel().getColumn(2).setPreferredWidth((int)(width * 0.1));
    625642  }
    626643 
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointTableModel.java

    r20791 r20835  
    2727    addColumn("Time");
    2828    addColumn("Stopname");
     29    addColumn("Shelter");
    2930    addTableModelListener(this);
    3031  }
     
    3233  public boolean isCellEditable(int row, int column)
    3334  {
    34     if (column == 1)
     35    if (column >= 1)
    3536      return true;
    3637    return false;
     
    5455  public void insertRow(int insPos, WayPoint wp)
    5556  {
    56     String[] buf = { "", "" };
     57    String[] buf = { "", "", "" };
    5758    buf[0] = wp.getString("time");
    5859    if (buf[0] == null)
     
    6364
    6465    Node node = controller.createNode(wp.getCoor(), buf[1]);
    65      
     66   
    6667    if (insPos == -1)
    6768    {
     
    9192        return;
    9293      Main.main.undoRedo.add(new WaypointsNameCommand
    93           (this, e.getFirstRow(), (String)getValueAt(e.getFirstRow(), 1)));
     94          (this, e.getFirstRow(), (String)getValueAt(e.getFirstRow(), 1),
     95           (String)getValueAt(e.getFirstRow(), 2)));
    9496    }
    95 /*    {
    96       if (nodes.elementAt(e.getFirstRow()) != null)
    97       {
    98         Node node = nodes.elementAt(e.getFirstRow());
    99         node.put("name", (String)getValueAt(e.getFirstRow(), 1));
    100       }
    101     }*/
    10297  }
    10398};
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsEnableCommand.java

    r20772 r20835  
    5252      Node node = StopImporterAction.createNode
    5353        (waypointTM.coors.elementAt(j), type, (String)waypointTM.getValueAt(j, 1));
     54      if ("".equals((String)waypointTM.getValueAt(j, 2)))
     55        node.put("shelter", null);
     56      else
     57        node.put("shelter", (String)waypointTM.getValueAt(j, 2));
    5458      waypointTM.nodes.set(j, node);
    5559    }
  • applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java

    r20791 r20835  
    1717  private String oldName = null;
    1818  private String name = null;
     19  private String oldShelter = null;
     20  private String shelter = null;
    1921 
    20   public WaypointsNameCommand(WaypointTableModel waypointTM, int workingLine, String name)
     22  public WaypointsNameCommand
     23      (WaypointTableModel waypointTM, int workingLine, String name, String shelter)
    2124  {
    2225    this.waypointTM = waypointTM;
    2326    this.workingLine = workingLine;
    2427    if (waypointTM.nodes.elementAt(workingLine) != null)
     28    {
    2529      oldName = waypointTM.nodes.elementAt(workingLine).get("name");
     30      oldShelter = waypointTM.nodes.elementAt(workingLine).get("shelter");
     31    }
    2632    this.name = name;
     33    this.shelter = shelter;
     34    if ("".equals(shelter))
     35      shelter = null;
    2736  }
    2837 
     
    3241    {
    3342      waypointTM.nodes.elementAt(workingLine).put("name", name);
     43      waypointTM.nodes.elementAt(workingLine).put("shelter", shelter);
    3444      waypointTM.inEvent = true;
    3545      waypointTM.setValueAt(name, workingLine, 1);
     46      if (shelter == null)
     47        waypointTM.setValueAt("", workingLine, 2);
     48      else
     49        waypointTM.setValueAt(shelter, workingLine, 2);
    3650      waypointTM.inEvent = false;
    3751    }
     
    4458    {
    4559      waypointTM.nodes.elementAt(workingLine).put("name", oldName);
     60      waypointTM.nodes.elementAt(workingLine).put("shelter", oldShelter);
    4661      waypointTM.inEvent = true;
    4762      waypointTM.setValueAt(oldName, workingLine, 1);
     63      if (oldShelter == null)
     64        waypointTM.setValueAt("", workingLine, 2);
     65      else
     66        waypointTM.setValueAt(oldShelter, workingLine, 2);
    4867      waypointTM.inEvent = false;
    4968    }
Note: See TracChangeset for help on using the changeset viewer.