- private void updateContents() {\r
-\r
- OpenRocketDocument rocketDocument = app.getRocketDocument();\r
- Rocket rocket = rocketDocument.getRocket();\r
-\r
- setTitle(rocket.getName());\r
-\r
- Unit LengthUnit = UnitGroup.UNITS_LENGTH.getDefaultUnit();\r
- Unit MassUnit = UnitGroup.UNITS_MASS.getDefaultUnit();\r
-\r
- Coordinate cg = RocketUtils.getCG(rocket);\r
- double length = RocketUtils.getLength(rocket);\r
- ((TextView) findViewById(R.id.openrocketviewerRocketName)).setText( rocket.getName());\r
- ((TextView)findViewById(R.id.openrocketviewerDesigner)).setText(rocket.getDesigner());\r
- ((TextView)findViewById(R.id.openrocketviewerCG)).setText(LengthUnit.toStringUnit(cg.x) );\r
- ((TextView)findViewById(R.id.openrocketviewerLength)).setText(LengthUnit.toStringUnit(length));\r
- ((TextView)findViewById(R.id.openrocketviewerMass)).setText(MassUnit.toStringUnit(cg.weight));\r
- ((TextView)findViewById(R.id.openrocketviewerStageCount)).setText(String.valueOf(rocket.getStageCount()));\r
- ((TextView)findViewById(R.id.openrocketviewerComment)).setText(rocket.getComment());\r
-\r
- ArrayAdapter<Simulation> sims = new ArrayAdapter<Simulation>(this,android.R.layout.simple_list_item_2,rocketDocument.getSimulations()) {\r
-\r
- @Override\r
- public View getView(int position, View convertView, ViewGroup parent) {\r
- View v = convertView;\r
- if ( v == null ) {\r
- LayoutInflater li = getLayoutInflater();\r
- v = li.inflate(android.R.layout.simple_list_item_2,null);\r
- }\r
- Simulation sim = this.getItem(position);\r
- ((TextView)v.findViewById(android.R.id.text1)).setText( sim.getName() );\r
- ((TextView)v.findViewById(android.R.id.text2)).setText( "motors: " + sim.getConfiguration().getMotorConfigurationDescription() + " apogee: " + sim.getSimulatedData().getMaxAltitude() + "m time: " + sim.getSimulatedData().getFlightTime() + "s");\r
- return v;\r
- }\r
+ Simulation sim = CurrentRocketHolder.getCurrentRocket().getRocketDocument().getSimulation(simulationId);\r
+ // Check if there is data for this simulation.\r
+ if ( sim.getSimulatedData() == null || sim.getSimulatedData().getBranchCount() == 0 ) {\r
+ // This shouldn't happen because the Simulations list does the check.\r
+ return;\r
+ }\r