- java.lang.Object
-
- org.tentackle.fx.Fx
-
public class Fx extends java.lang.ObjectOften used factory and helper methods for FX-related stuff.- Author:
- harald
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javafx.scene.image.ImageViewcreateImageView(java.lang.String name)Creates an image view for a tentackle image.static javafx.scene.image.ImageViewcreateImageView(java.lang.String realm, java.lang.String name)Creates an image view for an image.static <T,R extends T>
RcreateNode(java.lang.Class<T> clazz)Creates a node.
Nodes should not be created via the builder factory and not the tradional way by invoking a constructor.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 javafx.scene.control.Alerterror(java.lang.String message)Shows an error dialog.static javafx.scene.control.Alerterror(java.lang.String message, java.lang.Throwable t)Shows an error dialog.static javafx.scene.control.Alerterror(java.lang.String message, java.lang.Throwable t, java.lang.String title)Shows an error dialog.static javafx.stage.StagegetStage(javafx.scene.Node node)Gets the stage for a node.static javafx.scene.control.Alertinfo(java.lang.String message)Shows an info dialog.static javafx.scene.control.Alertinfo(java.lang.String message, java.lang.String title)Shows an info dialog.static booleanisModal(javafx.stage.Stage stage)Returns whether the stage is modal.static <T extends FxController>
Tload(java.lang.Class<T> controllerClass)Loads a controller with its FXML-view.static <T> Tload(java.net.URL location)Loads an object hierarchy from a FXML document.static <T> Tload(java.net.URL location, java.util.ResourceBundle resources)Loads an object hierarchy from a FXML document.static javafx.scene.control.Alertno(java.lang.String message, boolean defaultYes, java.lang.Runnable no)Shows a question dialog.
Short forquestion(String, boolean, Consumer)if answer is only checked for no.static javafx.scene.control.Alertquestion(java.lang.String message, boolean defaultYes, java.lang.String title, java.util.function.Consumer<java.lang.Boolean> answer)Shows a question dialog.static javafx.scene.control.Alertquestion(java.lang.String message, boolean defaultYes, java.util.function.Consumer<java.lang.Boolean> answer)Shows a question dialog.static javafx.scene.control.Alertwarning(java.lang.String message)Shows a warning dialog.static javafx.scene.control.Alertwarning(java.lang.String message, java.lang.String title)Shows a warning dialog.static javafx.scene.control.Alertyes(java.lang.String message, boolean defaultYes, java.lang.Runnable yes)Shows a question dialog.
Short forquestion(String, boolean, Consumer)if answer is only checked for yes.
-
-
-
Method Detail
-
load
public static <T> T load(java.net.URL location) throws java.io.IOExceptionLoads an object hierarchy from a FXML document.- Type Parameters:
T- the object's type- Parameters:
location- the url- Returns:
- the object
- Throws:
java.io.IOException- if loading failed
-
load
public static <T> T load(java.net.URL location, java.util.ResourceBundle resources) throws java.io.IOExceptionLoads 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:
java.io.IOException- if loading failed
-
load
public static <T extends FxController> T load(java.lang.Class<T> controllerClass)
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
-
createNode
public static <T,R extends T> R createNode(java.lang.Class<T> clazz)
Creates a node.
Nodes should not be created via the builder factory and not the tradional way by invoking a constructor. Only the builder factory guarantees TT-compliant instances.- Type Parameters:
T- the requested FX standard node typeR- the expected type of the returned node- Parameters:
clazz- the node's class- Returns:
- the node instance
-
info
public static javafx.scene.control.Alert info(java.lang.String message, java.lang.String title)Shows an info dialog.- Parameters:
message- the messagetitle- optional title- Returns:
- the alert dialog
-
info
public static javafx.scene.control.Alert info(java.lang.String message)
Shows an info dialog.- Parameters:
message- the message- Returns:
- the alert dialog
-
warning
public static javafx.scene.control.Alert warning(java.lang.String message, java.lang.String title)Shows a warning dialog.- Parameters:
message- the messagetitle- optional title- Returns:
- the alert dialog
-
warning
public static javafx.scene.control.Alert warning(java.lang.String message)
Shows a warning dialog.- Parameters:
message- the message- Returns:
- the alert dialog
-
question
public static javafx.scene.control.Alert question(java.lang.String message, boolean defaultYes, java.lang.String title, java.util.function.Consumer<java.lang.Boolean> answer)Shows a question dialog.- Parameters:
message- the messagedefaultYes- true if yes is the default buttontitle- optional titleanswer- the user's answer (invoked with Boolean.TRUE or Boolean.FALSE, never null)- Returns:
- the alert dialog
-
question
public static javafx.scene.control.Alert question(java.lang.String message, boolean defaultYes, java.util.function.Consumer<java.lang.Boolean> answer)Shows a question dialog.- Parameters:
message- the messagedefaultYes- true if yes is the default buttonanswer- the user's answer (invoked with Boolean.TRUE or Boolean.FALSE, never null)- Returns:
- the alert dialog
-
yes
public static javafx.scene.control.Alert yes(java.lang.String message, boolean defaultYes, java.lang.Runnable yes)Shows a question dialog.
Short forquestion(String, boolean, Consumer)if answer is only checked for yes.- Parameters:
message- the messagedefaultYes- true if yes is the default buttonyes- invoked if user answers with yes- Returns:
- the alert dialog
-
no
public static javafx.scene.control.Alert no(java.lang.String message, boolean defaultYes, java.lang.Runnable no)Shows a question dialog.
Short forquestion(String, boolean, Consumer)if answer is only checked for no.- Parameters:
message- the messagedefaultYes- true if yes is the default buttonno- invoked if user answers with no- Returns:
- the alert dialog
-
error
public static javafx.scene.control.Alert error(java.lang.String message, java.lang.Throwable t, java.lang.String title)Shows an error dialog.- Parameters:
message- the messaget- optional throwabletitle- optional title- Returns:
- the alert dialog
-
error
public static javafx.scene.control.Alert error(java.lang.String message, java.lang.Throwable t)Shows an error dialog.- Parameters:
message- the messaget- optional throwable- Returns:
- the alert dialog
-
error
public static javafx.scene.control.Alert error(java.lang.String message)
Shows an error dialog.- Parameters:
message- the message- Returns:
- the alert dialog
-
createImageView
public static javafx.scene.image.ImageView createImageView(java.lang.String realm, java.lang.String name)Creates an image view for an image.- Parameters:
realm- the realm, null or empty if tentackle imagesname- the image's name- Returns:
- the view
-
createImageView
public static javafx.scene.image.ImageView createImageView(java.lang.String name)
Creates an image view for a tentackle image.- Parameters:
name- the image's name- Returns:
- the view
-
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
-
-