Uniformity of mass component dialogs

Unified the look of the dialogs for parachutes, streamers, shock cords, and mass objects.
This commit is contained in:
hcraigmiller 2022-05-29 10:16:57 -07:00
parent 6b5982c6aa
commit 43a231c738
5 changed files with 118 additions and 87 deletions

View File

@ -1025,6 +1025,8 @@ RailBtnCfg.tab.General = General
RailBtnCfg.tab.GeneralProp = General properties
! MassComponentConfig
MassComponentCfg.lbl.Attributes = Attributes
MassComponentCfg.lbl.Placement = Placement
MassComponentCfg.lbl.Mass = Mass:
MassComponentCfg.lbl.Density = Approximate density:
MassComponentCfg.lbl.Length = Length:
@ -1076,7 +1078,10 @@ NoseConeCfg.tab.ttip.Shoulder = Shoulder properties
! ParachuteConfig
Parachute.Parachute = Parachute
ParachuteCfg.lbl.Canopy = Canopy:
ParachuteCfg.lbl.Canopy = Canopy
ParachuteCfg.lbl.Shroudlines = Shroud lines
ParachuteCfg.lbl.Placement = Placement
ParachuteCfg.lbl.Deployment = Deployment
ParachuteCfg.lbl.CanopyShape = Canopy shape:
ParachuteCfg.lbl.Diameter = Diameter:
ParachuteCfg.lbl.SpillDia = Spill hole diameter:
@ -1086,7 +1091,6 @@ ParachuteCfg.lbl.longA1 = <html>Drag coefficient C<sub>D</sub>:
ParachuteCfg.lbl.longB1 = <html>The drag coefficient relative to the total area of the parachute.<br>
ParachuteCfg.lbl.longB2 = A larger drag coefficient yields a slowed descent rate.
ParachuteCfg.lbl.longB3 = A typical value for parachutes is 0.8.
ParachuteCfg.lbl.Shroudlines = Shroud lines:
ParachuteCfg.lbl.Numberoflines = Number of lines:
ParachuteCfg.lbl.Linelength = Line length:
ParachuteCfg.lbl.Material = Material:
@ -1107,6 +1111,8 @@ ParachuteCfg.but.Reset = Reset
ParachuteCfg.lbl.plusdelay = plus
! ShockCordConfig
ShockCordCfg.lbl.ShockcordAttributes = Attributes
ShockCordCfg.lbl.ShockcordPlacement = Placement
ShockCordCfg.lbl.Shockcordlength = Shock cord length:
ShockCordCfg.lbl.Shockcordmaterial = Shock cord material:
ShockCordCfg.lbl.Posrelativeto = Position relative to:
@ -1130,6 +1136,9 @@ SleeveCfg.tab.General = General
SleeveCfg.tab.Generalproperties = General properties
! StreamerConfig
StreamerCfg.lbl.Attributes = Attributes
StreamerCfg.lbl.Placement = Placement
StreamerCfg.lbl.Deployment = Deployment
StreamerCfg.lbl.Striplength = Strip length:
StreamerCfg.lbl.Stripwidth = Strip width:
StreamerCfg.lbl.Striparea = Strip area:

View File

@ -16,6 +16,7 @@ import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.MassComponent;
@ -33,9 +34,12 @@ public class MassComponentConfig extends RocketComponentConfig {
public MassComponentConfig(OpenRocketDocument d, RocketComponent component) {
super(d, component);
//// Left side
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
//// Attributes
panel.add(new StyledLabel(trans.get("MassComponentCfg.lbl.Attributes"), StyledLabel.Style.BOLD), "wrap unrel");
//// Mass component type
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.type")));
@ -51,7 +55,7 @@ public class MassComponentConfig extends RocketComponentConfig {
MassComponent.MassComponentType.RECOVERYHARDWARE,
MassComponent.MassComponentType.BATTERY}));
panel.add(typecombo, "spanx, growx, wrap");
panel.add(typecombo, "spanx, wrap");
//// Mass
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.Mass")));
@ -113,23 +117,30 @@ public class MassComponentConfig extends RocketComponentConfig {
panel.add(checkAutoPackedRadius, "skip, span 2, wrap");
//// Position
//// Right side
JPanel panel2 = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany");
//// Placement
panel2.add(new StyledLabel(trans.get("MassComponentCfg.lbl.Placement"), StyledLabel.Style.BOLD), "wrap unrel");
//// Position relative to:
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.PosRelativeto")));
panel2.add(new JLabel(trans.get("MassComponentCfg.lbl.PosRelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final JComboBox<?> methodCombo = new JComboBox<AxialMethod>( methodModel );
panel.add(methodCombo, "spanx, growx, wrap");
panel2.add(methodCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.plus")), "right");
panel2.add(new JLabel(trans.get("MassComponentCfg.lbl.plus")), "right");
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
panel.add(spin, "growx");
panel2.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(
panel2.add(new UnitSelector(m), "growx");
panel2.add(new BasicSlider(m.getSliderModel(
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
new DoubleModel(component.getParent(), "Length"))),
"w 100lp, wrap");

View File

@ -31,7 +31,6 @@ import net.sf.openrocket.rocketcomponent.DeploymentConfiguration;
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
import net.sf.openrocket.rocketcomponent.Parachute;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.Transition;
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@ -45,11 +44,10 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
super(d, component);
Parachute parachute = (Parachute) component;
// Left Side
JPanel primary = new JPanel(new MigLayout());
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
//// Canopy
panel.add(new StyledLabel(trans.get("ParachuteCfg.lbl.Canopy"), Style.BOLD), "wrap unrel");
@ -64,6 +62,29 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.4, 1.5)), "w 100lp, wrap");
// TODO COMPLETE Spill hole development
/* panel.add(new JLabel(trans.get("ParachuteCfg.lbl.SpillDia") + CommonStrings.daggerDouble));
m = new DoubleModel(component, "SpillDia", UnitGroup.UNITS_LENGTH, 0, 0.08);
// The "max" value does not affect the slider maximum, and manual entry above that value is possible.
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.01, .1)), "w 100lp, wrap");
// The slider maximum value is "max", however, manual entry above that value is possible.
*/
// TODO END Spill hole development
//// Material:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Material")));
JComboBox<Material> surfaceMaterialCombo = new JComboBox<Material>(new MaterialModel(panel, component,
Material.Type.SURFACE));
surfaceMaterialCombo.setToolTipText(trans.get("ParachuteCfg.combo.MaterialModel"));
panel.add( surfaceMaterialCombo, "spanx 3, growx, wrap 15lp");
// CD
JLabel label = new HtmlLabel(trans.get("ParachuteCfg.lbl.longA1"));
String tip = trans.get("ParachuteCfg.lbl.longB1") +
@ -88,18 +109,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
p.setCD(Parachute.DEFAULT_CD);
}
});
panel.add(button, "spanx, wrap para");
//// Material:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Material")));
JComboBox<Material> surfaceMaterialCombo = new JComboBox<Material>(new MaterialModel(panel, component,
Material.Type.SURFACE));
surfaceMaterialCombo.setToolTipText(trans.get("ParachuteCfg.combo.MaterialModel"));
panel.add( surfaceMaterialCombo, "spanx 3, growx, wrap 30lp");
panel.add(button, "spanx, wrap 32lp");
//// Shroud lines
panel.add(new StyledLabel(trans.get("ParachuteCfg.lbl.Shroudlines"), Style.BOLD), "wrap unrel");
@ -126,23 +136,23 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
//// Material:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Material")));
JComboBox<Material> shroudMaterialCombo = new JComboBox<Material>(new MaterialModel(panel, component, Material.Type.LINE,
"LineMaterial"));
panel.add( shroudMaterialCombo, "spanx 3, growx, wrap");
JComboBox<Material> shroudMaterialCombo =
new JComboBox<Material>(new MaterialModel(panel, component, Material.Type.LINE, "LineMaterial"));
panel.add( shroudMaterialCombo, "spanx 3, growx, wrap 15lp");
// Right side
primary.add(panel, "grow, gapright 20lp");
panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
//// Placement
panel.add(new StyledLabel(trans.get("ParachuteCfg.lbl.Placement"), Style.BOLD), "wrap unrel");
//// Position
//// Position relative to:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Posrelativeto")));
final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
final EnumModel<AxialMethod> methodModel =
new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel );
panel.add( positionCombo, "spanx, growx, wrap");
@ -160,7 +170,6 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
new DoubleModel(component.getParent(), "Length"))),
"w 100lp, wrap");
//// Spatial length
//// Packed length:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Packedlength")));
@ -192,17 +201,20 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
////// Automatic
JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
panel.add(checkAutoPackedRadius, "skip, span 2, wrap 30lp");
panel.add(checkAutoPackedRadius, "skip, span 2, wrap 5lp");
//// Deployment
panel.add(new StyledLabel(trans.get("ParachuteCfg.lbl.Deployment"), Style.BOLD), "wrap unrel");
//// Deploys at:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Deploysat") + " " + CommonStrings.dagger), "");
DeploymentConfiguration deploymentConfig = parachute.getDeploymentConfigurations().getDefault();
// this issues a warning because EnumModel ipmlements ComboBoxModel without a parameter...
ComboBoxModel<DeploymentConfiguration.DeployEvent> deployOptionsModel = new EnumModel<DeploymentConfiguration.DeployEvent>(deploymentConfig, "DeployEvent");
JComboBox<DeploymentConfiguration.DeployEvent> eventCombo = new JComboBox<DeploymentConfiguration.DeployEvent>( deployOptionsModel );
ComboBoxModel<DeploymentConfiguration.DeployEvent> deployOptionsModel =
new EnumModel<DeploymentConfiguration.DeployEvent>(deploymentConfig, "DeployEvent");
JComboBox<DeploymentConfiguration.DeployEvent> eventCombo =
new JComboBox<DeploymentConfiguration.DeployEvent>( deployOptionsModel );
if( (component.getStageNumber() + 1 ) == d.getRocket().getStageCount() ){
// This is the bottom stage: Restrict deployment options.
eventCombo.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
@ -221,7 +233,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
//// seconds
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.seconds")), "wrap paragraph");
// Altitude:
//// Altitude:
label = new JLabel(trans.get("ParachuteCfg.lbl.Altitude") + CommonStrings.dagger);
altitudeComponents.add(label);
panel.add(label);
@ -254,8 +266,6 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
}
protected JPanel positionTab() {
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));

View File

@ -9,6 +9,7 @@ import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
@ -29,12 +30,15 @@ public class ShockCordConfig extends RocketComponentConfig {
public ShockCordConfig(OpenRocketDocument d, RocketComponent component) {
super(d, component);
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
JLabel label;
DoubleModel m;
JSpinner spin;
////// Left side
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
//// Attributes
panel.add(new StyledLabel(trans.get("ShockCordCfg.lbl.ShockcordAttributes"), StyledLabel.Style.BOLD), "wrap unrel");
// Cord length
//// Shock cord length
@ -50,7 +54,6 @@ public class ShockCordConfig extends RocketComponentConfig {
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 1, 10)), "w 100lp, wrap");
// Material
//// Shock cord material:
panel.add(materialPanel(Material.Type.LINE, trans.get("ShockCordCfg.lbl.Shockcordmaterial"), null, "Material"), "spanx 4, wrap");
@ -61,8 +64,9 @@ public class ShockCordConfig extends RocketComponentConfig {
JPanel panel2 = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany");
//// Placement
panel2.add(new StyledLabel(trans.get("ShockCordCfg.lbl.ShockcordPlacement"), StyledLabel.Style.BOLD), "wrap unrel");
//// Position
//// Position relative to:
panel2.add(new JLabel(trans.get("ShockCordCfg.lbl.Posrelativeto")));

View File

@ -40,10 +40,13 @@ public class StreamerConfig extends RecoveryDeviceConfig {
super(d, component);
Streamer streamer = (Streamer) component;
// Left side
JPanel primary = new JPanel(new MigLayout());
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
//// Attributes
panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.Attributes"), StyledLabel.Style.BOLD), "wrap unrel");
//// Strip length:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striplength")));
@ -65,9 +68,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
spin.setEditor(new SpinnerEditor(spin));
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.2)), "w 100lp, wrap 20lp");
panel.add(new BasicSlider(m.getSliderModel(0, 0.2)), "w 100lp, wrap 10lp");
//// Strip area:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striparea")));
@ -89,8 +90,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
spin.setEditor(new SpinnerEditor(spin));
panel.add(spin, "growx");
// panel.add(new UnitSelector(m),"growx");
panel.add(new BasicSlider(m.getSliderModel(2, 15)), "skip, w 100lp, wrap 20lp");
panel.add(new BasicSlider(m.getSliderModel(2, 15)), "skip, w 100lp, wrap 10lp");
//// Material:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Material")));
@ -99,9 +99,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
Material.Type.SURFACE));
//// The component material affects the weight of the component.
streamerMaterialCombo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel"));
panel.add(streamerMaterialCombo, "spanx 3, growx, wrap 20lp");
panel.add(streamerMaterialCombo, "spanx 3, growx, wrap 15lp");
// CD
//// <html>Drag coefficient C<sub>D</sub>:
@ -127,17 +125,16 @@ public class StreamerConfig extends RecoveryDeviceConfig {
//// The drag coefficient is relative to the area of the streamer.
panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.longC1"),
-2), "span, wrap");
-1), "span, wrap");
// Right side
primary.add(panel, "grow, gapright 20lp");
panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
//// Placement
panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.Placement"), StyledLabel.Style.BOLD), "wrap unrel");
//// Position
//// Position relative to:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Posrelativeto")));
@ -190,10 +187,12 @@ public class StreamerConfig extends RecoveryDeviceConfig {
////// Automatic
JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
panel.add(checkAutoPackedRadius, "skip, span 2, wrap 30lp");
panel.add(checkAutoPackedRadius, "skip, span 2, wrap 5lp");
//// Deployment
panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.Deployment"), StyledLabel.Style.BOLD), "wrap unrel");
//// Deploys at:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Deploysat") + " " + CommonStrings.dagger), "");
@ -235,7 +234,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
altitudeComponents.add(slider);
panel.add(slider, "w 100lp, wrap");
panel.add(new StyledLabel(CommonStrings.override_description, -1), "skip 1, spanx, wrap para");
panel.add(new StyledLabel(CommonStrings.override_description, -1), "spanx, wrap para");
primary.add(panel, "grow");
@ -270,8 +269,6 @@ public class StreamerConfig extends RecoveryDeviceConfig {
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)), "w 100lp, wrap");
//// Radial direction
//// Radial direction:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdirection")));