X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fmain%2FSimulationEditDialog.java;h=90561b49c96079305f0f2f9c94e1e115496c1281;hb=8320c04afa30e2aa0150adc870d02abeedb01066;hp=f9c1c4c6566b75dd6c76ce64a856c0842cbeb4e0;hpb=720d4935bc6bec453e6478ad5227356c626610a2;p=debian%2Fopenrocket
diff --git a/src/net/sf/openrocket/gui/main/SimulationEditDialog.java b/src/net/sf/openrocket/gui/main/SimulationEditDialog.java
index f9c1c4c6..90561b49 100644
--- a/src/net/sf/openrocket/gui/main/SimulationEditDialog.java
+++ b/src/net/sf/openrocket/gui/main/SimulationEditDialog.java
@@ -30,27 +30,32 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import net.miginfocom.swing.MigLayout;
-import net.sf.openrocket.aerodynamics.ExtendedISAModel;
import net.sf.openrocket.document.Simulation;
-import net.sf.openrocket.gui.BasicSlider;
-import net.sf.openrocket.gui.DescriptionArea;
import net.sf.openrocket.gui.SpinnerEditor;
-import net.sf.openrocket.gui.UnitSelector;
import net.sf.openrocket.gui.adaptors.BooleanModel;
import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.adaptors.MotorConfigurationModel;
+import net.sf.openrocket.gui.components.BasicSlider;
+import net.sf.openrocket.gui.components.DescriptionArea;
+import net.sf.openrocket.gui.components.SimulationExportPanel;
+import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.gui.plot.Axis;
import net.sf.openrocket.gui.plot.PlotConfiguration;
-import net.sf.openrocket.gui.plot.PlotPanel;
+import net.sf.openrocket.gui.plot.SimulationPlotPanel;
+import net.sf.openrocket.l10n.Translator;
+import net.sf.openrocket.models.atmosphere.ExtendedISAModel;
import net.sf.openrocket.rocketcomponent.Configuration;
import net.sf.openrocket.simulation.FlightData;
import net.sf.openrocket.simulation.FlightDataBranch;
-import net.sf.openrocket.simulation.RK4Simulator;
-import net.sf.openrocket.simulation.SimulationConditions;
-import net.sf.openrocket.simulation.SimulationListener;
-import net.sf.openrocket.simulation.listeners.CSVSaveListener;
+import net.sf.openrocket.simulation.RK4SimulationStepper;
+import net.sf.openrocket.simulation.SimulationOptions;
+import net.sf.openrocket.simulation.FlightDataType;
+import net.sf.openrocket.simulation.listeners.SimulationListener;
+import net.sf.openrocket.simulation.listeners.example.CSVSaveListener;
+import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.Unit;
import net.sf.openrocket.unit.UnitGroup;
+import net.sf.openrocket.util.Chars;
import net.sf.openrocket.util.GUIUtil;
import net.sf.openrocket.util.Icons;
import net.sf.openrocket.util.Prefs;
@@ -76,25 +81,28 @@ public class SimulationEditDialog extends JDialog {
private final Window parentWindow;
private final Simulation simulation;
- private final SimulationConditions conditions;
+ private final SimulationOptions conditions;
private final Configuration configuration;
-
+ private static final Translator trans = Application.getTranslator();
+
public SimulationEditDialog(Window parent, Simulation s) {
this(parent, s, 0);
}
public SimulationEditDialog(Window parent, Simulation s, int tab) {
- super(parent, "Edit simulation", JDialog.ModalityType.DOCUMENT_MODAL);
+ //// Edit simulation
+ super(parent, trans.get("simedtdlg.title.Editsim"), JDialog.ModalityType.DOCUMENT_MODAL);
this.parentWindow = parent;
this.simulation = s;
- this.conditions = simulation.getConditions();
+ this.conditions = simulation.getOptions();
configuration = simulation.getConfiguration();
JPanel mainPanel = new JPanel(new MigLayout("fill","[grow, fill]"));
- mainPanel.add(new JLabel("Simulation name: "), "span, split 2, shrink");
+ //// Simulation name:
+ mainPanel.add(new JLabel(trans.get("simedtdlg.lbl.Simname") + " "), "span, split 2, shrink");
final JTextField field = new JTextField(simulation.getName());
field.getDocument().addDocumentListener(new DocumentListener() {
@Override
@@ -122,11 +130,14 @@ public class SimulationEditDialog extends JDialog {
JTabbedPane tabbedPane = new JTabbedPane();
-
- tabbedPane.addTab("Launch conditions", flightConditionsTab());
- tabbedPane.addTab("Simulation options", simulationOptionsTab());
- tabbedPane.addTab("Plot data", plotTab());
-// tabbedPane.addTab("Export data", exportTab());
+ //// Launch conditions
+ tabbedPane.addTab(trans.get("simedtdlg.tab.Launchcond"), flightConditionsTab());
+ //// Simulation options
+ tabbedPane.addTab(trans.get("simedtdlg.tab.Simopt"), simulationOptionsTab());
+ //// Plot data
+ tabbedPane.addTab(trans.get("simedtdlg.tab.Plotdata"), plotTab());
+ //// Export data
+ tabbedPane.addTab(trans.get("simedtdlg.tab.Exportdata"), exportTab());
// Select the initial tab
if (tab == EDIT) {
@@ -148,7 +159,8 @@ public class SimulationEditDialog extends JDialog {
mainPanel.add(new JPanel(), "spanx, split, growx");
JButton button;
- button = new JButton("Run simulation");
+ //// Run simulation button
+ button = new JButton(trans.get("simedtdlg.but.runsimulation"));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -158,8 +170,8 @@ public class SimulationEditDialog extends JDialog {
});
mainPanel.add(button, "gapright para");
-
- JButton close = new JButton("Close");
+ //// Close button
+ JButton close = new JButton(trans.get("dlg.but.close"));
close.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -173,8 +185,8 @@ public class SimulationEditDialog extends JDialog {
this.validate();
this.pack();
this.setLocationByPlatform(true);
- GUIUtil.setDefaultButton(button);
- GUIUtil.installEscapeCloseOperation(this);
+
+ GUIUtil.setDisposableDialogOptions(this, button);
}
@@ -191,12 +203,15 @@ public class SimulationEditDialog extends JDialog {
JSpinner spin;
//// Motor selector
- JLabel label = new JLabel("Motor configuration:");
- label.setToolTipText("Select the motor configuration to use.");
+ //// Motor configuration:
+ JLabel label = new JLabel(trans.get("simedtdlg.lbl.Motorcfg"));
+ //// Select the motor configuration to use.
+ label.setToolTipText(trans.get("simedtdlg.lbl.ttip.Motorcfg"));
panel.add(label, "shrinkx, spanx, split 2");
JComboBox combo = new JComboBox(new MotorConfigurationModel(configuration));
- combo.setToolTipText("Select the motor configuration to use.");
+ //// Select the motor configuration to use.
+ combo.setToolTipText(trans.get("simedtdlg.combo.ttip.motorconf"));
combo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -209,13 +224,16 @@ public class SimulationEditDialog extends JDialog {
//// Wind settings: Average wind speed, turbulence intensity, std. deviation
sub = new JPanel(new MigLayout("fill, gap rel unrel",
"[grow][65lp!][30lp!][75lp!]",""));
- sub.setBorder(BorderFactory.createTitledBorder("Wind"));
+ //// Wind
+ sub.setBorder(BorderFactory.createTitledBorder(trans.get("simedtdlg.lbl.Wind")));
panel.add(sub, "growx, split 2, aligny 0, flowy, gapright para");
// Wind average
- label = new JLabel("Average windspeed:");
- tip = "The average windspeed relative to the ground.";
+ //// Average windspeed:
+ label = new JLabel(trans.get("simedtdlg.lbl.Averwindspeed"));
+ //// The average windspeed relative to the ground.
+ tip = trans.get("simedtdlg.lbl.ttip.Averwindspeed");
label.setToolTipText(tip);
sub.add(label);
@@ -236,10 +254,11 @@ public class SimulationEditDialog extends JDialog {
// Wind std. deviation
- label = new JLabel("Standard deviation:");
- tip = "The standard deviation of the windspeed.
" +
- "The windspeed is within twice the standard deviation from the average for " +
- "95% of the time.";
+ //// Standard deviation:
+ label = new JLabel(trans.get("simedtdlg.lbl.Stddeviation"));
+ //// The standard deviation of the windspeed.
+ //// The windspeed is within twice the standard deviation from the average for 95% of the time.
+ tip = trans.get("simedtdlg.lbl.ttip.Stddeviation");
label.setToolTipText(tip);
sub.add(label);
@@ -261,12 +280,15 @@ public class SimulationEditDialog extends JDialog {
// Wind turbulence intensity
- label = new JLabel("Turbulence intensity:");
- tip = "The turbulence intensity is the standard deviation " +
- "divided by the average windspeed.
" +
- "Typical values range from "+
+ //// Turbulence intensity:
+ label = new JLabel(trans.get("simedtdlg.lbl.Turbulenceintensity"));
+ //// The turbulence intensity is the standard deviation divided by the average windspeed.
+ //// Typical values range from
+ //// to
+ tip = trans.get("simedtdlg.lbl.ttip.Turbulenceintensity1") +
+ trans.get("simedtdlg.lbl.ttip.Turbulenceintensity2") + " "+
UnitGroup.UNITS_RELATIVE.getDefaultUnit().toStringUnit(0.05) +
- " to " +
+ " " + trans.get("simedtdlg.lbl.ttip.Turbulenceintensity3") +" " +
UnitGroup.UNITS_RELATIVE.getDefaultUnit().toStringUnit(0.20) + ".";
label.setToolTipText(tip);
sub.add(label);
@@ -301,24 +323,30 @@ public class SimulationEditDialog extends JDialog {
//// Temperature and pressure
sub = new JPanel(new MigLayout("fill, gap rel unrel",
"[grow][65lp!][30lp!][75lp!]",""));
- sub.setBorder(BorderFactory.createTitledBorder("Atmospheric conditions"));
+ //// Atmospheric conditions
+ sub.setBorder(BorderFactory.createTitledBorder(trans.get("simedtdlg.border.Atmoscond")));
panel.add(sub, "growx, aligny 0, gapright para");
BooleanModel isa = new BooleanModel(conditions, "ISAAtmosphere");
JCheckBox check = new JCheckBox(isa);
- check.setText("Use International Standard Atmosphere");
- check.setToolTipText("Select to use the International Standard Atmosphere model."+
- "
This model has a temperature of " +
+ //// Use International Standard Atmosphere
+ check.setText(trans.get("simedtdlg.checkbox.InterStdAtmosphere"));
+ //// Select to use the International Standard Atmosphere model.
+ ////
This model has a temperature of
+ //// and a pressure of
+ //// at sea level.
+ check.setToolTipText(trans.get("simedtdlg.checkbox.ttip.InterStdAtmosphere1") +" " +
UnitGroup.UNITS_TEMPERATURE.toStringUnit(ExtendedISAModel.STANDARD_TEMPERATURE)+
- " and a pressure of " +
+ " " + trans.get("simedtdlg.checkbox.ttip.InterStdAtmosphere2") + " " +
UnitGroup.UNITS_PRESSURE.toStringUnit(ExtendedISAModel.STANDARD_PRESSURE) +
- " at sea level.");
+ " " + trans.get("simedtdlg.checkbox.ttip.InterStdAtmosphere3"));
sub.add(check, "spanx, wrap unrel");
- // Temperature
- label = new JLabel("Temperature:");
- tip = "The temperature at the launch site.";
+ // Temperature:
+ label = new JLabel(trans.get("simedtdlg.lbl.Temperature"));
+ //// The temperature at the launch site.
+ tip = trans.get("simedtdlg.lbl.ttip.Temperature");
label.setToolTipText(tip);
isa.addEnableComponent(label, false);
sub.add(label);
@@ -342,9 +370,10 @@ public class SimulationEditDialog extends JDialog {
- // Pressure
- label = new JLabel("Pressure:");
- tip = "The atmospheric pressure at the launch site.";
+ // Pressure:
+ label = new JLabel(trans.get("simedtdlg.lbl.Pressure"));
+ //// The atmospheric pressure at the launch site.
+ tip = trans.get("simedtdlg.lbl.ttip.Pressure");
label.setToolTipText(tip);
isa.addEnableComponent(label, false);
sub.add(label);
@@ -373,15 +402,16 @@ public class SimulationEditDialog extends JDialog {
//// Launch site conditions
sub = new JPanel(new MigLayout("fill, gap rel unrel",
"[grow][65lp!][30lp!][75lp!]",""));
- sub.setBorder(BorderFactory.createTitledBorder("Launch site"));
+ //// Launch site
+ sub.setBorder(BorderFactory.createTitledBorder(trans.get("simedtdlg.lbl.Launchsite")));
panel.add(sub, "growx, split 2, aligny 0, flowy");
- // Latitude
- label = new JLabel("Latitude:");
- tip = "The launch site latitude affects the gravitational pull of Earth.
" +
- "Positive values are on the Northern hemisphere, negative values on the " +
- "Southern hemisphere.";
+ // Latitude:
+ label = new JLabel(trans.get("simedtdlg.lbl.Latitude"));
+ //// The launch site latitude affects the gravitational pull of Earth.
+ //// Positive values are on the Northern hemisphere, negative values on the Southern hemisphere.
+ tip = trans.get("simedtdlg.lbl.ttip.Latitude");
label.setToolTipText(tip);
sub.add(label);
@@ -392,7 +422,7 @@ public class SimulationEditDialog extends JDialog {
spin.setToolTipText(tip);
sub.add(spin,"w 65lp!");
- label = new JLabel("\u00b0 N");
+ label = new JLabel(Chars.DEGREE + " N");
label.setToolTipText(tip);
sub.add(label,"growx");
slider = new BasicSlider(m.getSliderModel(-90, 90));
@@ -401,10 +431,11 @@ public class SimulationEditDialog extends JDialog {
- // Altitude
- label = new JLabel("Altitude:");
- tip = "The launch altitude above mean sea level.
" +
- "This affects the position of the rocket in the atmospheric model.";
+ // Altitude:
+ label = new JLabel(trans.get("simedtdlg.lbl.Altitude"));
+ //// The launch altitude above mean sea level.
+ //// This affects the position of the rocket in the atmospheric model.
+ tip = trans.get("simedtdlg.lbl.ttip.Altitude");
label.setToolTipText(tip);
sub.add(label);
@@ -429,13 +460,15 @@ public class SimulationEditDialog extends JDialog {
//// Launch rod
sub = new JPanel(new MigLayout("fill, gap rel unrel",
"[grow][65lp!][30lp!][75lp!]",""));
- sub.setBorder(BorderFactory.createTitledBorder("Launch rod"));
+ //// Launch rod
+ sub.setBorder(BorderFactory.createTitledBorder(trans.get("simedtdlg.border.Launchrod")));
panel.add(sub, "growx, aligny 0, wrap");
- // Length
- label = new JLabel("Length:");
- tip = "The length of the launch rod.";
+ // Length:
+ label = new JLabel(trans.get("simedtdlg.lbl.Length"));
+ //// The length of the launch rod.
+ tip = trans.get("simedtdlg.lbl.ttip.Length");
label.setToolTipText(tip);
sub.add(label);
@@ -455,14 +488,15 @@ public class SimulationEditDialog extends JDialog {
- // Angle
- label = new JLabel("Angle:");
- tip = "The angle of the launch rod from vertical.";
+ // Angle:
+ label = new JLabel(trans.get("simedtdlg.lbl.Angle"));
+ //// The angle of the launch rod from vertical.
+ tip = trans.get("simedtdlg.lbl.ttip.Angle");
label.setToolTipText(tip);
sub.add(label);
m = new DoubleModel(conditions,"LaunchRodAngle", UnitGroup.UNITS_ANGLE,
- 0, SimulationConditions.MAX_LAUNCH_ROD_ANGLE);
+ 0, SimulationOptions.MAX_LAUNCH_ROD_ANGLE);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
@@ -473,19 +507,22 @@ public class SimulationEditDialog extends JDialog {
unit.setToolTipText(tip);
sub.add(unit,"growx");
slider = new BasicSlider(m.getSliderModel(0, Math.PI/9,
- SimulationConditions.MAX_LAUNCH_ROD_ANGLE));
+ SimulationOptions.MAX_LAUNCH_ROD_ANGLE));
slider.setToolTipText(tip);
sub.add(slider,"w 75lp, wrap");
- // Direction
- label = new JLabel("Direction:");
- tip = "Direction of the launch rod relative to the wind.
" +
+ // Direction:
+ label = new JLabel(trans.get("simedtdlg.lbl.Direction"));
+ //// Direction of the launch rod relative to the wind.
+ //// = towards the wind,
+ //// = downwind.
+ tip = trans.get("simedtdlg.lbl.ttip.Direction1") +
UnitGroup.UNITS_ANGLE.toStringUnit(0) +
- " = towards the wind, "+
+ " " + trans.get("simedtdlg.lbl.ttip.Direction2") + " "+
UnitGroup.UNITS_ANGLE.toStringUnit(Math.PI) +
- " = downwind.";
+ " " + trans.get("simedtdlg.lbl.ttip.Direction3");
label.setToolTipText(tip);
sub.add(label);
@@ -510,18 +547,25 @@ public class SimulationEditDialog extends JDialog {
private String getIntensityDescription(double i) {
if (i < 0.001)
- return "None";
+ //// None
+ return trans.get("simedtdlg.IntensityDesc.None");
if (i < 0.05)
- return "Very low";
+ //// Very low
+ return trans.get("simedtdlg.IntensityDesc.Verylow");
if (i < 0.10)
- return "Low";
+ //// Low
+ return trans.get("simedtdlg.IntensityDesc.Low");
if (i < 0.15)
- return "Medium";
+ //// Medium
+ return trans.get("simedtdlg.IntensityDesc.Medium");
if (i < 0.20)
- return "High";
+ //// High
+ return trans.get("simedtdlg.IntensityDesc.High");
if (i < 0.25)
- return "Very high";
- return "Extreme";
+ //// Very high
+ return trans.get("simedtdlg.IntensityDesc.Veryhigh");
+ //// Extreme
+ return trans.get("simedtdlg.IntensityDesc.Extreme");
}
@@ -540,32 +584,35 @@ public class SimulationEditDialog extends JDialog {
//// Simulation options
sub = new JPanel(new MigLayout("fill, gap rel unrel",
"[grow][65lp!][30lp!][75lp!]",""));
- sub.setBorder(BorderFactory.createTitledBorder("Simulator options"));
+ //// Simulator options
+ sub.setBorder(BorderFactory.createTitledBorder(trans.get("simedtdlg.border.Simopt")));
panel.add(sub, "w 330lp!, growy, aligny 0");
// Calculation method
- tip = "" +
- "The Extended Barrowman method calculates aerodynamic forces according
" +
- "to the Barrowman equations extended to accommodate more components.";
+ //// The Extended Barrowman method calculates aerodynamic forces according
+ //// to the Barrowman equations extended to accommodate more components.
+ tip = trans.get("simedtdlg.lbl.ttip.Calcmethod");
- label = new JLabel("Calculation method:");
+ //// Calculation method:
+ label = new JLabel(trans.get("simedtdlg.lbl.Calcmethod"));
label.setToolTipText(tip);
sub.add(label, "gaptop unrel, gapright para, spanx, split 2, w 150lp!");
- label = new JLabel("Extended Barrowman");
+ //// Extended Barrowman
+ label = new JLabel(trans.get("simedtdlg.lbl.ExtBarrowman"));
label.setToolTipText(tip);
sub.add(label, "growx, wrap para");
// Simulation method
- tip = "" +
- "The six degree-of-freedom simulator allows the rocket total freedom during " +
- "flight.
" +
- "Integration is performed using a 4th order Runge-Kutta 4 " +
- "numerical integration.";
+ //// The six degree-of-freedom simulator allows the rocket total freedom during flight.
+ //// Integration is performed using a 4th order Runge-Kutta 4 numerical integration.
+ tip = trans.get("simedtdlg.lbl.ttip.Simmethod1") +
+ trans.get("simedtdlg.lbl.ttip.Simmethod2");
- label = new JLabel("Simulation method:");
+ //// Simulation method:
+ label = new JLabel(trans.get("simedtdlg.lbl.Simmethod"));
label.setToolTipText(tip);
sub.add(label, "gaptop unrel, gapright para, spanx, split 2, w 150lp!");
@@ -575,12 +622,14 @@ public class SimulationEditDialog extends JDialog {
// Wind average
- label = new JLabel("Time step:");
- tip = "The time between simulation steps.
" +
- "A smaller time step results in a more accurate but slower simulation.
" +
- "The 4th order simulation method is quite accurate with a time " +
- "step of " +
- UnitGroup.UNITS_TIME_STEP.toStringUnit(RK4Simulator.RECOMMENDED_TIME_STEP) +
+ //// Time step:
+ label = new JLabel(trans.get("simedtdlg.lbl.Timestep"));
+ //// The time between simulation steps.
+ //// A smaller time step results in a more accurate but slower simulation.
+ //// The 4th order simulation method is quite accurate with a time step of
+ tip = trans.get("simedtdlg.lbl.ttip.Timestep1") +
+ trans.get("simedtdlg.lbl.ttip.Timestep2") + " " +
+ UnitGroup.UNITS_TIME_STEP.toStringUnit(RK4SimulationStepper.RECOMMENDED_TIME_STEP) +
".";
label.setToolTipText(tip);
sub.add(label);
@@ -628,10 +677,18 @@ public class SimulationEditDialog extends JDialog {
sub.add(slider,"w 75lp, wrap para");
*/
- JButton button = new JButton("Reset to default");
- button.setToolTipText("Reset the time step to its default value (" +
- UnitGroup.UNITS_SHORT_TIME.toStringUnit(RK4Simulator.RECOMMENDED_TIME_STEP) +
+ //// Reset to default button
+ JButton button = new JButton(trans.get("simedtdlg.but.resettodefault"));
+ //// Reset the time step to its default value (
+ button.setToolTipText(trans.get("simedtdlg.but.ttip.resettodefault") +
+ UnitGroup.UNITS_SHORT_TIME.toStringUnit(RK4SimulationStepper.RECOMMENDED_TIME_STEP) +
").");
+ button.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ conditions.setTimeStep(RK4SimulationStepper.RECOMMENDED_TIME_STEP);
+ }
+ });
// button.setToolTipText("Reset the step value to its default:
" +
// "Time step " +
@@ -645,20 +702,20 @@ public class SimulationEditDialog extends JDialog {
//// Simulation listeners
sub = new JPanel(new MigLayout("fill, gap 0 0"));
- sub.setBorder(BorderFactory.createTitledBorder("Simulator listeners"));
+ //// Simulator listeners
+ sub.setBorder(BorderFactory.createTitledBorder(trans.get("simedtdlg.border.Simlist")));
panel.add(sub, "growx, growy");
- DescriptionArea desc = new DescriptionArea(5, -1);
- desc.setText("
" + - "Simulation listeners is an advanced feature that allows "+ - "user-written code to listen to and interact with the simulation. " + - "For details on writing simulation listeners, see the OpenRocket " + - "technical documentation.
"); + DescriptionArea desc = new DescriptionArea(5); + //// Simulation listeners is an advanced feature that allows user-written code to listen to and interact with the simulation. + //// For details on writing simulation listeners, see the OpenRocket technical documentation. + desc.setText(trans.get("simedtdlg.txt.longA1") + + trans.get("simedtdlg.txt.longA2")); sub.add(desc, "aligny 0, growx, wrap para"); - - label = new JLabel("Current listeners:"); + //// Current listeners: + label = new JLabel(trans.get("simedtdlg.lbl.Curlist")); sub.add(label, "spanx, wrap rel"); final ListenerListModel listenerModel = new ListenerListModel(); @@ -668,17 +725,19 @@ public class SimulationEditDialog extends JDialog { // scroll.setPreferredSize(new Dimension(1,1)); sub.add(scroll, "height 1px, grow, wrap rel"); - - button = new JButton("Add"); + //// Add button + button = new JButton(trans.get("simedtdlg.but.add")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String previous = Prefs.NODE.get("previousListenerName", ""); String input = (String)JOptionPane.showInputDialog(SimulationEditDialog.this, new Object[] { + //// Type the full Java class name of the simulation listener, for example: "Type the full Java class name of the simulation listener, for example:", "" + CSVSaveListener.class.getName() + "" }, - "Add simulation listener", + //// Add simulation listener + trans.get("simedtdlg.lbl.Addsimlist"), JOptionPane.QUESTION_MESSAGE, null, null, previous @@ -693,7 +752,8 @@ public class SimulationEditDialog extends JDialog { }); sub.add(button, "split 2, sizegroup buttons, alignx 50%, gapright para"); - button = new JButton("Remove"); + //// Remove button + button = new JButton(trans.get("simedtdlg.but.remove")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -742,34 +802,7 @@ public class SimulationEditDialog extends JDialog { return noDataPanel(); } - - if (true) - return new PlotPanel(simulation); - - JPanel panel = new JPanel(new MigLayout("fill")); - - - - - JButton button = new JButton("test"); - - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PlotConfiguration config = new PlotConfiguration(); - config.addPlotDataType(FlightDataBranch.TYPE_ALTITUDE); - config.addPlotDataType(FlightDataBranch.TYPE_VELOCITY_Z); - config.addPlotDataType(FlightDataBranch.TYPE_ACCELERATION_Z); - config.addPlotDataType(FlightDataBranch.TYPE_ACCELERATION_TOTAL); - - config.setDomainAxisType(FlightDataBranch.TYPE_TIME); - - performPlot(config); - } - }); - panel.add(button); - - return panel; + return new SimulationPlotPanel(simulation); } @@ -778,19 +811,15 @@ public class SimulationEditDialog extends JDialog { * A panel for exporting the data. */ private JPanel exportTab() { + FlightData data = simulation.getSimulatedData(); // Check that data exists - if (simulation.getSimulatedData() == null || - simulation.getSimulatedData().getBranchCount() == 0) { + if (data == null || data.getBranchCount() == 0 || + data.getBranch(0).getTypes().length == 0) { return noDataPanel(); } - - JPanel panel = new JPanel(new MigLayout("fill")); - - panel.add(new JLabel("Not implemented yet.")); // TODO: HIGH: Implement export - - return panel; + return new SimulationExportPanel(simulation); } @@ -801,13 +830,15 @@ public class SimulationEditDialog extends JDialog { * Return a panel stating that there is no data available, and that the user * should run the simulation first. */ - private JPanel noDataPanel() { + public static JPanel noDataPanel() { JPanel panel = new JPanel(new MigLayout("fill")); // No data available - panel.add(new JLabel("No flight data available."), + //// No flight data available. + panel.add(new JLabel(trans.get("simedtdlg.lbl.Noflightdata")), "alignx 50%, aligny 100%, wrap para"); - panel.add(new JLabel("Please run the simulation first."), + //// Please run the simulation first. + panel.add(new JLabel(trans.get("simedtdlg.lbl.runsimfirst")), "alignx 50%, aligny 0%, wrap"); return panel; } @@ -828,7 +859,7 @@ public class SimulationEditDialog extends JDialog { // Get the domain axis type - final FlightDataBranch.Type domainType = filled.getDomainAxisType(); + final FlightDataType domainType = filled.getDomainAxisType(); final Unit domainUnit = filled.getDomainAxisUnit(); if (domainType == null) { throw new IllegalArgumentException("Domain axis type not specified."); @@ -841,7 +872,7 @@ public class SimulationEditDialog extends JDialog { String[] axisLabel = new String[2]; for (int i = 0; i < length; i++) { // Get info - FlightDataBranch.Type type = filled.getType(i); + FlightDataType type = filled.getType(i); Unit unit = filled.getUnit(i); int axis = filled.getAxis(i); String name = getLabel(type, unit); @@ -864,7 +895,8 @@ public class SimulationEditDialog extends JDialog { // Create the chart using the factory to get all default settings JFreeChart chart = ChartFactory.createXYLineChart( - "Simulated flight", + //// Simulated flight + trans.get("simedtdlg.chart.Simflight"), null, null, null, @@ -903,7 +935,8 @@ public class SimulationEditDialog extends JDialog { // Create the dialog - final JDialog dialog = new JDialog(this, "Simulation results"); + //// Simulation results + final JDialog dialog = new JDialog(this, trans.get("simedtdlg.dlg.Simres")); dialog.setModalityType(ModalityType.DOCUMENT_MODAL); JPanel panel = new JPanel(new MigLayout("fill")); @@ -923,7 +956,8 @@ public class SimulationEditDialog extends JDialog { panel.add(chartPanel, "grow, wrap 20lp"); - JButton button = new JButton("Close"); + //// Close button + JButton button = new JButton(trans.get("dlg.but.close")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -934,8 +968,8 @@ public class SimulationEditDialog extends JDialog { dialog.setLocationByPlatform(true); dialog.pack(); - GUIUtil.installEscapeCloseOperation(dialog); - GUIUtil.setDefaultButton(button); + + GUIUtil.setDisposableDialogOptions(dialog, button); dialog.setVisible(true); } @@ -958,7 +992,7 @@ public class SimulationEditDialog extends JDialog { } - private String getLabel(FlightDataBranch.Type type, Unit unit) { + private String getLabel(FlightDataType type, Unit unit) { String name = type.getName(); if (unit != null && !UnitGroup.UNITS_NONE.contains(unit) && !UnitGroup.UNITS_COEFFICIENT.contains(unit) && unit.getUnit().length() > 0) @@ -987,9 +1021,11 @@ public class SimulationEditDialog extends JDialog { if (ex == null) { setIcon(Icons.SIMULATION_LISTENER_OK); + //// Listener instantiated successfully. setToolTipText("Listener instantiated successfully."); } else { setIcon(Icons.SIMULATION_LISTENER_ERROR); + //// Unable to instantiate listener due to exception: