/** 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); }
/** * Called when one of the arrival and departure spinners changes value * * @param spinner the spinner */ protected void spinnerValueChanged(JSpinner spinner) { // Check if we are in a quiescent state if (quiescent) { return; } if (spinner == departureSpinner) { Date date = ParseUtils.combineDateTime(departurePicker.getDate(), (Date) departureSpinner.getValue()); route.setStarttime(date); adjustStartTime(); } else if (spinner == arrivalSpinner) { Date date = ParseUtils.combineDateTime(arrivalPicker.getDate(), (Date) arrivalSpinner.getValue()); recalculateSpeeds(date); } else { return; } routeUpdated(); }
/** * Called when one of the arrival and departure pickers changes value * * @param evt the event */ @Override public void propertyChange(PropertyChangeEvent evt) { // Check if we are in a quiescent state if (quiescent) { return; } if (evt.getSource() == departurePicker) { Date date = ParseUtils.combineDateTime(departurePicker.getDate(), (Date) departureSpinner.getValue()); route.setStarttime(date); adjustStartTime(); } else if (evt.getSource() == arrivalPicker) { Date date = ParseUtils.combineDateTime(arrivalPicker.getDate(), (Date) arrivalSpinner.getValue()); recalculateSpeeds(date); } else { return; } routeUpdated(); }