I like it better when the close button copies the SimulationOptions.
Only SimulationOptions needs to be a little bit smarter about when to fire the change event.
This commit is contained in:
parent
4cfc65fbe2
commit
7d30bcb67b
@ -213,6 +213,7 @@ public class SimulationEditDialog extends JDialog {
|
||||
close.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
copyChangesToAllSims();
|
||||
SimulationEditDialog.this.dispose();
|
||||
}
|
||||
});
|
||||
|
@ -453,24 +453,70 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
||||
}
|
||||
|
||||
public void copyConditionsFrom(SimulationOptions src) {
|
||||
|
||||
// Be a little smart about triggering the change event.
|
||||
// only do it if one of the "important" (user specified) parameters has really changed.
|
||||
boolean isChanged = false;
|
||||
if (this.launchAltitude != src.launchAltitude) {
|
||||
isChanged = true;
|
||||
this.launchAltitude = src.launchAltitude;
|
||||
}
|
||||
if (this.launchLatitude != src.launchLatitude) {
|
||||
isChanged = true;
|
||||
this.launchLatitude = src.launchLatitude;
|
||||
}
|
||||
if (this.launchLongitude != src.launchLongitude) {
|
||||
isChanged = true;
|
||||
this.launchLongitude = src.launchLongitude;
|
||||
}
|
||||
if (this.launchPressure != src.launchPressure) {
|
||||
isChanged = true;
|
||||
this.launchPressure = src.launchPressure;
|
||||
}
|
||||
if (this.launchRodAngle != src.launchRodAngle) {
|
||||
isChanged = true;
|
||||
this.launchRodAngle = src.launchRodAngle;
|
||||
}
|
||||
if (this.launchRodDirection != src.launchRodDirection) {
|
||||
isChanged = true;
|
||||
this.launchRodDirection = src.launchRodDirection;
|
||||
}
|
||||
if (this.launchRodLength != src.launchRodLength) {
|
||||
isChanged = true;
|
||||
this.launchRodLength = src.launchRodLength;
|
||||
}
|
||||
if (this.launchTemperature != src.launchTemperature) {
|
||||
isChanged = true;
|
||||
this.launchTemperature = src.launchTemperature;
|
||||
}
|
||||
if (this.maximumAngle != src.maximumAngle) {
|
||||
isChanged = true;
|
||||
this.maximumAngle = src.maximumAngle;
|
||||
}
|
||||
this.maximumAngle = src.maximumAngle;
|
||||
if (this.timeStep != src.timeStep) {
|
||||
isChanged = true;
|
||||
this.timeStep = src.timeStep;
|
||||
}
|
||||
if (this.windAverage != src.windAverage) {
|
||||
isChanged = true;
|
||||
this.windAverage = src.windAverage;
|
||||
}
|
||||
if (this.windTurbulence != src.windTurbulence) {
|
||||
isChanged = true;
|
||||
this.windTurbulence = src.windTurbulence;
|
||||
}
|
||||
if (this.calculateExtras != src.calculateExtras) {
|
||||
isChanged = true;
|
||||
this.calculateExtras = src.calculateExtras;
|
||||
this.randomSeed = src.randomSeed;
|
||||
}
|
||||
|
||||
if (isChanged) {
|
||||
// Only copy the randomSeed if something else has changed.
|
||||
// Honestly, I don't really see a need for that.
|
||||
this.randomSeed = src.randomSeed;
|
||||
fireChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user