Module de.seggebaeing.sqlanalyzer
Class GenerationController
java.lang.Object
de.seggebaeing.sqlanalyzer.presentation.uielements.window.TitledInitializableWindow
de.seggebaeing.sqlanalyzer.presentation.uielements.window.WorkerWindow
de.seggebaeing.sqlanalyzer.presentation.controller.general.GenerationController
- All Implemented Interfaces:
javafx.fxml.Initializable
Controller for the SQL generation workflow. Extends
WorkerWindow
to spawn a GenerationThread
, track per-LLM progress (incl. rate-limit countdown),
enable contextual help, validate settings, and persist/open newly generated queries on save.- Since:
- 1.0
- Author:
- Felix Seggebäing
-
Field Summary
Fields inherited from class de.seggebaeing.sqlanalyzer.presentation.uielements.window.WorkerWindow
workerProperty
Fields inherited from class de.seggebaeing.sqlanalyzer.presentation.uielements.window.TitledInitializableWindow
root
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Thread
Prepares per-LLM progress UI and callback wiring for the generation run.getTitle()
Returns the fixed title for the generation window.void
initialize
(URL location, ResourceBundle resources) Callssuper.initialize(...)
and enables the generation help link.protected void
Persists newly generated queries and navigates to their overview.protected void
Opens the Generation Settings window for configuring the run.protected boolean
Validates that generation can start: positive pool size and repetition count, and non-empty selections of LLMs and prompts.Methods inherited from class de.seggebaeing.sqlanalyzer.presentation.uielements.window.WorkerWindow
addDualProgressBar, signalDone
Methods inherited from class de.seggebaeing.sqlanalyzer.presentation.uielements.window.TitledInitializableWindow
closeWindow, enableHelp, getRoot, getStage
-
Constructor Details
-
GenerationController
public GenerationController()
-
-
Method Details
-
initialize
Callssuper.initialize(...)
and enables the generation help link.- Specified by:
initialize
in interfacejavafx.fxml.Initializable
- Overrides:
initialize
in classWorkerWindow
- Parameters:
location
- FXML location (may benull
)resources
- localization bundle (may benull
)- Implementation Note:
- Invoke on the JavaFX Application Thread.
-
getTitle
Returns the fixed title for the generation window.- Specified by:
getTitle
in classTitledInitializableWindow
- Returns:
- the string
"Generation"
-
saveBtnClick
protected void saveBtnClick()Persists newly generated queries and navigates to their overview. Retrieves the result set from the activeGenerationThread
, saves each via the service, opens the Generated Query overview filtered to the new items, then closes this window.- Specified by:
saveBtnClick
in classWorkerWindow
- Implementation Note:
- Assumes
workerProperty.get()
is a completedGenerationThread
. Invoke on the JavaFX Application Thread.
-
createWorkerThread
Prepares per-LLM progress UI and callback wiring for the generation run. For each selectedLLM
this:- Adds a
DualProgressBar
bound to started/finished progress, - Exposes a retry
Instant
via a boundCountdownLabel
, - Maintains atomic counters and derives progress as
started/total
andfinished/total
, - Stores lambdas in maps used by the worker to update progress and the latest rate-limit instant.
GenerationThread
that consumes these maps to report progress and rate-limit updates.- Specified by:
createWorkerThread
in classWorkerWindow
- Returns:
- a configured, not-yet-started
Thread
for SQL generation - Implementation Note:
- UI nodes are created and bound here; worker callbacks should be marshalled to the FX thread.
- Adds a
-
showSettingsPopup
protected void showSettingsPopup()Opens the Generation Settings window for configuring the run.- Specified by:
showSettingsPopup
in classWorkerWindow
-
startValid
protected boolean startValid()Validates that generation can start: positive pool size and repetition count, and non-empty selections of LLMs and prompts.- Specified by:
startValid
in classWorkerWindow
- Returns:
true
if all preconditions are met;false
otherwise
-