import javax.swing.JSpinner;
import net.miginfocom.swing.MigLayout;
+import net.sf.openrocket.document.OpenRocketDocument;
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.HtmlLabel;
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;
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 class StreamerConfig extends RecoveryDeviceConfig {
-
- public StreamerConfig(final RocketComponent component) {
- super(component);
-
- JPanel primary = new JPanel(new MigLayout());
-
- JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::][]",""));
+ private static final Translator trans = Application.getTranslator();
+
+ public StreamerConfig(OpenRocketDocument d, final RocketComponent component) {
+ super(d, component);
+ JPanel primary = new JPanel(new MigLayout());
+ JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
- panel.add(new JLabel("Strip length:"));
+
+ //// 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");
- panel.add(new JLabel("Strip width:"));
+ //// 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");
- panel.add(new JLabel("Strip area:"));
+
+ //// 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");
- panel.add(new JLabel("Aspect ratio:"));
+ //// 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");
-
- panel.add(new JLabel("Material:"));
-
- JComboBox combo = new JComboBox(new MaterialModel(panel, component,
- Material.Type.SURFACE));
- combo.setToolTipText("The component material affects the weight of the component.");
- panel.add(combo,"spanx 3, growx, wrap 20lp");
+ //// Material:
+ panel.add(new JLabel(trans.get("StreamerCfg.lbl.Material")));
+ 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");
+
+
// CD
- JLabel label = new HtmlLabel("<html>Drag coefficient C<sub>D</sub>:");
- String tip = "<html>The drag coefficient relative to the total area of the streamer.<br>" +
- "A larger drag coefficient yields a slowed descent rate.";
+ //// <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");
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());
- check.setText("Automatic");
- panel.add(check,"skip, span, wrap");
+ //// Automatic
+ check.setText(trans.get("StreamerCfg.lbl.Automatic"));
+ panel.add(check, "skip, span, wrap");
- panel.add(new StyledLabel("The drag coefficient is relative to the area of the streamer.",
+ //// 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
- panel.add(new JLabel("Position relative to:"));
+
+ //// 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");
- panel.add(new JLabel("plus"),"right");
-
- m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
+ //// plus
+ 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("Packed length:"));
+ //// 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(spin, "growx");
- panel.add(new UnitSelector(m),"growx");
- panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)),"w 100lp, wrap");
+ panel.add(new UnitSelector(m), "growx");
+ panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)), "w 100lp, wrap");
-
- //// Tube diameter
- panel.add(new JLabel("Packed diameter:"));
- DoubleModel od = new DoubleModel(component,"Radius",2,UnitGroup.UNITS_LENGTH,0);
+ //// Tube diameter
+ //// Packed diameter:
+ panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packeddiam")));
+
+ 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
- panel.add(new JLabel("Deploys at:"),"");
+ //// Deployment
+ //// Deploys at:
+ 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
- panel.add(new JLabel("plus"),"right");
+ //// plus
+ 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");
- panel.add(new JLabel("seconds"),"wrap paragraph");
-
- // Altitude
- label = new JLabel("Altitude:");
+ //// seconds
+ 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();
-
- tabbedPane.insertTab("General", null, primary, "General properties", 0);
- tabbedPane.insertTab("Radial position", null, positionTab(),
- "Radial position configuration", 1);
+
+ //// General and General properties
+ 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(),
+ 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
- panel.add(new JLabel("Radial distance:"));
+ //// 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
- panel.add(new JLabel("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("Reset");
+ JButton button = new JButton(trans.get("StreamerCfg.but.Reset"));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((MassComponent) component).setRadialPosition(0.0);
}
});
- panel.add(button,"spanx, right");
+ panel.add(button, "spanx, right");
return panel;
}