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.BasicEventSimulationEngine;
|
||||||
import net.sf.openrocket.simulation.DefaultSimulationOptionFactory;
|
import net.sf.openrocket.simulation.DefaultSimulationOptionFactory;
|
||||||
import net.sf.openrocket.simulation.FlightData;
|
import net.sf.openrocket.simulation.FlightData;
|
||||||
|
import net.sf.openrocket.simulation.FlightEvent;
|
||||||
import net.sf.openrocket.simulation.RK4SimulationStepper;
|
import net.sf.openrocket.simulation.RK4SimulationStepper;
|
||||||
import net.sf.openrocket.simulation.SimulationConditions;
|
import net.sf.openrocket.simulation.SimulationConditions;
|
||||||
import net.sf.openrocket.simulation.SimulationEngine;
|
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
|
* @param status status of the simulation to check for if its data is up-to-date
|
||||||
*/
|
*/
|
||||||
public static boolean isStatusUpToDate(Status status) {
|
public static boolean isStatusUpToDate(Status status) {
|
||||||
|
@ -98,8 +98,9 @@ public class SimulationPlotDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
panel.add(checkData, "split, left");
|
panel.add(checkData, "split, left");
|
||||||
|
|
||||||
//// Show errors
|
//// Show errors if any
|
||||||
//// ALWAYS show errors initially; make user turn it off for themselves
|
//// ALWAYS show errors initially; make user turn it off for themselves
|
||||||
|
if (simulation.hasErrors()) {
|
||||||
final JCheckBox checkErrors = new JCheckBox(trans.get("PlotDialog.CheckBox.ShowErrors"));
|
final JCheckBox checkErrors = new JCheckBox(trans.get("PlotDialog.CheckBox.ShowErrors"));
|
||||||
checkErrors.setSelected(true);
|
checkErrors.setSelected(true);
|
||||||
checkErrors.addActionListener(new ActionListener() {
|
checkErrors.addActionListener(new ActionListener() {
|
||||||
@ -109,6 +110,7 @@ public class SimulationPlotDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(checkErrors, "split, left");
|
panel.add(checkErrors, "split, left");
|
||||||
|
}
|
||||||
|
|
||||||
//// Add series selection box
|
//// Add series selection box
|
||||||
ArrayList<String> stages = new ArrayList<String>();
|
ArrayList<String> stages = new ArrayList<String>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user