Here’s a simple JavaFX controller class for your FXML. It wires up all of your fx:id fields and the two action‐handlers. You can fill in the “TODO” sections with your actual business logic or hook into your scanner service / model.
package ch.zhaw.pm3.group06.filsor.controller;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.text.Text;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Controller for AutomaticScannerObservable.fxml
*/
public class AutomaticScannerObservable implements Initializable {
@FXML
private Text automaticScanDirectory;
@FXML
private Text arrangementDirectory;
@FXML
private Text overwriteDuplicates;
@FXML
private Button cancelButton;
@FXML
private Button resetButton;
@Override
public void initialize(URL location, ResourceBundle resources) {
// Initial UI setup
cancelButton.setDisable(true);
// You can also initialize the labels here, for example:
// automaticScanDirectory.setText("No scan running");
// arrangementDirectory.setText("No target set");
// overwriteDuplicates.setText("false");
}
/**
* Called when "Automatischen Scanner deaktivieren" is clicked.
*/
@FXML
private void deactivateAction(ActionEvent event) {
// TODO: hook into your scanner‐service and stop it
System.out.println("Deactivating automatic scanner…");
// update UI
cancelButton.setDisable(true);
resetButton.setDisable(false);
automaticScanDirectory.setText("automatischer Scanner nicht aktiv");
arrangementDirectory.setText("automatischer Scanner nicht aktiv");
overwriteDuplicates.setText("automatischer Scanner nicht aktiv");
}
/**
* Called when "Automatischen Scanner anpassen" is clicked.
*/
@FXML
private void updateAction(ActionEvent event) {
// TODO: open a settings dialog or update the scanner parameters
System.out.println("Opening scanner settings…");
// Example: Enable the cancel button once scanner is running
cancelButton.setDisable(false);
resetButton.setDisable(false);
// TODO: after your user updates settings,
// update the labels accordingly, e.g.:
// automaticScanDirectory.setText(newSourceDir);
// arrangementDirectory.setText(newTargetDir);
// overwriteDuplicates.setText(overwrite ? "Ja" : "Nein");
}
}
Explanation of the key parts:
• Each @FXML field matches the fx:id in your FXML.
• initialize(...) is called right after the FXML is loaded—use it to set initial states.
• The two action methods (deactivateAction, updateAction) are wired via onAction="#...". You can add your actual logic there (e.g. calling a service, showing a dialog, binding to an observable model, etc.).