Merge branch 'unstable' into issue-1481

This commit is contained in:
SiboVG 2022-07-04 23:32:40 +02:00 committed by GitHub
commit 84cf7dd480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 236 additions and 62 deletions

View File

@ -715,7 +715,7 @@ compaddbuttons.Launchlug = Launch Lug
compaddbuttons.RailButton = Rail Button
compaddbuttons.InnerComponent = Inner Components
compaddbuttons.Innertube = Inner Tube
compaddbuttons.Coupler = Coupler
compaddbuttons.Coupler = Tube Coupler
compaddbuttons.Centeringring = Centering\nRing
compaddbuttons.Bulkhead = Bulkhead
compaddbuttons.Engineblock = Engine\nBlock
@ -887,16 +887,17 @@ RocketCfg.lbl.Material = Material:
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Component name:
RocketCompCfg.ttip.Thecomponentname = The component name.
RocketCompCfg.lbl.Componentname.ttip = The component name.
RocketCompCfg.tab.Override = Override
RocketCompCfg.tab.MassandCGoverride = Mass and CG override options
RocketCompCfg.tab.Override.ttip = Mass and CG override options
RocketCompCfg.tab.Assembly = General
RocketCompCfg.tab.AssemblyComment = Options for locating stages parallel to other stages
RocketCompCfg.tab.Figure = Figure
RocketCompCfg.tab.Figstyleopt = Figure style options
RocketCompCfg.tab.Comment = Comment
RocketCompCfg.tab.Specifyacomment = Specify a comment for the component
RocketCompCfg.tab.Appearance = Appearance
RocketCompCfg.tab.Comment.ttip = Specify a comment for the component
RocketCompCfg.tab.Appearance = Appearance
RocketCompCfg.tab.Appearance.ttip = Component's appearance
RocketCompCfg.lbl.Mass = Mass:
RocketCompCfg.lbl.Componentmass = Component mass:
RocketCompCfg.lbl.overriddento = (overridden to

View File

@ -621,13 +621,13 @@ ShockCordCfg.lbl.Shockcordlength = D
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Jméno komponenty:
RocketCompCfg.ttip.Thecomponentname = Jméno komponenty.
RocketCompCfg.lbl.Componentname.ttip = Jméno komponenty.
RocketCompCfg.tab.Override = Prepsat
RocketCompCfg.tab.MassandCGoverride = Prepi\u0161 hmotnost a te\u017Ei\u0161te
RocketCompCfg.tab.Override.ttip = Prepi\u0161 hmotnost a te\u017Ei\u0161te
RocketCompCfg.tab.Figure = Obrázek
RocketCompCfg.tab.Figstyleopt = Vlastnosti obrázku
RocketCompCfg.tab.Comment = Komentár
RocketCompCfg.tab.Specifyacomment = Upresnení komentáre komponenty
RocketCompCfg.tab.Comment.ttip = Upresnení komentáre komponenty
RocketCompCfg.lbl.Mass = Hmotnost:
RocketCompCfg.lbl.Componentmass = Hmotnost komponenty:
RocketCompCfg.lbl.overriddento = (prepsáno na

View File

@ -677,13 +677,13 @@ ShockCordCfg.lbl.Shockcordlength = Gummibandl
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Komponentenname:
RocketCompCfg.ttip.Thecomponentname = Name der Komponente.
RocketCompCfg.lbl.Componentname.ttip = Name der Komponente.
RocketCompCfg.tab.Override = Werte überschreiben
RocketCompCfg.tab.MassandCGoverride = Massen- und Schwerpunktsoptionen
RocketCompCfg.tab.Override.ttip = Massen- und Schwerpunktsoptionen
RocketCompCfg.tab.Figure = Form
RocketCompCfg.tab.Figstyleopt = Formoptionen
RocketCompCfg.tab.Comment = Kommentar
RocketCompCfg.tab.Specifyacomment = Kommentar zu dieser Komponente
RocketCompCfg.tab.Comment.ttip = Kommentar zu dieser Komponente
RocketCompCfg.lbl.Mass = Masse:
RocketCompCfg.lbl.Componentmass = Masse der Komponente:
RocketCompCfg.lbl.overriddento = (überschrieben auf

View File

@ -861,13 +861,13 @@ RocketCompCfg.tab.Appearance = Apariencia
RocketCompCfg.tab.Comment = Comentarios
RocketCompCfg.tab.Figstyleopt = Opciones de estilo de la figura
RocketCompCfg.tab.Figure = Estilo
RocketCompCfg.tab.MassandCGoverride = Especificar la Masa y el CG del componente.
RocketCompCfg.tab.Override.ttip = Especificar la Masa y el CG del componente.
RocketCompCfg.tab.Override = Masa y CG
RocketCompCfg.tab.Specifyacomment = Especifique un comentario para el componente
RocketCompCfg.tab.Comment.ttip = Especifique un comentario para el componente
RocketCompCfg.title.Aftshoulder = Trasera del acople
RocketCompCfg.title.Noseconeshoulder = Acople de la ojiva
RocketCompCfg.ttip.Endcapped = Si el extremo del soporte est\u00e1 truncado.
RocketCompCfg.ttip.Thecomponentname = El nombre del componente.
RocketCompCfg.lbl.Componentname.ttip = El nombre del componente.
RocketComponent.Position.ABSOLUTE = Extremo de la ojiva
RocketComponent.Position.AFTER = Despu\u00e9s del componente

View File

@ -853,13 +853,13 @@ RocketCompCfg.tab.Appearance = Apparence
RocketCompCfg.tab.Comment = Commentaires
RocketCompCfg.tab.Figstyleopt = Options de la forme
RocketCompCfg.tab.Figure = Forme
RocketCompCfg.tab.MassandCGoverride = For\u00E7age de la Masse et du CG
RocketCompCfg.tab.Override.ttip = For\u00E7age de la Masse et du CG
RocketCompCfg.tab.Override = Forcer la valeur
RocketCompCfg.tab.Specifyacomment = Commentaires concernant la pi\u00E8ce
RocketCompCfg.tab.Comment.ttip = Commentaires concernant la pi\u00E8ce
RocketCompCfg.title.Aftshoulder = Epaulement arri\u00E8re
RocketCompCfg.title.Noseconeshoulder = Epaulement du c\u00F4ne
RocketCompCfg.ttip.Endcapped = Pr\u00E9cise si l'arri\u00E8re du c\u00F4ne est clos.
RocketCompCfg.ttip.Thecomponentname = Le nom de la pi\u00E8ce.
RocketCompCfg.lbl.Componentname.ttip = Le nom de la pi\u00E8ce.
RocketComponent.Position.ABSOLUTE = Pointe de l'ogive
RocketComponent.Position.AFTER = Apr\u00E8s la pi\u00E8ce parente

View File

@ -679,13 +679,13 @@ ShockCordCfg.lbl.Shockcordlength = Lunghezza della Shock cord :
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Nome componente:
RocketCompCfg.ttip.Thecomponentname = Il nome del componente.
RocketCompCfg.lbl.Componentname.ttip = Il nome del componente.
RocketCompCfg.tab.Override = Modifica
RocketCompCfg.tab.MassandCGoverride = Opzioni di sovrascrittura di massa e CG
RocketCompCfg.tab.Override.ttip = Opzioni di sovrascrittura di massa e CG
RocketCompCfg.tab.Figure = Disegno
RocketCompCfg.tab.Figstyleopt = Opzioni dello stile della figure
RocketCompCfg.tab.Comment = Commento
RocketCompCfg.tab.Specifyacomment = Specifica un commento per il componente
RocketCompCfg.tab.Comment.ttip = Specifica un commento per il componente
RocketCompCfg.lbl.Mass = Massa:
RocketCompCfg.lbl.Componentmass = La massa del componente :
RocketCompCfg.lbl.overriddento = (sovrascritto a

View File

@ -709,13 +709,13 @@ ShockCordCfg.lbl.Shockcordlength = \u30B7\u30E7\u30C3\u30AF\u30B3\u30FC\u30C9\u
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = \u90E8\u54C1\u540D\uFF1A
RocketCompCfg.ttip.Thecomponentname = \u90E8\u54C1\u306E\u540D\u524D
RocketCompCfg.lbl.Componentname.ttip = \u90E8\u54C1\u306E\u540D\u524D
RocketCompCfg.tab.Override = \u518D\u5B9A\u7FA9
RocketCompCfg.tab.MassandCGoverride = \u8CEA\u91CF\u3068CG\u3092\u518D\u5B9A\u7FA9\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3
RocketCompCfg.tab.Override.ttip = \u8CEA\u91CF\u3068CG\u3092\u518D\u5B9A\u7FA9\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3
RocketCompCfg.tab.Figure = \u56F3\u793A
RocketCompCfg.tab.Figstyleopt = \u56F3\u793A\u306E\u30B9\u30BF\u30A4\u30EB\u30AA\u30D7\u30B7\u30E7\u30F3
RocketCompCfg.tab.Comment = \u30B3\u30E1\u30F3\u30C8
RocketCompCfg.tab.Specifyacomment = \u90E8\u54C1\u3078\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u8A18\u8FF0
RocketCompCfg.tab.Comment.ttip = \u90E8\u54C1\u3078\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u8A18\u8FF0
RocketCompCfg.lbl.Mass = \u8CEA\u91CF\uFF1A
RocketCompCfg.lbl.Componentmass = \u90E8\u54C1\u8CEA\u91CF\uFF1A
RocketCompCfg.lbl.overriddento = (overridden to

View File

@ -826,15 +826,15 @@ RocketCfg.lbl.Material = Materiaal:
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Componentnaam:
RocketCompCfg.ttip.Thecomponentname = De componentnaam.
RocketCompCfg.lbl.Componentname.ttip = De componentnaam.
RocketCompCfg.tab.Override = Overschrijf
RocketCompCfg.tab.MassandCGoverride = Massa en ZP overschrijvingsopties
RocketCompCfg.tab.Override.ttip = Massa en ZP overschrijvingsopties
RocketCompCfg.tab.Assembly = Algemeen
RocketCompCfg.tab.AssemblyComment = Opties voor het plaatsen van trappen parallel aan andere trappen
RocketCompCfg.tab.Figure = Figuur
RocketCompCfg.tab.Figstyleopt = Figuurstijl opties
RocketCompCfg.tab.Comment = Opmerking
RocketCompCfg.tab.Specifyacomment = Geef een opmerking voor het onderdeel
RocketCompCfg.tab.Comment.ttip = Geef een opmerking voor het onderdeel
RocketCompCfg.tab.Appearance = Uiterlijk
RocketCompCfg.lbl.Mass = Massa:
RocketCompCfg.lbl.Componentmass = Componentmassa:

View File

@ -623,13 +623,13 @@ update.dlg.latestVersion = Korzystasz z najnowszej wersji OpenRocket: %s.
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Nazwa cz\u0119\u015Bci:
RocketCompCfg.ttip.Thecomponentname = Nazwa cz\u0119\u015Bci sk\u0142adowej rakiety.
RocketCompCfg.lbl.Componentname.ttip = Nazwa cz\u0119\u015Bci sk\u0142adowej rakiety.
RocketCompCfg.tab.Override = Wymu\u015B
RocketCompCfg.tab.MassandCGoverride = Opcje wymuszenia ci\u0119\u017Caru oraz \u015Brodka ci\u0119\u017Cko\u015Bci
RocketCompCfg.tab.Override.ttip = Opcje wymuszenia ci\u0119\u017Caru oraz \u015Brodka ci\u0119\u017Cko\u015Bci
RocketCompCfg.tab.Figure = Wygl\u0105d
RocketCompCfg.tab.Figstyleopt = Styl kszta\u0142tu
RocketCompCfg.tab.Comment = Uwagi
RocketCompCfg.tab.Specifyacomment = Dodaj uwagi do cz\u0119\u015Bci
RocketCompCfg.tab.Comment.ttip = Dodaj uwagi do cz\u0119\u015Bci
RocketCompCfg.lbl.Mass = Masa:
RocketCompCfg.lbl.Componentmass = Masa cz\u0119\u015Bci:
RocketCompCfg.lbl.overriddento = (wymuszone do

View File

@ -838,13 +838,13 @@ RocketCompCfg.lbl.ttip.componentmaterialaffects = O material do componente afe
RocketCompCfg.tab.Comment = Coment\u00e1rio
RocketCompCfg.tab.Figstyleopt = Op\u00e7\u00f5es do estilo de figura
RocketCompCfg.tab.Figure = Figura
RocketCompCfg.tab.MassandCGoverride = Op\u00e7\u00f5es de modifica\u00e7\u00e3o de massa e CG
RocketCompCfg.tab.Override.ttip = Op\u00e7\u00f5es de modifica\u00e7\u00e3o de massa e CG
RocketCompCfg.tab.Override = Modificar
RocketCompCfg.tab.Specifyacomment = Especifique um coment\u00e1rio para o componente
RocketCompCfg.tab.Comment.ttip = Especifique um coment\u00e1rio para o componente
RocketCompCfg.title.Aftshoulder = Ressalto traseiro
RocketCompCfg.title.Noseconeshoulder = Ressalto da ogiva
RocketCompCfg.ttip.Endcapped = Quando a extremidade do ressalto \u00e9 limitada.
RocketCompCfg.ttip.Thecomponentname = Nome do componente.
RocketCompCfg.lbl.Componentname.ttip = Nome do componente.
RocketComponent.Position.ABSOLUTE = Dica da ogiva
RocketComponent.Position.AFTER = Depois do componente pai

View File

@ -888,15 +888,15 @@ RocketCfg.lbl.Material = \u041C\u0430\u0442\u0435\u0440\u0438\u0430\u043B:
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430:
RocketCompCfg.ttip.Thecomponentname = \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430.
RocketCompCfg.lbl.Componentname.ttip = \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430.
RocketCompCfg.tab.Override = \u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435
RocketCompCfg.tab.MassandCGoverride = \u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u043C\u0430\u0441\u0441\u044B \u0438 \u0426\u0422
RocketCompCfg.tab.Override.ttip = \u041F\u0435\u0440\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u043C\u0430\u0441\u0441\u044B \u0438 \u0426\u0422
RocketCompCfg.tab.Assembly = \u0421\u0431\u043E\u0440\u043A\u0430
RocketCompCfg.tab.AssemblyComment = \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0440\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u0438\u044F \u0441\u0442\u0443\u043F\u0435\u043D\u0435\u0439 \u043F\u0430\u0440\u0430\u043B\u043B\u0435\u043B\u044C\u043D\u043E \u0434\u0440\u0443\u0433\u0438\u043C \u0441\u0442\u0443\u043F\u0435\u043D\u044F\u043C
RocketCompCfg.tab.Figure = \u0420\u0438\u0441\u0443\u043D\u043E\u043A
RocketCompCfg.tab.Figstyleopt = \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0441\u0442\u0438\u043B\u044F \u0440\u0438\u0441\u0443\u043D\u043A\u0430
RocketCompCfg.tab.Comment = \u041F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435
RocketCompCfg.tab.Specifyacomment = \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435 \u043A \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0443
RocketCompCfg.tab.Comment.ttip = \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435 \u043A \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0443
RocketCompCfg.tab.Appearance = \u0412\u043D\u0435\u0448\u043D\u0438\u0439 \u0432\u0438\u0434
RocketCompCfg.lbl.Mass = \u041C\u0430\u0441\u0441\u0430:
RocketCompCfg.lbl.Componentmass = \u041C\u0430\u0441\u0441\u0430 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430:

View File

@ -779,13 +779,13 @@ ShockCordCfg.lbl.Shockcordlength = Shock cord length:
! RocketComponentConfig
RocketCompCfg.lbl.Componentname = Component name:
RocketCompCfg.ttip.Thecomponentname = The component name.
RocketCompCfg.lbl.Componentname.ttip = The component name.
RocketCompCfg.tab.Override = Override
RocketCompCfg.tab.MassandCGoverride = Mass and CG override options
RocketCompCfg.tab.Override.ttip = Mass and CG override options
RocketCompCfg.tab.Figure = Figure
RocketCompCfg.tab.Figstyleopt = Figure style options
RocketCompCfg.tab.Comment = Comment
RocketCompCfg.tab.Specifyacomment = Specify a comment for the component
RocketCompCfg.tab.Comment.ttip = Specify a comment for the component
RocketCompCfg.tab.Appearance = Appearance
RocketCompCfg.lbl.Mass = Mass:
RocketCompCfg.lbl.Componentmass = Component mass:

View File

@ -927,13 +927,13 @@ RocketCompCfg.tab.Appearance = \u5916\u89C2
RocketCompCfg.tab.Comment = \u6CE8\u91CA
RocketCompCfg.tab.Figstyleopt = \u6837\u5F0F\u9009\u9879
RocketCompCfg.tab.Figure = \u6837\u5F0F
RocketCompCfg.tab.MassandCGoverride = \u8D28\u91CF\u53CA\u91CD\u5FC3\u9009\u9879
RocketCompCfg.tab.Override.ttip = \u8D28\u91CF\u53CA\u91CD\u5FC3\u9009\u9879
RocketCompCfg.tab.Override = \u8986\u5199
RocketCompCfg.tab.Specifyacomment = \u7EC4\u4EF6\u6CE8\u91CA
RocketCompCfg.tab.Comment.ttip = \u7EC4\u4EF6\u6CE8\u91CA
RocketCompCfg.title.Aftshoulder = \u524D\u8FDE\u63A5\u5904
RocketCompCfg.title.Noseconeshoulder = \u5934\u9525\u8FDE\u63A5\u5904
RocketCompCfg.ttip.Endcapped = \u8FDE\u63A5\u5904\u7EC8\u7AEF\u662F\u5426\u6709\u76D6.
RocketCompCfg.ttip.Thecomponentname = \u7EC4\u4EF6\u540D\u79F0.
RocketCompCfg.lbl.Componentname.ttip = \u7EC4\u4EF6\u540D\u79F0.
RocketComponent.Position.ABSOLUTE = \u5934\u9525\u5C16\u7AEF
RocketComponent.Position.AFTER = \u7236\u7EC4\u4EF6\u4E4B\u540E

View File

@ -26,7 +26,7 @@ import net.sf.openrocket.util.MathUtil;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public class InnerTube extends ThicknessRingComponent implements AxialPositionable, BoxBounded, Clusterable, RadialParent, MotorMount {
public class InnerTube extends ThicknessRingComponent implements AxialPositionable, BoxBounded, Clusterable, RadialParent, MotorMount, InsideColorComponent {
private static final Translator trans = Application.getTranslator();
private static final Logger log = LoggerFactory.getLogger(InnerTube.class);
@ -37,6 +37,8 @@ public class InnerTube extends ThicknessRingComponent implements AxialPositionab
private double overhang = 0;
private boolean isActingMount;
private MotorConfigurationSet motors;
private InsideColorComponentHandler insideColorComponentHandler = new InsideColorComponentHandler(this);
/**
* Main constructor.
@ -447,6 +449,16 @@ public class InnerTube extends ThicknessRingComponent implements AxialPositionab
return this.motors.toDebug();
}
@Override
public InsideColorComponentHandler getInsideColorComponentHandler() {
return this.insideColorComponentHandler;
}
@Override
public void setInsideColorComponentHandler(InsideColorComponentHandler handler) {
this.insideColorComponentHandler = handler;
}
@Override
public boolean addConfigListener(RocketComponent listener) {
boolean success = super.addConfigListener(listener);

View File

@ -1,8 +1,14 @@
package net.sf.openrocket.gui;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.text.DefaultFormatter;
import javax.swing.text.DefaultFormatterFactory;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
* Editable editor for a JSpinner. Simply uses JSpinner.DefaultEditor, which has been made
@ -22,6 +28,59 @@ public class SpinnerEditor extends JSpinner.DefaultEditor {
DefaultFormatterFactory dff = (DefaultFormatterFactory) getTextField().getFormatterFactory();
DefaultFormatter formatter = (DefaultFormatter) dff.getDefaultFormatter();
formatter.setOverwriteMode(false);
// Add listeners to select all the text when the field is focussed
{
getTextField().addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
selectAllText();
}
@Override
public void focusLost(FocusEvent e) {
}
});
getTextField().addMouseListener(new MouseListener() {
private boolean isFocussed = false; // Checks whether the text field was focussed when it was clicked upon
@Override
public void mouseClicked(MouseEvent e) {
// If the text field was focussed when it was clicked upon instead of e.g. tab-switching to gain focus,
// then the select all action from the focus listener is ignored (it is replaced by a cursor-click event).
// So if we detect such a focus change, then redo the select all action.
if (!isFocussed) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JTextField tf = (JTextField) e.getSource();
tf.selectAll();
}
});
}
}
@Override
public void mousePressed(MouseEvent e) {
JTextField tf = (JTextField) e.getSource();
isFocussed = tf.hasFocus();
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
}
}
/**
@ -33,5 +92,17 @@ public class SpinnerEditor extends JSpinner.DefaultEditor {
this(spinner);
getTextField().setColumns(cols);
}
/**
* Highlights all the text in the text field.
*/
private void selectAllText() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
getTextField().selectAll();
}
});
}
}

View File

@ -69,6 +69,7 @@ public class PresetModel extends AbstractListModel implements ComboBoxModel, Com
} else {
document.addUndoPosition("Use Preset " + component.getComponentName());
component.loadPreset((ComponentPreset) item);
((RocketComponentConfig) parent).setFocusElement();
}
}

View File

@ -24,21 +24,49 @@ public class ConfigurationComboBox extends JComboBox<FlightConfiguration> implem
public class ConfigurationModel implements MutableComboBoxModel<FlightConfiguration> {
private final Rocket rkt;
public ConfigurationModel(final Rocket _rkt) {
private FlightConfiguration selectedConfig;
private final boolean updateRocketConfig;
private final ConfigurationModel listener;
/**
* @param _rkt the rocket to get the configurations from and to (optionally) change the rocket's selected configuration
* @param _updateRocketConfig whether to update the rocket's selected configuration based on the selected combo box item,
* or just change the combo box item without altering the rocket's configuration.
* @param listener model that should change its selected item to this model's selected item
*/
public ConfigurationModel(final Rocket _rkt, boolean _updateRocketConfig, ConfigurationModel listener) {
this.rkt = _rkt;
this.updateRocketConfig = _updateRocketConfig;
this.selectedConfig = this.rkt.getSelectedConfiguration();
this.listener = listener;
}
public ConfigurationModel(final Rocket _rkt, boolean _updateRocketConfig) {
this(_rkt, _updateRocketConfig, null);
}
@Override
public FlightConfiguration getSelectedItem() {
return rkt.getSelectedConfiguration();
if (updateRocketConfig) {
return rkt.getSelectedConfiguration();
} else {
return selectedConfig;
}
}
@Override
public void setSelectedItem(Object nextItem) {
if( nextItem instanceof FlightConfiguration ){
FlightConfigurationId selectedId = ((FlightConfiguration)nextItem).getId();
rkt.setSelectedConfiguration(selectedId);
if (updateRocketConfig) {
rkt.setSelectedConfiguration(selectedId);
} else {
selectedConfig = rkt.getFlightConfiguration(selectedId);
}
if (listener != null) {
listener.setSelectedItem(nextItem);
}
}
}
@ -79,9 +107,15 @@ public class ConfigurationComboBox extends JComboBox<FlightConfiguration> implem
private final Rocket rkt;
public ConfigurationComboBox(Rocket _rkt) {
/**
* @param _rkt the rocket to get the configurations from and to (optionally) change the rocket's selected configuration
* @param _updateRocketConfig whether to update the rocket's selected configuration based on the selected combo box item,
* or just change the combo box item without altering the rocket's configuration.
*/
public ConfigurationComboBox(Rocket _rkt, boolean _updateRocketConfig) {
rkt = _rkt;
setModel(new ConfigurationModel(rkt));
final ConfigurationModel model = new ConfigurationModel(rkt, _updateRocketConfig);
setModel(model);
rkt.addChangeListener(this);
addPopupMenuListener(new PopupMenuListener() {
@ -89,12 +123,18 @@ public class ConfigurationComboBox extends JComboBox<FlightConfiguration> implem
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
setModel(new ConfigurationModel(rkt));
final ConfigurationModel model2 = new ConfigurationModel(rkt, _updateRocketConfig, model);
model2.setSelectedItem(model.getSelectedItem());
setModel(model2);
}
});
}
public ConfigurationComboBox(Rocket _rkt) {
this(_rkt, true);
}
@Override
public void stateChanged(EventObject e) {

View File

@ -6,6 +6,8 @@ import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.document.OpenRocketDocument;
@ -23,6 +25,12 @@ import net.sf.openrocket.rocketcomponent.SymmetricComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Arrays;
@SuppressWarnings("serial")
public class BodyTubeConfig extends RocketComponentConfig {
@ -43,6 +51,7 @@ public class BodyTubeConfig extends RocketComponentConfig {
JSpinner spin = new JSpinner(length.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel.add(spin, "growx");
panel.add(new UnitSelector(length), "growx");

View File

@ -64,7 +64,6 @@ public class InnerTubeConfig extends RocketComponentConfig {
super(d, c, parent);
//// General and General properties
JPanel rightPanel = new JPanel(new MigLayout());
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
DoubleModel m;
@ -86,7 +85,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
panel.add(spin, "growx");
panel.add(new UnitSelector(od), "growx");
panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap");
panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "wmin 100lp, growx, wrap");
if (od.isAutomaticAvailable()) {
JCheckBox check = new JCheckBox(od.getAutomaticAction());
@ -106,7 +105,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(new DoubleModel(0), od)), "w 100lp, wrap");
panel.add(new BasicSlider(m.getSliderModel(new DoubleModel(0), od)), "wmin 100lp, growx, wrap");
if (m.isAutomaticAvailable()) {
JCheckBox check = new JCheckBox(m.getAutomaticAction());
@ -127,7 +126,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "w 100lp, wrap");
panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "wmin 100lp, growx, wrap");
//// Inner tube length
@ -138,14 +137,15 @@ public class InnerTubeConfig extends RocketComponentConfig {
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)), "w 100lp, wrap");
panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)), "wmin 100lp, growx, wrap");
//// Material
panel.add(materialPanel(Material.Type.BULK),
"spanx 3, growx, wrap 15lp");
"spanx 4, growx, wrap 15lp");
//// Right side of panel ----
@ -174,7 +174,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
panel2.add(new BasicSlider(m.getSliderModel(
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
new DoubleModel(component.getParent(), "Length"))),
"w 100lp, wrap");
"wmin 100lp, growx, wrap");

View File

@ -45,6 +45,7 @@ public class LaunchLugConfig extends RocketComponentConfig {
JSpinner spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");

View File

@ -138,6 +138,7 @@ public class MassComponentConfig extends RocketComponentConfig {
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel2.add(spin, "growx");
panel2.add(new UnitSelector(m), "growx");

View File

@ -163,6 +163,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");

View File

@ -92,6 +92,7 @@ public class RailButtonConfig extends RocketComponentConfig {
DoubleModel offsetModel = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
JSpinner offsetSpinner = new JSpinner(offsetModel.getSpinnerModel());
offsetSpinner.setEditor(new SpinnerEditor(offsetSpinner));
focusElement = offsetSpinner;
panel.add(offsetSpinner, "growx");
panel.add(new UnitSelector(offsetModel), "growx");
panel.add(new BasicSlider(offsetModel.getSliderModel(

View File

@ -20,6 +20,7 @@ import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.rocketcomponent.EngineBlock;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.ThicknessRingComponent;
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@ -116,6 +117,9 @@ public class RingComponentConfig extends RocketComponentConfig {
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
if (component instanceof ThicknessRingComponent) {
focusElement = spin;
}
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");
@ -139,6 +143,9 @@ public class RingComponentConfig extends RocketComponentConfig {
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
if (!(component instanceof ThicknessRingComponent)) {
focusElement = spin;
}
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");

View File

@ -64,6 +64,7 @@ public class RocketComponentConfig extends JPanel {
private JComboBox<?> presetComboBox;
private PresetModel presetModel;
protected Component focusElement = null; // Element that will be focused on after a preset is selected
protected final JTextField componentNameField;
protected JTextArea commentTextArea;
@ -103,7 +104,7 @@ public class RocketComponentConfig extends JPanel {
//// Component name:
JLabel label = new JLabel(trans.get("RocketCompCfg.lbl.Componentname"));
//// The component name.
label.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname"));
label.setToolTipText(trans.get("RocketCompCfg.lbl.Componentname.ttip"));
this.add(label, "spanx, height 32!, split");
componentNameField = new JTextField(15);
@ -111,7 +112,7 @@ public class RocketComponentConfig extends JPanel {
componentNameField.addActionListener(textFieldListener);
componentNameField.addFocusListener(textFieldListener);
//// The component name.
componentNameField.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname"));
componentNameField.setToolTipText(trans.get("RocketCompCfg.lbl.Componentname.ttip"));
this.add(componentNameField, "growx");
if (allSameType && component.getPresetType() != null) {
@ -139,17 +140,17 @@ public class RocketComponentConfig extends JPanel {
//// Override and Mass and CG override options
tabbedPane.addTab(trans.get("RocketCompCfg.tab.Override"), null, overrideTab(),
trans.get("RocketCompCfg.tab.MassandCGoverride"));
trans.get("RocketCompCfg.tab.Override.ttip"));
if (allMassive) {
//// Appearance options
appearancePanel = new AppearancePanel(document, component, parent);
tabbedPane.addTab(trans.get("RocketCompCfg.tab.Appearance"), null, appearancePanel,
"Appearance Tool Tip");
trans.get("RocketCompCfg.tab.Appearance.ttip"));
}
//// Comment and Specify a comment for the component
tabbedPane.addTab(trans.get("RocketCompCfg.tab.Comment"), null, commentTab(),
trans.get("RocketCompCfg.tab.Specifyacomment"));
trans.get("RocketCompCfg.tab.Comment.ttip"));
addButtons();
@ -735,6 +736,24 @@ public class RocketComponentConfig extends JPanel {
}
}
}
/**
* Requests focus for the focus element that should be active after a preset is selected.
*/
public void setFocusElement() {
if (focusElement != null) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (focusElement instanceof JSpinner) {
SpinnerEditor ed = (SpinnerEditor) ((JSpinner)focusElement).getEditor();
ed.getTextField().requestFocusInWindow();
} else {
focusElement.requestFocusInWindow();
}
}
});
}
}
protected void register(Invalidatable model) {

View File

@ -80,6 +80,7 @@ public class ShockCordConfig extends RocketComponentConfig {
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel2.add(spin, "growx");
panel2.add(new UnitSelector(m), "growx");

View File

@ -149,6 +149,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");

View File

@ -54,6 +54,7 @@ public class TubeFinSetConfig extends RocketComponentConfig {
spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin));
focusElement = spin;
panel.add(spin, "growx");
panel.add(new UnitSelector(m), "growx");

View File

@ -7,6 +7,7 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.glu.GLU;
import com.jogamp.opengl.glu.GLUquadric;
import net.sf.openrocket.rocketcomponent.InnerTube;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -98,6 +99,8 @@ public class ComponentRenderer {
if (c instanceof BodyTube) {
renderTube(gl, (BodyTube) c, which);
} else if (c instanceof InnerTube) {
renderTube(gl, (InnerTube) c, which);
} else if (c instanceof LaunchLug) {
renderLug(gl, (LaunchLug) c, which);
} else if ( c instanceof RailButton ){
@ -257,6 +260,10 @@ public class ComponentRenderer {
renderTube(gl, which, t.getOuterRadius(), t.getInnerRadius(), t.getLength());
}
private void renderTube(GL2 gl, InnerTube t, Surface which) {
renderTube(gl, which, t.getOuterRadius(), t.getInnerRadius(), t.getLength());
}
private void renderRing(GL2 gl, RingComponent r) {
gl.glRotated(90, 0, 1.0, 0);

View File

@ -151,7 +151,7 @@ public class SimulationEditDialog extends JDialog {
final Rocket rkt = document.getRocket();
final FlightConfiguration config = rkt.getFlightConfiguration(simulationList[0].getFlightConfigurationId());
final ConfigurationComboBox configComboBox = new ConfigurationComboBox(rkt);
final ConfigurationComboBox configComboBox = new ConfigurationComboBox(rkt, false);
configComboBox.setSelectedItem(config);
//// Select the motor configuration to use.