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.material.Material;
19 import net.sf.openrocket.rocketcomponent.FinSet;
20 import net.sf.openrocket.rocketcomponent.RocketComponent;
21 import net.sf.openrocket.unit.UnitGroup;
23 public class EllipticalFinSetConfig extends FinSetConfig {
25 public EllipticalFinSetConfig(final RocketComponent component) {
32 JPanel mainPanel = new JPanel(new MigLayout());
36 JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
39 panel.add(new JLabel("Number of fins:"));
41 IntegerModel im = new IntegerModel(component,"FinCount",1,8);
43 spin = new JSpinner(im.getSpinnerModel());
44 spin.setEditor(new SpinnerEditor(spin));
45 panel.add(spin,"growx, wrap");
49 panel.add(new JLabel("Rotation:"));
51 m = new DoubleModel(component, "BaseRotation", UnitGroup.UNITS_ANGLE,-Math.PI,Math.PI);
53 spin = new JSpinner(m.getSpinnerModel());
54 spin.setEditor(new SpinnerEditor(spin));
55 panel.add(spin,"growx");
57 panel.add(new UnitSelector(m),"growx");
58 panel.add(new BasicSlider(m.getSliderModel(-Math.PI,Math.PI)),"w 100lp, wrap");
62 JLabel label = new JLabel("Fin cant:");
63 label.setToolTipText("The angle that the fins are canted with respect to the rocket " +
67 m = new DoubleModel(component, "CantAngle", UnitGroup.UNITS_ANGLE,
68 -FinSet.MAX_CANT, FinSet.MAX_CANT);
70 spin = new JSpinner(m.getSpinnerModel());
71 spin.setEditor(new SpinnerEditor(spin));
72 panel.add(spin,"growx");
74 panel.add(new UnitSelector(m),"growx");
75 panel.add(new BasicSlider(m.getSliderModel(-FinSet.MAX_CANT,FinSet.MAX_CANT)),
81 panel.add(new JLabel("Root chord:"));
83 m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0);
85 spin = new JSpinner(m.getSpinnerModel());
86 spin.setEditor(new SpinnerEditor(spin));
87 panel.add(spin,"growx");
89 panel.add(new UnitSelector(m),"growx");
90 panel.add(new BasicSlider(m.getSliderModel(0,0.05,0.2)),"w 100lp, wrap");
94 panel.add(new JLabel("Height:"));
96 m = new DoubleModel(component,"Height",UnitGroup.UNITS_LENGTH,0);
98 spin = new JSpinner(m.getSpinnerModel());
99 spin.setEditor(new SpinnerEditor(spin));
100 panel.add(spin,"growx");
102 panel.add(new UnitSelector(m),"growx");
103 panel.add(new BasicSlider(m.getSliderModel(0,0.05,0.2)),"w 100lp, wrap");
108 panel.add(new JLabel("Position relative to:"));
110 combo = new JComboBox(
111 new EnumModel<RocketComponent.Position>(component, "RelativePosition",
112 new RocketComponent.Position[] {
113 RocketComponent.Position.TOP,
114 RocketComponent.Position.MIDDLE,
115 RocketComponent.Position.BOTTOM,
116 RocketComponent.Position.ABSOLUTE
118 panel.add(combo,"spanx, growx, wrap");
120 panel.add(new JLabel("plus"),"right");
122 m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
123 spin = new JSpinner(m.getSpinnerModel());
124 spin.setEditor(new SpinnerEditor(spin));
125 panel.add(spin,"growx");
127 panel.add(new UnitSelector(m),"growx");
128 panel.add(new BasicSlider(m.getSliderModel(
129 new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
130 new DoubleModel(component.getParent(), "Length"))),
136 mainPanel.add(panel,"aligny 20%");
138 mainPanel.add(new JSeparator(SwingConstants.VERTICAL),"growy");
142 panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
146 panel.add(new JLabel("Fin cross section:"),"span, split");
147 combo = new JComboBox(
148 new EnumModel<FinSet.CrossSection>(component,"CrossSection"));
149 panel.add(combo,"growx, wrap unrel");
153 panel.add(new JLabel("Thickness:"));
155 m = new DoubleModel(component,"Thickness",UnitGroup.UNITS_LENGTH,0);
157 spin = new JSpinner(m.getSpinnerModel());
158 spin.setEditor(new SpinnerEditor(spin));
159 panel.add(spin,"growx");
161 panel.add(new UnitSelector(m),"growx");
162 panel.add(new BasicSlider(m.getSliderModel(0,0.01)),"w 100lp, wrap 30lp");
167 materialPanel(panel, Material.Type.BULK);
173 mainPanel.add(panel,"aligny 20%");
178 tabbedPane.insertTab("General", null, mainPanel, "General properties", 0);
179 tabbedPane.setSelectedIndex(0);