diff --git a/core/src/net/sf/openrocket/document/OpenRocketDocument.java b/core/src/net/sf/openrocket/document/OpenRocketDocument.java index eb0f26d7a..41c32acac 100644 --- a/core/src/net/sf/openrocket/document/OpenRocketDocument.java +++ b/core/src/net/sf/openrocket/document/OpenRocketDocument.java @@ -810,7 +810,7 @@ public class OpenRocketDocument implements ComponentChangeListener { listeners.remove(listener); } - protected void fireDocumentChangeEvent(DocumentChangeEvent event) { + public void fireDocumentChangeEvent(DocumentChangeEvent event) { DocumentChangeListener[] array = listeners.toArray(new DocumentChangeListener[0]); for (DocumentChangeListener l : array) { l.documentChanged(event); diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index a7db4f200..82723a6e1 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -533,7 +533,8 @@ public class BasicEventSimulationEngine implements SimulationEngine { } } - + + // TODO : FUTURE : do not hard code the 1200 (maybe even make it configurable by the user) if( 1200 < currentStatus.getSimulationTime() ){ ret = false; log.error("Simulation hit max time (1200s): aborting."); diff --git a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java index 2488234e7..7657bba57 100644 --- a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java @@ -576,7 +576,7 @@ public class SimulationPanel extends JPanel { public void documentChanged(DocumentChangeEvent event) { if (!(event instanceof SimulationChangeEvent)) return; - simulationTableModel.fireTableDataChanged(); + fireMaintainSelection(); } }); diff --git a/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java b/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java index 39445e35c..1caf8388e 100644 --- a/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java +++ b/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java @@ -38,6 +38,7 @@ import net.sf.openrocket.aerodynamics.FlightConditions; import net.sf.openrocket.aerodynamics.WarningSet; import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.document.Simulation; +import net.sf.openrocket.document.events.SimulationChangeEvent; import net.sf.openrocket.gui.adaptors.DoubleModel; import net.sf.openrocket.gui.components.BasicSlider; import net.sf.openrocket.gui.components.ConfigurationComboBox; @@ -216,6 +217,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change rkt.addComponentChangeListener(new ComponentChangeListener() { @Override public void componentChanged(ComponentChangeEvent e) { + updateExtras(); if (is3d) { if (e.isTextureChange()) { figure3d.flushTextureCaches(); @@ -557,7 +559,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change /** * Updates the extra data included in the figure. Currently this includes - * the CP and CG carets. + * the CP and CG carets. Also start the background simulator. */ private WarningSet warnings = new WarningSet(); @@ -708,7 +710,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change simulation.setFlightConfigurationId( document.getSelectedConfiguration().getId()); } else System.out.println("using pre-existing simulation"); - + backgroundSimulationWorker = new BackgroundSimulationWorker(document, simulation); backgroundSimulationExecutor.execute(backgroundSimulationWorker); } @@ -758,12 +760,12 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change // Do nothing if cancelled if (isCancelled() || backgroundSimulationWorker != this) return; - backgroundSimulationWorker = null; extraText.setFlightData(simulation.getSimulatedData()); extraText.setCalculatingData(false); figure.repaint(); figure3d.repaint(); + document.fireDocumentChangeEvent(new SimulationChangeEvent(simulation)); } @Override