[Refine] Copying a FlightConfiguration in the UI now updates correctly.
- involved adjusting clone() -> copy(...) in FlightConfigurableParameters
This commit is contained in:
parent
d7faf0d273
commit
345d5952c6
@ -186,23 +186,36 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return this.id.hashCode();
|
return this.id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of this motor instance. The state of the motor is
|
* Create a new instance of this motor instance. The state of the motor is
|
||||||
* identical to this instance and can be used independently from this one.
|
* identical to this instance and can be used independently from this one.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MotorConfiguration clone( ) {
|
public MotorConfiguration clone( ) {
|
||||||
MotorConfiguration clone = new MotorConfiguration( this.mount, this.fcid);
|
MotorConfiguration clone = new MotorConfiguration( this.mount, this.fcid);
|
||||||
clone.motor = this.motor;
|
clone.motor = this.motor;
|
||||||
clone.ejectionDelay = this.ejectionDelay;
|
clone.ejectionDelay = this.ejectionDelay;
|
||||||
clone.ignitionOveride = this.ignitionOveride;
|
clone.ignitionOveride = this.ignitionOveride;
|
||||||
clone.ignitionDelay = this.ignitionDelay;
|
clone.ignitionDelay = this.ignitionDelay;
|
||||||
clone.ignitionEvent = this.ignitionEvent;
|
clone.ignitionEvent = this.ignitionEvent;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getModID() {
|
@Override
|
||||||
|
public MotorConfiguration copy( final FlightConfigurationId copyId){
|
||||||
|
MotorConfiguration clone = new MotorConfiguration( this.mount, copyId);
|
||||||
|
clone.motor = this.motor;
|
||||||
|
clone.ejectionDelay = this.ejectionDelay;
|
||||||
|
clone.ignitionOveride = this.ignitionOveride;
|
||||||
|
clone.ignitionDelay = this.ignitionDelay;
|
||||||
|
clone.ignitionEvent = this.ignitionEvent;
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int getModID() {
|
||||||
return modID;
|
return modID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,17 +18,12 @@ public final class MotorConfigurationId {
|
|||||||
|
|
||||||
private final static String ERROR_ID_TEXT = "MotorInstance Error Id".intern();
|
private final static String ERROR_ID_TEXT = "MotorInstance Error Id".intern();
|
||||||
private final static UUID ERROR_KEY = new UUID( 62274413, 56768908);
|
private final static UUID ERROR_KEY = new UUID( 62274413, 56768908);
|
||||||
public final static MotorConfigurationId ERROR_ID = new MotorConfigurationId();
|
|
||||||
|
|
||||||
private MotorConfigurationId( ) {
|
|
||||||
this.key = MotorConfigurationId.ERROR_KEY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sole constructor.
|
* Sole constructor.
|
||||||
*
|
*
|
||||||
* @param componentName the component ID, must not be null
|
* @param _mount the component ID, must not be null
|
||||||
* @param number a positive motor number
|
* @param _fcid the key for a
|
||||||
*/
|
*/
|
||||||
public MotorConfigurationId(final MotorMount _mount, final FlightConfigurationId _fcid) {
|
public MotorConfigurationId(final MotorMount _mount, final FlightConfigurationId _fcid) {
|
||||||
if (null == _mount ) {
|
if (null == _mount ) {
|
||||||
@ -43,7 +38,6 @@ public final class MotorConfigurationId {
|
|||||||
final long lower = _fcid.key.getLeastSignificantBits();
|
final long lower = _fcid.key.getLeastSignificantBits();
|
||||||
this.key = new UUID( upper, lower);
|
this.key = new UUID( upper, lower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
|
@ -72,8 +72,8 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
public void copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
||||||
separations.cloneFlightConfiguration(oldConfigId, newConfigId);
|
separations.copyFlightConfiguration(oldConfigId, newConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -397,8 +397,8 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
public void copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
||||||
motors.cloneFlightConfiguration(oldConfigId, newConfigId);
|
motors.copyFlightConfiguration(oldConfigId, newConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,6 +141,9 @@ public class DeploymentConfiguration implements FlightConfigurableParameter<Depl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeploymentConfiguration clone() {
|
public DeploymentConfiguration clone() {
|
||||||
|
return copy(null);
|
||||||
|
}
|
||||||
|
public DeploymentConfiguration copy( final FlightConfigurationId copyId) {
|
||||||
DeploymentConfiguration that = new DeploymentConfiguration();
|
DeploymentConfiguration that = new DeploymentConfiguration();
|
||||||
that.deployAltitude = this.deployAltitude;
|
that.deployAltitude = this.deployAltitude;
|
||||||
that.deployDelay = this.deployDelay;
|
that.deployDelay = this.deployDelay;
|
||||||
|
@ -14,6 +14,6 @@ public interface FlightConfigurableComponent {
|
|||||||
* @param oldConfigId the old configuration ID
|
* @param oldConfigId the old configuration ID
|
||||||
* @param newConfigId the new configuration ID
|
* @param newConfigId the new configuration ID
|
||||||
*/
|
*/
|
||||||
public void cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId);
|
void copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,18 @@ package net.sf.openrocket.rocketcomponent;
|
|||||||
public interface FlightConfigurableParameter<E> {
|
public interface FlightConfigurableParameter<E> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a copy of this object. The listeners must not be copied
|
* return an exact copy of this object
|
||||||
* to the new object.
|
|
||||||
*/
|
*/
|
||||||
public E clone();
|
E clone();
|
||||||
|
|
||||||
public void update();
|
/**
|
||||||
|
* return a copy of this object, corresponding to the specified Id
|
||||||
|
*
|
||||||
|
* @param fcid id to attach the new object to
|
||||||
|
* @return the desired copy
|
||||||
|
*/
|
||||||
|
E copy( final FlightConfigurationId fcid );
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,10 +221,11 @@ public class FlightConfigurableParameterSet<E extends FlightConfigurableParamete
|
|||||||
setDefault(tempValue);
|
setDefault(tempValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlightConfigurationId cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
public FlightConfigurationId copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
||||||
// clones the ENTRIES for the given fcid's.
|
// clones the ENTRIES for the given fcid's.
|
||||||
E oldValue = this.get(oldConfigId);
|
E oldValue = this.get(oldConfigId);
|
||||||
this.set(newConfigId, oldValue.clone());
|
E newValue = oldValue.copy( newConfigId);
|
||||||
|
this.set(newConfigId, newValue );
|
||||||
update();
|
update();
|
||||||
return newConfigId;
|
return newConfigId;
|
||||||
}
|
}
|
||||||
|
@ -465,25 +465,40 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
// Note the stages are updated in the constructor call.
|
// Note the stages are updated in the constructor call.
|
||||||
FlightConfiguration clone = new FlightConfiguration( this.rocket, this.fcid );
|
FlightConfiguration clone = new FlightConfiguration( this.rocket, this.fcid );
|
||||||
clone.setName("clone[#"+clone.instanceNumber+"]"+clone.fcid.toShortKey());
|
clone.setName("clone[#"+clone.instanceNumber+"]"+clone.fcid.toShortKey());
|
||||||
//FlightConfigurationId cloneId = clone.getFlightConfigurationID();
|
|
||||||
|
|
||||||
System.err.println(" cloning from: "+this.toDebug());
|
clone.cachedBounds = this.cachedBounds.clone();
|
||||||
System.err.println(" cloning to: "+clone.toDebug());
|
|
||||||
|
|
||||||
// // clone motor instances.
|
|
||||||
// for( MotorConfiguration motor : motors.values() ){
|
|
||||||
// MotorConfiguration cloneMotor = new MotorConfiguration( motor, cloneId);
|
|
||||||
// clone.addMotor( cloneMotor);
|
|
||||||
// cloneMotor.getMount().setMotorConfig(cloneMotor, cloneId);
|
|
||||||
// }
|
|
||||||
|
|
||||||
clone.cachedBounds = this.cachedBounds.clone();
|
|
||||||
clone.modID = this.modID;
|
clone.modID = this.modID;
|
||||||
clone.boundsModID = -1;
|
clone.boundsModID = -1;
|
||||||
clone.refLengthModID = -1;
|
clone.refLengthModID = -1;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy all available information attached to this, and attached copies to the
|
||||||
|
* new configuration
|
||||||
|
*
|
||||||
|
* @param copyId attached the new configuration to this Id
|
||||||
|
* @return the new configuration
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FlightConfiguration copy( final FlightConfigurationId copyId ) {
|
||||||
|
// Note the stages are updated in the constructor call.
|
||||||
|
FlightConfiguration copy= new FlightConfiguration( this.rocket, copyId );
|
||||||
|
|
||||||
|
// copy motor instances.
|
||||||
|
for( final MotorConfiguration sourceMotor: motors.values() ){
|
||||||
|
MotorConfiguration cloneMotor = sourceMotor.copy( copyId);
|
||||||
|
copy.addMotor( cloneMotor);
|
||||||
|
cloneMotor.getMount().setMotorConfig(cloneMotor, copyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
copy.cachedBounds = this.cachedBounds.clone();
|
||||||
|
copy.modID = this.modID;
|
||||||
|
copy.boundsModID = -1;
|
||||||
|
copy.refLengthModID = -1;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getModID() {
|
public int getModID() {
|
||||||
// TODO: this doesn't seem consistent...
|
// TODO: this doesn't seem consistent...
|
||||||
@ -509,10 +524,8 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other){
|
public boolean equals(Object other){
|
||||||
if( other instanceof FlightConfiguration ){
|
return (( other instanceof FlightConfiguration ) &&
|
||||||
return this.fcid.equals( ((FlightConfiguration)other).fcid);
|
this.fcid.equals( ((FlightConfiguration)other).fcid));
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,11 +73,7 @@ public final class FlightConfigurationId implements Comparable<FlightConfigurati
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return this.key.hashCode();
|
return this.key.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID intern() {
|
|
||||||
return this.key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasError(){
|
public boolean hasError(){
|
||||||
return (ERROR_UUID == this.key);
|
return (ERROR_UUID == this.key);
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,16 @@ public class IgnitionConfiguration implements FlightConfigurableParameter<Igniti
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IgnitionConfiguration clone() {
|
public IgnitionConfiguration clone() {
|
||||||
IgnitionConfiguration clone = new IgnitionConfiguration();
|
return this.copy(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IgnitionConfiguration copy( final FlightConfigurationId copyId) {
|
||||||
|
IgnitionConfiguration clone = new IgnitionConfiguration();
|
||||||
clone.ignitionDelay = this.ignitionDelay;
|
clone.ignitionDelay = this.ignitionDelay;
|
||||||
clone.ignitionEvent = this.ignitionEvent;
|
clone.ignitionEvent = this.ignitionEvent;
|
||||||
clone.ignitionTime = this.ignitionTime;
|
clone.ignitionTime = this.ignitionTime;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
@ -304,8 +304,8 @@ public class InnerTube extends ThicknessRingComponent implements Clusterable, Ra
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
public void copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
||||||
motors.cloneFlightConfiguration(oldConfigId, newConfigId);
|
motors.copyFlightConfiguration(oldConfigId, newConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
public void copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
||||||
this.separations.cloneFlightConfiguration(oldConfigId, newConfigId);
|
this.separations.copyFlightConfiguration(oldConfigId, newConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,8 +90,8 @@ public abstract class RecoveryDevice extends MassObject implements FlightConfigu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cloneFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
public void copyFlightConfiguration(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
||||||
deploymentConfigurations.cloneFlightConfiguration(oldConfigId, newConfigId);
|
deploymentConfigurations.copyFlightConfiguration(oldConfigId, newConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,6 +135,10 @@ public class StageSeparationConfiguration implements FlightConfigurableParameter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StageSeparationConfiguration clone() {
|
public StageSeparationConfiguration clone() {
|
||||||
|
return copy(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StageSeparationConfiguration copy( final FlightConfigurationId copyId){
|
||||||
StageSeparationConfiguration clone = new StageSeparationConfiguration();
|
StageSeparationConfiguration clone = new StageSeparationConfiguration();
|
||||||
clone.separationEvent = this.separationEvent;
|
clone.separationEvent = this.separationEvent;
|
||||||
clone.separationDelay = this.separationDelay;
|
clone.separationDelay = this.separationDelay;
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package net.sf.openrocket.rocketvisitors;
|
|
||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurableComponent;
|
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
|
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
|
||||||
|
|
||||||
public class CopyFlightConfigurationVisitor extends DepthFirstRecusiveVisitor<Void> {
|
|
||||||
|
|
||||||
private final FlightConfigurationId oldConfigId;
|
|
||||||
private final FlightConfigurationId newConfigId;
|
|
||||||
|
|
||||||
public CopyFlightConfigurationVisitor(FlightConfigurationId oldConfigId, FlightConfigurationId newConfigId) {
|
|
||||||
super();
|
|
||||||
this.oldConfigId = oldConfigId;
|
|
||||||
this.newConfigId = newConfigId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doAction(RocketComponent visitable) {
|
|
||||||
|
|
||||||
if (visitable instanceof FlightConfigurableComponent) {
|
|
||||||
((FlightConfigurableComponent) visitable).cloneFlightConfiguration(oldConfigId, newConfigId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Void getResult() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -51,11 +51,16 @@ public class ParameterSetTest extends BaseTestCase {
|
|||||||
public String toString(){
|
public String toString(){
|
||||||
return "tp#:"+id;
|
return "tp#:"+id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestParameter clone(){
|
public TestParameter clone(){
|
||||||
return new TestParameter();
|
return new TestParameter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TestParameter copy( final FlightConfigurationId copyId){
|
||||||
|
return new TestParameter();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@ -230,7 +235,7 @@ public class ParameterSetTest extends BaseTestCase {
|
|||||||
assertThat("set stores default value correctly: ", testSet.get(fcid2), equalTo( tp2 ));
|
assertThat("set stores default value correctly: ", testSet.get(fcid2), equalTo( tp2 ));
|
||||||
|
|
||||||
FlightConfigurationId fcid3 = new FlightConfigurationId();
|
FlightConfigurationId fcid3 = new FlightConfigurationId();
|
||||||
testSet.cloneFlightConfiguration(fcid2, fcid3);
|
testSet.copyFlightConfiguration(fcid2, fcid3);
|
||||||
// fcid <=> tp2 should be stored....
|
// fcid <=> tp2 should be stored....
|
||||||
assertThat("set should contain zero overrides: ", testSet.size(), equalTo( 2 ));
|
assertThat("set should contain zero overrides: ", testSet.size(), equalTo( 2 ));
|
||||||
assertThat("set stores default value correctly: ", testSet.get(fcid3), not( testSet.getDefault() ));
|
assertThat("set stores default value correctly: ", testSet.get(fcid3), not( testSet.getDefault() ));
|
||||||
|
@ -27,8 +27,6 @@ import net.sf.openrocket.startup.Application;
|
|||||||
import net.sf.openrocket.util.StateChangeListener;
|
import net.sf.openrocket.util.StateChangeListener;
|
||||||
|
|
||||||
public class FlightConfigurationPanel extends JPanel implements StateChangeListener {
|
public class FlightConfigurationPanel extends JPanel implements StateChangeListener {
|
||||||
private static final long serialVersionUID = -5467500312467789009L;
|
|
||||||
//private static final Logger log = LoggerFactory.getLogger(FlightConfigurationPanel.class);
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
private final OpenRocketDocument document;
|
private final OpenRocketDocument document;
|
||||||
@ -123,7 +121,6 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
private void addConfiguration() {
|
private void addConfiguration() {
|
||||||
FlightConfigurationId newFCID = new FlightConfigurationId();
|
FlightConfigurationId newFCID = new FlightConfigurationId();
|
||||||
FlightConfiguration newConfig = new FlightConfiguration( rocket, newFCID );
|
FlightConfiguration newConfig = new FlightConfiguration( rocket, newFCID );
|
||||||
|
|
||||||
rocket.setFlightConfiguration(newFCID, newConfig);
|
rocket.setFlightConfiguration(newFCID, newConfig);
|
||||||
|
|
||||||
// Create a new simulation for this configuration.
|
// Create a new simulation for this configuration.
|
||||||
@ -133,14 +130,15 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void copyConfiguration() {
|
private void copyConfiguration() {
|
||||||
FlightConfiguration oldConfig = rocket.getSelectedConfiguration();
|
FlightConfiguration oldConfig = rocket.getSelectedConfiguration();
|
||||||
FlightConfiguration newConfig = oldConfig.clone();
|
FlightConfigurationId oldId = oldConfig.getFlightConfigurationID();
|
||||||
FlightConfigurationId oldId = oldConfig.getFlightConfigurationID();
|
|
||||||
FlightConfigurationId newId = newConfig.getFlightConfigurationID();
|
FlightConfigurationId newId = new FlightConfigurationId();
|
||||||
|
FlightConfiguration newConfig = oldConfig.copy( newId);
|
||||||
|
|
||||||
for (RocketComponent c : rocket) {
|
for (RocketComponent c : rocket) {
|
||||||
if (c instanceof FlightConfigurableComponent) {
|
if (c instanceof FlightConfigurableComponent) {
|
||||||
((FlightConfigurableComponent) c).cloneFlightConfiguration(oldId, newId);
|
((FlightConfigurableComponent) c).copyFlightConfiguration(oldId, newId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rocket.setFlightConfiguration(newId, newConfig);
|
rocket.setFlightConfiguration(newId, newConfig);
|
||||||
@ -170,8 +168,10 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
private void createSimulationForNewConfiguration() {
|
private void createSimulationForNewConfiguration() {
|
||||||
Simulation newSim = new Simulation(rocket);
|
Simulation newSim = new Simulation(rocket);
|
||||||
OpenRocketDocument doc = BasicFrame.findDocument(rocket);
|
OpenRocketDocument doc = BasicFrame.findDocument(rocket);
|
||||||
newSim.setName(doc.getNextSimulationName());
|
if (doc != null) {
|
||||||
doc.addSimulation(newSim);
|
newSim.setName(doc.getNextSimulationName());
|
||||||
|
doc.addSimulation(newSim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configurationChanged() {
|
private void configurationChanged() {
|
||||||
@ -192,7 +192,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
int motorMountCount = rocket.accept(new ListMotorMounts()).size();
|
int motorMountCount = rocket.accept(new ListMotorMounts()).size();
|
||||||
|
|
||||||
// Count the number of recovery devices
|
// Count the number of recovery devices
|
||||||
int recoveryDeviceCount = rocket.accept(new ListComponents<RecoveryDevice>(RecoveryDevice.class)).size();
|
int recoveryDeviceCount = rocket.accept(new ListComponents<>(RecoveryDevice.class)).size();
|
||||||
|
|
||||||
// Count the number of stages
|
// Count the number of stages
|
||||||
int stageCount = rocket.getStageCount();
|
int stageCount = rocket.getStageCount();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user