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.rocketcomponent.Configuration;
import net.sf.openrocket.simulation.FlightData;
import net.sf.openrocket.simulation.FlightDataBranch;
import net.sf.openrocket.simulation.listeners.CSVSaveListener;
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;
tabbedPane.addTab("Launch conditions", flightConditionsTab());
tabbedPane.addTab("Simulation options", simulationOptionsTab());
tabbedPane.addTab("Plot data", plotTab());
-// tabbedPane.addTab("Export data", exportTab());
+ tabbedPane.addTab("Export data", exportTab());
// Select the initial tab
if (tab == EDIT) {
this.validate();
this.pack();
this.setLocationByPlatform(true);
- GUIUtil.setDefaultButton(button);
- GUIUtil.installEscapeCloseOperation(this);
+
+ GUIUtil.setDisposableDialogOptions(this, button);
}
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));
button.setToolTipText("Reset the time step to its default value (" +
UnitGroup.UNITS_SHORT_TIME.toStringUnit(RK4Simulator.RECOMMENDED_TIME_STEP) +
").");
+ button.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ conditions.setTimeStep(RK4Simulator.RECOMMENDED_TIME_STEP);
+ }
+ });
// button.setToolTipText("<html>Reset the step value to its default:<br>" +
// "Time step " +
DescriptionArea desc = new DescriptionArea(5);
- desc.setText("<html><p>" +
+ desc.setText("<html>" +
"<i>Simulation listeners</i> 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.</p>");
+ "technical documentation.");
sub.add(desc, "aligny 0, growx, wrap para");
if (true)
- return new PlotPanel(simulation);
+ return new SimulationPlotPanel(simulation);
JPanel panel = new JPanel(new MigLayout("fill"));
* 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);
}
* 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
dialog.setLocationByPlatform(true);
dialog.pack();
- GUIUtil.installEscapeCloseOperation(dialog);
- GUIUtil.setDefaultButton(button);
+
+ GUIUtil.setDisposableDialogOptions(dialog, button);
dialog.setVisible(true);
}