Add traversal policy for streamer config
This commit is contained in:
		
							parent
							
								
									3171809ae4
								
							
						
					
					
						commit
						dfdb214cc8
					
				@ -15,6 +15,7 @@ import javax.swing.JSpinner;
 | 
			
		||||
import net.miginfocom.swing.MigLayout;
 | 
			
		||||
import net.sf.openrocket.document.OpenRocketDocument;
 | 
			
		||||
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.EnumModel;
 | 
			
		||||
import net.sf.openrocket.gui.adaptors.MaterialModel;
 | 
			
		||||
@ -57,6 +58,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		JSpinner spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(0, 0.6, 1.5)), "w 100lp, wrap");
 | 
			
		||||
		
 | 
			
		||||
@ -68,6 +70,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(0, 0.2)), "w 100lp, wrap 10lp");
 | 
			
		||||
 | 
			
		||||
@ -79,6 +82,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(0, 0.04, 0.25)), "w 100lp, wrap");
 | 
			
		||||
		
 | 
			
		||||
@ -90,6 +94,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		//		panel.add(new UnitSelector(m),"growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(2, 15)), "skip, w 100lp, wrap 10lp");
 | 
			
		||||
 | 
			
		||||
@ -101,6 +106,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		//// The component material affects the weight of the component.
 | 
			
		||||
		streamerMaterialCombo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel"));
 | 
			
		||||
		panel.add(streamerMaterialCombo, "spanx 3, growx, wrap 15lp");
 | 
			
		||||
		order.add(streamerMaterialCombo);
 | 
			
		||||
 | 
			
		||||
		// CD
 | 
			
		||||
		//// <html>Drag coefficient C<sub>D</sub>:
 | 
			
		||||
@ -118,11 +124,13 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin.setToolTipText(tip);
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		JCheckBox check = new JCheckBox(m.getAutomaticAction());
 | 
			
		||||
		//// Automatic
 | 
			
		||||
		check.setText(trans.get("StreamerCfg.lbl.Automatic"));
 | 
			
		||||
		panel.add(check, "skip, span, wrap");
 | 
			
		||||
		order.add(check);
 | 
			
		||||
		
 | 
			
		||||
		//// The drag coefficient is relative to the area of the streamer.
 | 
			
		||||
		panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.longC1"),
 | 
			
		||||
@ -142,6 +150,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		final EnumModel<AxialMethod> methodModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
 | 
			
		||||
		final JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( methodModel );
 | 
			
		||||
		panel.add( positionCombo, "spanx, growx, wrap");
 | 
			
		||||
		order.add(positionCombo);
 | 
			
		||||
		
 | 
			
		||||
		//// plus
 | 
			
		||||
		panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")), "right");
 | 
			
		||||
@ -151,6 +160,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		focusElement = spin;
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(
 | 
			
		||||
@ -167,6 +177,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)), "w 100lp, wrap");
 | 
			
		||||
@ -182,6 +193,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(od.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(od), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
 | 
			
		||||
@ -190,6 +202,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		JCheckBox checkAutoPackedRadius = new JCheckBox(od.getAutomaticAction());
 | 
			
		||||
		checkAutoPackedRadius.setText(trans.get("TransitionCfg.checkbox.Automatic"));
 | 
			
		||||
		panel.add(checkAutoPackedRadius, "skip, span 2, wrap 5lp");
 | 
			
		||||
		order.add(checkAutoPackedRadius);
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		//// Deployment
 | 
			
		||||
@ -205,6 +218,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
			eventCombo.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
 | 
			
		||||
		}
 | 
			
		||||
		panel.add( eventCombo, "spanx 3, growx, wrap");
 | 
			
		||||
		order.add(eventCombo);
 | 
			
		||||
		
 | 
			
		||||
		// ... and delay
 | 
			
		||||
		//// plus
 | 
			
		||||
@ -214,6 +228,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin, 3));
 | 
			
		||||
		panel.add(spin, "spanx, split");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		//// seconds
 | 
			
		||||
		panel.add(new JLabel(trans.get("StreamerCfg.lbl.seconds")), "wrap paragraph");
 | 
			
		||||
@ -229,6 +244,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		altitudeComponents.add(spin);
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		UnitSelector unit = new UnitSelector(m);
 | 
			
		||||
		altitudeComponents.add(unit);
 | 
			
		||||
		panel.add(unit, "growx");
 | 
			
		||||
@ -249,6 +265,11 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		tabbedPane.insertTab(trans.get("StreamerCfg.tab.Radialpos"), null, positionTab(),
 | 
			
		||||
				trans.get("StreamerCfg.tab.ttip.Radialpos"), 1);
 | 
			
		||||
		tabbedPane.setSelectedIndex(0);
 | 
			
		||||
 | 
			
		||||
		// Apply the custom focus travel policy to this config dialog
 | 
			
		||||
		CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order);
 | 
			
		||||
		parent.setFocusTraversalPolicy(policy);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
@ -267,6 +288,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		JSpinner spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)), "w 100lp, wrap");
 | 
			
		||||
@ -279,6 +301,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
		spin = new JSpinner(m.getSpinnerModel());
 | 
			
		||||
		spin.setEditor(new SpinnerEditor(spin));
 | 
			
		||||
		panel.add(spin, "growx");
 | 
			
		||||
		order.add(((SpinnerEditor) spin.getEditor()).getTextField());
 | 
			
		||||
		
 | 
			
		||||
		panel.add(new UnitSelector(m), "growx");
 | 
			
		||||
		panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)), "w 100lp, wrap");
 | 
			
		||||
@ -294,7 +317,12 @@ public class StreamerConfig extends RecoveryDeviceConfig {
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		panel.add(button, "spanx, right");
 | 
			
		||||
		
 | 
			
		||||
		order.add(button);
 | 
			
		||||
 | 
			
		||||
		// Apply the custom focus travel policy to this panel
 | 
			
		||||
		CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order);
 | 
			
		||||
		parent.setFocusTraversalPolicy(policy);
 | 
			
		||||
 | 
			
		||||
		return panel;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user