implemented gui elements for controlling stage axial placement. + other Event refinements

This commit is contained in:
Daniel_M_Williams 2015-06-15 15:38:18 -04:00
parent 4f716b40af
commit c5d47cf806
3 changed files with 49 additions and 12 deletions

View File

@ -829,6 +829,7 @@ RocketCompCfg.outside.stage = Make this Stage Parallel
RocketCompCfg.outside.radius = Radial Distance
RocketCompCfg.outside.angle = Angle
RocketCompCfg.outside.rotation = Rotation
RocketCompCfg.outside.componentname = Name of parent component
RocketCompCfg.tab.Figure = Figure
RocketCompCfg.tab.Figstyleopt = Figure style options
RocketCompCfg.tab.Comment = Comment
@ -1369,6 +1370,7 @@ RocketComponent.Position.BOTTOM = Bottom of the parent component
RocketComponent.Position.AFTER = After the parent component
RocketComponent.Position.ABSOLUTE = Tip of the nose cone
! LaunchLug
LaunchLug.Launchlug = Launch lug
! NoseCone

View File

@ -73,58 +73,62 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
public void setOutside(final boolean _outside) {
this.outside = _outside;
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}
@Override
public double getAngularPosition() {
if (this.isInline()) {
if (this.outside) {
return this.position_angular_rad;
} else {
return 0.;
}
return this.position_angular_rad;
}
@Override
public void setAngularPosition(final double angle_rad) {
this.position_angular_rad = angle_rad;
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}
@Override
public double getRadialPosition() {
if (this.isInline()) {
if (this.outside) {
return this.position_radial_m;
} else {
return 0.;
}
return this.position_radial_m;
}
@Override
public void setRadialPosition(final double radius) {
this.position_radial_m = radius;
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}
@Override
public double getRotation() {
if (this.isInline()) {
if (this.outside) {
return this.rotation_rad;
} else {
return 0.;
}
return this.rotation_rad;
}
@Override
public void setRotation(final double rotation) {
this.rotation_rad = rotation;
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}
public RocketComponent.Position getRelativePositionMethod() {
@ -134,6 +138,9 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
@Override
public void setRelativePosition(final Position position) {
super.setRelativePosition(position);
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}
public double getAxialPosition() {
@ -142,6 +149,9 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
public void setAxialPosition(final double _pos) {
super.setPositionValue(_pos);
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}

View File

@ -120,9 +120,34 @@ public class StageConfig extends RocketComponentConfig {
RocketComponent.Position.ABSOLUTE
});
JComboBox<?> combo = new JComboBox<RocketComponent.Position>( posRelModel );
motherPanel.add(combo, "spanx, growx, wrap");
motherPanel.add(combo, "spanx 2, growx, wrap");
parallelEnabledModel.addEnableComponent( positionLabel);
// setPositions relative to parent component
JLabel parentLabel = new JLabel(trans.get("RocketCompCfg.outside.componentname"));
motherPanel.add( parentLabel);
parallelEnabledModel.addEnableComponent( parentLabel);
// setPositions relative to parent component
// ComboBoxModel<?> componentModel = new Enj
// JComboBox<?> relToCombo = new JComboBox<?>( componentModel );
JLabel relToCombo = new JLabel( stage.getParent().getName() );
motherPanel.add( relToCombo , "growx, wrap");
parallelEnabledModel.addEnableComponent( relToCombo );
// // EnumModel(ChangeSource source, String valueName, Enum<T>[] values) {
// ComboBoxModel<RocketComponent.Position> posRelModel = new EnumModel<RocketComponent.Position>(component, "RelativePosition",
// new RocketComponent.Position[] {
// RocketComponent.Position.TOP,
// RocketComponent.Position.MIDDLE,
// RocketComponent.Position.BOTTOM,
// RocketComponent.Position.ABSOLUTE
// });
// JComboBox<?> combo = new JComboBox<RocketComponent.Position>( posRelModel );
// motherPanel.add(combo, "spanx, growx, wrap");
// parallelEnabledModel.addEnableComponent( positionLabel);
//
// plus
JLabel positionPlusLabel = new JLabel(trans.get("LaunchLugCfg.lbl.plus"));
motherPanel.add( positionPlusLabel );