Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.SwingUtilities;
import java.util.HashMap;
import java.util.Map;

import static java.util.concurrent.CompletableFuture.runAsync;

public class StatsMenu extends AbstractEnigmaMenu {
private final JCheckBoxMenuItem enableIcons = new JCheckBoxMenuItem();
private final JCheckBoxMenuItem includeSynthetic = new JCheckBoxMenuItem();
Expand Down Expand Up @@ -67,17 +70,17 @@ public void updateState(boolean jarOpen, ConnectionState state) {

private void onEnableIconsClicked() {
Config.main().features.enableClassTreeStatIcons.setValue(this.enableIcons.isSelected());
this.gui.getController().regenerateAndUpdateStatIcons();
this.updateIconsLater();
}

private void onIncludeSyntheticClicked() {
Config.main().stats.shouldIncludeSyntheticParameters.setValue(this.includeSynthetic.isSelected());
this.gui.getController().regenerateAndUpdateStatIcons();
this.updateIconsLater();
}

private void onCountFallbackClicked() {
Config.main().stats.shouldCountFallbackNames.setValue(this.countFallback.isSelected());
this.gui.getController().regenerateAndUpdateStatIcons();
this.updateIconsLater();
}

private void onCheckboxClicked(StatType type) {
Expand All @@ -89,6 +92,10 @@ private void onCheckboxClicked(StatType type) {
Config.stats().includedStatTypes.value().remove(type);
}

this.gui.getController().regenerateAndUpdateStatIcons();
this.updateIconsLater();
}

private void updateIconsLater() {
SwingUtilities.invokeLater(() -> runAsync(() -> this.gui.getController().regenerateAndUpdateStatIcons()));
}
}