1 package net.sf.openrocket.gui.configdialog;
4 import javax.swing.JComboBox;
5 import javax.swing.JLabel;
6 import javax.swing.JPanel;
7 import javax.swing.JSeparator;
8 import javax.swing.JSpinner;
9 import javax.swing.SwingConstants;
11 import net.miginfocom.swing.MigLayout;
12 import net.sf.openrocket.gui.SpinnerEditor;
13 import net.sf.openrocket.gui.adaptors.DoubleModel;
14 import net.sf.openrocket.gui.adaptors.EnumModel;
15 import net.sf.openrocket.gui.adaptors.IntegerModel;
16 import net.sf.openrocket.gui.components.BasicSlider;
17 import net.sf.openrocket.gui.components.UnitSelector;
18 import net.sf.openrocket.l10n.Translator;
19 import net.sf.openrocket.material.Material;
20 import net.sf.openrocket.rocketcomponent.FinSet;
21 import net.sf.openrocket.rocketcomponent.RocketComponent;
22 import net.sf.openrocket.startup.Application;
23 import net.sf.openrocket.unit.UnitGroup;
25 public class EllipticalFinSetConfig extends FinSetConfig {
26 private static final Translator trans = Application.getTranslator();
28 public EllipticalFinSetConfig(final RocketComponent component) {
35 JPanel mainPanel = new JPanel(new MigLayout());
39 JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
42 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Nbroffins")));
44 IntegerModel im = new IntegerModel(component,"FinCount",1,8);
46 spin = new JSpinner(im.getSpinnerModel());
47 spin.setEditor(new SpinnerEditor(spin));
48 panel.add(spin,"growx, wrap");
52 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Rotation")));
54 m = new DoubleModel(component, "BaseRotation", UnitGroup.UNITS_ANGLE,-Math.PI,Math.PI);
56 spin = new JSpinner(m.getSpinnerModel());
57 spin.setEditor(new SpinnerEditor(spin));
58 panel.add(spin,"growx");
60 panel.add(new UnitSelector(m),"growx");
61 panel.add(new BasicSlider(m.getSliderModel(-Math.PI,Math.PI)),"w 100lp, wrap");
65 JLabel label = new JLabel(trans.get("EllipticalFinSetCfg.Fincant"));
66 //// "The angle that the fins are canted with respect to the rocket
67 label.setToolTipText(trans.get("EllipticalFinSetCfg.ttip.Fincant"));
70 m = new DoubleModel(component, "CantAngle", UnitGroup.UNITS_ANGLE,
71 -FinSet.MAX_CANT, FinSet.MAX_CANT);
73 spin = new JSpinner(m.getSpinnerModel());
74 spin.setEditor(new SpinnerEditor(spin));
75 panel.add(spin,"growx");
77 panel.add(new UnitSelector(m),"growx");
78 panel.add(new BasicSlider(m.getSliderModel(-FinSet.MAX_CANT,FinSet.MAX_CANT)),
84 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Rootchord")));
86 m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0);
88 spin = new JSpinner(m.getSpinnerModel());
89 spin.setEditor(new SpinnerEditor(spin));
90 panel.add(spin,"growx");
92 panel.add(new UnitSelector(m),"growx");
93 panel.add(new BasicSlider(m.getSliderModel(0,0.05,0.2)),"w 100lp, wrap");
97 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Height")));
99 m = new DoubleModel(component,"Height",UnitGroup.UNITS_LENGTH,0);
101 spin = new JSpinner(m.getSpinnerModel());
102 spin.setEditor(new SpinnerEditor(spin));
103 panel.add(spin,"growx");
105 panel.add(new UnitSelector(m),"growx");
106 panel.add(new BasicSlider(m.getSliderModel(0,0.05,0.2)),"w 100lp, wrap");
110 //// Position relative to:
111 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Positionrelativeto")));
113 combo = new JComboBox(
114 new EnumModel<RocketComponent.Position>(component, "RelativePosition",
115 new RocketComponent.Position[] {
116 RocketComponent.Position.TOP,
117 RocketComponent.Position.MIDDLE,
118 RocketComponent.Position.BOTTOM,
119 RocketComponent.Position.ABSOLUTE
121 panel.add(combo,"spanx, growx, wrap");
124 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.plus")),"right");
126 m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
127 spin = new JSpinner(m.getSpinnerModel());
128 spin.setEditor(new SpinnerEditor(spin));
129 panel.add(spin,"growx");
131 panel.add(new UnitSelector(m),"growx");
132 panel.add(new BasicSlider(m.getSliderModel(
133 new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
134 new DoubleModel(component.getParent(), "Length"))),
140 mainPanel.add(panel,"aligny 20%");
142 mainPanel.add(new JSeparator(SwingConstants.VERTICAL),"growy");
146 panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
150 //// Fin cross section:
151 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.FincrossSection")),"span, split");
152 combo = new JComboBox(
153 new EnumModel<FinSet.CrossSection>(component,"CrossSection"));
154 panel.add(combo,"growx, wrap unrel");
158 panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Thickness")));
160 m = new DoubleModel(component,"Thickness",UnitGroup.UNITS_LENGTH,0);
162 spin = new JSpinner(m.getSpinnerModel());
163 spin.setEditor(new SpinnerEditor(spin));
164 panel.add(spin,"growx");
166 panel.add(new UnitSelector(m),"growx");
167 panel.add(new BasicSlider(m.getSliderModel(0,0.01)),"w 100lp, wrap 30lp");
172 materialPanel(panel, Material.Type.BULK);
178 mainPanel.add(panel,"aligny 20%");
182 //// General and General properties
183 tabbedPane.insertTab(trans.get("EllipticalFinSetCfg.General"), null, mainPanel,
184 trans.get("EllipticalFinSetCfg.Generalproperties"), 0);
185 tabbedPane.setSelectedIndex(0);