]> git.gag.com Git - debian/openrocket/blobdiff - src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java
component config refactoring, localization fixes
[debian/openrocket] / src / net / sf / openrocket / gui / configdialog / InnerTubeConfig.java
index 751aa86bac009d1b298b00e30aebe232bed09891..a1c6993814fc9eee9e7148cb12bec9414a925e46 100644 (file)
@@ -27,37 +27,47 @@ import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 import net.miginfocom.swing.MigLayout;
+import net.sf.openrocket.document.OpenRocketDocument;
 import net.sf.openrocket.gui.Resettable;
 import net.sf.openrocket.gui.SpinnerEditor;
 import net.sf.openrocket.gui.adaptors.DoubleModel;
 import net.sf.openrocket.gui.components.BasicSlider;
 import net.sf.openrocket.gui.components.UnitSelector;
+import net.sf.openrocket.l10n.Translator;
 import net.sf.openrocket.rocketcomponent.ClusterConfiguration;
 import net.sf.openrocket.rocketcomponent.Clusterable;
 import net.sf.openrocket.rocketcomponent.InnerTube;
 import net.sf.openrocket.rocketcomponent.MotorMount;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import net.sf.openrocket.startup.Application;
 import net.sf.openrocket.unit.UnitGroup;
 import net.sf.openrocket.util.BugException;
 import net.sf.openrocket.util.Coordinate;
 
 
 public class InnerTubeConfig extends ThicknessRingComponentConfig {
+       private static final Translator trans = Application.getTranslator();
        
-
-       public InnerTubeConfig(RocketComponent c) {
-               super(c);
+       
+       public InnerTubeConfig(OpenRocketDocument d, RocketComponent c) {
+               super(d, c);
                
                JPanel tab;
                
                tab = new MotorConfig((MotorMount) c);
-               tabbedPane.insertTab("Motor", null, tab, "Motor mount configuration", 1);
+               //// Motor and Motor mount configuration
+               tabbedPane.insertTab(trans.get("InnerTubeCfg.tab.Motor"), null, tab,
+                               trans.get("InnerTubeCfg.tab.ttip.Motor"), 1);
                
                tab = clusterTab();
-               tabbedPane.insertTab("Cluster", null, tab, "Cluster configuration", 2);
+               //// Cluster and Cluster configuration
+               tabbedPane.insertTab(trans.get("InnerTubeCfg.tab.Cluster"), null, tab,
+                               trans.get("InnerTubeCfg.tab.ttip.Cluster"), 2);
                
                tab = positionTab();
-               tabbedPane.insertTab("Radial position", null, tab, "Radial position", 3);
+               //// Radial position
+               tabbedPane.insertTab(trans.get("InnerTubeCfg.tab.Radialpos"), null, tab,
+                               trans.get("InnerTubeCfg.tab.ttip.Radialpos"), 3);
                
                tabbedPane.setSelectedIndex(0);
        }
@@ -69,7 +79,8 @@ public class InnerTubeConfig extends ThicknessRingComponentConfig {
                JPanel subPanel = new JPanel(new MigLayout());
                
                // Cluster type selection
-               subPanel.add(new JLabel("Select cluster configuration:"), "spanx, wrap");
+               //// Select cluster configuration:
+               subPanel.add(new JLabel(trans.get("InnerTubeCfg.lbl.Selectclustercfg")), "spanx, wrap");
                subPanel.add(new ClusterSelectionPanel((InnerTube) component), "spanx, wrap");
                //              JPanel clusterSelection = new ClusterSelectionPanel((InnerTube)component);
                //              clusterSelection.setBackground(Color.blue);
@@ -81,43 +92,53 @@ public class InnerTubeConfig extends ThicknessRingComponentConfig {
                subPanel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]"));
                
                // Tube separation scale
-               JLabel l = new JLabel("Tube separation:");
-               l.setToolTipText("The separation of the tubes, 1.0 = touching each other");
+               //// Tube separation:
+               JLabel l = new JLabel(trans.get("InnerTubeCfg.lbl.TubeSep"));
+               //// The separation of the tubes, 1.0 = touching each other
+               l.setToolTipText(trans.get("InnerTubeCfg.lbl.ttip.TubeSep"));
                subPanel.add(l);
                DoubleModel dm = new DoubleModel(component, "ClusterScale", 1, UnitGroup.UNITS_NONE, 0);
                
                JSpinner spin = new JSpinner(dm.getSpinnerModel());
                spin.setEditor(new SpinnerEditor(spin));
-               spin.setToolTipText("The separation of the tubes, 1.0 = touching each other");
+               //// The separation of the tubes, 1.0 = touching each other
+               spin.setToolTipText(trans.get("InnerTubeCfg.lbl.ttip.TubeSep"));
                subPanel.add(spin, "growx");
                
                BasicSlider bs = new BasicSlider(dm.getSliderModel(0, 1, 4));
-               bs.setToolTipText("The separation of the tubes, 1.0 = touching each other");
+               //// The separation of the tubes, 1.0 = touching each other
+               bs.setToolTipText(trans.get("InnerTubeCfg.lbl.ttip.TubeSep"));
                subPanel.add(bs, "skip,w 100lp, wrap");
                
-               // Rotation
-               l = new JLabel("Rotation:");
-               l.setToolTipText("Rotation angle of the cluster configuration");
+               // Rotation:
+               l = new JLabel(trans.get("InnerTubeCfg.lbl.Rotation"));
+               //// Rotation angle of the cluster configuration
+               l.setToolTipText(trans.get("InnerTubeCfg.lbl.ttip.Rotation"));
                subPanel.add(l);
                dm = new DoubleModel(component, "ClusterRotation", 1, UnitGroup.UNITS_ANGLE,
                                -Math.PI, Math.PI);
                
                spin = new JSpinner(dm.getSpinnerModel());
                spin.setEditor(new SpinnerEditor(spin));
-               spin.setToolTipText("Rotation angle of the cluster configuration");
+               //// Rotation angle of the cluster configuration
+               spin.setToolTipText(trans.get("InnerTubeCfg.lbl.ttip.Rotation"));
                subPanel.add(spin, "growx");
                
                subPanel.add(new UnitSelector(dm), "growx");
                bs = new BasicSlider(dm.getSliderModel(-Math.PI, 0, Math.PI));
-               bs.setToolTipText("Rotation angle of the cluster configuration");
+               //// Rotation angle of the cluster configuration
+               bs.setToolTipText(trans.get("InnerTubeCfg.lbl.ttip.Rotation"));
                subPanel.add(bs, "w 100lp, wrap para");
                
 
 
                // Split button
-               JButton split = new JButton("Split cluster");
-               split.setToolTipText("<html>Split the cluster into separate components.<br>" +
-                               "This also duplicates all components attached to this inner tube.");
+               //// Split cluster
+               JButton split = new JButton(trans.get("InnerTubeCfg.but.Splitcluster"));
+               //// <html>Split the cluster into separate components.<br>
+               //// This also duplicates all components attached to this inner tube.
+               split.setToolTipText(trans.get("InnerTubeCfg.lbl.longA1") +
+                               trans.get("InnerTubeCfg.lbl.longA2"));
                split.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
@@ -136,7 +157,7 @@ public class InnerTubeConfig extends ThicknessRingComponentConfig {
                                                if (tube.getClusterCount() <= 1)
                                                        return;
                                                
-                                               ComponentConfigDialog.addUndoPosition("Split cluster");
+                                               document.addUndoPosition("Split cluster");
                                                
                                                Coordinate[] coords = { Coordinate.NUL };
                                                coords = component.shiftCoordinates(coords);
@@ -159,8 +180,10 @@ public class InnerTubeConfig extends ThicknessRingComponentConfig {
                
 
                // Reset button
-               JButton reset = new JButton("Reset settings");
-               reset.setToolTipText("Reset the separation and rotation to the default values");
+               ///// Reset settings
+               JButton reset = new JButton(trans.get("InnerTubeCfg.but.Resetsettings"));
+               //// Reset the separation and rotation to the default values
+               reset.setToolTipText(trans.get("InnerTubeCfg.but.ttip.Resetsettings"));
                reset.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent arg0) {