Cleanup - Statement lambda -> expression lambda

This commit is contained in:
Jetz
2024-08-10 12:58:32 -04:00
parent a7e1338eea
commit 2fb7ad0c7b
4 changed files with 32 additions and 40 deletions

View File

@@ -183,30 +183,28 @@ public class DialogChooseSets {
spinnersEditionTypeMap.put(editionType, spinner);
}
// == SPINNERS ACTION PERFORMED ==
editionTypeSpinners.forEach(spinner -> {
spinner.addChangeListener(e -> {
// As soon as the value of a spinner becomes different from zero,
// enabled the random selection button.
int spinValue = (int) spinner.getValue();
if (spinValue > 0) {
if (!randomSelectionButton.isEnabled())
randomSelectionButton.setEnabled(true);
} else {
// Similarly, when all spinners are set to zero,
// disable the random selection button
boolean allZeros = true;
for (FSpinner spin : editionTypeSpinners) {
int value = (int) spin.getValue();
if (value != 0) {
allZeros = false;
break;
}
}
if (allZeros)
randomSelectionButton.setEnabled(false);
}
});
});
editionTypeSpinners.forEach(spinner -> spinner.addChangeListener(e -> {
// As soon as the value of a spinner becomes different from zero,
// enabled the random selection button.
int spinValue = (int) spinner.getValue();
if (spinValue > 0) {
if (!randomSelectionButton.isEnabled())
randomSelectionButton.setEnabled(true);
} else {
// Similarly, when all spinners are set to zero,
// disable the random selection button
boolean allZeros = true;
for (FSpinner spin : editionTypeSpinners) {
int value = (int) spin.getValue();
if (value != 0) {
allZeros = false;
break;
}
}
if (allZeros)
randomSelectionButton.setEnabled(false);
}
}));
// == ADD SPINNERS AND LABELS TO THE PANEL ==
JPanel typeFieldsPanel = null;

View File

@@ -412,9 +412,7 @@ public enum CSubmenuPreferences implements ICDoc {
final FComboBox<String> comboBox = createComboBox(new String[] {"Off", "AI", "Human For AI"}, userSetting);
final String selectedItem = this.prefs.getPref(userSetting);
panel.setComboBox(comboBox, selectedItem);
comboBox.addActionListener(actionEvent -> {
AiProfileUtil.setAiSideboardingMode(AiProfileUtil.AISideboardingMode.normalizedValueOf(comboBox.getSelectedItem()));
});
comboBox.addActionListener(actionEvent -> AiProfileUtil.setAiSideboardingMode(AiProfileUtil.AISideboardingMode.normalizedValueOf(comboBox.getSelectedItem())));
}
private void initializeSoundSetsComboBox() {