57 lines
1.3 KiB
Java
57 lines
1.3 KiB
Java
package envoy.client.ui;
|
|
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.control.*;
|
|
|
|
/**
|
|
* Project: <strong>envoy-client</strong><br>
|
|
* File: <strong>SettingsSceneController.java</strong><br>
|
|
* Created: <strong>10.04.2020</strong><br>
|
|
*
|
|
* @author Kai S. K. Engelbart
|
|
* @since Envoy Client v0.1-beta
|
|
*/
|
|
public class SettingsSceneController {
|
|
|
|
private Startup startup;
|
|
@FXML
|
|
private ListView<SettingsPane> settingsList;
|
|
|
|
@FXML
|
|
private TitledPane titledPane;
|
|
|
|
/**
|
|
* initializes the object needed to reset the scene
|
|
*
|
|
* @param startup the instance of startup that stores the stage
|
|
* @since Envoy Client v0.1-beta
|
|
*/
|
|
public void initializeData(Startup startup) { this.startup = startup; }
|
|
|
|
@FXML
|
|
private void initialize() {
|
|
settingsList.setCellFactory(listView -> new ListCell<>() {
|
|
|
|
@Override
|
|
protected void updateItem(SettingsPane item, boolean empty) {
|
|
super.updateItem(item, empty);
|
|
if (!empty && item != null) setGraphic(new Label(item.getTitle()));
|
|
}
|
|
});
|
|
|
|
settingsList.getItems().add(new GeneralSettingsPane());
|
|
}
|
|
|
|
@FXML
|
|
private void settingsListClicked() {
|
|
final var pane = settingsList.getSelectionModel().getSelectedItem();
|
|
if (pane != null) {
|
|
titledPane.setText(pane.getTitle());
|
|
titledPane.setContent(pane);
|
|
}
|
|
}
|
|
|
|
@FXML
|
|
private void backButtonClicked() { startup.restoreScene(false); }
|
|
}
|