Adapt new/copy config windows popup based on current tab

This will make sure that e.g. when you are in the recovery tab and add a new configuration, that the deployment window opens instead of the motor selection window
This commit is contained in:
Sibo Van Gool 2022-01-30 14:03:29 +01:00
parent d0a1025f6d
commit b26ae9e541
3 changed files with 24 additions and 4 deletions

View File

@ -82,7 +82,17 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
motorConfigurationPanel.table.setColumnSelectionInterval(lastCol, lastCol); motorConfigurationPanel.table.setColumnSelectionInterval(lastCol, lastCol);
configurationChanged(ComponentChangeEvent.MOTOR_CHANGE); configurationChanged(ComponentChangeEvent.MOTOR_CHANGE);
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select
motorConfigurationPanel.selectMotor(); switch (tabs.getSelectedIndex()) {
case MOTOR_TAB_INDEX:
motorConfigurationPanel.selectMotor();
break;
case RECOVERY_TAB_INDEX:
recoveryConfigurationPanel.selectDeployment();
break;
case SEPARATION_TAB_INDEX:
separationConfigurationPanel.selectSeparation();
break;
}
} }
}); });
@ -116,7 +126,17 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
addOrCopyConfiguration(true); addOrCopyConfiguration(true);
configurationChanged(ComponentChangeEvent.MOTOR_CHANGE); configurationChanged(ComponentChangeEvent.MOTOR_CHANGE);
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select
motorConfigurationPanel.selectMotor(); switch (tabs.getSelectedIndex()) {
case MOTOR_TAB_INDEX:
motorConfigurationPanel.selectMotor();
break;
case RECOVERY_TAB_INDEX:
recoveryConfigurationPanel.selectDeployment();
break;
case SEPARATION_TAB_INDEX:
separationConfigurationPanel.selectSeparation();
break;
}
} }
}); });
this.add(copyConfButton, "wrap"); this.add(copyConfButton, "wrap");

View File

@ -97,7 +97,7 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel<Recovery
return recoveryTable; return recoveryTable;
} }
private void selectDeployment() { public void selectDeployment() {
RecoveryDevice c = getSelectedComponent(); RecoveryDevice c = getSelectedComponent();
FlightConfigurationId fcid = getSelectedConfigurationId(); FlightConfigurationId fcid = getSelectedConfigurationId();
if ((c == null) || (fcid == null)) { if ((c == null) || (fcid == null)) {

View File

@ -104,7 +104,7 @@ public class SeparationConfigurationPanel extends FlightConfigurablePanel<AxialS
return separationTable; return separationTable;
} }
private void selectSeparation() { public void selectSeparation() {
AxialStage stage = getSelectedComponent(); AxialStage stage = getSelectedComponent();
FlightConfigurationId fcid = getSelectedConfigurationId(); FlightConfigurationId fcid = getSelectedConfigurationId();
if ((stage == null) || (fcid == null)) { if ((stage == null) || (fcid == null)) {