import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.rocketcomponent.MassComponent;
-import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.MotorMount.IgnitionEvent;
+import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
public StreamerConfig(final RocketComponent component) {
super(component);
-
- JPanel primary = new JPanel(new MigLayout());
- JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::][]",""));
+ JPanel primary = new JPanel(new MigLayout());
+ JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
+
//// Strip length:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striplength")));
- DoubleModel m = new DoubleModel(component,"StripLength",UnitGroup.UNITS_LENGTH,0);
+ DoubleModel m = new DoubleModel(component, "StripLength", UnitGroup.UNITS_LENGTH, 0);
JSpinner 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.6, 1.5)),"w 100lp, wrap");
-
+ panel.add(spin, "growx");
+ panel.add(new UnitSelector(m), "growx");
+ panel.add(new BasicSlider(m.getSliderModel(0, 0.6, 1.5)), "w 100lp, wrap");
+
//// Strip width:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Stripwidth")));
- m = new DoubleModel(component,"StripWidth",UnitGroup.UNITS_LENGTH,0);
+ m = new DoubleModel(component, "StripWidth", UnitGroup.UNITS_LENGTH, 0);
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.2)),"w 100lp, wrap 20lp");
-
-
+ panel.add(spin, "growx");
+ panel.add(new UnitSelector(m), "growx");
+ panel.add(new BasicSlider(m.getSliderModel(0, 0.2)), "w 100lp, wrap 20lp");
+
+
//// Strip area:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striparea")));
- m = new DoubleModel(component,"Area",UnitGroup.UNITS_AREA,0);
+ m = new DoubleModel(component, "Area", UnitGroup.UNITS_AREA, 0);
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.04, 0.25)),"w 100lp, wrap");
-
+ panel.add(spin, "growx");
+ panel.add(new UnitSelector(m), "growx");
+ panel.add(new BasicSlider(m.getSliderModel(0, 0.04, 0.25)), "w 100lp, wrap");
+
//// Aspect ratio:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Aspectratio")));
- m = new DoubleModel(component,"AspectRatio",UnitGroup.UNITS_NONE,0);
+ m = new DoubleModel(component, "AspectRatio", UnitGroup.UNITS_NONE, 0);
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(2, 15)),"skip, w 100lp, wrap 20lp");
-
+ panel.add(spin, "growx");
+ // panel.add(new UnitSelector(m),"growx");
+ panel.add(new BasicSlider(m.getSliderModel(2, 15)), "skip, w 100lp, wrap 20lp");
+
//// Material:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Material")));
- JComboBox combo = new JComboBox(new MaterialModel(panel, component,
+ JComboBox combo = new JComboBox(new MaterialModel(panel, component,
Material.Type.SURFACE));
//// The component material affects the weight of the component.
combo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel"));
- panel.add(combo,"spanx 3, growx, wrap 20lp");
-
-
+ panel.add(combo, "spanx 3, growx, wrap 20lp");
+
+
// CD
//// <html>Drag coefficient C<sub>D</sub>:
JLabel label = new HtmlLabel(trans.get("StreamerCfg.lbl.longA1"));
//// <html>The drag coefficient relative to the total area of the streamer.<br>
String tip = trans.get("StreamerCfg.lbl.longB1") +
//// "A larger drag coefficient yields a slowed descent rate.
- trans.get("StreamerCfg.lbl.longB2");
+ trans.get("StreamerCfg.lbl.longB2");
label.setToolTipText(tip);
panel.add(label);
- m = new DoubleModel(component,"CD",UnitGroup.UNITS_COEFFICIENT,0);
+ m = new DoubleModel(component, "CD", UnitGroup.UNITS_COEFFICIENT, 0);
spin = new JSpinner(m.getSpinnerModel());
spin.setToolTipText(tip);
spin.setEditor(new SpinnerEditor(spin));
- panel.add(spin,"growx");
+ panel.add(spin, "growx");
JCheckBox check = new JCheckBox(m.getAutomaticAction());
//// Automatic
check.setText(trans.get("StreamerCfg.lbl.Automatic"));
- panel.add(check,"skip, span, wrap");
+ panel.add(check, "skip, span, wrap");
//// The drag coefficient is relative to the area of the streamer.
panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.longC1"),
-2), "span, wrap");
-
-
- primary.add(panel, "grow, gapright 20lp");
- panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::][]",""));
+
+ primary.add(panel, "grow, gapright 20lp");
+ panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
-
-
+
+
+
//// Position
//// Position relative to:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Posrelativeto")));
-
+
combo = new JComboBox(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
- RocketComponent.Position.TOP,
- RocketComponent.Position.MIDDLE,
- RocketComponent.Position.BOTTOM,
- RocketComponent.Position.ABSOLUTE
+ RocketComponent.Position.TOP,
+ RocketComponent.Position.MIDDLE,
+ RocketComponent.Position.BOTTOM,
+ RocketComponent.Position.ABSOLUTE
}));
- panel.add(combo,"spanx, growx, wrap");
+ panel.add(combo, "spanx, growx, wrap");
//// plus
- panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")),"right");
-
- m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
+ panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")), "right");
+
+ m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
- panel.add(spin,"growx");
+ panel.add(spin, "growx");
- panel.add(new UnitSelector(m),"growx");
+ panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
new DoubleModel(component.getParent(), "Length"))),
"w 100lp, wrap");
-
+
//// Spatial length:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packedlength")));
- m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0);
+ m = new DoubleModel(component, "Length", UnitGroup.UNITS_LENGTH, 0);
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.1, 0.5)),"w 100lp, wrap");
+ panel.add(spin, "growx");
+ panel.add(new UnitSelector(m), "growx");
+ panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)), "w 100lp, wrap");
+
//// Tube diameter
//// Packed diameter:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packeddiam")));
-
- DoubleModel od = new DoubleModel(component,"Radius",2,UnitGroup.UNITS_LENGTH,0);
+
+ DoubleModel od = new DoubleModel(component, "Radius", 2, UnitGroup.UNITS_LENGTH, 0);
// Diameter = 2*Radius
-
+
spin = new JSpinner(od.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
- panel.add(spin,"growx");
-
- panel.add(new UnitSelector(od),"growx");
- panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)),"w 100lp, wrap 30lp");
+ panel.add(spin, "growx");
+ panel.add(new UnitSelector(od), "growx");
+ panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap 30lp");
+
//// Deployment
//// Deploys at:
- panel.add(new JLabel(trans.get("StreamerCfg.lbl.Deploysat")),"");
+ panel.add(new JLabel(trans.get("StreamerCfg.lbl.Deploysat")), "");
combo = new JComboBox(new EnumModel<IgnitionEvent>(component, "DeployEvent"));
- panel.add(combo,"spanx 3, growx, wrap");
+ panel.add(combo, "spanx 3, growx, wrap");
// ... and delay
//// plus
- panel.add(new JLabel(trans.get("StreamerCfg.lbl.plusdelay")),"right");
+ panel.add(new JLabel(trans.get("StreamerCfg.lbl.plusdelay")), "right");
- m = new DoubleModel(component,"DeployDelay",0);
+ m = new DoubleModel(component, "DeployDelay", 0);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
- panel.add(spin,"spanx, split");
+ panel.add(spin, "spanx, split");
//// seconds
- panel.add(new JLabel(trans.get("StreamerCfg.lbl.seconds")),"wrap paragraph");
-
+ panel.add(new JLabel(trans.get("StreamerCfg.lbl.seconds")), "wrap paragraph");
+
// Altitude:
label = new JLabel(trans.get("StreamerCfg.lbl.Altitude"));
altitudeComponents.add(label);
panel.add(label);
- m = new DoubleModel(component,"DeployAltitude",UnitGroup.UNITS_DISTANCE,0);
+ m = new DoubleModel(component, "DeployAltitude", UnitGroup.UNITS_DISTANCE, 0);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
altitudeComponents.add(spin);
- panel.add(spin,"growx");
+ panel.add(spin, "growx");
UnitSelector unit = new UnitSelector(m);
altitudeComponents.add(unit);
- panel.add(unit,"growx");
+ panel.add(unit, "growx");
BasicSlider slider = new BasicSlider(m.getSliderModel(100, 1000));
altitudeComponents.add(slider);
- panel.add(slider,"w 100lp, wrap");
-
+ panel.add(slider, "w 100lp, wrap");
+
primary.add(panel, "grow");
updateFields();
//// General and General properties
- tabbedPane.insertTab(trans.get("StreamerCfg.tab.General"), null, primary,
+ tabbedPane.insertTab(trans.get("StreamerCfg.tab.General"), null, primary,
trans.get("StreamerCfg.tab.ttip.General"), 0);
//// Radial position and Radial position configuration
- tabbedPane.insertTab(trans.get("StreamerCfg.tab.Radialpos"), null, positionTab(),
+ tabbedPane.insertTab(trans.get("StreamerCfg.tab.Radialpos"), null, positionTab(),
trans.get("StreamerCfg.tab.ttip.Radialpos"), 1);
tabbedPane.setSelectedIndex(0);
}
-
+
protected JPanel positionTab() {
- JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
+ JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
//// Radial position
//// Radial distance:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdistance")));
- DoubleModel m = new DoubleModel(component,"RadialPosition",UnitGroup.UNITS_LENGTH,0);
+ DoubleModel m = new DoubleModel(component, "RadialPosition", UnitGroup.UNITS_LENGTH, 0);
JSpinner 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.1, 1.0)),"w 100lp, wrap");
+ panel.add(spin, "growx");
+ 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")));
- m = new DoubleModel(component,"RadialDirection",UnitGroup.UNITS_ANGLE,0);
+ m = new DoubleModel(component, "RadialDirection", UnitGroup.UNITS_ANGLE, 0);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
- panel.add(spin,"growx");
+ panel.add(spin, "growx");
- panel.add(new UnitSelector(m),"growx");
- panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)),"w 100lp, wrap");
-
+ panel.add(new UnitSelector(m), "growx");
+ panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)), "w 100lp, wrap");
+
//// Reset button
JButton button = new JButton(trans.get("StreamerCfg.but.Reset"));
button.addActionListener(new ActionListener() {
((MassComponent) component).setRadialPosition(0.0);
}
});
- panel.add(button,"spanx, right");
+ panel.add(button, "spanx, right");
return panel;
}
* OpenRocketPrintable.java
*/
package net.sf.openrocket.gui.print;
+
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
*/
public enum OpenRocketPrintable {
- //PARTS_LIST("Parts list", true, 0),
+ //PARTS_LIST("Parts list", true, 0),
//// Parts detail
- PARTS_DETAIL("OpenRocketPrintable.Partsdetail", true, 1),
- ////
- FIN_TEMPLATE("OpenRocketPrintable.Fintemplates", true, 2),
- //// Design Report
- DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3);
-
- /**
- * The description - will be displayed in the JTree.
- */
- private String description;
-
- /**
- * Flag that indicates if the enum value is different depending upon stage.
- */
- private boolean stageSpecific;
-
- /**
- * The order of the item as it appears in the printed document.
- */
- private int order;
-
- /**
- * Constructor.
- *
- * @param s the displayable description
- * @param staged indicates if the printable is stage dependent
- * @param idx the relative print order
- */
- OpenRocketPrintable (String s, boolean staged, int idx) {
- description = s;
- stageSpecific = staged;
- order = idx;
- }
-
- /**
- * Get the description of this printable.
- *
- * @return a displayable string
- */
- public String getDescription () {
- final Translator trans = Application.getTranslator();
- return trans.get(description);
- }
-
- /**
- * Answers if this enum value has different meaning depending upon the stage.
- *
- * @return true if the printable is stage dependent
- */
- public boolean isStageSpecific () {
- return stageSpecific;
- }
-
- /**
- * Answer the print order. This is relative to other enum values. No two enum values will have the same print
- * order value.
- *
- * @return a 0 based order (0 being first, or highest)
- */
- public int getPrintOrder () {
- return order;
- }
-
- /**
- * Look up an enum value based on the description.
- *
- * @param target the description
- *
- * @return an instance of this enum class or null if not found
- */
- public static OpenRocketPrintable findByDescription (String target) {
- OpenRocketPrintable[] values = values();
- for (OpenRocketPrintable value : values) {
- if (value.getDescription().equalsIgnoreCase(target)) {
- return value;
- }
- }
- return null;
- }
+ PARTS_DETAIL("OpenRocketPrintable.Partsdetail", true, 1),
+ ////
+ FIN_TEMPLATE("OpenRocketPrintable.Fintemplates", true, 2),
+ //// Design Report
+ DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3);
+
+ private static final Translator trans = Application.getTranslator();
+
+ /**
+ * The description - will be displayed in the JTree.
+ */
+ private String description;
+
+ /**
+ * Flag that indicates if the enum value is different depending upon stage.
+ */
+ private boolean stageSpecific;
+
+ /**
+ * The order of the item as it appears in the printed document.
+ */
+ private int order;
+
+ /**
+ * Constructor.
+ *
+ * @param s the displayable description
+ * @param staged indicates if the printable is stage dependent
+ * @param idx the relative print order
+ */
+ OpenRocketPrintable(String s, boolean staged, int idx) {
+ description = s;
+ stageSpecific = staged;
+ order = idx;
+ }
+
+ /**
+ * Get the description of this printable.
+ *
+ * @return a displayable string
+ */
+ public String getDescription() {
+ return trans.get(description);
+ }
+
+ /**
+ * Answers if this enum value has different meaning depending upon the stage.
+ *
+ * @return true if the printable is stage dependent
+ */
+ public boolean isStageSpecific() {
+ return stageSpecific;
+ }
+
+ /**
+ * Answer the print order. This is relative to other enum values. No two enum values will have the same print
+ * order value.
+ *
+ * @return a 0 based order (0 being first, or highest)
+ */
+ public int getPrintOrder() {
+ return order;
+ }
+
+ /**
+ * Look up an enum value based on the description.
+ *
+ * @param target the description
+ *
+ * @return an instance of this enum class or null if not found
+ */
+ public static OpenRocketPrintable findByDescription(String target) {
+ OpenRocketPrintable[] values = values();
+ for (OpenRocketPrintable value : values) {
+ if (value.getDescription().equalsIgnoreCase(target)) {
+ return value;
+ }
+ }
+ return null;
+ }
}