Improve booster dialog

This commit is contained in:
SiboVG 2023-01-11 14:35:09 +01:00
parent 9d58b08f39
commit 73e6a2e78c
2 changed files with 15 additions and 13 deletions

View File

@ -46,32 +46,33 @@ public class AxialStageConfig extends ComponentAssemblyConfig {
private JPanel separationTab(AxialStage stage) { private JPanel separationTab(AxialStage stage) {
JPanel panel = new JPanel(new MigLayout("fill")); JPanel panel = new JPanel(new MigLayout());
// Select separation event // Select separation event
panel.add(new StyledLabel(trans.get("StageConfig.separation.lbl.title") + " " + CommonStrings.dagger, Style.BOLD), "spanx, wrap rel"); panel.add(new StyledLabel(trans.get("StageConfig.separation.lbl.title") + " " + CommonStrings.dagger, Style.BOLD),
"spanx, gaptop unrel, wrap 30lp");
StageSeparationConfiguration sepConfig = stage.getSeparationConfiguration(); StageSeparationConfiguration sepConfig = stage.getSeparationConfiguration();
JComboBox<?> combo = new JComboBox<>(new EnumModel<>( sepConfig, "SeparationEvent", SeparationEvent.values())); JComboBox<?> combo = new JComboBox<>(new EnumModel<>( sepConfig, "SeparationEvent", SeparationEvent.values()));
//combo.setSelectedItem(sepConfig); //combo.setSelectedItem(sepConfig);
panel.add(combo, ""); panel.add(combo);
order.add(combo); order.add(combo);
// ... and delay // ... and delay
panel.add(new JLabel(trans.get("StageConfig.separation.lbl.plus")), ""); panel.add(new JLabel(trans.get("StageConfig.separation.lbl.plus")));
DoubleModel dm = new DoubleModel( sepConfig, "SeparationDelay", 0); DoubleModel dm = new DoubleModel( sepConfig, "SeparationDelay", 0);
JSpinner spin = new JSpinner(dm.getSpinnerModel()); JSpinner spin = new JSpinner(dm.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin, "width 45"); panel.add(spin, "width 45lp");
order.add(((SpinnerEditor)spin.getEditor()).getTextField()); order.add(((SpinnerEditor)spin.getEditor()).getTextField());
//// seconds //// seconds
panel.add(new JLabel(trans.get("StageConfig.separation.lbl.seconds")), "wrap unrel"); panel.add(new JLabel(trans.get("StageConfig.separation.lbl.seconds")), "wrap unrel");
panel.add(new StyledLabel(CommonStrings.override_description, -1), "spanx, wrap para"); panel.add(new StyledLabel(CommonStrings.override_description, -1), "spanx, pushy, wrap para");
return panel; return panel;
} }

View File

@ -43,21 +43,22 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
// only stages which are actually off-centerline will get the dialog here: // only stages which are actually off-centerline will get the dialog here:
if( ParallelStage.class.isAssignableFrom( component.getClass()) || PodSet.class.isAssignableFrom( component.getClass())){ if( ParallelStage.class.isAssignableFrom( component.getClass()) || PodSet.class.isAssignableFrom( component.getClass())){
tabbedPane.insertTab( trans.get("RocketCompCfg.tab.Assembly"), null, parallelTab( (ComponentAssembly)component ), trans.get("RocketCompCfg.tab.AssemblyComment"), 0); tabbedPane.insertTab( trans.get("RocketCompCfg.tab.Assembly"), null, parallelTab( (ComponentAssembly)component ),
trans.get("RocketCompCfg.tab.AssemblyComment"), 0);
tabbedPane.setSelectedIndex(0); tabbedPane.setSelectedIndex(0);
} }
} }
private JPanel parallelTab( final ComponentAssembly boosters ){ private JPanel parallelTab( final ComponentAssembly boosters ){
JPanel motherPanel = new JPanel( new MigLayout("fill")); JPanel motherPanel = new JPanel( new MigLayout("fillx"));
// radial distance method // radial distance method
JLabel radiusMethodLabel = new JLabel(trans.get("RocketComponent.Position.Method.Radius.Label")); JLabel radiusMethodLabel = new JLabel(trans.get("RocketComponent.Position.Method.Radius.Label"));
motherPanel.add( radiusMethodLabel, "align left"); motherPanel.add( radiusMethodLabel, "align left");
final ComboBoxModel<RadiusMethod> radiusMethodModel = new EnumModel<RadiusMethod>( boosters, "RadiusMethod", RadiusMethod.choices()); final ComboBoxModel<RadiusMethod> radiusMethodModel = new EnumModel<RadiusMethod>( boosters, "RadiusMethod", RadiusMethod.choices());
final JComboBox<RadiusMethod> radiusMethodCombo = new JComboBox<RadiusMethod>( radiusMethodModel ); final JComboBox<RadiusMethod> radiusMethodCombo = new JComboBox<RadiusMethod>( radiusMethodModel );
motherPanel.add( radiusMethodCombo, "spanx 3, growx, wrap"); motherPanel.add( radiusMethodCombo, "spanx 3, wrap");
order.add(radiusMethodCombo); order.add(radiusMethodCombo);
// set radial distance // set radial distance
@ -72,7 +73,7 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
order.add(((SpinnerEditor) radiusSpinner.getEditor()).getTextField()); order.add(((SpinnerEditor) radiusSpinner.getEditor()).getTextField());
// autoRadOffsModel.addEnableComponent(radiusSpinner, false); // autoRadOffsModel.addEnableComponent(radiusSpinner, false);
UnitSelector radiusUnitSelector = new UnitSelector(radiusModel); UnitSelector radiusUnitSelector = new UnitSelector(radiusModel);
motherPanel.add(radiusUnitSelector, "growx 1"); motherPanel.add(radiusUnitSelector);
motherPanel.add(new BasicSlider(radiusModel.getSliderModel(0, new DoubleModel(component.getParent(), "OuterRadius", 4.0, UnitGroup.UNITS_LENGTH))), motherPanel.add(new BasicSlider(radiusModel.getSliderModel(0, new DoubleModel(component.getParent(), "OuterRadius", 4.0, UnitGroup.UNITS_LENGTH))),
"gapleft para, growx 2, wrap"); "gapleft para, growx 2, wrap");
@ -93,7 +94,7 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
motherPanel.add(angleSpinner, "wmin 65lp, growx 1"); motherPanel.add(angleSpinner, "wmin 65lp, growx 1");
order.add(((SpinnerEditor) angleSpinner.getEditor()).getTextField()); order.add(((SpinnerEditor) angleSpinner.getEditor()).getTextField());
UnitSelector angleUnitSelector = new UnitSelector(angleModel); UnitSelector angleUnitSelector = new UnitSelector(angleModel);
motherPanel.add( angleUnitSelector, "growx 1"); motherPanel.add( angleUnitSelector);
motherPanel.add(new BasicSlider(angleModel.getSliderModel(-Math.PI, Math.PI)), "gapleft para, growx 2, wrap"); motherPanel.add(new BasicSlider(angleModel.getSliderModel(-Math.PI, Math.PI)), "gapleft para, growx 2, wrap");
// set multiplicity // set multiplicity
@ -112,7 +113,7 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
ComboBoxModel<AxialMethod> axialPositionMethodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods ); ComboBoxModel<AxialMethod> axialPositionMethodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
JComboBox<?> positionMethodCombo = new JComboBox<AxialMethod>( axialPositionMethodModel ); JComboBox<?> positionMethodCombo = new JComboBox<AxialMethod>( axialPositionMethodModel );
motherPanel.add(positionMethodCombo, "spanx 3, growx, wrap"); motherPanel.add(positionMethodCombo, "spanx 3, wrap");
order.add(positionMethodCombo); order.add(positionMethodCombo);
// plus // plus
@ -131,7 +132,7 @@ public class ComponentAssemblyConfig extends RocketComponentConfig {
} }
}); });
motherPanel.add(new UnitSelector(axialOffsetModel), "growx"); motherPanel.add(new UnitSelector(axialOffsetModel));
motherPanel.add(new BasicSlider(axialOffsetModel.getSliderModel( motherPanel.add(new BasicSlider(axialOffsetModel.getSliderModel(
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE), new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
new DoubleModel(component.getParent(), "Length"))), new DoubleModel(component.getParent(), "Length"))),