55 lines
1.3 KiB
Java
55 lines
1.3 KiB
Java
package envoy.client.ui.controller;
|
|
|
|
import java.util.Map;
|
|
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.control.*;
|
|
import javafx.scene.input.*;
|
|
|
|
import envoy.client.data.Context;
|
|
import envoy.client.data.shortcuts.KeyboardMapping;
|
|
import envoy.client.ui.listcell.ListCellFactory;
|
|
import envoy.client.ui.settings.*;
|
|
|
|
/**
|
|
* Controller for the settings scene.
|
|
*
|
|
* @author Kai S. K. Engelbart
|
|
* @since Envoy Client v0.1-beta
|
|
*/
|
|
public final class SettingsScene implements KeyboardMapping {
|
|
|
|
@FXML
|
|
private ListView<SettingsPane> settingsList;
|
|
|
|
@FXML
|
|
private TitledPane titledPane;
|
|
|
|
@FXML
|
|
private void initialize() {
|
|
settingsList.setCellFactory(new ListCellFactory<>(pane -> new Label(pane.getTitle())));
|
|
settingsList.getItems().addAll(new GeneralSettingsPane(), new UserSettingsPane(),
|
|
new DownloadSettingsPane(), new BugReportPane());
|
|
}
|
|
|
|
@FXML
|
|
private void settingsListClicked() {
|
|
final var pane = settingsList.getSelectionModel().getSelectedItem();
|
|
if (pane != null) {
|
|
titledPane.setText(pane.getTitle());
|
|
titledPane.setContent(pane);
|
|
}
|
|
}
|
|
|
|
@FXML
|
|
private void backButtonClicked() {
|
|
Context.getInstance().getSceneContext().pop();
|
|
}
|
|
|
|
@Override
|
|
public Map<KeyCombination, Runnable> getKeyboardShortcuts() {
|
|
return Map.of(new KeyCodeCombination(KeyCode.B, KeyCombination.CONTROL_DOWN),
|
|
this::backButtonClicked);
|
|
}
|
|
}
|