java.lang.Object
de.seggebaeing.sqlanalyzer.presentation.util.ControllerFactory

public class ControllerFactory extends Object
Factory for constructing de.seggebaeing.sqlanalyzer.presentation-layer controllers. Provides creators for OverviewWindow (by BdoWindowType and optional filter), DetailsWindow (by concrete BusinessDomainObject instance), and general workflow/settings controllers (by GeneralWindowType). Throws IllegalArgumentException for unsupported types. Intended to be used on the JavaFX Application Thread; does not perform FXML loading.
Since:
1.0
Author:
Felix Seggebäing
  • Constructor Details

    • ControllerFactory

      public ControllerFactory()
  • Method Details

    • createOverviewController

      public static OverviewWindow<?> createOverviewController(BdoWindowType windowType, Predicate<?> filter)
      Creates an overview controller for the given BDO window type, optionally applying an external filter. The filter is cast to the concrete BDO type expected by the controller; unchecked casts are suppressed and rely on the caller to provide a matching predicate.
      Parameters:
      windowType - the BDO overview type to instantiate
      filter - optional predicate to pre-filter listed items; may be null
      Returns:
      a new OverviewWindow for the requested type
      Implementation Note:
      Uses unchecked casts per branch; passing a mismatched predicate type may cause a ClassCastException at runtime.
    • createDetailsController

      public static DetailsWindow<?> createDetailsController(BusinessDomainObject bdo)
      Creates a details controller bound to the given BDO instance by dispatching on its runtime type (SampleQuery, PromptType, LLM, Prompt, GeneratedQuery).
      Parameters:
      bdo - the domain object to display/edit
      Returns:
      a new DetailsWindow for the object
      Throws:
      IllegalArgumentException - if the BDO type is unsupported
    • createGeneralController

      public static TitledInitializableWindow createGeneralController(GeneralWindowType windowType)
      Creates a controller for the requested general window type (generation/evaluation workflows or their settings dialogs).
      Parameters:
      windowType - the general window type to instantiate
      Returns:
      a new TitledInitializableWindow instance