Class MainViewController

java.lang.Object
de.spiritscorp.datasync.controller.MainViewController
All Implemented Interfaces:
ViewController

public class MainViewController extends Object implements 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.
Since:
1.2.0
Author:
Tom Spirit
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The timeout limit in milliseconds for asynchronous background processes (e.g., automated file or task scans).
    static final int
    The timeout limit in milliseconds for regular, worker threads before a forced termination is triggered.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a primary controller instance, automatically provisioning the underlying dialog subsystem using the active window stage hook.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Triggers a destructive purging routine to eliminate identified duplicate entities within the scope of the given synchronization task context.
    void
    Requests an orderly, programmatic termination of the entire application ecosystem.
    void
    handleAutostart(boolean autostart)
    Handles the configuration update for the application's operating system autostart behavior.
    void
    Handles the creation and append workflow for a new managed task synchronization context instance.
    void
    Permanently removes a task entity context from the global orchestrator matrix tracking layer.
    void
    handleDragJob(int newIdx, int draggedIdx)
    Coordinates and processes drag-and-drop reordering requests originating from the job list.
    void
    Creates an independent copy of the currently selected task parameters profile mapping.
    void
    Initiates execution of processing operations based on active configuration parameters.
    void
    Handles switching between different primary view layers within the main viewport.
    void
    Triggers the specialized configuration context dialog to change a job instance identification label.
    void
    Commits altered orchestration state variables using the encapsulated properties entity carrier.
    void
    Stop execution of processing operations based on active configuration parameters.
    void
    Registers a native host operating system runtime shutdown hook within the virtual machine to intercept external termination signals.
    void
    runInBackground(boolean firstStart)
    Asynchronously dispatches the orchestration engine onto a background worker thread.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BG_TIMEOUT

      public static final int BG_TIMEOUT
      The timeout limit in milliseconds for asynchronous background processes (e.g., automated file or task scans).
      See Also:
    • EXIT_TIMEOUT

      public static final int EXIT_TIMEOUT
      The timeout limit in milliseconds for regular, worker threads before a forced termination is triggered.
      See Also:
  • Constructor Details

    • MainViewController

      public MainViewController(Gui gui)
      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: ViewController
      Registers 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:
      registerNativeShutdownHook in interface ViewController
    • handleApplicationShutdown

      public void handleApplicationShutdown()
      Description copied from interface: ViewController
      Requests 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:
      handleApplicationShutdown in interface ViewController
    • runInBackground

      public void runInBackground(boolean firstStart)
      Description copied from interface: ViewController
      Asynchronously 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:
      runInBackground in interface ViewController
      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: ViewController
      Handles 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:
      handleAutostart in interface ViewController
      Parameters:
      autostart - true to register the application for automatic launch on system boot; false to remove the autostart registration hook
    • handleNavigate

      public void handleNavigate(Gui.ViewState state)
      Description copied from interface: ViewController
      Handles switching between different primary view layers within the main viewport.
      Specified by:
      handleNavigate in interface ViewController
      Parameters:
      state - The target structural navigation layer.
    • handleCreateNewJob

      public void handleCreateNewJob()
      Description copied from interface: ViewController
      Handles the creation and append workflow for a new managed task synchronization context instance.
      Specified by:
      handleCreateNewJob in interface ViewController
    • handleRenameJob

      public void handleRenameJob(SyncJobContext job)
      Description copied from interface: ViewController
      Triggers the specialized configuration context dialog to change a job instance identification label.
      Specified by:
      handleRenameJob in interface ViewController
      Parameters:
      job - The source configuration instance payload.
    • handleDuplicateJob

      public void handleDuplicateJob(SyncJobContext job)
      Description copied from interface: ViewController
      Creates an independent copy of the currently selected task parameters profile mapping.
      Specified by:
      handleDuplicateJob in interface ViewController
      Parameters:
      job - The source configuration instance payload.
    • deleteSelectedDuplicates

      public void deleteSelectedDuplicates(SyncJobContext jobContext)
      Description copied from interface: ViewController
      Triggers 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:
      deleteSelectedDuplicates in interface ViewController
      Parameters:
      jobContext - The specific synchronization runtime context targeting duplicate remediation.
    • handleDeleteJob

      public void handleDeleteJob(SyncJobContext job)
      Description copied from interface: ViewController
      Permanently removes a task entity context from the global orchestrator matrix tracking layer.
      Specified by:
      handleDeleteJob in interface ViewController
      Parameters:
      job - The target configuration instance to wipe.
    • handleDragJob

      public void handleDragJob(int newIdx, int draggedIdx)
      Description copied from interface: ViewController
      Coordinates 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:
      handleDragJob in interface ViewController
      Parameters:
      newIdx - The destination target index where the dragged element is dropped.
      draggedIdx - The original source index where the drag gesture was initiated.
    • handleExecuteTask

      public void handleExecuteTask(SyncJobContext job)
      Description copied from interface: ViewController
      Initiates execution of processing operations based on active configuration parameters.
      Specified by:
      handleExecuteTask in interface ViewController
      Parameters:
      job - The active task configuration processing target.
    • handleStopTask

      public void handleStopTask(SyncJobContext job)
      Description copied from interface: ViewController
      Stop execution of processing operations based on active configuration parameters.
      Specified by:
      handleStopTask in interface ViewController
      Parameters:
      job - The active task configuration processing target.
    • handleSaveSettings

      public void handleSaveSettings(AppTheme targetTheme)
      Description copied from interface: ViewController
      Commits altered orchestration state variables using the encapsulated properties entity carrier.
      Specified by:
      handleSaveSettings in interface ViewController
      Parameters:
      targetTheme - Visual presentation theme strategy selection.