java.lang.Object
org.tentackle.fx.Fx
Often used factory and helper methods for FX-related stuff.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,R extends T>
RCreates an object.
FX objects should not be created via the builder factory and not the traditional way by invoking a constructor.static javafx.scene.NodecreateGraphic(String name) Creates the graphic node for a given name and the default realm.
Throws IllegalArgumentException if no such icon.static javafx.scene.NodecreateGraphic(String realm, String name) Creates the graphic node for a given realm and name.
Throws IllegalArgumentException if no such icon and/or realm.static javafx.scene.ScenecreateScene(javafx.scene.Parent root) Creates a scene.static javafx.stage.StagecreateStage(javafx.stage.Modality modality) Creates a new decorated stage.
Tentackle applications should use this factory method instead ofnew Stage()because the stage will be configured to meet certain framework-wide conventions.static javafx.stage.StagecreateStage(javafx.stage.StageStyle stageStyle, javafx.stage.Modality modality) Creates a new stage.
Tentackle applications should use this factory method instead ofnew Stage()because the stage will be configured to meet certain framework-wide conventions.static voidShows an error dialog.static voidShows an error dialog.static voidShows an error dialog.static javafx.stage.StagegetStage(javafx.scene.Node node) Gets the stage for a node.static voidShows an info dialog.static voidShows an info dialog.static booleanisModal(javafx.stage.Stage stage) Returns whether the stage is modal.static <T extends FxController>
TLoads a controller with its FXML-view.static <T> TLoads an object hierarchy from a FXML document.static <T> Tload(URL location, ResourceBundle resources) Loads an object hierarchy from a FXML document.static voidShows a question dialog.
Short forquestion(Object, String, boolean, Consumer)if answer is only checked for no.static voidShows a question dialog.static voidTerminates the FX client.static voidShows a warning dialog.static voidShows a warning dialog.static voidShows a question dialog.
Short forquestion(Object, String, boolean, Consumer)if answer is only checked for yes.
-
Method Details
-
load
Loads an object hierarchy from a FXML document.- Type Parameters:
T- the object's type- Parameters:
location- the url- Returns:
- the object
- Throws:
IOException- if loading failed
-
load
Loads an object hierarchy from a FXML document.- Type Parameters:
T- the object's type- Parameters:
location- the urlresources- the optional resources- Returns:
- the object
- Throws:
IOException- if loading failed
-
load
Loads a controller with its FXML-view.- Type Parameters:
T- the controller type- Parameters:
controllerClass- the controller class- Returns:
- the controller
-
createStage
public static javafx.stage.Stage createStage(javafx.stage.StageStyle stageStyle, javafx.stage.Modality modality) Creates a new stage.
Tentackle applications should use this factory method instead ofnew Stage()because the stage will be configured to meet certain framework-wide conventions.- Parameters:
stageStyle- the stylemodality- the modality- Returns:
- the stage
-
createStage
public static javafx.stage.Stage createStage(javafx.stage.Modality modality) Creates a new decorated stage.
Tentackle applications should use this factory method instead ofnew Stage()because the stage will be configured to meet certain framework-wide conventions.- Parameters:
modality- the modality- Returns:
- the stage
-
createScene
public static javafx.scene.Scene createScene(javafx.scene.Parent root) Creates a scene.- Parameters:
root- the parent node- Returns:
- the scene
-
create
Creates an object.
FX objects should not be created via the builder factory and not the traditional way by invoking a constructor. Only the builder factory guarantees TT-compliant instances.Throws
FxRuntimeExceptionif no builder for this type and/or the type does not provide a no-arg constructor.- Type Parameters:
T- the requested FX standard typeR- the expected type of the returned object- Parameters:
clazz- the object's class- Returns:
- the created object
-
info
Shows an info dialog.- Parameters:
owner- the owner window or nodemessage- the messageonClose- optional runnable invoked when dialog is closed- See Also:
-
info
Shows an info dialog.- Parameters:
owner- the owner window or nodemessage- the message- See Also:
-
warning
Shows a warning dialog.- Parameters:
owner- the owner window or nodemessage- the messageonClose- optional runnable invoked when dialog is closed- See Also:
-
warning
Shows a warning dialog.- Parameters:
owner- the owner window or nodemessage- the message- See Also:
-
error
Shows an error dialog.- Parameters:
owner- the owner window or nodemessage- the messaget- optional throwableonClose- optional runnable invoked when dialog is closed- See Also:
-
error
Shows an error dialog.- Parameters:
owner- the owner window or nodemessage- the messaget- optional throwable- See Also:
-
error
Shows an error dialog.- Parameters:
owner- the owner window or nodemessage- the message- See Also:
-
question
public static void question(Object owner, String message, boolean defaultYes, Consumer<Boolean> answer) Shows a question dialog.- Parameters:
owner- the owner window or nodemessage- the messagedefaultYes- true if yes is the default buttonanswer- the user's answer (invoked withBoolean.TRUEorBoolean.FALSE, never null)- See Also:
-
yes
Shows a question dialog.
Short forquestion(Object, String, boolean, Consumer)if answer is only checked for yes.- Parameters:
owner- the owner window or nodemessage- the messagedefaultYes- true if yes is the default buttonyes- invoked if user answers with yes- See Also:
-
no
Shows a question dialog.
Short forquestion(Object, String, boolean, Consumer)if answer is only checked for no.- Parameters:
owner- the owner window or nodemessage- the messagedefaultYes- true if yes is the default buttonno- invoked if user answers with no- See Also:
-
createGraphic
Creates the graphic node for a given realm and name.
Throws IllegalArgumentException if no such icon and/or realm.- Parameters:
realm- the realm, null of empty if default tentackle realmname- the graphic name- Returns:
- the graphic node
-
createGraphic
Creates the graphic node for a given name and the default realm.
Throws IllegalArgumentException if no such icon.- Parameters:
name- the graphic name- Returns:
- the graphic node
-
getStage
public static javafx.stage.Stage getStage(javafx.scene.Node node) Gets the stage for a node.- Parameters:
node- the node- Returns:
- the stage, null if node does not belong to a scene or scene does not belong to a stage.
-
isModal
public static boolean isModal(javafx.stage.Stage stage) Returns whether the stage is modal.- Parameters:
stage- the stage- Returns:
- true if effectively modal
-
terminate
public static void terminate()Terminates the FX client.
-