[Resolves #377] new Configuration Button now updates to be available if motor mounts are present.

This commit is contained in:
Daniel_M_Williams 2017-10-29 18:00:43 -04:00
parent 9bfaf8877e
commit 2379fbae95

View File

@ -54,6 +54,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
this.document = doc; this.document = doc;
this.rocket = doc.getRocket(); this.rocket = doc.getRocket();
this.rocket.addChangeListener(this);
//JPanel panel = new JPanel(new MigLayout("fill","[grow][][][][][grow]")); //JPanel panel = new JPanel(new MigLayout("fill","[grow][][][][][grow]"));
@ -159,7 +160,6 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
FlightConfigurationId currentId = this.motorConfigurationPanel.getSelectedConfigurationId(); FlightConfigurationId currentId = this.motorConfigurationPanel.getSelectedConfigurationId();
if (currentId == null) if (currentId == null)
return; return;
System.err.println(this.rocket.toDebugConfigs());
document.removeFlightConfigurationAndSimulations(currentId); document.removeFlightConfigurationAndSimulations(currentId);
configurationChanged(); configurationChanged();
} }
@ -180,7 +180,6 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
motorConfigurationPanel.fireTableDataChanged(); motorConfigurationPanel.fireTableDataChanged();
recoveryConfigurationPanel.fireTableDataChanged(); recoveryConfigurationPanel.fireTableDataChanged();
separationConfigurationPanel.fireTableDataChanged(); separationConfigurationPanel.fireTableDataChanged();
updateButtonState();
} }
private void updateButtonState() { private void updateButtonState() {
@ -199,7 +198,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
// Count the number of stages // Count the number of stages
int stageCount = rocket.getStageCount(); int stageCount = rocket.getStageCount();
// Enable the new configuration button only when a motor mount is defined. // Enable the new configuration button only when a motor mount is defined.
newConfButton.setEnabled(motorMountCount > 0); newConfButton.setEnabled(motorMountCount > 0);
// Only enable the recovery tab if there is a motor mount and there is a recovery device // Only enable the recovery tab if there is a motor mount and there is a recovery device