Fix some ui update and data entry issues.
This commit is contained in:
parent
9d44df1af3
commit
a0b3ccae08
@ -32,6 +32,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
private final JButton renameConfButton, removeConfButton, copyConfButton;
|
private final JButton renameConfButton, removeConfButton, copyConfButton;
|
||||||
|
|
||||||
private final MotorConfigurationPanel motorConfigurationPanel;
|
private final MotorConfigurationPanel motorConfigurationPanel;
|
||||||
|
private final RecoveryConfigurationPanel recoveryConfigurationPanel;
|
||||||
|
|
||||||
private String currentID = null;
|
private String currentID = null;
|
||||||
|
|
||||||
@ -108,7 +109,8 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Motortab"), motorConfigurationPanel);
|
tabs.add(trans.get("edtmotorconfdlg.lbl.Motortab"), motorConfigurationPanel);
|
||||||
|
|
||||||
//// Recovery tab
|
//// Recovery tab
|
||||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Recoverytab"), new RecoveryConfigurationPanel(this,rocket));
|
recoveryConfigurationPanel = new RecoveryConfigurationPanel(this,rocket);
|
||||||
|
tabs.add(trans.get("edtmotorconfdlg.lbl.Recoverytab"), recoveryConfigurationPanel );
|
||||||
|
|
||||||
//// Close button
|
//// Close button
|
||||||
JButton close = new JButton(trans.get("dlg.but.close"));
|
JButton close = new JButton(trans.get("dlg.but.close"));
|
||||||
@ -147,7 +149,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
currentID = id;
|
currentID = id;
|
||||||
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
recoveryConfigurationPanel.fireTableDataChanged();
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,15 +157,13 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
currentID = rocket.newFlightConfigurationID();
|
currentID = rocket.newFlightConfigurationID();
|
||||||
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(currentID);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
|
recoveryConfigurationPanel.fireTableDataChanged();
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeConfigurationName( String newName ) {
|
public void changeConfigurationName( String newName ) {
|
||||||
rocket.setFlightConfigurationName(currentID, newName);
|
rocket.setFlightConfigurationName(currentID, newName);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
|
||||||
// FIXME - update data in recovery configuration panel
|
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,8 +173,8 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
rocket.removeFlightConfigurationID(currentID);
|
rocket.removeFlightConfigurationID(currentID);
|
||||||
rocket.getDefaultConfiguration().setFlightConfigurationID(null);
|
rocket.getDefaultConfiguration().setFlightConfigurationID(null);
|
||||||
motorConfigurationPanel.fireTableDataChanged();
|
motorConfigurationPanel.fireTableDataChanged();
|
||||||
// FIXME - update data in recovery configuration panel
|
|
||||||
flightConfigurationModel.fireContentsUpdated();
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
|
recoveryConfigurationPanel.fireTableDataChanged();
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
removeConfButton.setEnabled(currentID != null);
|
removeConfButton.setEnabled(currentID != null);
|
||||||
renameConfButton.setEnabled(currentID != null);
|
renameConfButton.setEnabled(currentID != null);
|
||||||
motorConfigurationPanel.updateButtonState();
|
motorConfigurationPanel.updateButtonState();
|
||||||
// FIXME - update button state in recovery configuration panel
|
recoveryConfigurationPanel.updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
import net.sf.openrocket.gui.dialogs.motor.MotorChooserDialog;
|
import net.sf.openrocket.gui.dialogs.motor.MotorChooserDialog;
|
||||||
import net.sf.openrocket.gui.util.GUIUtil;
|
import net.sf.openrocket.gui.util.GUIUtil;
|
||||||
import net.sf.openrocket.motor.Motor;
|
import net.sf.openrocket.motor.Motor;
|
||||||
|
import net.sf.openrocket.rocketcomponent.MotorConfiguration;
|
||||||
import net.sf.openrocket.rocketcomponent.MotorMount;
|
import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
import net.sf.openrocket.rocketcomponent.MotorMount.IgnitionEvent;
|
|
||||||
import net.sf.openrocket.util.Chars;
|
import net.sf.openrocket.util.Chars;
|
||||||
|
|
||||||
public class MotorConfigurationPanel extends JPanel {
|
public class MotorConfigurationPanel extends JPanel {
|
||||||
@ -135,7 +135,9 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void fireTableDataChanged() {
|
public void fireTableDataChanged() {
|
||||||
|
currentMount = null;
|
||||||
configurationTableModel.fireTableDataChanged();
|
configurationTableModel.fireTableDataChanged();
|
||||||
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateButtonState() {
|
public void updateButtonState() {
|
||||||
@ -238,7 +240,7 @@ public class MotorConfigurationPanel extends JPanel {
|
|||||||
if (motor == null)
|
if (motor == null)
|
||||||
//// None
|
//// None
|
||||||
return null;
|
return null;
|
||||||
IgnitionEvent ignition = mount.getIgnitionEvent();
|
MotorConfiguration.IgnitionEvent ignition = mount.getIgnitionEvent();
|
||||||
return ignition.toString();
|
return ignition.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ public class RecoveryConfigurationPanel extends JPanel {
|
|||||||
|
|
||||||
private final FlightConfigurationDialog flightConfigurationDialog;
|
private final FlightConfigurationDialog flightConfigurationDialog;
|
||||||
private final Rocket rocket;
|
private final Rocket rocket;
|
||||||
|
|
||||||
|
private final RecoveryTableModel recoveryTableModel;
|
||||||
private final JButton selectDeploymentButton;
|
private final JButton selectDeploymentButton;
|
||||||
private final JButton resetDeploymentButton;
|
private final JButton resetDeploymentButton;
|
||||||
|
|
||||||
@ -35,7 +37,8 @@ public class RecoveryConfigurationPanel extends JPanel {
|
|||||||
this.rocket = rocket;
|
this.rocket = rocket;
|
||||||
|
|
||||||
//// Recovery selection
|
//// Recovery selection
|
||||||
JTable table = new JTable( new RecoveryTableModel() );
|
recoveryTableModel = new RecoveryTableModel();
|
||||||
|
JTable table = new JTable( recoveryTableModel );
|
||||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
table.setCellSelectionEnabled(true);
|
table.setCellSelectionEnabled(true);
|
||||||
table.addMouseListener(new MouseAdapter() {
|
table.addMouseListener(new MouseAdapter() {
|
||||||
@ -89,19 +92,31 @@ public class RecoveryConfigurationPanel extends JPanel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fireTableDataChanged() {
|
||||||
|
selectedComponent = null;
|
||||||
|
recoveryTableModel.fireTableDataChanged();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
private void selectDeployment() {
|
private void selectDeployment() {
|
||||||
JDialog d = new SelectDeploymentConfigDialog( flightConfigurationDialog, rocket, selectedComponent );
|
JDialog d = new SelectDeploymentConfigDialog( flightConfigurationDialog, rocket, selectedComponent );
|
||||||
d.setVisible(true);
|
d.setVisible(true);
|
||||||
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetDeployment() {
|
private void resetDeployment() {
|
||||||
selectedComponent.setFlightConfiguration(rocket.getDefaultConfiguration().getFlightConfigurationID(), null);
|
selectedComponent.setFlightConfiguration(rocket.getDefaultConfiguration().getFlightConfigurationID(), null);
|
||||||
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtonState() {
|
public void updateButtonState() {
|
||||||
boolean buttonsEnabled = selectedComponent != null;
|
boolean componentSelected = selectedComponent != null;
|
||||||
selectDeploymentButton.setEnabled(buttonsEnabled);
|
boolean isDefaulted = true;
|
||||||
resetDeploymentButton.setEnabled(buttonsEnabled);
|
if ( componentSelected ) {
|
||||||
|
isDefaulted = selectedComponent.getFlightConfiguration(rocket.getDefaultConfiguration().getFlightConfigurationID()) == null;
|
||||||
|
}
|
||||||
|
selectDeploymentButton.setEnabled(componentSelected);
|
||||||
|
resetDeploymentButton.setEnabled(componentSelected & ! isDefaulted);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RecoveryDevice findRecoveryDevice( int count ) {
|
private RecoveryDevice findRecoveryDevice( int count ) {
|
||||||
|
@ -110,7 +110,7 @@ public class SelectDeploymentConfigDialog extends JDialog {
|
|||||||
newConfiguration.setDeployDelay(deployDelay);
|
newConfiguration.setDeployDelay(deployDelay);
|
||||||
|
|
||||||
//// extract altitude;
|
//// extract altitude;
|
||||||
double deployAltitude = alt.getCurrentUnit().fromUnit( alt.getValue() );
|
double deployAltitude = alt.getValue();
|
||||||
newConfiguration.setDeployAltitude(deployAltitude);
|
newConfiguration.setDeployAltitude(deployAltitude);
|
||||||
|
|
||||||
component.setFlightConfiguration(configId, newConfiguration);
|
component.setFlightConfiguration(configId, newConfiguration);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user