Only show error checkbox if there are errors
This commit is contained in:
parent
1dda428b2f
commit
843c2e6d22
@ -19,6 +19,7 @@ import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.simulation.BasicEventSimulationEngine;
|
||||
import net.sf.openrocket.simulation.DefaultSimulationOptionFactory;
|
||||
import net.sf.openrocket.simulation.FlightData;
|
||||
import net.sf.openrocket.simulation.FlightEvent;
|
||||
import net.sf.openrocket.simulation.RK4SimulationStepper;
|
||||
import net.sf.openrocket.simulation.SimulationConditions;
|
||||
import net.sf.openrocket.simulation.SimulationEngine;
|
||||
@ -349,7 +350,20 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true is the status indicates that the simulation data is up-to-date.
|
||||
* Determines whether the simulation has errors
|
||||
*/
|
||||
public boolean hasErrors() {
|
||||
FlightData data = getSimulatedData();
|
||||
for (int branchNo = 0; branchNo < data.getBranchCount(); branchNo++) {
|
||||
if (data.getBranch(branchNo).getFirstEvent(FlightEvent.Type.SIM_ABORT) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the status indicates that the simulation data is up-to-date.
|
||||
* @param status status of the simulation to check for if its data is up-to-date
|
||||
*/
|
||||
public static boolean isStatusUpToDate(Status status) {
|
||||
|
@ -98,17 +98,19 @@ public class SimulationPlotDialog extends JDialog {
|
||||
});
|
||||
panel.add(checkData, "split, left");
|
||||
|
||||
//// Show errors
|
||||
//// Show errors if any
|
||||
//// ALWAYS show errors initially; make user turn it off for themselves
|
||||
final JCheckBox checkErrors = new JCheckBox(trans.get("PlotDialog.CheckBox.ShowErrors"));
|
||||
checkErrors.setSelected(true);
|
||||
checkErrors.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
myPlot.setShowErrors(checkErrors.isSelected());
|
||||
}
|
||||
});
|
||||
panel.add(checkErrors, "split, left");
|
||||
if (simulation.hasErrors()) {
|
||||
final JCheckBox checkErrors = new JCheckBox(trans.get("PlotDialog.CheckBox.ShowErrors"));
|
||||
checkErrors.setSelected(true);
|
||||
checkErrors.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
myPlot.setShowErrors(checkErrors.isSelected());
|
||||
}
|
||||
});
|
||||
panel.add(checkErrors, "split, left");
|
||||
}
|
||||
|
||||
//// Add series selection box
|
||||
ArrayList<String> stages = new ArrayList<String>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user