Fin fillet UI complete, radius and material are saved to file and reloaded.
This commit is contained in:
		
							parent
							
								
									90480faa24
								
							
						
					
					
						commit
						bc28fc58c5
					
				| @ -1097,6 +1097,13 @@ TrapezoidFinSetCfg.lbl.plus = plus | |||||||
| TrapezoidFinSetCfg.tab.General = General | TrapezoidFinSetCfg.tab.General = General | ||||||
| TrapezoidFinSetCfg.tab.Generalproperties = General properties | TrapezoidFinSetCfg.tab.Generalproperties = General properties | ||||||
| 
 | 
 | ||||||
|  | ! Fin Fillets | ||||||
|  | FinSetCfg.lbl.Finfilletmaterial = Fillet material: | ||||||
|  | FinSetCfg.lbl.Filletradius = Fillet radius: | ||||||
|  | FinsetCfg.ttip.Finfillets1 = <HTML>Adds the predicted mass of fin fillets to the root of the fins.<br> | ||||||
|  | FinsetCfg.ttip.Finfillets2 = Assumes the fillet is concave and tangent to the body tube and fin.<br> | ||||||
|  | FinsetCfg.ttip.Finfillets3 = Zero radius will give no fillet.   | ||||||
|  | 
 | ||||||
| ! StorageOptionChooser | ! StorageOptionChooser | ||||||
| StorageOptChooser.lbl.Simdatatostore = Simulated data to store: | StorageOptChooser.lbl.Simdatatostore = Simulated data to store: | ||||||
| StorageOptChooser.rdbut.Allsimdata = All simulated data | StorageOptChooser.rdbut.Allsimdata = All simulated data | ||||||
|  | |||||||
| @ -207,7 +207,11 @@ class DocumentConfig { | |||||||
| 		setters.put("FinSet:tablength", new DoubleSetter( | 		setters.put("FinSet:tablength", new DoubleSetter( | ||||||
| 				Reflection.findMethod(FinSet.class, "setTabLength", double.class))); | 				Reflection.findMethod(FinSet.class, "setTabLength", double.class))); | ||||||
| 		setters.put("FinSet:tabposition", new FinTabPositionSetter()); | 		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 | 		// TrapezoidFinSet | ||||||
| 		setters.put("TrapezoidFinSet:rootchord", new DoubleSetter( | 		setters.put("TrapezoidFinSet:rootchord", new DoubleSetter( | ||||||
| 				Reflection.findMethod(TrapezoidFinSet.class, "setRootChord", double.class))); | 				Reflection.findMethod(TrapezoidFinSet.class, "setRootChord", double.class))); | ||||||
|  | |||||||
| @ -30,6 +30,9 @@ public class FinSetSaver extends ExternalComponentSaver { | |||||||
| 					fins.getTabShift() + "</tabposition>"); | 					fins.getTabShift() + "</tabposition>"); | ||||||
| 			 | 			 | ||||||
| 		} | 		} | ||||||
|  | 		 | ||||||
|  | 		elements.add("<filletradius>" + fins.getFilletRadius() + "</filletradius>"); | ||||||
|  | 		elements.add(materialParam("filletmaterial", fins.getFilletMaterial())); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| } | } | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import java.util.Collection; | |||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| import net.sf.openrocket.l10n.Translator; | import net.sf.openrocket.l10n.Translator; | ||||||
|  | import net.sf.openrocket.material.Material; | ||||||
| import net.sf.openrocket.startup.Application; | import net.sf.openrocket.startup.Application; | ||||||
| import net.sf.openrocket.util.ArrayUtils; | import net.sf.openrocket.util.ArrayUtils; | ||||||
| import net.sf.openrocket.util.Coordinate; | import net.sf.openrocket.util.Coordinate; | ||||||
| @ -15,6 +16,7 @@ import net.sf.openrocket.util.Transformation; | |||||||
| public abstract class FinSet extends ExternalComponent { | public abstract class FinSet extends ExternalComponent { | ||||||
| 	private static final Translator trans = Application.getTranslator(); | 	private static final Translator trans = Application.getTranslator(); | ||||||
| 	 | 	 | ||||||
|  | 	 | ||||||
| 	/** | 	/** | ||||||
| 	 * Maximum allowed cant of fins. | 	 * Maximum allowed cant of fins. | ||||||
| 	 */ | 	 */ | ||||||
| @ -117,6 +119,12 @@ public abstract class FinSet extends ExternalComponent { | |||||||
| 	private double tabShift = 0; | 	private double tabShift = 0; | ||||||
| 	private TabRelativePosition tabRelativePosition = TabRelativePosition.CENTER; | 	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! | 	// Cached fin area & CG.  Validity of both must be checked using finArea! | ||||||
| 	// Fin area does not include fin tabs, CG does. | 	// Fin area does not include fin tabs, CG does. | ||||||
| @ -132,6 +140,7 @@ public abstract class FinSet extends ExternalComponent { | |||||||
| 	 */ | 	 */ | ||||||
| 	public FinSet() { | 	public FinSet() { | ||||||
| 		super(RocketComponent.Position.BOTTOM); | 		super(RocketComponent.Position.BOTTOM); | ||||||
|  | 		this.filletMaterial = Application.getPreferences().getDefaultComponentMaterial(this.getClass(), Material.Type.BULK); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| @ -717,4 +726,38 @@ public abstract class FinSet extends ExternalComponent { | |||||||
| 		 | 		 | ||||||
| 		return super.copyFrom(c); | 		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); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| } | } | ||||||
|  | |||||||
| @ -25,9 +25,9 @@ public class MaterialModel extends AbstractListModel implements | |||||||
| 	private final String custom; | 	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 Material.Type type; | ||||||
| 	private final Database<Material> database; | 	private final Database<Material> database; | ||||||
| 	 | 	 | ||||||
| @ -44,8 +44,8 @@ public class MaterialModel extends AbstractListModel implements | |||||||
| 
 | 
 | ||||||
| 	public MaterialModel(Component parent, RocketComponent component, Material.Type type,  | 	public MaterialModel(Component parent, RocketComponent component, Material.Type type,  | ||||||
| 			String name) { | 			String name) { | ||||||
| 		this.parentComponent = parent; | 		this.parentUIComponent = parent; | ||||||
| 		this.component = component; | 		this.rocketComponent = component; | ||||||
| 		this.type = type; | 		this.type = type; | ||||||
| 		this.custom = trans.get ("Material.CUSTOM"); | 		this.custom = trans.get ("Material.CUSTOM"); | ||||||
| 		 | 		 | ||||||
| @ -81,7 +81,7 @@ public class MaterialModel extends AbstractListModel implements | |||||||
| 	 | 	 | ||||||
| 	@Override | 	@Override | ||||||
| 	public Object getSelectedItem() { | 	public Object getSelectedItem() { | ||||||
| 		return getMethod.invoke(component); | 		return getMethod.invoke(rocketComponent); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| @ -98,7 +98,7 @@ public class MaterialModel extends AbstractListModel implements | |||||||
| 				@Override | 				@Override | ||||||
| 				public void run() { | 				public void run() { | ||||||
| 					CustomMaterialDialog dialog = new CustomMaterialDialog( | 					CustomMaterialDialog dialog = new CustomMaterialDialog( | ||||||
| 							SwingUtilities.getWindowAncestor(parentComponent),  | 							SwingUtilities.getWindowAncestor(parentUIComponent),  | ||||||
| 							(Material) getSelectedItem(), true, | 							(Material) getSelectedItem(), true, | ||||||
| 							//// Define custom material | 							//// Define custom material | ||||||
| 							trans.get("MaterialModel.title.Defcustmat")); | 							trans.get("MaterialModel.title.Defcustmat")); | ||||||
| @ -109,7 +109,7 @@ public class MaterialModel extends AbstractListModel implements | |||||||
| 						return; | 						return; | ||||||
| 					 | 					 | ||||||
| 					Material material = dialog.getMaterial(); | 					Material material = dialog.getMaterial(); | ||||||
| 					setMethod.invoke(component, material); | 					setMethod.invoke(rocketComponent, material); | ||||||
| 					 | 					 | ||||||
| 					if (dialog.isAddSelected()) { | 					if (dialog.isAddSelected()) { | ||||||
| 						database.add(material); | 						database.add(material); | ||||||
| @ -119,7 +119,7 @@ public class MaterialModel extends AbstractListModel implements | |||||||
| 			 | 			 | ||||||
| 		} else if (item instanceof Material) { | 		} else if (item instanceof Material) { | ||||||
| 			 | 			 | ||||||
| 			setMethod.invoke(component, item); | 			setMethod.invoke(rocketComponent, item); | ||||||
| 			 | 			 | ||||||
| 		} else { | 		} else { | ||||||
| 			throw new IllegalArgumentException("Illegal item class " + item.getClass() +  | 			throw new IllegalArgumentException("Illegal item class " + item.getClass() +  | ||||||
|  | |||||||
| @ -98,7 +98,7 @@ public class BodyTubeConfig extends RocketComponentConfig { | |||||||
| 		panel.add(check, "skip, span 2, wrap"); | 		panel.add(check, "skip, span 2, wrap"); | ||||||
| 
 | 
 | ||||||
| 		//// Material | 		//// 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"); | 				"cell 4 0, gapleft paragraph, aligny 0%, spany"); | ||||||
| 
 | 
 | ||||||
| 		//// General and General properties | 		//// General and General properties | ||||||
|  | |||||||
| @ -170,8 +170,9 @@ public class EllipticalFinSetConfig extends FinSetConfig { | |||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		//// Material | 		//// Material | ||||||
| 		materialPanel(panel, Material.Type.BULK); | 		panel.add(materialPanel(Material.Type.BULK), "span, wrap"); | ||||||
| 		 | 		 | ||||||
|  | 		panel.add(filletMaterialPanel(), "span, wrap"); | ||||||
| 	 | 	 | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
|  | |||||||
| @ -1,16 +1,34 @@ | |||||||
| package net.sf.openrocket.gui.configdialog; | 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.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.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.components.BasicSlider; | import net.sf.openrocket.gui.components.BasicSlider; | ||||||
| import net.sf.openrocket.gui.components.StyledLabel; | import net.sf.openrocket.gui.components.StyledLabel; | ||||||
| import net.sf.openrocket.gui.components.StyledLabel.Style; | import net.sf.openrocket.gui.components.StyledLabel.Style; | ||||||
| import net.sf.openrocket.gui.components.UnitSelector; | import net.sf.openrocket.gui.components.UnitSelector; | ||||||
| import net.sf.openrocket.l10n.Translator; | import net.sf.openrocket.l10n.Translator; | ||||||
| import net.sf.openrocket.logging.Markers; | import net.sf.openrocket.logging.Markers; | ||||||
|  | import net.sf.openrocket.material.Material; | ||||||
| import net.sf.openrocket.rocketcomponent.CenteringRing; | import net.sf.openrocket.rocketcomponent.CenteringRing; | ||||||
| import net.sf.openrocket.rocketcomponent.Coaxial; | import net.sf.openrocket.rocketcomponent.Coaxial; | ||||||
| import net.sf.openrocket.rocketcomponent.FinSet; | 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.startup.Application; | ||||||
| import net.sf.openrocket.unit.UnitGroup; | import net.sf.openrocket.unit.UnitGroup; | ||||||
| 
 | 
 | ||||||
| import javax.swing.*; |  | ||||||
| 
 |  | ||||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||||
| import org.slf4j.LoggerFactory; | 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 { | public abstract class FinSetConfig extends RocketComponentConfig { | ||||||
| 	private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class); | 	private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class); | ||||||
| @ -469,4 +477,40 @@ public abstract class FinSetConfig extends RocketComponentConfig { | |||||||
| 			return positionFromTop; | 			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; | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -24,9 +24,6 @@ import javax.swing.SwingConstants; | |||||||
| import javax.swing.SwingUtilities; | import javax.swing.SwingUtilities; | ||||||
| import javax.swing.table.AbstractTableModel; | import javax.swing.table.AbstractTableModel; | ||||||
| 
 | 
 | ||||||
| import org.slf4j.Logger; |  | ||||||
| import org.slf4j.LoggerFactory; |  | ||||||
| 
 |  | ||||||
| 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; | ||||||
| @ -55,6 +52,9 @@ import net.sf.openrocket.startup.Application; | |||||||
| import net.sf.openrocket.unit.UnitGroup; | import net.sf.openrocket.unit.UnitGroup; | ||||||
| import net.sf.openrocket.util.Coordinate; | import net.sf.openrocket.util.Coordinate; | ||||||
| 
 | 
 | ||||||
|  | import org.slf4j.Logger; | ||||||
|  | import org.slf4j.LoggerFactory; | ||||||
|  | 
 | ||||||
| public class FreeformFinSetConfig extends FinSetConfig { | public class FreeformFinSetConfig extends FinSetConfig { | ||||||
| 	 | 	 | ||||||
| 	private static final Logger log = LoggerFactory.getLogger(FreeformFinSetConfig.class); | 	private static final Logger log = LoggerFactory.getLogger(FreeformFinSetConfig.class); | ||||||
| @ -187,8 +187,9 @@ public class FreeformFinSetConfig extends FinSetConfig { | |||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		//// Material | 		//// Material | ||||||
| 		materialPanel(panel, Material.Type.BULK); | 		panel.add(materialPanel(Material.Type.BULK), "span, wrap"); | ||||||
| 		 | 		 | ||||||
|  | 		panel.add(filletMaterialPanel(), "span, wrap"); | ||||||
| 
 | 
 | ||||||
| 		 | 		 | ||||||
| 		mainPanel.add(panel, "aligny 20%"); | 		mainPanel.add(panel, "aligny 20%"); | ||||||
|  | |||||||
| @ -168,7 +168,7 @@ public class InnerTubeConfig extends RocketComponentConfig { | |||||||
| 				"w 100lp, wrap"); | 				"w 100lp, wrap"); | ||||||
| 
 | 
 | ||||||
| 		//// Material | 		//// 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"); | 				"cell 4 0, gapleft paragraph, aligny 0%, spany"); | ||||||
| 
 | 
 | ||||||
| 		tabbedPane.insertTab(trans.get("ThicknessRingCompCfg.tab.General"), null, panel, | 		tabbedPane.insertTab(trans.get("ThicknessRingCompCfg.tab.General"), null, panel, | ||||||
|  | |||||||
| @ -140,7 +140,7 @@ public class LaunchLugConfig extends RocketComponentConfig { | |||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		//// Material | 		//// Material | ||||||
| 		materialPanel(panel, Material.Type.BULK); | 		panel.add(materialPanel( Material.Type.BULK), "span, wrap"); | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		primary.add(panel, "grow"); | 		primary.add(panel, "grow"); | ||||||
|  | |||||||
| @ -155,7 +155,7 @@ public class NoseConeConfig extends RocketComponentConfig { | |||||||
| 		//// Material | 		//// 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"); | 		panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany"); | ||||||
| 		 | 		 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -152,7 +152,7 @@ public class RingComponentConfig extends RocketComponentConfig { | |||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		//// Material | 		//// Material | ||||||
| 		JPanel sub = materialPanel(new JPanel(new MigLayout()), Material.Type.BULK); | 		JPanel sub = materialPanel( Material.Type.BULK); | ||||||
| 		 | 		 | ||||||
| 		if (component instanceof EngineBlock) { | 		if (component instanceof EngineBlock) { | ||||||
| 			final DescriptionArea desc = new DescriptionArea(6); | 			final DescriptionArea desc = new DescriptionArea(6); | ||||||
|  | |||||||
| @ -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: | 		////Component material: and Component finish: | ||||||
| 		return materialPanel(panel, type, trans.get("RocketCompCfg.lbl.Componentmaterial"), | 		return materialPanel(type,  | ||||||
| 				trans.get("RocketCompCfg.lbl.Componentfinish")); | 				trans.get("RocketCompCfg.lbl.Componentmaterial"), | ||||||
|  | 				trans.get("RocketCompCfg.lbl.Componentfinish"),  | ||||||
|  | 				"Material"); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	protected JPanel materialPanel(JPanel panel, Material.Type type, | 	protected JPanel materialPanel(Material.Type type, String partName){ | ||||||
| 			String materialString, String finishString) { | 		return materialPanel(type, trans.get("RocketCompCfg.lbl.Componentmaterial"), | ||||||
|  | 			trans.get("RocketCompCfg.lbl.Componentfinish"), partName); | ||||||
|  | 	    	} | ||||||
| 	 | 	 | ||||||
| 		JLabel label = new JLabel(materialString); | 	protected JPanel materialPanel(Material.Type type, | ||||||
|  | 					String materialString,  | ||||||
|  | 					String finishString,  | ||||||
|  | 					String partName) { | ||||||
|  | 		 | ||||||
|  | 	    JPanel subPanel = new JPanel(new MigLayout()); | ||||||
|  | 	    	JLabel label = new JLabel(materialString); | ||||||
| 		//// The component material affects the weight of the component. | 		//// The component material affects the weight of the component. | ||||||
| 		label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects")); | 		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. | 		//// The component material affects the weight of the component. | ||||||
| 		combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects")); | 		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) { | 		if (component instanceof ExternalComponent) { | ||||||
| @ -223,11 +233,11 @@ public class RocketComponentConfig extends JPanel { | |||||||
| 					//// The value indicated is the average roughness height of the surface. | 					//// The value indicated is the average roughness height of the surface. | ||||||
| 					+ trans.get("RocketCompCfg.lbl.longA2"); | 					+ trans.get("RocketCompCfg.lbl.longA2"); | ||||||
| 			label.setToolTipText(tip); | 			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<ExternalComponent.Finish>(component, "Finish")); | 			combo = new JComboBox(new EnumModel<ExternalComponent.Finish>(component, "Finish")); | ||||||
| 			combo.setToolTipText(tip); | 			combo.setToolTipText(tip); | ||||||
| 			panel.add(combo, "spanx 4, growx, split"); | 			subPanel.add(combo, "spanx 4, growx, split"); | ||||||
| 			 | 			 | ||||||
| 			//// Set for all | 			//// Set for all | ||||||
| 			JButton button = new JButton(trans.get("RocketCompCfg.but.Setforall")); | 			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 subPanel; | ||||||
| 		return panel; |  | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ public class ShockCordConfig extends RocketComponentConfig { | |||||||
| 
 | 
 | ||||||
| 		// Material | 		// Material | ||||||
| 		//// Shock cord 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"); | ||||||
| 		 | 		 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -185,7 +185,7 @@ public class TransitionConfig extends RocketComponentConfig { | |||||||
| 		//// Material | 		//// 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"); | 		panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany"); | ||||||
| 		 | 		 | ||||||
| 		//// General and General properties | 		//// General and General properties | ||||||
|  | |||||||
| @ -163,6 +163,34 @@ public class TrapezoidFinSetConfig extends FinSetConfig { | |||||||
| 				"w 100lp, wrap paragraph"); | 				"w 100lp, wrap paragraph"); | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
|  | 		////  Position | ||||||
|  | 		//// Position relative to: | ||||||
|  | 		panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.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 | ||||||
|  | 						})); | ||||||
|  | 		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"); | 		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<RocketComponent.Position>(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 | 		//// Material | ||||||
| 		materialPanel(panel, Material.Type.BULK); | 		panel.add(materialPanel(Material.Type.BULK), "span, wrap"); | ||||||
| 		 |  | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		mainPanel.add(panel, "aligny 20%"); | 		mainPanel.add(panel, "aligny 20%"); | ||||||
| 		 | 		 | ||||||
|  | 		panel.add(filletMaterialPanel(), "span, wrap"); | ||||||
| 		//// General and General properties | 		//// General and General properties | ||||||
| 		tabbedPane.insertTab(trans.get("TrapezoidFinSetCfg.tab.General"), null, mainPanel, | 		tabbedPane.insertTab(trans.get("TrapezoidFinSetCfg.tab.General"), null, mainPanel, | ||||||
| 				trans.get("TrapezoidFinSetCfg.tab.Generalproperties"), 0); | 				trans.get("TrapezoidFinSetCfg.tab.Generalproperties"), 0); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user