Fix reprocess choices

Make sure the choice to continue anyway is always present.
This commit is contained in:
Douglas Gillespie 2024-06-10 09:22:30 +01:00
parent a6b0ccd780
commit f0aca0c83f
3 changed files with 21 additions and 1 deletions

View File

@ -4,6 +4,8 @@ import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.ButtonGroup;
@ -64,15 +66,28 @@ public class ReprocessChoiceDialog extends PamDialog {
List<ReprocessStoreChoice> userChoices = choiceSummary.getChoices();
choiceButtons = new JRadioButton[userChoices.size()];
ButtonGroup bg = new ButtonGroup();
SelAction selAction = new SelAction();
for (int i = 0; i < userChoices.size(); i++) {
ReprocessStoreChoice aChoice = userChoices.get(i);
choiceButtons[i] = new JRadioButton(aChoice.toString());
choiceButtons[i].setToolTipText(aChoice.getToolTip());
bg.add(choiceButtons[i]);
choiceButtons[i].addActionListener(selAction);
choicePanel.add(choiceButtons[i], c);
c.gridy++;
}
setDialogComponent(mainPanel);
getCancelButton().setVisible(false);
getOkButton().setEnabled(false);
}
private class SelAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
getOkButton().setEnabled(true);
}
}
public static ReprocessStoreChoice showDialog(Window parentFrame, StoreChoiceSummary choices) {

View File

@ -62,7 +62,7 @@ public class ReprocessManager {
*/
boolean setupOK = setupInputStream(choiceSummary, choice);
if (choice == ReprocessStoreChoice.DONTSSTART) {
if (choice == null || choice == ReprocessStoreChoice.DONTSSTART) {
return false;
}
@ -172,6 +172,8 @@ public class ReprocessManager {
choiceSummary.addChoice(ReprocessStoreChoice.STARTNORMAL);
return choiceSummary;
}
choiceSummary.addChoice(ReprocessStoreChoice.STARTNORMAL);
ArrayList<PamControlledUnit> outputStores = PamController.getInstance().findControlledUnits(DataOutputStore.class, true);
boolean partStores = false;

View File

@ -65,6 +65,9 @@ public class StoreChoiceSummary {
* @param choice
*/
public void addChoice(ReprocessStoreChoice choice) {
if (choices.contains(choice)) {
return;
}
choices.add(choice);
}