Class WindowManager
Threading: All public methods must be called on the JavaFX Application Thread. This class is not thread-safe.
- Since:
- 1.0
- Author:
- Felix Seggebäing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Opens a Details window for the specifiedBusinessDomainObject
.static void
openOverview
(BdoWindowType bdoWindowType, Predicate<? extends BusinessDomainObject> filter) Opens an Overview window for the givenBdoWindowType
and registers it for centralized refresh.static void
openWindow
(GeneralWindowType windowType) Opens a general-purpose window (e.g., Generation/Evaluation worker or Settings) based on the givenGeneralWindowType
.static void
refreshOverviewsFor
(BdoWindowType windowType) Triggers a UI refresh on all currently open Overview windows of the given type.static void
showHelpWindow
(String htmlFileName) Opens a non-resizable Help window and loads the specified help HTML.static void
start
(javafx.stage.Stage primaryStage) Bootstraps the primary (Home) stage and hands control to the WindowManager.
-
Constructor Details
-
WindowManager
public WindowManager()
-
-
Method Details
-
start
public static void start(javafx.stage.Stage primaryStage) Bootstraps the primary (Home) stage and hands control to the WindowManager.Loads the Home FXML with a
HomeController
, sets standardized title & icon (vialoadFxmlInto(Stage, String, TitledInitializableWindow)
), shows the stage, and enforces a minimum size based on the root node’s preferred size. The Home stage cannot be closed; its close request is consumed and the stage is hidden instead. If it is closed while no other non-help stages are visible, the application terminates viaSystem.exit(0)
.Threading: Must be called on the JavaFX Application Thread.
- Parameters:
primaryStage
- the primary JavaFX stage provided by the runtime- Throws:
IllegalStateException
- if the WindowManager has already been initialized
-
openWindow
Opens a general-purpose window (e.g., Generation/Evaluation worker or Settings) based on the givenGeneralWindowType
.Resolves the FXML name via
GeneralWindowType.getFxmlName()
, creates the corresponding controller viaControllerFactory.createGeneralController(GeneralWindowType)
, and delegates toinitializeAndShow(TitledInitializableWindow, String, boolean)
withresizable=true
. Title, icon, and scene are applied during initialization. Failures during FXML/controller loading are logged and the window will not be shown.Threading: Must be called on the JavaFX Application Thread.
- Parameters:
windowType
- the type of general window to open; must not benull
-
openOverview
public static void openOverview(BdoWindowType bdoWindowType, Predicate<? extends BusinessDomainObject> filter) Opens an Overview window for the givenBdoWindowType
and registers it for centralized refresh.Uses the shared
overview.fxml
and a type-specific controller created viaControllerFactory.createOverviewController(BdoWindowType, java.util.function.Predicate)
. The controller is tracked internally sorefreshOverviewsFor(BdoWindowType)
can update all open overviews of the same type. The controller is automatically untracked when its window hides, preventing leaks. The window is shown resizable.External filter: An optional predicate may be provided to pre-filter items in the UI; it may be
null
to omit external filtering.Threading: Must be called on the JavaFX Application Thread.
- Parameters:
bdoWindowType
- the kind of BDO overview to open; must not benull
filter
- optional external filter applied by the overview; may benull
-
openDetails
Opens a Details window for the specifiedBusinessDomainObject
.Determines the FXML via
BdoWindowType.getForType(Class)
and creates the appropriate controller usingControllerFactory.createDetailsController(BusinessDomainObject)
. Delegates toinitializeAndShow(TitledInitializableWindow, String, boolean)
withresizable=true
; title, icon, and scene are applied during initialization.Threading: Must be called on the JavaFX Application Thread.
- Parameters:
bdo
- the domain object to view or edit; must not benull
- Throws:
NullPointerException
- ifbdo
isnull
IllegalArgumentException
- if noBdoWindowType
is registered for the object’s class
-
showHelpWindow
Opens a non-resizable Help window and loads the specified help HTML.Shows
help.fxml
with a newHelpWindow
controller, then resolves the HTML viaResourceLoader.getHelpHtmlUrl(String)
and callsHelpWindow.loadHtml(String)
with the URL’s external form. If the resource cannot be found, an error is logged and the window remains in its default state.Threading: Must be called on the JavaFX Application Thread.
- Parameters:
htmlFileName
- help key or file name (typically without.html
); if no resource is found, content is not loaded and an error is logged
-
refreshOverviewsFor
Triggers a UI refresh on all currently open Overview windows of the given type.Looks up tracked controllers in the internal registry and invokes
OverviewWindow.refresh()
on each. If no overview windows are registered for the type, this method is a no-op.Threading: Must be called on the JavaFX Application Thread.
- Parameters:
windowType
- the overview category to refresh; must not benull
-