Add traversal policy for elliptical fin set config
This commit is contained in:
parent
8954ca7a7d
commit
cfe16020a4
@ -15,6 +15,7 @@ import javax.swing.SwingConstants;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.gui.SpinnerEditor;
|
import net.sf.openrocket.gui.SpinnerEditor;
|
||||||
|
import net.sf.openrocket.gui.adaptors.CustomFocusTraversalPolicy;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.adaptors.EnumModel;
|
import net.sf.openrocket.gui.adaptors.EnumModel;
|
||||||
import net.sf.openrocket.gui.adaptors.IntegerModel;
|
import net.sf.openrocket.gui.adaptors.IntegerModel;
|
||||||
@ -51,6 +52,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(im.getSpinnerModel());
|
spin = new JSpinner(im.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx, wrap");
|
panel.add(spin, "growx, wrap");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
|
|
||||||
//// Base rotation
|
//// Base rotation
|
||||||
@ -61,6 +63,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(m.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(m), "growx");
|
panel.add(new UnitSelector(m), "growx");
|
||||||
panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)), "w 100lp, wrap");
|
panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)), "w 100lp, wrap");
|
||||||
@ -78,6 +81,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(m.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(m), "growx");
|
panel.add(new UnitSelector(m), "growx");
|
||||||
panel.add(new BasicSlider(m.getSliderModel(-FinSet.MAX_CANT_RADIANS, FinSet.MAX_CANT_RADIANS)),
|
panel.add(new BasicSlider(m.getSliderModel(-FinSet.MAX_CANT_RADIANS, FinSet.MAX_CANT_RADIANS)),
|
||||||
@ -93,6 +97,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(m.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(m), "growx");
|
panel.add(new UnitSelector(m), "growx");
|
||||||
panel.add(new BasicSlider(m.getSliderModel(0, 0.05, 0.2)), "w 100lp, wrap");
|
panel.add(new BasicSlider(m.getSliderModel(0, 0.05, 0.2)), "w 100lp, wrap");
|
||||||
@ -106,6 +111,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(m.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(m), "growx");
|
panel.add(new UnitSelector(m), "growx");
|
||||||
panel.add(new BasicSlider(m.getSliderModel(0, 0.05, 0.2)), "w 100lp, wrap");
|
panel.add(new BasicSlider(m.getSliderModel(0, 0.05, 0.2)), "w 100lp, wrap");
|
||||||
@ -118,6 +124,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
final EnumModel<AxialMethod> axialMethodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
|
final EnumModel<AxialMethod> axialMethodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
|
||||||
final JComboBox<AxialMethod> axialMethodCombo = new JComboBox<AxialMethod>( axialMethodModel );
|
final JComboBox<AxialMethod> axialMethodCombo = new JComboBox<AxialMethod>( axialMethodModel );
|
||||||
panel.add(axialMethodCombo, "spanx, growx, wrap");
|
panel.add(axialMethodCombo, "spanx, growx, wrap");
|
||||||
|
order.add(axialMethodCombo);
|
||||||
|
|
||||||
//// plus
|
//// plus
|
||||||
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.plus")), "right");
|
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.plus")), "right");
|
||||||
@ -126,6 +133,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(axialOffsetModel.getSpinnerModel());
|
spin = new JSpinner(axialOffsetModel.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
axialMethodCombo.addActionListener(new ActionListener() {
|
axialMethodCombo.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -157,7 +165,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
JComboBox<FinSet.CrossSection> sectionCombo = new JComboBox<FinSet.CrossSection>(
|
JComboBox<FinSet.CrossSection> sectionCombo = new JComboBox<FinSet.CrossSection>(
|
||||||
new EnumModel<FinSet.CrossSection>(component, "CrossSection"));
|
new EnumModel<FinSet.CrossSection>(component, "CrossSection"));
|
||||||
panel.add( sectionCombo, "growx, wrap unrel");
|
panel.add( sectionCombo, "growx, wrap unrel");
|
||||||
|
order.add(sectionCombo);
|
||||||
|
|
||||||
//// Thickness:
|
//// Thickness:
|
||||||
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Thickness")));
|
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Thickness")));
|
||||||
@ -167,6 +175,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
spin = new JSpinner(m.getSpinnerModel());
|
spin = new JSpinner(m.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(m), "growx");
|
panel.add(new UnitSelector(m), "growx");
|
||||||
panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "w 100lp, wrap 30lp");
|
panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "w 100lp, wrap 30lp");
|
||||||
@ -176,6 +185,10 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
//// Material
|
//// Material
|
||||||
MaterialPanel materialPanel = new MaterialPanel(component, document, Material.Type.BULK);
|
MaterialPanel materialPanel = new MaterialPanel(component, document, Material.Type.BULK);
|
||||||
panel.add(materialPanel, "span, wrap");
|
panel.add(materialPanel, "span, wrap");
|
||||||
|
order.add(materialPanel.getMaterialCombo());
|
||||||
|
if (materialPanel.getFinishCombo() != null) {
|
||||||
|
order.add(materialPanel.getFinishCombo());
|
||||||
|
}
|
||||||
|
|
||||||
panel.add(filletMaterialPanel(), "span, wrap");
|
panel.add(filletMaterialPanel(), "span, wrap");
|
||||||
|
|
||||||
@ -190,6 +203,10 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
|||||||
tabbedPane.insertTab(trans.get("EllipticalFinSetCfg.General"), null, mainPanel,
|
tabbedPane.insertTab(trans.get("EllipticalFinSetCfg.General"), null, mainPanel,
|
||||||
trans.get("EllipticalFinSetCfg.Generalproperties"), 0);
|
trans.get("EllipticalFinSetCfg.Generalproperties"), 0);
|
||||||
tabbedPane.setSelectedIndex(0);
|
tabbedPane.setSelectedIndex(0);
|
||||||
|
|
||||||
|
// Apply the custom focus travel policy to this config dialog
|
||||||
|
CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order);
|
||||||
|
parent.setFocusTraversalPolicy(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import javax.swing.SwingUtilities;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.gui.SpinnerEditor;
|
import net.sf.openrocket.gui.SpinnerEditor;
|
||||||
|
import net.sf.openrocket.gui.adaptors.CustomFocusTraversalPolicy;
|
||||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.adaptors.EnumModel;
|
import net.sf.openrocket.gui.adaptors.EnumModel;
|
||||||
import net.sf.openrocket.gui.adaptors.MaterialModel;
|
import net.sf.openrocket.gui.adaptors.MaterialModel;
|
||||||
@ -134,11 +135,15 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
});
|
});
|
||||||
split.setEnabled(((FinSet) component).getFinCount() > 1);
|
split.setEnabled(((FinSet) component).getFinCount() > 1);
|
||||||
|
|
||||||
if (convert == null)
|
if (convert == null) {
|
||||||
addButtons(split);
|
addButtons(split);
|
||||||
else
|
order.add(split);
|
||||||
|
}
|
||||||
|
else {
|
||||||
addButtons(split, convert);
|
addButtons(split, convert);
|
||||||
|
order.add(split);
|
||||||
|
order.add(convert);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel finTabPanel() {
|
private JPanel finTabPanel() {
|
||||||
@ -179,6 +184,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
spin = new JSpinner(mtl.getSpinnerModel());
|
spin = new JSpinner(mtl.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx 1");
|
panel.add(spin, "growx 1");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(mtl), "growx 1");
|
panel.add(new UnitSelector(mtl), "growx 1");
|
||||||
panel.add(new BasicSlider(mtl.getSliderModel(DoubleModel.ZERO, length)),
|
panel.add(new BasicSlider(mtl.getSliderModel(DoubleModel.ZERO, length)),
|
||||||
@ -196,6 +202,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
spin = new JSpinner(tabHeightModel.getSpinnerModel());
|
spin = new JSpinner(tabHeightModel.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(tabHeightModel), "growx");
|
panel.add(new UnitSelector(tabHeightModel), "growx");
|
||||||
panel.add(new BasicSlider(tabHeightModel.getSliderModel(DoubleModel.ZERO, length2)),
|
panel.add(new BasicSlider(tabHeightModel.getSliderModel(DoubleModel.ZERO, length2)),
|
||||||
@ -212,6 +219,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
spin = new JSpinner(mts.getSpinnerModel());
|
spin = new JSpinner(mts.getSpinnerModel());
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
|
|
||||||
panel.add(new UnitSelector(mts), "growx");
|
panel.add(new UnitSelector(mts), "growx");
|
||||||
panel.add(new BasicSlider(mts.getSliderModel(length_2, length2)), "w 100lp, growx 5, wrap");
|
panel.add(new BasicSlider(mts.getSliderModel(length_2, length2)), "w 100lp, growx 5, wrap");
|
||||||
@ -226,6 +234,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
JComboBox<AxialMethod> enumCombo = new JComboBox<>(em);
|
JComboBox<AxialMethod> enumCombo = new JComboBox<>(em);
|
||||||
|
|
||||||
panel.add( enumCombo, "spanx 3, growx, wrap para");
|
panel.add( enumCombo, "spanx 3, growx, wrap para");
|
||||||
|
order.add(enumCombo);
|
||||||
|
|
||||||
// Calculate fin tab height, length, and position
|
// Calculate fin tab height, length, and position
|
||||||
autoCalc = new SelectColorButton(trans.get("FinSetConfig.but.AutoCalc"));
|
autoCalc = new SelectColorButton(trans.get("FinSetConfig.but.AutoCalc"));
|
||||||
@ -284,6 +293,11 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(autoCalc, "skip 1, spanx");
|
panel.add(autoCalc, "skip 1, spanx");
|
||||||
|
order.add(autoCalc);
|
||||||
|
|
||||||
|
// Apply the custom focus travel policy to this panel
|
||||||
|
CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order);
|
||||||
|
parent.setFocusTraversalPolicy(policy);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
@ -499,6 +513,8 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
trans.get("FinsetCfg.ttip.Finfillets2") +
|
trans.get("FinsetCfg.ttip.Finfillets2") +
|
||||||
trans.get("FinsetCfg.ttip.Finfillets3");
|
trans.get("FinsetCfg.ttip.Finfillets3");
|
||||||
filletPanel.setBorder(BorderFactory.createTitledBorder("Root Fillets"));
|
filletPanel.setBorder(BorderFactory.createTitledBorder("Root Fillets"));
|
||||||
|
|
||||||
|
// Fillet Radius:
|
||||||
filletPanel.add(new JLabel(trans.get("FinSetCfg.lbl.Filletradius")));
|
filletPanel.add(new JLabel(trans.get("FinSetCfg.lbl.Filletradius")));
|
||||||
|
|
||||||
DoubleModel m = new DoubleModel(component, "FilletRadius", UnitGroup.UNITS_LENGTH, 0);
|
DoubleModel m = new DoubleModel(component, "FilletRadius", UnitGroup.UNITS_LENGTH, 0);
|
||||||
@ -507,6 +523,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
spin.setToolTipText(tip);
|
spin.setToolTipText(tip);
|
||||||
filletPanel.add(spin, "growx, w 40");
|
filletPanel.add(spin, "growx, w 40");
|
||||||
|
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
|
||||||
UnitSelector us = new UnitSelector(m);
|
UnitSelector us = new UnitSelector(m);
|
||||||
filletPanel.add(us, "growx");
|
filletPanel.add(us, "growx");
|
||||||
us.setToolTipText(tip);
|
us.setToolTipText(tip);
|
||||||
@ -514,6 +531,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
filletPanel.add(bs, "w 100lp, wrap para");
|
filletPanel.add(bs, "w 100lp, wrap para");
|
||||||
bs.setToolTipText(tip);
|
bs.setToolTipText(tip);
|
||||||
|
|
||||||
|
// Fillet Material:
|
||||||
JLabel label = new JLabel(trans.get("FinSetCfg.lbl.Finfilletmaterial"));
|
JLabel label = new JLabel(trans.get("FinSetCfg.lbl.Finfilletmaterial"));
|
||||||
label.setToolTipText(tip);
|
label.setToolTipText(tip);
|
||||||
//// The component material affects the weight of the component.
|
//// The component material affects the weight of the component.
|
||||||
@ -525,7 +543,13 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
//// The component material affects the weight of the component.
|
//// The component material affects the weight of the component.
|
||||||
materialCombo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects"));
|
materialCombo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects"));
|
||||||
filletPanel.add( materialCombo, "spanx 4, growx, wrap paragraph");
|
filletPanel.add( materialCombo, "spanx 4, growx, wrap paragraph");
|
||||||
|
order.add(materialCombo);
|
||||||
filletPanel.setToolTipText(tip);
|
filletPanel.setToolTipText(tip);
|
||||||
|
|
||||||
|
// Apply the custom focus travel policy to this panel
|
||||||
|
CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order);
|
||||||
|
parent.setFocusTraversalPolicy(policy);
|
||||||
|
|
||||||
return filletPanel;
|
return filletPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user