Enhance flight configuration UI
This commit is contained in:
parent
6f0cf6826a
commit
b3b2303f27
@ -172,21 +172,16 @@ debuglogdlg.lbl.Stacktrace = Stack trace:
|
||||
MotorChooserDialog.title = Select a rocket motor
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Remove motor
|
||||
edtmotorconfdlg.but.Selectmotor = Select motor
|
||||
edtmotorconfdlg.but.Removeconfiguration = Remove
|
||||
edtmotorconfdlg.but.Renameconfiguration = Rename
|
||||
edtmotorconfdlg.but.Newconfiguration = New
|
||||
edtmotorconfdlg.but.Copyconfiguration = Copy
|
||||
edtmotorconfdlg.but.Selectignition = Select ignition
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Motor mounts:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Edit Flight configurations
|
||||
edtmotorconfdlg.title.Renameconf = Rename Flight Configuration
|
||||
edtmotorconfdlg.title.Selectdeploymentconf = Select Deployment Configuration
|
||||
edtmotorconfdlg.title.Selectignitionconf = Select Ignition Configuration
|
||||
edtmotorconfdlg.title.Selectseparationconf = Select Separation Configuration
|
||||
edtmotorconfdlg.selectcomp = <html>Select which components function as motor mounts:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Motor configurations:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Configuration name:
|
||||
edtmotorconfdlg.lbl.Motortab = Motors
|
||||
edtmotorconfdlg.lbl.Recoverytab = Recovery
|
||||
@ -1326,6 +1321,13 @@ MotorMount.IgnitionEvent.EJECTION_CHARGE = First ejection charge of previous sta
|
||||
MotorMount.IgnitionEvent.BURNOUT = First burnout of previous stage
|
||||
MotorMount.IgnitionEvent.NEVER = Never
|
||||
|
||||
MotorMount.IgnitionEvent.short.AUTOMATIC = Automatic
|
||||
MotorMount.IgnitionEvent.short.LAUNCH = Launch
|
||||
MotorMount.IgnitionEvent.short.EJECTION_CHARGE = Ejection charge
|
||||
MotorMount.IgnitionEvent.short.BURNOUT = Burnout
|
||||
MotorMount.IgnitionEvent.short.NEVER = Never
|
||||
|
||||
|
||||
!ComponentIcons
|
||||
ComponentIcons.Nosecone = Nose cone
|
||||
ComponentIcons.Bodytube = Body tube
|
||||
@ -1816,3 +1818,15 @@ EditDecalDialog.lbl.always = Always use these settings
|
||||
EditDecalDialog.btn.chooser = Select Graphics Editor Program
|
||||
|
||||
|
||||
MotorConfigurationPanel.lbl.motorMounts = Motor mounts:
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = Motor configurations:
|
||||
MotorConfigurationPanel.btn.removeMotor = Remove motor
|
||||
MotorConfigurationPanel.btn.selectMotor = Select motor
|
||||
MotorConfigurationPanel.btn.selectIgnition = Select ignition
|
||||
MotorConfigurationPanel.btn.resetIgnition = Reset ignition
|
||||
|
||||
MotorConfigurationPanel.table.ignition.default = Default ({0})
|
||||
|
||||
|
||||
MotorConfigurationPanel.description = <b>Select the motors and motor ignition events of your rocket.</b><br> <em>Motor mounts:</em> Select which components function as motor mounts.<br> <em>Motor configurations:</em> Select the motor and ignition event for each motor mount.
|
||||
|
||||
|
@ -170,14 +170,14 @@ debuglogdlg.lbl.Stacktrace = Tracov
|
||||
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Odeber motor
|
||||
edtmotorconfdlg.but.Selectmotor = Vyber motor
|
||||
MotorConfigurationPanel.btn.removeMotor = Odeber motor
|
||||
MotorConfigurationPanel.btn.selectMotor = Vyber motor
|
||||
edtmotorconfdlg.but.Removeconfiguration = Odeber nastavení
|
||||
edtmotorconfdlg.but.Newconfiguration = Nové nastavení
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Pripojení motoru:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>Pripojení motoru:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Úprava nastavení motoru
|
||||
edtmotorconfdlg.selectcomp = <html>Vyber ke kterým komponentám se má motor pripojit:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Nastavení motoru:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>Nastavení motoru:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Jméno nastavení:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = Nechej prázdné polícko jako výchozí hodnotu.
|
||||
|
||||
|
@ -171,14 +171,14 @@ debuglogdlg.lbl.Stacktrace = Stacktrace:
|
||||
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Motor entfernen
|
||||
edtmotorconfdlg.but.Selectmotor = Motor auswählen
|
||||
MotorConfigurationPanel.btn.removeMotor = Motor entfernen
|
||||
MotorConfigurationPanel.btn.selectMotor = Motor auswählen
|
||||
edtmotorconfdlg.but.Removeconfiguration = Konfiguration entfernen
|
||||
edtmotorconfdlg.but.Newconfiguration = Neue Konfiguration
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Motorhalterungen:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>Motorhalterungen:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Motorkonfiguration bearbeiten
|
||||
edtmotorconfdlg.selectcomp = <html>Auswählen, welche Komponenten Motorhalterungen sind:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Motorkonfigurationen:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>Motorkonfigurationen:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Name der Konfiguration:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = Leer lassen für Standardwert.
|
||||
|
||||
|
@ -179,14 +179,14 @@ debuglogdlg.lbl.Stacktrace = Trazabilidad de la pila:
|
||||
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Quitar motor
|
||||
edtmotorconfdlg.but.Selectmotor = Seleccionar motor
|
||||
MotorConfigurationPanel.btn.removeMotor = Quitar motor
|
||||
MotorConfigurationPanel.btn.selectMotor = Seleccionar motor
|
||||
edtmotorconfdlg.but.Removeconfiguration = Quitar configuración
|
||||
edtmotorconfdlg.but.Newconfiguration = Nueva configuración
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Porta motor:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>Porta motor:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Mostrar las configuraciones de motor
|
||||
edtmotorconfdlg.selectcomp = <html>Seleccionar qué componentes tienen la función de porta motor:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Configuraciones del motor:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>Configuraciones del motor:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Nombre de la configuración:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = Dejar el nombre por defecto.
|
||||
|
||||
|
@ -173,14 +173,14 @@ debuglogdlg.lbl.Stacktrace = Stack trace:
|
||||
MotorChooserDialog.title = Selectionnez un moteur fusée
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Enlever le moteur
|
||||
edtmotorconfdlg.but.Selectmotor = Choisir le moteur
|
||||
MotorConfigurationPanel.btn.removeMotor = Enlever le moteur
|
||||
MotorConfigurationPanel.btn.selectMotor = Choisir le moteur
|
||||
edtmotorconfdlg.but.Removeconfiguration = Supprimer la configuration
|
||||
edtmotorconfdlg.but.Newconfiguration = Nouvelle configuration
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Portes moteur:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>Portes moteur:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Changer la configuration moteur
|
||||
edtmotorconfdlg.selectcomp = <html>Choisir les pièces utilisées par le porte moteur:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Configurations moteur:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>Configurations moteur:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Nom de la configuration:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = Laisser le champ vide par défaut.
|
||||
|
||||
|
@ -173,14 +173,14 @@ debuglogdlg.lbl.Stacktrace = traccia della memoria:
|
||||
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Rimuovi il motore
|
||||
edtmotorconfdlg.but.Selectmotor = Seleziona il motore
|
||||
MotorConfigurationPanel.btn.removeMotor = Rimuovi il motore
|
||||
MotorConfigurationPanel.btn.selectMotor = Seleziona il motore
|
||||
edtmotorconfdlg.but.Removeconfiguration = Rimuovi la configurazione
|
||||
edtmotorconfdlg.but.Newconfiguration = Nuova configurazione
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Alloggiamenti motore:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>Alloggiamenti motore:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Modifica la configurazione del motore
|
||||
edtmotorconfdlg.selectcomp = <html>Seleziona quali componenti fungono da alloggiamenti per il motore:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Configurazione dei motori:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>Configurazione dei motori:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Nome della configurazione:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = Lascia il campo vuoto per il nome prestabilito.
|
||||
|
||||
|
@ -171,14 +171,14 @@
|
||||
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = Usu\u0144 silnik
|
||||
edtmotorconfdlg.but.Selectmotor = Wybierz silnik
|
||||
MotorConfigurationPanel.btn.removeMotor = Usu\u0144 silnik
|
||||
MotorConfigurationPanel.btn.selectMotor = Wybierz silnik
|
||||
edtmotorconfdlg.but.Removeconfiguration = Usu\u0144 konfiguracj\u0119
|
||||
edtmotorconfdlg.but.Newconfiguration = Nowa konfiguracja
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>Gniazda silnikowe:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>Gniazda silnikowe:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = Edytuj konfiguracje silnika
|
||||
edtmotorconfdlg.selectcomp = <html>Wybierz cz\u0119\u015Bci, które pe\u0142ni\u0105 funkcj\u0119 gniazd silnikowych:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>Konfiguracje silników:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>Konfiguracje silników:</b>
|
||||
edtmotorconfdlg.lbl.Configname = Nazwa konfiguracji:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = Pozostaw bez nazwy w celu u\u017Cycia nazwy domy\u015Blnej.
|
||||
|
||||
|
@ -173,14 +173,14 @@ debuglogdlg.lbl.Stacktrace = \u0421\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u
|
||||
MotorChooserDialog.title = \u0412\u044b\u0431\u043e\u0440 \u0440\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.but.removemotor = \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c
|
||||
edtmotorconfdlg.but.Selectmotor = \u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c
|
||||
MotorConfigurationPanel.btn.removeMotor = \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c
|
||||
MotorConfigurationPanel.btn.selectMotor = \u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c
|
||||
edtmotorconfdlg.but.Removeconfiguration = \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e
|
||||
edtmotorconfdlg.but.Newconfiguration = \u041d\u043e\u0432\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f
|
||||
edtmotorconfdlg.lbl.Motormounts = <html><b>\u041a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439:</b>
|
||||
MotorConfigurationPanel.lbl.motorMounts = <html><b>\u041a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439:</b>
|
||||
edtmotorconfdlg.title.Editmotorconf = \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439
|
||||
edtmotorconfdlg.selectcomp = <html>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439:
|
||||
edtmotorconfdlg.lbl.Motorconfig = <html><b>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439:</b>
|
||||
MotorConfigurationPanel.lbl.motorConfiguration = <html><b>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439:</b>
|
||||
edtmotorconfdlg.lbl.Configname = \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:
|
||||
edtmotorconfdlg.lbl.Leavenamedefault = \u041e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u043c \u0434\u043b\u044f \u0438\u043c\u0435\u043d\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.
|
||||
|
||||
|
@ -20,7 +20,6 @@ import net.sf.openrocket.gui.main.BasicFrame;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration;
|
||||
import net.sf.openrocket.rocketvisitors.CopyFlightConfigurationVisitor;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
@ -55,16 +54,17 @@ public class FlightConfigurationDialog extends JDialog {
|
||||
|
||||
JPanel panel = new JPanel(new MigLayout("fill"));
|
||||
|
||||
JLabel label = new JLabel("Selected Configuration: ");
|
||||
// FIXME: Localize
|
||||
JLabel label = new JLabel("Selected Configuration:");
|
||||
panel.add(label);
|
||||
|
||||
flightConfigurationModel = new FlightConfigurationModel(this, rocket.getDefaultConfiguration());
|
||||
JComboBox configSelector = new JComboBox(flightConfigurationModel);
|
||||
|
||||
panel.add(configSelector,"gapright para");
|
||||
panel.add(configSelector, "gapright para");
|
||||
|
||||
JButton newConfButton = new JButton(trans.get("edtmotorconfdlg.but.Newconfiguration"));
|
||||
newConfButton.addActionListener( new ActionListener() {
|
||||
newConfButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
addConfiguration();
|
||||
@ -75,10 +75,10 @@ public class FlightConfigurationDialog extends JDialog {
|
||||
panel.add(newConfButton);
|
||||
|
||||
renameConfButton = new JButton(trans.get("edtmotorconfdlg.but.Renameconfiguration"));
|
||||
renameConfButton.addActionListener( new ActionListener() {
|
||||
renameConfButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new RenameConfigDialog( rocket, FlightConfigurationDialog.this).setVisible(true);
|
||||
new RenameConfigDialog(rocket, FlightConfigurationDialog.this).setVisible(true);
|
||||
}
|
||||
});
|
||||
panel.add(renameConfButton);
|
||||
@ -101,25 +101,25 @@ public class FlightConfigurationDialog extends JDialog {
|
||||
copyConfiguration();
|
||||
}
|
||||
});
|
||||
panel.add(copyConfButton,"wrap");
|
||||
panel.add(copyConfButton, "wrap");
|
||||
|
||||
|
||||
//// Tabs for advanced view.
|
||||
JTabbedPane tabs = new JTabbedPane();
|
||||
panel.add( tabs, "grow, spanx, w 700lp, h 500lp, wrap");
|
||||
panel.add(tabs, "grow, spanx, w 700lp, h 500lp, wrap");
|
||||
|
||||
//// Motor tabs
|
||||
motorConfigurationPanel = new MotorConfigurationPanel(this,rocket);
|
||||
motorConfigurationPanel = new MotorConfigurationPanel(this, rocket);
|
||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Motortab"), motorConfigurationPanel);
|
||||
|
||||
//// Recovery tab
|
||||
recoveryConfigurationPanel = new RecoveryConfigurationPanel(this,rocket);
|
||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Recoverytab"), recoveryConfigurationPanel );
|
||||
recoveryConfigurationPanel = new RecoveryConfigurationPanel(this, rocket);
|
||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Recoverytab"), recoveryConfigurationPanel);
|
||||
|
||||
//// Stage tab
|
||||
separationConfigurationPanel = new SeparationConfigurationPanel(this,rocket);
|
||||
if ( rocket.getStageCount() > 1 ) {
|
||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Stagetab"), separationConfigurationPanel );
|
||||
separationConfigurationPanel = new SeparationConfigurationPanel(this, rocket);
|
||||
if (rocket.getStageCount() > 1) {
|
||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Stagetab"), separationConfigurationPanel);
|
||||
}
|
||||
|
||||
//// Close button
|
||||
@ -155,7 +155,7 @@ public class FlightConfigurationDialog extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
public void selectConfiguration( String id ) {
|
||||
public void selectConfiguration(String id) {
|
||||
currentID = id;
|
||||
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
||||
motorConfigurationPanel.fireTableDataChanged();
|
||||
@ -191,7 +191,7 @@ public class FlightConfigurationDialog extends JDialog {
|
||||
updateButtonState();
|
||||
}
|
||||
|
||||
public void changeConfigurationName( String newName ) {
|
||||
public void changeConfigurationName(String newName) {
|
||||
rocket.setFlightConfigurationName(currentID, newName);
|
||||
flightConfigurationModel.fireContentsUpdated();
|
||||
}
|
||||
|
@ -17,22 +17,30 @@ import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.gui.components.DescriptionArea;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
||||
import net.sf.openrocket.gui.dialogs.motor.MotorChooserDialog;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.motor.Motor;
|
||||
import net.sf.openrocket.rocketcomponent.MotorConfiguration;
|
||||
import net.sf.openrocket.rocketcomponent.MotorConfiguration.IgnitionEvent;
|
||||
import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.util.Chars;
|
||||
|
||||
public class MotorConfigurationPanel extends JPanel {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
private final FlightConfigurationDialog flightConfigurationDialog;
|
||||
private final Rocket rocket;
|
||||
|
||||
private final MotorConfigurationTableModel configurationTableModel;
|
||||
private final JButton selectMotorButton, removeMotorButton, selectIgnitionButton;
|
||||
private final JButton selectMotorButton, removeMotorButton, selectIgnitionButton, resetIgnitionButton;
|
||||
|
||||
private MotorMount currentMount = null;
|
||||
final MotorMount[] mounts;
|
||||
@ -42,21 +50,19 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
this.flightConfigurationDialog = flightConfigurationDialog;
|
||||
this.rocket = rocket;
|
||||
|
||||
DescriptionArea desc = new DescriptionArea(trans.get("description"), 3, -1);
|
||||
this.add(desc, "spanx, growx, wrap para");
|
||||
|
||||
mounts = getPotentialMotorMounts();
|
||||
|
||||
//// Motor mount selection
|
||||
//// <html><b>Motor mounts:</b>
|
||||
JLabel label = new JLabel(FlightConfigurationDialog.trans.get("edtmotorconfdlg.lbl.Motormounts"));
|
||||
this.add(label, "gapbottom para");
|
||||
JLabel label = new StyledLabel(trans.get("lbl.motorMounts"), Style.BOLD);
|
||||
this.add(label, "");
|
||||
|
||||
//// Motor selection
|
||||
//// <html><b>Motor configurations:</b>
|
||||
label = new JLabel(FlightConfigurationDialog.trans.get("edtmotorconfdlg.lbl.Motorconfig"));
|
||||
this.add(label, "gapbottom para, wrap");
|
||||
label = new StyledLabel(trans.get("lbl.motorConfiguration"), Style.BOLD);
|
||||
this.add(label, "wrap rel");
|
||||
|
||||
//// <html>Select which components function as motor mounts:
|
||||
label = new JLabel(FlightConfigurationDialog.trans.get("edtmotorconfdlg.selectcomp"));
|
||||
this.add(label, "ay 100%, w 1px, growx, wrap");
|
||||
|
||||
//// Motor Mount selection
|
||||
JTable table = new JTable(new MotorMountTableModel(this));
|
||||
@ -76,6 +82,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
JScrollPane scroll = new JScrollPane(table);
|
||||
this.add(scroll, "w 200lp, h 150lp, grow");
|
||||
|
||||
|
||||
//// Motor selection table.
|
||||
configurationTableModel = new MotorConfigurationTableModel(this, true);
|
||||
final JTable configurationTable = new JTable(configurationTableModel);
|
||||
@ -87,7 +94,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int row = configurationTable.getSelectedRow();
|
||||
|
||||
if ( row >= 0 ) {
|
||||
if (row >= 0) {
|
||||
currentMount = findMount(row);
|
||||
} else {
|
||||
currentMount = null;
|
||||
@ -112,7 +119,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
this.add(scroll, "w 500lp, h 150lp, grow, wrap");
|
||||
|
||||
//// Select motor
|
||||
selectMotorButton = new JButton(FlightConfigurationDialog.trans.get("edtmotorconfdlg.but.Selectmotor"));
|
||||
selectMotorButton = new JButton(trans.get("MotorConfigurationPanel.btn.selectMotor"));
|
||||
selectMotorButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@ -122,24 +129,35 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
this.add(selectMotorButton, "skip, split, sizegroup button");
|
||||
|
||||
//// Remove motor button
|
||||
removeMotorButton = new JButton(FlightConfigurationDialog.trans.get("edtmotorconfdlg.but.removemotor"));
|
||||
removeMotorButton = new JButton(trans.get("MotorConfigurationPanel.btn.removeMotor"));
|
||||
removeMotorButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
removeMotor();
|
||||
}
|
||||
});
|
||||
this.add(removeMotorButton,"sizegroup button");
|
||||
this.add(removeMotorButton, "sizegroup button");
|
||||
|
||||
//// Select Ignition button
|
||||
selectIgnitionButton = new JButton(FlightConfigurationDialog.trans.get("edtmotorconfdlg.but.Selectignition"));
|
||||
selectIgnitionButton = new JButton(trans.get("MotorConfigurationPanel.btn.selectIgnition"));
|
||||
selectIgnitionButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selectIgnition();
|
||||
}
|
||||
});
|
||||
this.add(selectIgnitionButton,"sizegroup button, wrap");
|
||||
this.add(selectIgnitionButton, "sizegroup button");
|
||||
|
||||
//// Reset Ignition button
|
||||
resetIgnitionButton = new JButton(trans.get("MotorConfigurationPanel.btn.resetIgnition"));
|
||||
resetIgnitionButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// FIXME
|
||||
selectIgnition();
|
||||
}
|
||||
});
|
||||
this.add(resetIgnitionButton, "sizegroup button, wrap");
|
||||
|
||||
}
|
||||
|
||||
@ -154,6 +172,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
selectMotorButton.setEnabled(currentMount != null && currentID != null);
|
||||
removeMotorButton.setEnabled(currentMount != null && currentID != null);
|
||||
selectIgnitionButton.setEnabled(currentMount != null && currentID != null);
|
||||
resetIgnitionButton.setEnabled(currentMount != null && currentID != null);
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +220,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
SelectIgnitionConfigDialog dialog = new SelectIgnitionConfigDialog(
|
||||
this.flightConfigurationDialog,
|
||||
rocket,
|
||||
currentMount );
|
||||
currentMount);
|
||||
dialog.setVisible(true);
|
||||
|
||||
flightConfigurationDialog.fireContentsUpdated();
|
||||
@ -209,8 +228,8 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
updateButtonState();
|
||||
}
|
||||
|
||||
public void makeMotorMount( MotorMount mount, boolean isMotorMount ) {
|
||||
mount.setMotorMount( isMotorMount );
|
||||
public void makeMotorMount(MotorMount mount, boolean isMotorMount) {
|
||||
mount.setMotorMount(isMotorMount);
|
||||
configurationTableModel.fireTableStructureChanged();
|
||||
updateButtonState();
|
||||
}
|
||||
@ -244,7 +263,7 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
return mount;
|
||||
}
|
||||
|
||||
public String findMotorForDisplay( int row ) {
|
||||
public String findMotorForDisplay(int row) {
|
||||
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||
MotorMount mount = findMount(row);
|
||||
Motor motor = mount.getMotor(currentID);
|
||||
@ -259,24 +278,32 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
return str;
|
||||
}
|
||||
|
||||
public String findIgnitionForDisplay( int row ) {
|
||||
public String findIgnitionForDisplay(int row) {
|
||||
String currentID = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
||||
MotorMount mount = findMount(row);
|
||||
MotorConfiguration motorConfig = mount.getFlightConfiguration(currentID);
|
||||
if (motorConfig == null)
|
||||
//// None
|
||||
if (motorConfig == null) {
|
||||
// No motor exists
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
MotorConfiguration.IgnitionEvent ignition = motorConfig.getIgnitionEvent();
|
||||
if ( ignition == null ) {
|
||||
sb.append("[").append(ellipsizeString(mount.getDefaultIgnitionEvent().toString(),15)).append("]");
|
||||
if (ignition == null) {
|
||||
|
||||
// Default ignition event
|
||||
IgnitionEvent event = mount.getDefaultIgnitionEvent();
|
||||
String def = trans.get("table.ignition.default");
|
||||
String value = trans.get("MotorMount.IgnitionEvent.short." + event.name());
|
||||
return def.replace("{0}", value);
|
||||
|
||||
} else {
|
||||
sb.append(ellipsizeString(ignition.toString(),15));
|
||||
sb.append(ellipsizeString(ignition.toString(), 15));
|
||||
}
|
||||
Double ignitionDelay = motorConfig.getIgnitionDelay();
|
||||
if ( ignitionDelay == null ) {
|
||||
if (ignitionDelay == null) {
|
||||
double defaultdelay = mount.getDefaultIgnitionDelay();
|
||||
if ( defaultdelay > 0 ) {
|
||||
if (defaultdelay > 0) {
|
||||
sb.append(" + [").append(defaultdelay).append("s]");
|
||||
}
|
||||
} else {
|
||||
@ -286,8 +313,8 @@ public class MotorConfigurationPanel extends JPanel {
|
||||
}
|
||||
|
||||
|
||||
private static String ellipsizeString( String s, int length ) {
|
||||
if ( s.length() < length ) {
|
||||
private static String ellipsizeString(String s, int length) {
|
||||
if (s.length() < length) {
|
||||
return s;
|
||||
}
|
||||
String newString = s.substring(0, length) + "...";
|
||||
|
@ -1,15 +1,61 @@
|
||||
package net.sf.openrocket.rocketcomponent;
|
||||
|
||||
/**
|
||||
* An interface defining that specific parameters of a component are
|
||||
* configurable on a per-flight-configuration basis.
|
||||
*
|
||||
* TODO: This should be refactored and redesigned. In the current
|
||||
* implementation there can be only one object that is overridable,
|
||||
* while it should be possible to have independent variables being
|
||||
* overridden. For example:
|
||||
* - motor selection and ignition selection
|
||||
* - parachute diameter and parachute deployment
|
||||
*
|
||||
* @param <T> The configuration variable type
|
||||
*/
|
||||
public interface FlightConfigurable<T> {
|
||||
|
||||
public T getFlightConfiguration( String configId );
|
||||
/**
|
||||
* Return the parameters for the provided flight configuration, or
|
||||
* <code>null</code> if they are not overridden.
|
||||
*
|
||||
* @param configId the flight configuration ID
|
||||
* @return the overridden parameters or <code>null</code>
|
||||
*/
|
||||
public T getFlightConfiguration(String configId);
|
||||
|
||||
public void setFlightConfiguration( String configId, T config );
|
||||
/**
|
||||
* Set or removing the overriding parameters for a specific flight configuration.
|
||||
* If the configuration is <code>null</code> the overriding parameters are removed.
|
||||
*
|
||||
* @param configId the flight configuration ID.
|
||||
* @param config the configuration which will override the default values.
|
||||
*/
|
||||
public void setFlightConfiguration(String configId, T config);
|
||||
|
||||
public void cloneFlightConfiguration( String oldConfigId, String newConfigId );
|
||||
/**
|
||||
* Clone a flight configuration to a new flight configuration ID.
|
||||
* This functions also in case there is no overridden values for the
|
||||
* configuration ID.
|
||||
*
|
||||
* @param oldConfigId the old configuration ID
|
||||
* @param newConfigId the new configuration ID
|
||||
*/
|
||||
public void cloneFlightConfiguration(String oldConfigId, String newConfigId);
|
||||
|
||||
/**
|
||||
* Return the default flight configuration to use if the values are not
|
||||
* overridden.
|
||||
*
|
||||
* @return the default configuration (never <code>null</code>)
|
||||
*/
|
||||
public T getDefaultFlightConfiguration();
|
||||
|
||||
public void setDefaultFlightConfiguration( T config );
|
||||
/**
|
||||
* Set the default flight configuration to use if the values are not overridden.
|
||||
*
|
||||
* @param config the default configuration (must not be <code>null</code>)
|
||||
*/
|
||||
public void setDefaultFlightConfiguration(T config);
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import net.sf.openrocket.util.BugException;
|
||||
|
||||
public class EnumName<E extends Enum<E>> {
|
||||
|
||||
public static final EnumConversion NAME = new EnumConversion() {
|
||||
private static final EnumConversion NAME = new EnumConversion() {
|
||||
@Override
|
||||
public String convert(Enum<?> e) {
|
||||
return e.name();
|
||||
|
Loading…
x
Reference in New Issue
Block a user