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/client/src/main/java/envoy/client/ui/settings/GeneralSettingsPane.java

51 lines
1.5 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
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.data.User.UserStatus;
2020-06-08 10:02:39 +02:00
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 {
/**
* @since Envoy Client v0.1-beta
*/
2020-04-18 16:04:47 +02:00
public GeneralSettingsPane() {
super("General");
2020-04-18 21:37:44 +02:00
// TODO: Support other value types
List.of("hideOnClose", "enterToSend")
2020-04-18 21:37:44 +02:00
.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
final var combobox = new ComboBox<String>();
2020-06-08 10:02:39 +02:00
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);
final var statusComboBox = new ComboBox<UserStatus>();
statusComboBox.getItems().setAll(UserStatus.values());
statusComboBox.setValue(UserStatus.ONLINE);
// TODO add action when value is changed
statusComboBox.setOnAction(e -> {});
vbox.getChildren().add(statusComboBox);
2020-04-18 16:04:47 +02:00
}
}