This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/src/main/java/envoy/client/ui/settings/GeneralSettingsPane.java

50 lines
1.3 KiB
Java
Raw Normal View History

2020-04-19 19:57:40 +02:00
package envoy.client.ui.settings;
2020-04-18 21:37:44 +02:00
import java.util.List;
2020-06-08 10:02:39 +02:00
import javafx.scene.control.ComboBox;
2020-04-18 16:04:47 +02:00
import javafx.scene.layout.VBox;
import envoy.client.data.Settings;
2020-04-18 21:37:44 +02:00
import envoy.client.data.SettingsItem;
2020-06-08 10:02:39 +02:00
import envoy.client.event.ThemeChangeEvent;
import envoy.event.EventBus;
/**
* Project: <strong>envoy-client</strong><br>
* File: <strong>GeneralSettingsPane.java</strong><br>
* Created: <strong>18.04.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta
*/
public class GeneralSettingsPane extends SettingsPane {
private static final Settings settings = Settings.getInstance();
/**
* @since Envoy Client v0.1-beta
*/
2020-04-18 16:04:47 +02:00
public GeneralSettingsPane() {
super("General");
var vbox = new VBox();
2020-04-18 21:37:44 +02:00
// TODO: Support other value types
List.of("onCloseMode", "enterToSend")
.stream()
.map(settings.getItems()::get)
2020-06-08 10:02:39 +02:00
.map(i -> new SettingsCheckbox((SettingsItem<Boolean>) i))
2020-04-18 21:37:44 +02:00
.forEach(vbox.getChildren()::add);
2020-06-08 10:02:39 +02:00
var combobox = new ComboBox<String>();
combobox.getItems().add("dark");
combobox.getItems().add("light");
combobox.setValue(settings.getCurrentTheme());
combobox.setOnAction(
e -> { settings.setCurrentTheme(combobox.getValue()); EventBus.getInstance().dispatch(new ThemeChangeEvent(combobox.getValue())); });
vbox.getChildren().add(combobox);
2020-04-18 16:04:47 +02:00
getChildren().add(vbox);
}
}