l10n updates
authorplaa <plaa@180e2498-e6e9-4542-8430-84ac67f01cd8>
Wed, 20 Jul 2011 15:44:57 +0000 (15:44 +0000)
committerplaa <plaa@180e2498-e6e9-4542-8430-84ac67f01cd8>
Wed, 20 Jul 2011 15:44:57 +0000 (15:44 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@140 180e2498-e6e9-4542-8430-84ac67f01cd8

l10n/messages.properties
scripts/checkTranslations.sh [new file with mode: 0755]
scripts/renameTranslationKeys.sh [new file with mode: 0644]
scripts/verifyTranslationKeys.pl [new file with mode: 0755]
src/net/sf/openrocket/gui/components/StageSelector.java
src/net/sf/openrocket/gui/configdialog/StreamerConfig.java
src/net/sf/openrocket/gui/print/OpenRocketPrintable.java
src/net/sf/openrocket/rocketcomponent/ExternalComponent.java
src/net/sf/openrocket/rocketcomponent/MotorMount.java
src/net/sf/openrocket/util/LineStyle.java

index 757eca94d914f7135039ab055380d6be9fd37270..6f14e49eeeddbe4fc9535cbe180cf5907580d365 100644 (file)
@@ -144,6 +144,9 @@ debuglogdlg.col.Message = Message
 debuglogdlg.lbl.Loglinenbr = Log line number:
 debuglogdlg.lbl.Time = Time:
 debuglogdlg.lbl.Level = Level:
+debuglogdlg.lbl.Location = Location:
+debuglogdlg.lbl.Logmessage = Log message:
+debuglogdlg.lbl.Stacktrace = Stack trace:
 
 
 ! Edit Motor configuration dialog
@@ -485,6 +488,7 @@ componentanalysisdlg.println.settingnam = SETTING NAN VALUES
 componentanalysisdlg.lbl.reflenght = Reference length: 
 componentanalysisdlg.lbl.refarea = Reference area: 
 !componentanalysisdlg.But.close =Close
+componentanalysisdlg.TabStability.Col.Component = Component
 
 ! Custom Material dialog
 custmatdlg.title.Custommaterial = Custom material
@@ -754,6 +758,7 @@ ParachuteCfg.tab.ttip.Radialpos = Radial position configuration
 ParachuteCfg.lbl.Radialdistance = Radial distance:
 ParachuteCfg.lbl.Radialdirection = Radial direction:
 ParachuteCfg.but.Reset = Reset
+ParachuteCfg.lbl.plusdelay = plus
 
 ! ShockCordConfig 
 ShockCordCfg.lbl.Shockcordlength = Shock cord length
@@ -799,6 +804,7 @@ StreamerCfg.tab.ttip.Radialpos = Radial position configuration
 StreamerCfg.lbl.Radialdistance = Radial distance:
 StreamerCfg.lbl.Radialdirection = Radial direction:
 StreamerCfg.but.Reset = Reset
+StreamerCfg.lbl.plusdelay = plus
 
 ! ThicknessRingComponentConfig
 ThicknessRingCompCfg.tab.Outerdiam = Outer diameter:
diff --git a/scripts/checkTranslations.sh b/scripts/checkTranslations.sh
new file mode 100755 (executable)
index 0000000..bbbf91c
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+#
+# Perform all tests for the translation files.
+#
+# Usage:
+#    ./scripts/checkTranslations.sh
+#
+
+
+# Test that keys used in Java files are present in English messages
+find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
+
diff --git a/scripts/renameTranslationKeys.sh b/scripts/renameTranslationKeys.sh
new file mode 100644 (file)
index 0000000..2a7314d
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Rename translation keys in translation files.
+#
+# Usage:
+#    renameTranslationKeys.sh <mapping files...>
+#
+# The mapping files contain "<original> <new>" key pairs.
+# Empty lines and lines starting with "#" are ignored.
+# All translation files are modified at once.
+#
+
+TRANSLATIONS=messages*.properties
+
+cat "$@" | while read line; do
+
+    if echo "$line" | grep -q "^\s*$\|^\s*#"; then
+       continue
+    fi
+
+    if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
+       echo "Invalid line:  $line"
+    fi
+
+    from="`echo $line | cut -d" " -f1`"
+    to="`echo $line | cut -d" " -f2`"
+
+    sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS
+
+done
diff --git a/scripts/verifyTranslationKeys.pl b/scripts/verifyTranslationKeys.pl
new file mode 100755 (executable)
index 0000000..f084f06
--- /dev/null
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+#
+# Verify that keys used in Java files are present in the translation file.
+# 
+# Usage:
+#    verifyTranslationKeys.pl <property file> <Java files...>
+#
+# For example:
+#    find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
+#
+
+
+
+# Read the translation file
+my %keys;
+print "Reading translation keys...\n";
+while ($str = <>) {
+    if ($ARGV!~/\.properties/) {
+       last;
+    }
+
+    if ($str=~/^\s*($|[#!])/) {
+       next;
+    }
+
+    if ($str=~/^([a-zA-Z0-9._-]+)\s*=/) {
+       $keys{$1} = 1;
+    } else {
+       print "ERROR:  Invalid line in $ARGV: $str";
+    }
+}
+
+
+# Read Java files
+my $oldFile = $ARGV;
+my $class="";
+print "Reading Java files...\n";
+while ($str = <>) {
+
+    # Check for new file
+    if ($ARGV != $oldFile) {
+       $class = "";
+    }
+    
+    # Check for irregular translator definition (exclude /l10n/ and /startup/)
+    if ($str =~ / Translator / &&
+       $str !~ /private static final Translator trans = Application.getTranslator\(\);/ &&
+       $ARGV !~ /\/(l10n|startup)\//) {
+       print "ERROR:  Unusual translator usage in file $ARGV: $str";
+    }
+
+    # Check for new class definition
+    if ($str =~ /^[\sa-z]*class ([a-zA-Z0-9]+) /) {
+       $class = $1;
+    }
+
+    # Check for translator usage
+    if ($str =~ /trans\.get\(\"([^\"]+)\"\)/) {
+       $key = $1;
+       if (!(exists $keys{$key}) && 
+           !(exists $keys{$class . "." . $key})) {
+           print "ERROR:  Missing translation for '$key' in file $ARGV\n";
+       }
+    }
+
+}
index 13a98890dee5feee66c1b6816b32d708242db6ff..301b25ffd52ac0930a56c2163d8efe2aba92954b 100644 (file)
@@ -17,7 +17,8 @@ import net.sf.openrocket.startup.Application;
 
 
 public class StageSelector extends JPanel implements ChangeListener {
-
+       private static final Translator trans = Application.getTranslator();
+       
        private final Configuration configuration;
        
        private List<JToggleButton> buttons = new ArrayList<JToggleButton>();
@@ -40,7 +41,7 @@ public class StageSelector extends JPanel implements ChangeListener {
                        return;
                
                while (buttons.size() > stages) {
-                       JToggleButton button = buttons.remove(buttons.size()-1);
+                       JToggleButton button = buttons.remove(buttons.size() - 1);
                        this.remove(button);
                }
                
@@ -53,7 +54,7 @@ public class StageSelector extends JPanel implements ChangeListener {
                this.revalidate();
        }
        
-
+       
 
 
        @Override
@@ -64,8 +65,7 @@ public class StageSelector extends JPanel implements ChangeListener {
        
        private class StageAction extends AbstractAction implements ChangeListener {
                private final int stage;
-               private final Translator trans = Application.getTranslator();
-
+               
                public StageAction(final int stage) {
                        this.stage = stage;
                        configuration.addChangeListener(this);
@@ -76,7 +76,7 @@ public class StageSelector extends JPanel implements ChangeListener {
                public Object getValue(String key) {
                        if (key.equals(NAME)) {
                                //// Stage
-                               return trans.get("StageAction.Stage") + " " + (stage+1);
+                               return trans.get("StageAction.Stage") + " " + (stage + 1);
                        }
                        return super.getValue(key);
                }
@@ -85,25 +85,25 @@ public class StageSelector extends JPanel implements ChangeListener {
                public void actionPerformed(ActionEvent e) {
                        configuration.setToStage(stage);
                        
-//                     boolean state = (Boolean)getValue(SELECTED_KEY);
-//                     if (state == true) {
-//                             // Was disabled, now enabled
-//                             configuration.setToStage(stage);
-//                     } else {
-//                             // Was enabled, check what to do
-//                             if (configuration.isStageActive(stage + 1)) {
-//                                     configuration.setToStage(stage);
-//                             } else {
-//                                     if (stage == 0)
-//                                             configuration.setAllStages();
-//                                     else 
-//                                             configuration.setToStage(stage-1);
-//                             }
-//                     }
-//                     stateChanged(null);
+                       //                      boolean state = (Boolean)getValue(SELECTED_KEY);
+                       //                      if (state == true) {
+                       //                              // Was disabled, now enabled
+                       //                              configuration.setToStage(stage);
+                       //                      } else {
+                       //                              // Was enabled, check what to do
+                       //                              if (configuration.isStageActive(stage + 1)) {
+                       //                                      configuration.setToStage(stage);
+                       //                              } else {
+                       //                                      if (stage == 0)
+                       //                                              configuration.setAllStages();
+                       //                                      else 
+                       //                                              configuration.setToStage(stage-1);
+                       //                              }
+                       //                      }
+                       //                      stateChanged(null);
                }
                
-
+               
                @Override
                public void stateChanged(ChangeEvent e) {
                        this.putValue(SELECTED_KEY, configuration.isStageActive(stage));
index efea6f9a903797aae7ceb0a9fca2ec97e6742a40..3aef4acc021b73c66ad8cebd3161dc142476ec86 100644 (file)
@@ -23,8 +23,8 @@ 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;
 
@@ -33,247 +33,247 @@ 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::][]",""));
+               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() {
@@ -283,7 +283,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
                                ((MassComponent) component).setRadialPosition(0.0);
                        }
                });
-               panel.add(button,"spanx, right");
+               panel.add(button, "spanx, right");
                
                return panel;
        }
index 709e3c7a8a7acd0ffcba5b8e9a5591c755b5ac4e..d0908a7dade24deec36355978dd25e0c9bc50efc 100644 (file)
@@ -2,6 +2,7 @@
  * OpenRocketPrintable.java
  */
 package net.sf.openrocket.gui.print;
+
 import net.sf.openrocket.l10n.Translator;
 import net.sf.openrocket.startup.Application;
 
@@ -10,85 +11,86 @@ 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;
+       }
 }
index ed543c12fe352eab0890e31d04817621afd87b05..64c1a50ec095509c5348f648ace514f3677c253a 100644 (file)
@@ -1,13 +1,13 @@
 package net.sf.openrocket.rocketcomponent;
 
+import java.util.List;
+
 import net.sf.openrocket.l10n.Translator;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.startup.Application;
 import net.sf.openrocket.unit.UnitGroup;
 import net.sf.openrocket.util.Prefs;
 
-import java.util.List;
-
 /**
  * Class of components with well-defined physical appearance and which have an effect on
  * aerodynamic simulation.  They have material defined for them, and the mass of the component
@@ -17,7 +17,7 @@ import java.util.List;
  */
 
 public abstract class ExternalComponent extends RocketComponent {
-
+       
        public enum Finish {
                //// Rough
                ROUGH("ExternalComponent.Rough", 500e-6),
@@ -29,35 +29,35 @@ public abstract class ExternalComponent extends RocketComponent {
                SMOOTH("ExternalComponent.Smoothpaint", 20e-6),
                //// Polished
                POLISHED("ExternalComponent.Polished", 2e-6);
-
+               
+               private static final Translator trans = Application.getTranslator();
                private final String name;
                private final double roughnessSize;
-
+               
                Finish(String name, double roughness) {
                        this.name = name;
                        this.roughnessSize = roughness;
                }
-
+               
                public double getRoughnessSize() {
                        return roughnessSize;
                }
-
+               
                @Override
                public String toString() {
-                       final Translator trans = Application.getTranslator();
                        return trans.get(name) + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")";
                }
        }
-
-
+       
+       
        /**
         * The material of the component.
         */
        protected Material material = null;
-
+       
        protected Finish finish = Finish.NORMAL;
-
-
+       
+       
 
        /**
         * Constructor that sets the relative position of the component.
@@ -66,13 +66,13 @@ public abstract class ExternalComponent extends RocketComponent {
                super(relativePosition);
                this.material = Prefs.getDefaultComponentMaterial(this.getClass(), Material.Type.BULK);
        }
-
+       
        /**
         * Returns the volume of the component.  This value is used in calculating the mass
         * of the object.
         */
        public abstract double getComponentVolume();
-
+       
        /**
         * Calculates the mass of the component as the product of the volume and interior density.
         */
@@ -80,7 +80,7 @@ public abstract class ExternalComponent extends RocketComponent {
        public double getComponentMass() {
                return material.getDensity() * getComponentVolume();
        }
-
+       
        /**
         * ExternalComponent has aerodynamic effect, so return true.
         */
@@ -88,7 +88,7 @@ public abstract class ExternalComponent extends RocketComponent {
        public boolean isAerodynamic() {
                return true;
        }
-
+       
        /**
         * ExternalComponent has effect on the mass, so return true.
         */
@@ -96,36 +96,36 @@ public abstract class ExternalComponent extends RocketComponent {
        public boolean isMassive() {
                return true;
        }
-
-
+       
+       
        public Material getMaterial() {
                return material;
        }
-
+       
        public void setMaterial(Material mat) {
                if (mat.getType() != Material.Type.BULK) {
                        throw new IllegalArgumentException("ExternalComponent requires a bulk material" +
                                        " type=" + mat.getType());
                }
-
+               
                if (material.equals(mat))
                        return;
                material = mat;
                fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
        }
-
+       
        public Finish getFinish() {
                return finish;
        }
-
+       
        public void setFinish(Finish finish) {
                if (this.finish == finish)
                        return;
                this.finish = finish;
                fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
        }
-
-
+       
+       
        @Override
        protected List<RocketComponent> copyFrom(RocketComponent c) {
                ExternalComponent src = (ExternalComponent) c;
@@ -133,5 +133,5 @@ public abstract class ExternalComponent extends RocketComponent {
                this.material = src.material;
                return super.copyFrom(c);
        }
-
+       
 }
index 15ea70f85322935a2e1eb31f051e3686ebe6c37b..1c849d4d2a96a682269119216a4af61b51cd755d 100644 (file)
@@ -8,17 +8,16 @@ import net.sf.openrocket.util.ChangeSource;
 import net.sf.openrocket.util.Coordinate;
 
 public interface MotorMount extends ChangeSource {
-       static final Translator trans = Application.getTranslator();
-
+       
        public static enum IgnitionEvent {
                //// Automatic (launch or ejection charge)
-               AUTOMATIC(trans.get("MotorMount.IgnitionEvent.AUTOMATIC")) {
+               AUTOMATIC("MotorMount.IgnitionEvent.AUTOMATIC") {
                        @Override
                        public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
                                int count = source.getRocket().getStageCount();
                                int stage = source.getStageNumber();
                                
-                               if (stage == count-1) {
+                               if (stage == count - 1) {
                                        return LAUNCH.isActivationEvent(e, source);
                                } else {
                                        return EJECTION_CHARGE.isActivationEvent(e, source);
@@ -26,38 +25,38 @@ public interface MotorMount extends ChangeSource {
                        }
                },
                //// Launch
-               LAUNCH(trans.get("MotorMount.IgnitionEvent.LAUNCH")) {
+               LAUNCH("MotorMount.IgnitionEvent.LAUNCH") {
                        @Override
-                       public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
+                       public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
                                return (e.getType() == FlightEvent.Type.LAUNCH);
                        }
                },
                //// First ejection charge of previous stage
-               EJECTION_CHARGE(trans.get("MotorMount.IgnitionEvent.EJECTION_CHARGE")) {
+               EJECTION_CHARGE("MotorMount.IgnitionEvent.EJECTION_CHARGE") {
                        @Override
                        public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
                                if (e.getType() != FlightEvent.Type.EJECTION_CHARGE)
                                        return false;
-
+                               
                                int charge = e.getSource().getStageNumber();
                                int mount = source.getStageNumber();
-                               return (mount+1 == charge);
+                               return (mount + 1 == charge);
                        }
                },
                //// First burnout of previous stage
-               BURNOUT(trans.get("MotorMount.IgnitionEvent.BURNOUT")) {
+               BURNOUT("MotorMount.IgnitionEvent.BURNOUT") {
                        @Override
                        public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
                                if (e.getType() != FlightEvent.Type.BURNOUT)
                                        return false;
-
+                               
                                int charge = e.getSource().getStageNumber();
                                int mount = source.getStageNumber();
-                               return (mount+1 == charge);
+                               return (mount + 1 == charge);
                        }
                },
                //// Never
-               NEVER(trans.get("MotorMount.IgnitionEvent.NEVER")) {
+               NEVER("MotorMount.IgnitionEvent.NEVER") {
                        @Override
                        public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
                                return false;
@@ -65,7 +64,8 @@ public interface MotorMount extends ChangeSource {
                },
                ;
                
-               
+
+               private static final Translator trans = Application.getTranslator();
                private final String description;
                
                IgnitionEvent(String description) {
@@ -76,7 +76,7 @@ public interface MotorMount extends ChangeSource {
                
                @Override
                public String toString() {
-                       return description;
+                       return trans.get(description);
                }
        };
        
@@ -113,7 +113,7 @@ public interface MotorMount extends ChangeSource {
         * @param motor  the motor, or <code>null</code>.
         */
        public void setMotor(String id, Motor motor);
-
+       
        /**
         * Get the number of similar motors clustered.
         * 
@@ -125,7 +125,7 @@ public interface MotorMount extends ChangeSource {
        public int getMotorCount();
        
        
-       
+
        /**
         * Return the ejection charge delay of given motor configuration.
         * A "plugged" motor without an ejection charge is given by
@@ -192,7 +192,7 @@ public interface MotorMount extends ChangeSource {
        public void setMotorOverhang(double overhang);
        
        
-       
+
        /**
         * Return the inner diameter of the motor mount.
         * 
index edd562b3129354a8ed159e693df64c61aa1f39d0..73df2b7381172129b2b144848eec41148477bfa6 100644 (file)
@@ -15,29 +15,29 @@ import net.sf.openrocket.startup.Application;
 public enum LineStyle {
        
        //// Solid
-       SOLID("LineStyle.Solid",new float[] { 10f, 0f }),
+       SOLID("LineStyle.Solid", new float[] { 10f, 0f }),
        //// Dashed
-       DASHED("LineStyle.Dashed",new float[] { 6f, 4f }),
+       DASHED("LineStyle.Dashed", new float[] { 6f, 4f }),
        //// Dotted
-       DOTTED("LineStyle.Dotted",new float[] { 2f, 3f }),
+       DOTTED("LineStyle.Dotted", new float[] { 2f, 3f }),
        //// Dash-dotted
-       DASHDOT("LineStyle.Dash-dotted",new float[] { 8f, 3f, 2f, 3f})
-       ;
+       DASHDOT("LineStyle.Dash-dotted", new float[] { 8f, 3f, 2f, 3f });
        
+       private static final Translator trans = Application.getTranslator();
        private final String name;
        private final float[] dashes;
        
        LineStyle(String name, float[] dashes) {
-       
                this.name = name;
                this.dashes = dashes;
        }
+       
        public float[] getDashes() {
                return Arrays.copyOf(dashes, dashes.length);
        }
+       
        @Override
        public String toString() {
-               final Translator trans = Application.getTranslator();
                return trans.get(name);
        }
 }
\ No newline at end of file