/** Called when route values changes and the fields should be refreshed */
 private void updateFields() {
   if (!readOnlyRoute) {
     route.calcValues(true);
     route.calcAllWpEta();
   }
   inrouteTxT.setText(Formatter.formatTime(route.getRouteTtg()));
   distanceTxT.setText(Formatter.formatDistNM(route.getRouteDtg()));
   routeTableModel.fireTableDataChanged();
 }
  /** Test method */
  public static final void main(String... args) throws Exception {

    // =====================
    // Create test data
    // =====================
    final Route route = new Route();
    route.setName("Test route");
    final LinkedList<RouteWaypoint> waypoints = new LinkedList<>();
    route.setWaypoints(waypoints);
    route.setStarttime(new Date());

    int len = 10;
    final boolean[] locked = new boolean[len];
    for (int x = 0; x < len; x++) {
      locked[x] = false;
      RouteWaypoint wp = new RouteWaypoint();
      waypoints.add(wp);

      // Set leg values
      if (x > 0) {
        RouteLeg leg = new RouteLeg();
        leg.setSpeed(12.00 + x);
        leg.setHeading(Heading.RL);
        leg.setXtdPort(185.0);
        leg.setXtdStarboard(185.0);

        wp.setInLeg(leg);
        waypoints.get(x - 1).setOutLeg(leg);
        leg.setStartWp(waypoints.get(x - 1));
        leg.setEndWp(wp);
      }

      wp.setName("WP_00" + x);
      wp.setPos(Position.create(56.02505 + Math.random() * 2.0, 12.37 + Math.random() * 2.0));
    }
    for (int x = 1; x < len; x++) {
      waypoints.get(x).setTurnRad(0.5 + x * 0.2);
    }
    route.calcValues(true);

    // Launch the route properties dialog
    PntTime.init();
    RoutePropertiesDialogCommon dialog = new RoutePropertiesDialogCommon(null, null, route, false);
    dialog.setVisible(true);
  }