[fixes #1088] Select booster motor first
This commit is contained in:
parent
ba973961cd
commit
b3399f2d35
@ -84,7 +84,7 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
private final JTable doTableInitialization() {
|
private final JTable doTableInitialization() {
|
||||||
JTable table = this.initializeTable();
|
JTable table = this.initializeTable();
|
||||||
FlightConfigurationId current = this.rocket.getSelectedConfiguration().getFlightConfigurationID();
|
FlightConfigurationId current = this.rocket.getSelectedConfiguration().getFlightConfigurationID();
|
||||||
int col = (table.getColumnCount() > 1) ? 1 : 0;
|
int col = (table.getColumnCount() > 1) ? table.getColumnCount() - 1 : 0;
|
||||||
for (int row = 0; row < table.getRowCount(); row++) {
|
for (int row = 0; row < table.getRowCount(); row++) {
|
||||||
FlightConfigurationId rowFCID = rocket.getId(row);
|
FlightConfigurationId rowFCID = rocket.getId(row);
|
||||||
if (rowFCID.equals(current)) {
|
if (rowFCID.equals(current)) {
|
||||||
@ -107,7 +107,7 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
// We'll select the correct row, in the currently selected column.
|
// We'll select the correct row, in the currently selected column.
|
||||||
int col = table.getSelectedColumn();
|
int col = table.getSelectedColumn();
|
||||||
if ( col < 0 ) {
|
if ( col < 0 ) {
|
||||||
col = (table.getColumnCount() > 1) ? 1 : 0;
|
col = (table.getColumnCount() > 1) ? table.getColumnCount() - 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int rowNum = 0; rowNum < table.getRowCount(); rowNum++ ) {
|
for( int rowNum = 0; rowNum < table.getRowCount(); rowNum++ ) {
|
||||||
|
@ -76,25 +76,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
newConfButton.addActionListener(new ActionListener() {
|
newConfButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
newOrCopyConfigAction(false);
|
||||||
addOrCopyConfiguration(false);
|
|
||||||
int lastRow = motorConfigurationPanel.table.getRowCount() - 1;
|
|
||||||
int lastCol = motorConfigurationPanel.table.getColumnCount() - 1;
|
|
||||||
motorConfigurationPanel.table.setRowSelectionInterval(lastRow, lastRow);
|
|
||||||
motorConfigurationPanel.table.setColumnSelectionInterval(lastCol, lastCol);
|
|
||||||
configurationChanged(ComponentChangeEvent.MOTOR_CHANGE);
|
|
||||||
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select
|
|
||||||
switch (tabs.getSelectedIndex()) {
|
|
||||||
case MOTOR_TAB_INDEX:
|
|
||||||
motorConfigurationPanel.selectMotor();
|
|
||||||
break;
|
|
||||||
case RECOVERY_TAB_INDEX:
|
|
||||||
recoveryConfigurationPanel.selectDeployment();
|
|
||||||
break;
|
|
||||||
case SEPARATION_TAB_INDEX:
|
|
||||||
separationConfigurationPanel.selectSeparation();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -125,20 +107,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
copyConfButton.addActionListener(new ActionListener() {
|
copyConfButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
addOrCopyConfiguration(true);
|
newOrCopyConfigAction(true);
|
||||||
configurationChanged(ComponentChangeEvent.MOTOR_CHANGE);
|
|
||||||
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select
|
|
||||||
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");
|
||||||
@ -166,6 +135,28 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
this.add(tabs, "spanx, grow, wrap rel");
|
this.add(tabs, "spanx, grow, wrap rel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action for when the new configuration or copy configuration button is pressed.
|
||||||
|
* @param copy if True, then copy configuration operation, if False then create a new configuration
|
||||||
|
*/
|
||||||
|
private void newOrCopyConfigAction(boolean copy) {
|
||||||
|
addOrCopyConfiguration(copy);
|
||||||
|
configurationChanged(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
|
stateChanged(null);
|
||||||
|
switch (tabs.getSelectedIndex()) {
|
||||||
|
case MOTOR_TAB_INDEX:
|
||||||
|
motorConfigurationPanel.selectMotor();
|
||||||
|
break;
|
||||||
|
case RECOVERY_TAB_INDEX:
|
||||||
|
recoveryConfigurationPanel.selectDeployment();
|
||||||
|
break;
|
||||||
|
case SEPARATION_TAB_INDEX:
|
||||||
|
separationConfigurationPanel.selectSeparation();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* either create or copy configuration
|
* either create or copy configuration
|
||||||
* set new configuration as current
|
* set new configuration as current
|
||||||
|
Loading…
x
Reference in New Issue
Block a user