[UI] fixed RailButton UI, file I/O
This commit is contained in:
parent
1ce452265c
commit
657c407ba5
@ -870,6 +870,8 @@ RocketCompCfg.title.Noseconeshoulder = Nose cone shoulder
|
||||
RocketCompCfg.title.Aftshoulder = Aft shoulder
|
||||
RocketCompCfg.border.Foreshoulder = Fore shoulder
|
||||
!RocketCompCfg.lbl.Length = Length:
|
||||
RocketCompCfg.lbl.InstanceCount = Instance Count
|
||||
RocketCompCfg.lbl.InstanceSeparation = Instance Separation
|
||||
|
||||
! BulkheadConfig
|
||||
BulkheadCfg.tab.Diameter = Diameter:
|
||||
|
@ -186,7 +186,7 @@ class DocumentConfig {
|
||||
// RailButton
|
||||
setters.put("RailButton:instancecount", new IntSetter(
|
||||
Reflection.findMethod( RailButton.class, "setInstanceCount",int.class)));
|
||||
setters.put("RailButton:instanceseparation", new DoubleSetter(
|
||||
setters.put("RailButton:linseparation", new DoubleSetter(
|
||||
Reflection.findMethod( RailButton.class, "setInstanceSeparation", double.class)));
|
||||
setters.put("RailButton:angularoffset", new DoubleSetter(
|
||||
Reflection.findMethod( RailButton.class, "setAngularOffset", double.class), Math.PI / 180.0));
|
||||
|
@ -87,10 +87,10 @@ public class RocketComponentSaver {
|
||||
if ( c instanceof Instanceable) {
|
||||
int instanceCount = c.getInstanceCount();
|
||||
if( 1 < instanceCount ){
|
||||
emitDouble( elements, "instancecount", c.getInstanceCount() );
|
||||
emitString( elements, "instancecount", Integer.toString( c.getInstanceCount()) );
|
||||
if( c instanceof LineInstanceable ){
|
||||
LineInstanceable line = (LineInstanceable)c;
|
||||
emitDouble( elements, "lineseparation", line.getInstanceSeparation());
|
||||
emitDouble( elements, "linseparation", line.getInstanceSeparation());
|
||||
}
|
||||
if( c instanceof RingInstanceable){
|
||||
RingInstanceable ring = (RingInstanceable)c;
|
||||
|
@ -258,6 +258,7 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
@Override
|
||||
public void setInstanceSeparation(final double _separation){
|
||||
this.instanceSeparation = _separation;
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -265,6 +266,7 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
if( 0 < newCount ){
|
||||
this.instanceCount = newCount;
|
||||
}
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class RailButtonConfig extends RocketComponentConfig {
|
||||
}
|
||||
|
||||
private JPanel buttonTab( final RailButton rbc ){
|
||||
JPanel panel = new JPanel( new MigLayout("fill"));
|
||||
JPanel panel = new JPanel( new MigLayout());
|
||||
|
||||
|
||||
{ //// Outer Diameter
|
||||
@ -54,7 +54,7 @@ public class RailButtonConfig extends RocketComponentConfig {
|
||||
ODSpinner.setEditor(new SpinnerEditor(ODSpinner));
|
||||
panel.add(ODSpinner, "growx");
|
||||
panel.add(new UnitSelector(ODModel), "growx");
|
||||
panel.add(new BasicSlider(ODModel.getSliderModel(0, 0.001, 0.02)), "w 100lp, wrap para");
|
||||
panel.add(new BasicSlider(ODModel.getSliderModel(0, 0.001, 0.02)), "w 100lp, wrap");
|
||||
}
|
||||
{ //// Height
|
||||
panel.add(new JLabel(trans.get("RailBtnCfg.lbl.TotalHeight")));
|
||||
@ -63,17 +63,17 @@ public class RailButtonConfig extends RocketComponentConfig {
|
||||
heightSpinner.setEditor(new SpinnerEditor(heightSpinner));
|
||||
panel.add(heightSpinner, "growx");
|
||||
panel.add(new UnitSelector(heightModel), "growx");
|
||||
panel.add(new BasicSlider(heightModel.getSliderModel(0, 0.001, 0.02)), "w 100lp, wrap para");
|
||||
panel.add(new BasicSlider(heightModel.getSliderModel(0, 0.001, 0.02)), "w 100lp, wrap");
|
||||
}
|
||||
|
||||
{ //// RadialPos:
|
||||
{ //// Angular Position:
|
||||
panel.add(new JLabel(trans.get("RailBtnCfg.lbl.Angle")));
|
||||
DoubleModel angleModel = new DoubleModel(component, "AngularOffset", UnitGroup.UNITS_ANGLE, -180, +180);
|
||||
JSpinner angleSpinner = new JSpinner( angleModel.getSpinnerModel());
|
||||
angleSpinner .setEditor(new SpinnerEditor(angleSpinner));
|
||||
angleSpinner.setEditor(new SpinnerEditor(angleSpinner));
|
||||
panel.add(angleSpinner, "growx");
|
||||
panel.add(new UnitSelector( angleModel), "growx");
|
||||
panel.add(new BasicSlider( angleModel.getSliderModel(-180, 180)), "w 100lp, wrap rel");
|
||||
panel.add(new BasicSlider( angleModel.getSliderModel(-180, 180)), "w 100lp, wrap");
|
||||
}
|
||||
|
||||
{ //// Position relative to:
|
||||
@ -87,7 +87,7 @@ public class RailButtonConfig extends RocketComponentConfig {
|
||||
RocketComponent.Position.BOTTOM,
|
||||
RocketComponent.Position.ABSOLUTE
|
||||
}));
|
||||
panel.add( relToCombo, "spanx, growx, wrap");
|
||||
panel.add( relToCombo, "growx, wrap rel");
|
||||
}
|
||||
|
||||
{ //// plus
|
||||
@ -103,7 +103,12 @@ public class RailButtonConfig extends RocketComponentConfig {
|
||||
}
|
||||
|
||||
//// Material
|
||||
panel.add(materialPanel( Material.Type.BULK), "span, wrap");
|
||||
panel.add( instanceablePanel(rbc), "cell 4 0, spany 3, wrap para");
|
||||
|
||||
|
||||
//// Material
|
||||
panel.add(materialPanel(Material.Type.BULK),"cell 4 2, spany 2, gapleft paragraph, aligny 0%, growy");
|
||||
// ... spany");
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import net.sf.openrocket.gui.SpinnerEditor;
|
||||
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||
import net.sf.openrocket.gui.adaptors.EnumModel;
|
||||
import net.sf.openrocket.gui.adaptors.IntegerModel;
|
||||
import net.sf.openrocket.gui.adaptors.MaterialModel;
|
||||
import net.sf.openrocket.gui.adaptors.PresetModel;
|
||||
import net.sf.openrocket.gui.components.BasicSlider;
|
||||
@ -44,6 +45,7 @@ import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
|
||||
import net.sf.openrocket.rocketcomponent.ExternalComponent;
|
||||
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
|
||||
import net.sf.openrocket.rocketcomponent.Instanceable;
|
||||
import net.sf.openrocket.rocketcomponent.NoseCone;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
@ -270,6 +272,28 @@ public class RocketComponentConfig extends JPanel {
|
||||
return subPanel;
|
||||
}
|
||||
|
||||
protected JPanel instanceablePanel( Instanceable inst ){
|
||||
JPanel panel = new JPanel( new MigLayout("fill"));
|
||||
{ // Instance Count
|
||||
panel.add(new JLabel(trans.get("RocketCompCfg.lbl.InstanceCount")));
|
||||
IntegerModel countModel = new IntegerModel(component, "InstanceCount", 1);
|
||||
JSpinner countSpinner = new JSpinner( countModel.getSpinnerModel());
|
||||
countSpinner.setEditor(new SpinnerEditor(countSpinner));
|
||||
panel.add(countSpinner, "w 100lp, wrap rel");
|
||||
}
|
||||
|
||||
{ // Instance separation
|
||||
panel.add(new JLabel(trans.get("RocketCompCfg.lbl.InstanceSeparation")));
|
||||
DoubleModel separationModel = new DoubleModel(component, "InstanceSeparation", UnitGroup.UNITS_LENGTH);
|
||||
JSpinner separationSpinner = new JSpinner( separationModel.getSpinnerModel());
|
||||
separationSpinner.setEditor(new SpinnerEditor(separationSpinner));
|
||||
panel.add(separationSpinner, "growx");
|
||||
panel.add(new UnitSelector(separationModel), "growx");
|
||||
panel.add(new BasicSlider(separationModel.getSliderModel(0, 0.001, 0.02)), "w 100lp, wrap para");
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
private JPanel overrideTab() {
|
||||
JPanel panel = new JPanel(new MigLayout("align 50% 20%, fillx, gap rel unrel",
|
||||
"[][65lp::][30lp::][]", ""));
|
||||
|
Loading…
x
Reference in New Issue
Block a user