From bc28fc58c53aa4ae19e8a8149fdec4ed16f0927d Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Sat, 27 Dec 2014 20:11:09 -0800 Subject: [PATCH] Fin fillet UI complete, radius and material are saved to file and reloaded. --- core/resources/l10n/messages.properties | 7 ++ .../openrocket/importt/DocumentConfig.java | 6 +- .../file/openrocket/savers/FinSetSaver.java | 3 + .../sf/openrocket/rocketcomponent/FinSet.java | 87 ++++++++++++++----- .../gui/adaptors/MaterialModel.java | 16 ++-- .../gui/configdialog/BodyTubeConfig.java | 2 +- .../configdialog/EllipticalFinSetConfig.java | 5 +- .../gui/configdialog/FinSetConfig.java | 64 +++++++++++--- .../configdialog/FreeformFinSetConfig.java | 11 +-- .../gui/configdialog/InnerTubeConfig.java | 2 +- .../gui/configdialog/LaunchLugConfig.java | 2 +- .../gui/configdialog/NoseConeConfig.java | 2 +- .../gui/configdialog/RingComponentConfig.java | 2 +- .../configdialog/RocketComponentConfig.java | 37 +++++--- .../gui/configdialog/ShockCordConfig.java | 2 +- .../gui/configdialog/TransitionConfig.java | 2 +- .../configdialog/TrapezoidFinSetConfig.java | 60 ++++++------- 17 files changed, 211 insertions(+), 99 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index e77cba5ff..7aa8d4dbd 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1097,6 +1097,13 @@ TrapezoidFinSetCfg.lbl.plus = plus TrapezoidFinSetCfg.tab.General = General TrapezoidFinSetCfg.tab.Generalproperties = General properties +! Fin Fillets +FinSetCfg.lbl.Finfilletmaterial = Fillet material: +FinSetCfg.lbl.Filletradius = Fillet radius: +FinsetCfg.ttip.Finfillets1 = Adds the predicted mass of fin fillets to the root of the fins.
+FinsetCfg.ttip.Finfillets2 = Assumes the fillet is concave and tangent to the body tube and fin.
+FinsetCfg.ttip.Finfillets3 = Zero radius will give no fillet. + ! StorageOptionChooser StorageOptChooser.lbl.Simdatatostore = Simulated data to store: StorageOptChooser.rdbut.Allsimdata = All simulated data diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java index 2e909207d..a1d207a8a 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java @@ -207,7 +207,11 @@ class DocumentConfig { setters.put("FinSet:tablength", new DoubleSetter( Reflection.findMethod(FinSet.class, "setTabLength", double.class))); setters.put("FinSet:tabposition", new FinTabPositionSetter()); - + setters.put("FinSet:filletradius", new DoubleSetter( + Reflection.findMethod(FinSet.class, "setFilletRadius", double.class))); + setters.put("FinSet:filletmaterial", new MaterialSetter( + Reflection.findMethod(FinSet.class, "setFilletMaterial", Material.class), + Material.Type.BULK)); // TrapezoidFinSet setters.put("TrapezoidFinSet:rootchord", new DoubleSetter( Reflection.findMethod(TrapezoidFinSet.class, "setRootChord", double.class))); diff --git a/core/src/net/sf/openrocket/file/openrocket/savers/FinSetSaver.java b/core/src/net/sf/openrocket/file/openrocket/savers/FinSetSaver.java index 7eaffc693..30e321f40 100644 --- a/core/src/net/sf/openrocket/file/openrocket/savers/FinSetSaver.java +++ b/core/src/net/sf/openrocket/file/openrocket/savers/FinSetSaver.java @@ -30,6 +30,9 @@ public class FinSetSaver extends ExternalComponentSaver { fins.getTabShift() + ""); } + + elements.add("" + fins.getFilletRadius() + ""); + elements.add(materialParam("filletmaterial", fins.getFilletMaterial())); } } diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index 55cf23095..4bd623577 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -5,6 +5,7 @@ import java.util.Collection; 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.util.ArrayUtils; import net.sf.openrocket.util.Coordinate; @@ -15,6 +16,7 @@ import net.sf.openrocket.util.Transformation; public abstract class FinSet extends ExternalComponent { private static final Translator trans = Application.getTranslator(); + /** * Maximum allowed cant of fins. */ @@ -87,7 +89,7 @@ public abstract class FinSet extends ExternalComponent { */ protected Transformation baseRotation = Transformation.rotate_x(rotation); - + /** * Cant angle of fins. */ @@ -96,19 +98,19 @@ public abstract class FinSet extends ExternalComponent { /* Cached value: */ private Transformation cantRotation = null; - + /** * Thickness of the fins. */ protected double thickness = 0.003; - + /** * The cross-section shape of the fins. */ protected CrossSection crossSection = CrossSection.SQUARE; - + /* * Fin tab properties. */ @@ -117,7 +119,13 @@ public abstract class FinSet extends ExternalComponent { private double tabShift = 0; private TabRelativePosition tabRelativePosition = TabRelativePosition.CENTER; - + /* + * Fin fillet properties + */ + + protected Material filletMaterial = null; + protected double filletRadius = 0; + // Cached fin area & CG. Validity of both must be checked using finArea! // Fin area does not include fin tabs, CG does. private double finArea = -1; @@ -132,10 +140,11 @@ public abstract class FinSet extends ExternalComponent { */ public FinSet() { super(RocketComponent.Position.BOTTOM); + this.filletMaterial = Application.getPreferences().getDefaultComponentMaterial(this.getClass(), Material.Type.BULK); } - + /** * Return the number of fins in the set. * @return The number of fins. @@ -190,7 +199,7 @@ public abstract class FinSet extends ExternalComponent { } - + public double getCantAngle() { return cantAngle; } @@ -219,7 +228,7 @@ public abstract class FinSet extends ExternalComponent { } - + public double getThickness() { return thickness; } @@ -244,9 +253,9 @@ public abstract class FinSet extends ExternalComponent { } - - - + + + @Override public void setRelativePosition(RocketComponent.Position position) { super.setRelativePosition(position); @@ -261,8 +270,8 @@ public abstract class FinSet extends ExternalComponent { } - - + + public double getTabHeight() { return tabHeight; } @@ -307,7 +316,7 @@ public abstract class FinSet extends ExternalComponent { if (this.tabRelativePosition == position) return; - + double front = getTabFrontEdge(); switch (position) { case FRONT: @@ -369,8 +378,8 @@ public abstract class FinSet extends ExternalComponent { } - - + + /////////// Calculation methods /////////// /** @@ -401,7 +410,7 @@ public abstract class FinSet extends ExternalComponent { } - + @Override public double getComponentVolume() { return fins * (getFinArea() + tabHeight * tabLength) * thickness * @@ -594,7 +603,7 @@ public abstract class FinSet extends ExternalComponent { } - + @Override public void componentChanged(ComponentChangeEvent e) { if (e.isAerodynamicChange()) { @@ -641,8 +650,8 @@ public abstract class FinSet extends ExternalComponent { } - - + + /** * Return a list of coordinates defining the geometry of a single fin. * The coordinates are the XY-coordinates of points defining the shape of a single fin, @@ -686,12 +695,12 @@ public abstract class FinSet extends ExternalComponent { points[n++] = new Coordinate(x1, y); if (add1) points[n++] = new Coordinate(x1, 0); - + return points; } - + /** * Get the span of a single fin. That is, the length from the root to the tip of the fin. * @return Span of a single fin. @@ -717,4 +726,38 @@ public abstract class FinSet extends ExternalComponent { return super.copyFrom(c); } + + /* + * Handle fin fillet mass properties + */ + + public Material getFilletMaterial() { + return filletMaterial; + } + + public void setFilletMaterial(Material mat) { + if (mat.getType() != Material.Type.BULK) { + throw new IllegalArgumentException("ExternalComponent requires a bulk material" + + " type=" + mat.getType()); + } + + if (filletMaterial.equals(mat)) + return; + filletMaterial = mat; + clearPreset(); + fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); + } + + public double getFilletRadius() { + return filletRadius; + } + + public void setFilletRadius(double r) { + if (MathUtil.equals(filletRadius, r)) + return; + filletRadius = r; + clearPreset(); + fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); + } + } diff --git a/swing/src/net/sf/openrocket/gui/adaptors/MaterialModel.java b/swing/src/net/sf/openrocket/gui/adaptors/MaterialModel.java index b0b83dbc5..f4f6ba95f 100644 --- a/swing/src/net/sf/openrocket/gui/adaptors/MaterialModel.java +++ b/swing/src/net/sf/openrocket/gui/adaptors/MaterialModel.java @@ -25,9 +25,9 @@ public class MaterialModel extends AbstractListModel implements private final String custom; - private final Component parentComponent; + private final Component parentUIComponent; - private final RocketComponent component; + private final RocketComponent rocketComponent; private final Material.Type type; private final Database database; @@ -44,8 +44,8 @@ public class MaterialModel extends AbstractListModel implements public MaterialModel(Component parent, RocketComponent component, Material.Type type, String name) { - this.parentComponent = parent; - this.component = component; + this.parentUIComponent = parent; + this.rocketComponent = component; this.type = type; this.custom = trans.get ("Material.CUSTOM"); @@ -81,7 +81,7 @@ public class MaterialModel extends AbstractListModel implements @Override public Object getSelectedItem() { - return getMethod.invoke(component); + return getMethod.invoke(rocketComponent); } @Override @@ -98,7 +98,7 @@ public class MaterialModel extends AbstractListModel implements @Override public void run() { CustomMaterialDialog dialog = new CustomMaterialDialog( - SwingUtilities.getWindowAncestor(parentComponent), + SwingUtilities.getWindowAncestor(parentUIComponent), (Material) getSelectedItem(), true, //// Define custom material trans.get("MaterialModel.title.Defcustmat")); @@ -109,7 +109,7 @@ public class MaterialModel extends AbstractListModel implements return; Material material = dialog.getMaterial(); - setMethod.invoke(component, material); + setMethod.invoke(rocketComponent, material); if (dialog.isAddSelected()) { database.add(material); @@ -119,7 +119,7 @@ public class MaterialModel extends AbstractListModel implements } else if (item instanceof Material) { - setMethod.invoke(component, item); + setMethod.invoke(rocketComponent, item); } else { throw new IllegalArgumentException("Illegal item class " + item.getClass() + diff --git a/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java index e490c23a0..51bf75e93 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java @@ -98,7 +98,7 @@ public class BodyTubeConfig extends RocketComponentConfig { panel.add(check, "skip, span 2, wrap"); //// Material - panel.add(materialPanel(new JPanel(new MigLayout()), Material.Type.BULK), + panel.add(materialPanel(Material.Type.BULK), "cell 4 0, gapleft paragraph, aligny 0%, spany"); //// General and General properties diff --git a/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java index 7f9857253..509ba867e 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java @@ -170,9 +170,10 @@ public class EllipticalFinSetConfig extends FinSetConfig { //// Material - materialPanel(panel, Material.Type.BULK); - + panel.add(materialPanel(Material.Type.BULK), "span, wrap"); + panel.add(filletMaterialPanel(), "span, wrap"); + diff --git a/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java index a68824d67..91a1a751f 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/FinSetConfig.java @@ -1,16 +1,34 @@ package net.sf.openrocket.gui.configdialog; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.SwingUtilities; + import net.miginfocom.swing.MigLayout; import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.gui.SpinnerEditor; import net.sf.openrocket.gui.adaptors.DoubleModel; import net.sf.openrocket.gui.adaptors.EnumModel; +import net.sf.openrocket.gui.adaptors.MaterialModel; import net.sf.openrocket.gui.components.BasicSlider; import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel.Style; import net.sf.openrocket.gui.components.UnitSelector; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.Markers; +import net.sf.openrocket.material.Material; import net.sf.openrocket.rocketcomponent.CenteringRing; import net.sf.openrocket.rocketcomponent.Coaxial; import net.sf.openrocket.rocketcomponent.FinSet; @@ -20,19 +38,9 @@ import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; -import javax.swing.*; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - public abstract class FinSetConfig extends RocketComponentConfig { private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class); @@ -469,4 +477,40 @@ public abstract class FinSetConfig extends RocketComponentConfig { return positionFromTop; } } + + protected JPanel filletMaterialPanel(){ + + JPanel filletPanel=new JPanel(new MigLayout("", "[][65lp::][30lp::]")); + String tip = trans.get("FinsetCfg.ttip.Finfillets1") + + trans.get("FinsetCfg.ttip.Finfillets2") + + trans.get("FinsetCfg.ttip.Finfillets3"); + filletPanel.setBorder(BorderFactory.createTitledBorder("Root Fillets")); + filletPanel.add(new JLabel(trans.get("FinSetCfg.lbl.Filletradius"))); + + DoubleModel m = new DoubleModel(component, "FilletRadius", UnitGroup.UNITS_LENGTH, 0); + + JSpinner spin = new JSpinner(m.getSpinnerModel()); + spin.setEditor(new SpinnerEditor(spin)); + spin.setToolTipText(tip); + filletPanel.add(spin, "growx, w 40"); + UnitSelector us = new UnitSelector(m); + filletPanel.add(us, "growx"); + us.setToolTipText(tip); + BasicSlider bs =new BasicSlider(m.getSliderModel(0, 10)); + filletPanel.add(bs, "w 100lp, wrap para"); + bs.setToolTipText(tip); + + JLabel label = new JLabel(trans.get("FinSetCfg.lbl.Finfilletmaterial")); + label.setToolTipText(tip); + //// The component material affects the weight of the component. + label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects")); + filletPanel.add(label, "spanx 4, wrap rel"); + + JComboBox combo = new JComboBox(new MaterialModel(filletPanel, component, Material.Type.BULK, "FilletMaterial")); + //// The component material affects the weight of the component. + combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects")); + filletPanel.add(combo, "spanx 4, growx, wrap paragraph"); + filletPanel.setToolTipText(tip); + return filletPanel; + } } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java index 348ac4f82..1fd28b2ff 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java @@ -24,9 +24,6 @@ import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.table.AbstractTableModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import net.miginfocom.swing.MigLayout; import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.gui.SpinnerEditor; @@ -55,6 +52,9 @@ import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.util.Coordinate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class FreeformFinSetConfig extends FinSetConfig { private static final Logger log = LoggerFactory.getLogger(FreeformFinSetConfig.class); @@ -187,9 +187,10 @@ public class FreeformFinSetConfig extends FinSetConfig { //// Material - materialPanel(panel, Material.Type.BULK); - + panel.add(materialPanel(Material.Type.BULK), "span, wrap"); + panel.add(filletMaterialPanel(), "span, wrap"); + mainPanel.add(panel, "aligny 20%"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java index 338feb38c..614785ef4 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java @@ -168,7 +168,7 @@ public class InnerTubeConfig extends RocketComponentConfig { "w 100lp, wrap"); //// Material - panel.add(materialPanel(new JPanel(new MigLayout()), Material.Type.BULK), + panel.add(materialPanel(Material.Type.BULK), "cell 4 0, gapleft paragraph, aligny 0%, spany"); tabbedPane.insertTab(trans.get("ThicknessRingCompCfg.tab.General"), null, panel, diff --git a/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java index 6f6ff0a32..3f482f2f4 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java @@ -140,7 +140,7 @@ public class LaunchLugConfig extends RocketComponentConfig { //// Material - materialPanel(panel, Material.Type.BULK); + panel.add(materialPanel( Material.Type.BULK), "span, wrap"); primary.add(panel, "grow"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java index e27ee6189..e57fdd900 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java @@ -155,7 +155,7 @@ public class NoseConeConfig extends RocketComponentConfig { //// Material - materialPanel(panel2, Material.Type.BULK); + panel2.add(materialPanel( Material.Type.BULK), "span, wrap"); panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java index 10b6e8483..df5267405 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java @@ -152,7 +152,7 @@ public class RingComponentConfig extends RocketComponentConfig { //// Material - JPanel sub = materialPanel(new JPanel(new MigLayout()), Material.Type.BULK); + JPanel sub = materialPanel( Material.Type.BULK); if (component instanceof EngineBlock) { final DescriptionArea desc = new DescriptionArea(6); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java index dea61a680..30142f4cc 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java @@ -196,24 +196,34 @@ public class RocketComponentConfig extends JPanel { } - protected JPanel materialPanel(JPanel panel, Material.Type type) { + protected JPanel materialPanel(Material.Type type) { ////Component material: and Component finish: - return materialPanel(panel, type, trans.get("RocketCompCfg.lbl.Componentmaterial"), - trans.get("RocketCompCfg.lbl.Componentfinish")); + return materialPanel(type, + trans.get("RocketCompCfg.lbl.Componentmaterial"), + trans.get("RocketCompCfg.lbl.Componentfinish"), + "Material"); } - protected JPanel materialPanel(JPanel panel, Material.Type type, - String materialString, String finishString) { + protected JPanel materialPanel(Material.Type type, String partName){ + return materialPanel(type, trans.get("RocketCompCfg.lbl.Componentmaterial"), + trans.get("RocketCompCfg.lbl.Componentfinish"), partName); + } + + protected JPanel materialPanel(Material.Type type, + String materialString, + String finishString, + String partName) { - JLabel label = new JLabel(materialString); + JPanel subPanel = new JPanel(new MigLayout()); + JLabel label = new JLabel(materialString); //// The component material affects the weight of the component. label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects")); - panel.add(label, "spanx 4, wrap rel"); + subPanel.add(label, "spanx 4, wrap rel"); - JComboBox combo = new JComboBox(new MaterialModel(panel, component, type)); + JComboBox combo = new JComboBox(new MaterialModel(subPanel, component, type, partName)); //// The component material affects the weight of the component. combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects")); - panel.add(combo, "spanx 4, growx, wrap paragraph"); + subPanel.add(combo, "spanx 4, growx, wrap paragraph"); if (component instanceof ExternalComponent) { @@ -223,11 +233,11 @@ public class RocketComponentConfig extends JPanel { //// The value indicated is the average roughness height of the surface. + trans.get("RocketCompCfg.lbl.longA2"); label.setToolTipText(tip); - panel.add(label, "spanx 4, wmin 220lp, wrap rel"); + subPanel.add(label, "spanx 4, wmin 220lp, wrap rel"); combo = new JComboBox(new EnumModel(component, "Finish")); combo.setToolTipText(tip); - panel.add(combo, "spanx 4, growx, split"); + subPanel.add(combo, "spanx 4, growx, split"); //// Set for all JButton button = new JButton(trans.get("RocketCompCfg.but.Setforall")); @@ -253,10 +263,9 @@ public class RocketComponentConfig extends JPanel { } } }); - panel.add(button, "wrap paragraph"); + subPanel.add(button, "wrap paragraph"); } - - return panel; + return subPanel; } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java index e199c41dc..3fc5d6841 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java @@ -49,7 +49,7 @@ public class ShockCordConfig extends RocketComponentConfig { // Material //// Shock cord material: - materialPanel(panel, Material.Type.LINE, trans.get("ShockCordCfg.lbl.Shockcordmaterial"), null); + panel.add(materialPanel(Material.Type.LINE, trans.get("ShockCordCfg.lbl.Shockcordmaterial"), null, "Material"), "span, wrap"); diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java index 5e0286d89..882364722 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java @@ -185,7 +185,7 @@ public class TransitionConfig extends RocketComponentConfig { //// Material - materialPanel(panel2, Material.Type.BULK); + panel2.add(materialPanel(Material.Type.BULK), "span, wrap"); panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany"); //// General and General properties diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java index 7c343fbf2..a3611299b 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java @@ -163,6 +163,34 @@ public class TrapezoidFinSetConfig extends FinSetConfig { "w 100lp, wrap paragraph"); + //// Position + //// Position relative to: + panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.Posrelativeto"))); + + combo = new JComboBox( + new EnumModel(component, "RelativePosition", + new RocketComponent.Position[] { + RocketComponent.Position.TOP, + RocketComponent.Position.MIDDLE, + RocketComponent.Position.BOTTOM, + RocketComponent.Position.ABSOLUTE + })); + panel.add(combo, "spanx, growx, wrap"); + //// plus + panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.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(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 para"); + + @@ -196,43 +224,15 @@ public class TrapezoidFinSetConfig extends FinSetConfig { panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "w 100lp, wrap para"); - //// Position - //// Position relative to: - panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.Posrelativeto"))); - - combo = new JComboBox( - new EnumModel(component, "RelativePosition", - new RocketComponent.Position[] { - RocketComponent.Position.TOP, - RocketComponent.Position.MIDDLE, - RocketComponent.Position.BOTTOM, - RocketComponent.Position.ABSOLUTE - })); - panel.add(combo, "spanx, growx, wrap"); - //// plus - panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.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(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 para"); - - //// Material - materialPanel(panel, Material.Type.BULK); - + panel.add(materialPanel(Material.Type.BULK), "span, wrap"); mainPanel.add(panel, "aligny 20%"); + panel.add(filletMaterialPanel(), "span, wrap"); //// General and General properties tabbedPane.insertTab(trans.get("TrapezoidFinSetCfg.tab.General"), null, mainPanel, trans.get("TrapezoidFinSetCfg.tab.Generalproperties"), 0);