Scheduler: Autostart-Feature entfernen
Der Scheduler startet niemals automatisch beim Programmstart. Der Nutzer startet ihn ausschliesslich bewusst ueber den Start-Button im Scheduler-Tab. scheduler.enabled wird nicht mehr gelesen oder geschrieben; das Property ist obsolet. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+1
-71
@@ -40,9 +40,6 @@ import javafx.scene.layout.VBox;
|
||||
*
|
||||
* <h2>Bereiche</h2>
|
||||
* <ul>
|
||||
* <li><strong>Autostart-Fehler-Banner</strong>: Sichtbar wenn beim Programmstart
|
||||
* ein konfigurierter Autostart fehlgeschlagen ist. Bietet Schnellaktionen zum
|
||||
* Starten des Schedulers oder zum Deaktivieren des Autostarts.</li>
|
||||
* <li><strong>Scheduler-Steuerung</strong>: Status-Anzeige (● Aktiv / ○ Gestoppt),
|
||||
* Start-/Stopp-Schaltflächen, Countdown bis zum nächsten Lauf,
|
||||
* Letzter-Lauf-Info, Fehlermeldung und Intervall-Konfiguration.</li>
|
||||
@@ -88,21 +85,6 @@ public final class GuiSchedulerTab {
|
||||
private final TextField intervalField = new TextField();
|
||||
private final Label intervalValidationLabel = new Label();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Bereich 2: Autostart-Fehler-Banner
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
private final VBox autostartErrorBanner = new VBox(6);
|
||||
private final Label autostartErrorDetailLabel = new Label();
|
||||
private final Button autostartStartButton = new Button("Scheduler starten");
|
||||
private final Button autostartDisableButton = new Button("Autostart deaktivieren");
|
||||
|
||||
/**
|
||||
* Wenn {@code true}, wird das Autostart-Fehler-Banner dauerhaft ausgeblendet
|
||||
* (weil der Benutzer „Autostart deaktivieren" geklickt hat).
|
||||
*/
|
||||
private boolean autostartBannerDismissed = false;
|
||||
|
||||
private final ExecutorService workerExecutor = Executors.newSingleThreadExecutor(r -> {
|
||||
Thread t = new Thread(r, "gui-scheduler-control");
|
||||
t.setDaemon(true);
|
||||
@@ -180,7 +162,6 @@ public final class GuiSchedulerTab {
|
||||
updateLastRunLabel(status);
|
||||
updateLastErrorLabel(status);
|
||||
updateIntervalFieldEditability(status);
|
||||
updateAutostartBanner(status);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -188,27 +169,11 @@ public final class GuiSchedulerTab {
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
private void buildUi() {
|
||||
buildAutostartBanner();
|
||||
VBox controlArea = buildControlArea();
|
||||
VBox content = new VBox(0, autostartErrorBanner, controlArea);
|
||||
tab.setContent(content);
|
||||
tab.setContent(controlArea);
|
||||
wireActions();
|
||||
}
|
||||
|
||||
private void buildAutostartBanner() {
|
||||
Label autostartTitleLabel = new Label("⚠ Autostart fehlgeschlagen – Scheduler ist nicht aktiv.");
|
||||
autostartTitleLabel.setStyle("-fx-font-weight: bold;");
|
||||
autostartErrorDetailLabel.setWrapText(true);
|
||||
HBox bannerButtons = new HBox(10, autostartStartButton, autostartDisableButton);
|
||||
autostartErrorBanner.getChildren().addAll(
|
||||
autostartTitleLabel, autostartErrorDetailLabel, bannerButtons);
|
||||
autostartErrorBanner.setStyle(
|
||||
"-fx-background-color: #fff3cd; -fx-border-color: #ffc107;"
|
||||
+ " -fx-border-width: 1; -fx-padding: 10;");
|
||||
autostartErrorBanner.setVisible(false);
|
||||
autostartErrorBanner.setManaged(false);
|
||||
}
|
||||
|
||||
private VBox buildControlArea() {
|
||||
statusLabel.setStyle(HEADER_LABEL_STYLE);
|
||||
|
||||
@@ -251,8 +216,6 @@ public final class GuiSchedulerTab {
|
||||
private void wireActions() {
|
||||
startButton.setOnAction(e -> executeStart());
|
||||
stopButton.setOnAction(e -> executeStop());
|
||||
autostartStartButton.setOnAction(e -> executeStart());
|
||||
autostartDisableButton.setOnAction(e -> executeDisableAutostart());
|
||||
|
||||
intervalField.focusedProperty().addListener((obs, wasFocused, focused) -> {
|
||||
if (!focused) {
|
||||
@@ -334,7 +297,6 @@ public final class GuiSchedulerTab {
|
||||
stopButton.setDisable(true);
|
||||
}
|
||||
}
|
||||
autostartStartButton.setDisable(startButton.isDisable());
|
||||
}
|
||||
|
||||
private void updateNextTickLabel(SchedulerStatus status) {
|
||||
@@ -394,17 +356,6 @@ public final class GuiSchedulerTab {
|
||||
intervalField.setDisable(!editable);
|
||||
}
|
||||
|
||||
private void updateAutostartBanner(SchedulerStatus status) {
|
||||
boolean show = status.autostartFailed()
|
||||
&& !autostartBannerDismissed
|
||||
&& !status.state().isActive();
|
||||
autostartErrorBanner.setVisible(show);
|
||||
autostartErrorBanner.setManaged(show);
|
||||
if (show) {
|
||||
status.lastError().ifPresent(autostartErrorDetailLabel::setText);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Aktions-Handler
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -412,7 +363,6 @@ public final class GuiSchedulerTab {
|
||||
private void executeStart() {
|
||||
LOG.info("GUI: Scheduler-Start angefordert.");
|
||||
startButton.setDisable(true);
|
||||
autostartStartButton.setDisable(true);
|
||||
stopButton.setDisable(true);
|
||||
workerExecutor.submit(() -> schedulerUseCase.ifPresent(uc -> {
|
||||
try {
|
||||
@@ -442,26 +392,6 @@ public final class GuiSchedulerTab {
|
||||
}));
|
||||
}
|
||||
|
||||
private void executeDisableAutostart() {
|
||||
LOG.info("GUI: Autostart-Deaktivierung angefordert.");
|
||||
autostartDisableButton.setDisable(true);
|
||||
workerExecutor.submit(() -> schedulerUseCase.ifPresent(uc -> {
|
||||
try {
|
||||
uc.disableAutostart();
|
||||
LOG.info("GUI: Autostart erfolgreich deaktiviert.");
|
||||
Platform.runLater(() -> {
|
||||
autostartBannerDismissed = true;
|
||||
autostartErrorBanner.setVisible(false);
|
||||
autostartErrorBanner.setManaged(false);
|
||||
autostartDisableButton.setDisable(false);
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
LOG.error("GUI: Fehler beim Deaktivieren des Autostarts.", e);
|
||||
Platform.runLater(() -> autostartDisableButton.setDisable(false));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void validateAndSaveInterval() {
|
||||
String text = intervalField.getText() == null ? "" : intervalField.getText().trim();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user