world coordinate patch
[debian/openrocket] / src / net / sf / openrocket / gui / configdialog / EllipticalFinSetConfig.java
index 8092ae4b61f1002a3f0e97d8858c7d70d3f2dd59..cfb70b35f95f8cc0869d0ec269a1ee328f2c335c 100644 (file)
@@ -1,32 +1,29 @@
 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.BasicSlider;
 import net.sf.openrocket.gui.SpinnerEditor;
-import net.sf.openrocket.gui.UnitSelector;
 import net.sf.openrocket.gui.adaptors.DoubleModel;
 import net.sf.openrocket.gui.adaptors.EnumModel;
 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);
@@ -42,7 +39,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
                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);
                
@@ -52,7 +49,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
                
                
                ////  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);
                
@@ -64,8 +61,27 @@ public class EllipticalFinSetConfig extends FinSetConfig {
                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);
                
@@ -78,7 +94,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
 
 
                ////  Height
-               panel.add(new JLabel("Height:"));
+               panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Height")));
                
                m = new DoubleModel(component,"Height",UnitGroup.UNITS_LENGTH,0);
                
@@ -91,8 +107,8 @@ public class EllipticalFinSetConfig extends FinSetConfig {
        
                
                ////  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",
@@ -104,7 +120,8 @@ public class EllipticalFinSetConfig extends FinSetConfig {
                                }));
                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());
@@ -130,14 +147,15 @@ public class EllipticalFinSetConfig extends FinSetConfig {
 
 
                ////  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);
                
@@ -155,40 +173,15 @@ public class EllipticalFinSetConfig extends FinSetConfig {
                
                
                
-               //// 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);
        }