public static void main(String[] args) { GuiUtils.setLookAndFeel(); OperationLimits limits = new OperationLimits(); limits.setMaxSpeed(100d); OperationLimitsPanel panel = new OperationLimitsPanel(new MissionType(), true); panel.setLimits(limits); GuiUtils.testFrame(panel); }
public OperationLimits getLimits() { if (minSpeedCheck.isSelected()) limits.setMinSpeed(Double.valueOf(minSpeedField.getText())); else limits.setMinSpeed(null); if (maxSpeedCheck.isSelected()) limits.setMaxSpeed(Double.valueOf(maxSpeedField.getText())); else limits.setMaxSpeed(null); if (minAltitudeCheck.isSelected()) limits.setMinAltitude(Double.valueOf(minAltitudeField.getText())); else limits.setMinAltitude(null); if (maxAltitudeCheck.isSelected()) limits.setMaxAltitude(Double.valueOf(maxAltitudeField.getText())); else limits.setMaxAltitude(null); if (maxVRateCheck.isSelected()) limits.setMaxVertRate(Double.valueOf(maxVRateField.getText())); else limits.setMaxVertRate(null); if (maxDepthCheck.isSelected()) limits.setMaxDepth(Double.valueOf(maxDepthField.getText())); else limits.setMaxDepth(null); if (!areaCheck.isSelected()) { limits.setOpAreaLat(null); limits.setOpAreaLon(null); limits.setOpAreaLength(null); limits.setOpAreaWidth(null); limits.setOpRotationRads(null); } return limits; }
public void setLimits(OperationLimits limits) { this.limits = limits; this.minSpeedCheck.setSelected(limits.getMinSpeed() != null); this.maxSpeedCheck.setSelected(limits.getMaxSpeed() != null); this.minAltitudeCheck.setSelected(limits.getMinAltitude() != null); this.maxAltitudeCheck.setSelected(limits.getMaxAltitude() != null); this.maxDepthCheck.setSelected(limits.getMaxDepth() != null); this.areaCheck.setSelected(limits.getOpAreaLat() != null); this.maxVRateCheck.setSelected(limits.getMaxVertRate() != null); this.minSpeedField.setText(limits.getMinSpeed() == null ? "" : "" + limits.getMinSpeed()); this.maxSpeedField.setText(limits.getMaxSpeed() == null ? "" : "" + limits.getMaxSpeed()); this.minAltitudeField.setText( limits.getMinAltitude() == null ? "" : "" + limits.getMinAltitude()); this.maxAltitudeField.setText( limits.getMaxAltitude() == null ? "" : "" + limits.getMaxAltitude()); this.maxDepthField.setText(limits.getMaxDepth() == null ? "" : "" + limits.getMaxDepth()); this.maxVRateField.setText(limits.getMaxVertRate() == null ? "" : "" + limits.getMaxVertRate()); }