Class MainViewController
java.lang.Object
de.spiritscorp.datasync.controller.MainViewController
- All Implemented Interfaces:
ViewController
Central controller implementation executing operational state translations and business action flows.
Acting as the primary orchestrator (Mediator pattern), this component decouples the reactive JavaFX user interface layer from the transactional backend service domains and persistence engines. It intercepts user-driven view interactions, coordinates lifecycle mutations of background synchronization tasks, and dispatches state-change signals across the active runtime workspace.
Acting as the primary orchestrator (Mediator pattern), this component decouples the reactive JavaFX user interface layer from the transactional backend service domains and persistence engines. It intercepts user-driven view interactions, coordinates lifecycle mutations of background synchronization tasks, and dispatches state-change signals across the active runtime workspace.
- Since:
- 1.2.0
- Author:
- Tom Spirit
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe timeout limit in milliseconds for asynchronous background processes (e.g., automated file or task scans).static final intThe timeout limit in milliseconds for regular, worker threads before a forced termination is triggered. -
Constructor Summary
ConstructorsConstructorDescriptionMainViewController(Gui gui) Constructs a primary controller instance, automatically provisioning the underlying dialog subsystem using the active window stage hook. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSelectedDuplicates(SyncJobContext jobContext) Triggers a destructive purging routine to eliminate identified duplicate entities within the scope of the given synchronization task context.voidRequests an orderly, programmatic termination of the entire application ecosystem.voidhandleAutostart(boolean autostart) Handles the configuration update for the application's operating system autostart behavior.voidHandles the creation and append workflow for a new managed task synchronization context instance.voidPermanently removes a task entity context from the global orchestrator matrix tracking layer.voidhandleDragJob(int newIdx, int draggedIdx) Coordinates and processes drag-and-drop reordering requests originating from the job list.voidCreates an independent copy of the currently selected task parameters profile mapping.voidInitiates execution of processing operations based on active configuration parameters.voidhandleNavigate(Gui.ViewState state) Handles switching between different primary view layers within the main viewport.voidTriggers the specialized configuration context dialog to change a job instance identification label.voidhandleSaveSettings(AppTheme targetTheme) Commits altered orchestration state variables using the encapsulated properties entity carrier.voidStop execution of processing operations based on active configuration parameters.voidRegisters a native host operating system runtime shutdown hook within the virtual machine to intercept external termination signals.voidrunInBackground(boolean firstStart) Asynchronously dispatches the orchestration engine onto a background worker thread.
-
Field Details
-
BG_TIMEOUT
public static final int BG_TIMEOUTThe timeout limit in milliseconds for asynchronous background processes (e.g., automated file or task scans).- See Also:
-
EXIT_TIMEOUT
public static final int EXIT_TIMEOUTThe timeout limit in milliseconds for regular, worker threads before a forced termination is triggered.- See Also:
-
-
Constructor Details
-
MainViewController
Constructs a primary controller instance, automatically provisioning the underlying dialog subsystem using the active window stage hook.- Parameters:
gui- The primary user interface orchestration shell managing view states and layouts.
-
-
Method Details
-
registerNativeShutdownHook
public void registerNativeShutdownHook()Description copied from interface:ViewControllerRegisters a native host operating system runtime shutdown hook within the virtual machine to intercept external termination signals.
This hook acts as a defensive fallback mechanism that catches OS-level interrupts such as SIGTERM, unexpected system logoffs, or manual console terminations (e.g., Ctrl+C). Upon interception, it ensures a controlled transition to essential cleanup routines, allowing the application to preserve data integrity, flush pending transaction logs, and prevent file system corruption before the JVM process is completely killed by the host environment.- Specified by:
registerNativeShutdownHookin interfaceViewController
-
handleApplicationShutdown
public void handleApplicationShutdown()Description copied from interface:ViewControllerRequests an orderly, programmatic termination of the entire application ecosystem.
Unlike defensive signal trapping, this method orchestrates the intentional, graceful shutdown lifecycle of active runtime components. It systematically cancels active synchronization tasks, halts scheduled background thread daemons, safely releases locked file descriptors, persists outstanding preference states to disk, and ultimately triggers a clean exit of the JavaFX platform runtime environment.- Specified by:
handleApplicationShutdownin interfaceViewController
-
runInBackground
public void runInBackground(boolean firstStart) Description copied from interface:ViewControllerAsynchronously dispatches the orchestration engine onto a background worker thread. Optionally defers the initial execution sequence to accommodate bootstrap stabilization, dependency initialization, or throttling requirements during application startup.- Specified by:
runInBackgroundin interfaceViewController- Parameters:
firstStart- true to enforce an initial structural delay prior to thread execution; false for immediate background execution.
-
handleAutostart
public void handleAutostart(boolean autostart) Description copied from interface:ViewControllerHandles the configuration update for the application's operating system autostart behavior.
This method is triggered upon user interaction with the global autostart controls. It delegates the registration or removal of the application's boot-time execution hooks to the system integration layer, enabling the application to load minimized during system startup.- Specified by:
handleAutostartin interfaceViewController- Parameters:
autostart-trueto register the application for automatic launch on system boot;falseto remove the autostart registration hook
-
handleCreateNewJob
public void handleCreateNewJob()Description copied from interface:ViewControllerHandles the creation and append workflow for a new managed task synchronization context instance.- Specified by:
handleCreateNewJobin interfaceViewController
-
handleRenameJob
Description copied from interface:ViewControllerTriggers the specialized configuration context dialog to change a job instance identification label.- Specified by:
handleRenameJobin interfaceViewController- Parameters:
job- The source configuration instance payload.
-
handleDuplicateJob
Description copied from interface:ViewControllerCreates an independent copy of the currently selected task parameters profile mapping.- Specified by:
handleDuplicateJobin interfaceViewController- Parameters:
job- The source configuration instance payload.
-
deleteSelectedDuplicates
Description copied from interface:ViewControllerTriggers a destructive purging routine to eliminate identified duplicate entities within the scope of the given synchronization task context. Mutates the active memory allocation state and immediately persists structural changes.- Specified by:
deleteSelectedDuplicatesin interfaceViewController- Parameters:
jobContext- The specific synchronization runtime context targeting duplicate remediation.
-
handleDeleteJob
Description copied from interface:ViewControllerPermanently removes a task entity context from the global orchestrator matrix tracking layer.- Specified by:
handleDeleteJobin interfaceViewController- Parameters:
job- The target configuration instance to wipe.
-
handleDragJob
public void handleDragJob(int newIdx, int draggedIdx) Description copied from interface:ViewControllerCoordinates and processes drag-and-drop reordering requests originating from the job list. Acts as the bridge to pass index mutations from the view architecture back to the underlying sequential model registries.- Specified by:
handleDragJobin interfaceViewController- Parameters:
newIdx- The destination target index where the dragged element is dropped.draggedIdx- The original source index where the drag gesture was initiated.
-
handleExecuteTask
Description copied from interface:ViewControllerInitiates execution of processing operations based on active configuration parameters.- Specified by:
handleExecuteTaskin interfaceViewController- Parameters:
job- The active task configuration processing target.
-
handleStopTask
Description copied from interface:ViewControllerStop execution of processing operations based on active configuration parameters.- Specified by:
handleStopTaskin interfaceViewController- Parameters:
job- The active task configuration processing target.
-
handleSaveSettings
Description copied from interface:ViewControllerCommits altered orchestration state variables using the encapsulated properties entity carrier.- Specified by:
handleSaveSettingsin interfaceViewController- Parameters:
targetTheme- Visual presentation theme strategy selection.
-