package net.sf.openrocket.gui.configdialog;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.IntegerModel;
import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.UnitSelector;
+import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.rocketcomponent.FinSet;
-import net.sf.openrocket.rocketcomponent.FreeformFinSet;
import net.sf.openrocket.rocketcomponent.RocketComponent;
+import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
public class EllipticalFinSetConfig extends FinSetConfig {
+ private static final Translator trans = Application.getTranslator();
public EllipticalFinSetConfig(final RocketComponent component) {
super(component);
JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
//// Number of fins
- panel.add(new JLabel("Number of fins:"));
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Nbroffins")));
IntegerModel im = new IntegerModel(component,"FinCount",1,8);
//// Base rotation
- panel.add(new JLabel("Rotation:"));
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Rotation")));
m = new DoubleModel(component, "BaseRotation", UnitGroup.UNITS_ANGLE,-Math.PI,Math.PI);
panel.add(new BasicSlider(m.getSliderModel(-Math.PI,Math.PI)),"w 100lp, wrap");
+ //// Fin cant
+ JLabel label = new JLabel(trans.get("EllipticalFinSetCfg.Fincant"));
+ //// "The angle that the fins are canted with respect to the rocket
+ label.setToolTipText(trans.get("EllipticalFinSetCfg.ttip.Fincant"));
+ panel.add(label);
+
+ m = new DoubleModel(component, "CantAngle", UnitGroup.UNITS_ANGLE,
+ -FinSet.MAX_CANT, FinSet.MAX_CANT);
+
+ 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(-FinSet.MAX_CANT,FinSet.MAX_CANT)),
+ "w 100lp, wrap");
+
+
+
//// Root chord
- panel.add(new JLabel("Root chord:"));
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Rootchord")));
m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0);
//// Height
- panel.add(new JLabel("Height:"));
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Height")));
m = new DoubleModel(component,"Height",UnitGroup.UNITS_LENGTH,0);
//// Position
-
- panel.add(new JLabel("Position relative to:"));
+ //// Position relative to:
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Positionrelativeto")));
combo = new JComboBox(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
}));
panel.add(combo,"spanx, growx, wrap");
- panel.add(new JLabel("plus"),"right");
+ //// plus
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.plus")),"right");
m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
//// Cross section
- panel.add(new JLabel("Fin cross section:"),"span, split");
+ //// Fin cross section:
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.FincrossSection")),"span, split");
combo = new JComboBox(
new EnumModel<FinSet.CrossSection>(component,"CrossSection"));
panel.add(combo,"growx, wrap unrel");
- //// Thickness
- panel.add(new JLabel("Thickness:"));
+ //// Thickness:
+ panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Thickness")));
m = new DoubleModel(component,"Thickness",UnitGroup.UNITS_LENGTH,0);
- //// Convert button
-
- JButton button = new JButton("Convert to freeform fin set");
- button.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- // Do change in future for overall safety
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- FreeformFinSet freeform = new FreeformFinSet((FinSet)component);
- RocketComponent parent = component.getParent();
- int index = parent.getChildPosition(component);
-
- ComponentConfigDialog.addUndoPosition("Convert fin set");
- parent.removeChild(index);
- parent.addChild(freeform, index);
- ComponentConfigDialog.showDialog(freeform);
- }
- });
-
- ComponentConfigDialog.hideDialog();
- }
- });
- panel.add(button,"span, growx, gaptop paragraph");
-
mainPanel.add(panel,"aligny 20%");
addFinSetButtons();
-
- tabbedPane.insertTab("General", null, mainPanel, "General properties", 0);
+ //// General and General properties
+ tabbedPane.insertTab(trans.get("EllipticalFinSetCfg.General"), null, mainPanel,
+ trans.get("EllipticalFinSetCfg.Generalproperties"), 0);
tabbedPane.setSelectedIndex(0);
}