Class BindingUtils
java.lang.Object
org.matwoess.jsourceprofiler.fxui.util.BindingUtils
This class contains utility methods for creating bindings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConverter<Path> This StringConverter is used to convert a Path to a String and vice versa. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ObjectBinding<Border> createBorderBinding(ObjectProperty<T> property, BooleanBinding invalidityBinding) Creates a binding that returns a Border depending on the validity of the property.static ObjectBinding<Border> createBorderBinding(StringProperty stringProperty, BooleanBinding invalidityBinding) Specialized version ofcreateBorderBinding(ObjectProperty, BooleanBinding)for StringProperties.static BooleanBindingcreateIsDirectoryBinding(ObjectProperty<Path> dirProperty) Creates a binding for whether the directory property is a valid directory, relative to the parent directory property.static BooleanBindingcreateRelativeIsDirectoryBinding(ObjectProperty<Path> parentDirProperty, ObjectProperty<Path> dirProperty) LikecreateIsDirectoryBinding(ObjectProperty), but relative to the parent directory property.static ObjectBinding<Border> createSelectedTreeItemBorderBinding(BooleanBinding isOutDir, BooleanBinding isSelectedDir, BooleanBinding isSelectedMain) Create the border binding for aSelectableTreeCell.static BooleanBindingcreatRelativeFileExistsBinding(ObjectProperty<Path> parentDirProperty, Path relFilePath) Creates a binding for whether the file path property exists, relative to the parent directory property.static BooleanBindingcreatRelativeIsJavaFileBinding(ObjectProperty<Path> parentDirProperty, ObjectProperty<Path> fileProperty) Creates a binding for whether the file property is a valid java file, relative to the parent directory property.
-
Field Details
-
pathStringConverter
This StringConverter is used to convert a Path to a String and vice versa.
-
-
Constructor Details
-
BindingUtils
public BindingUtils()
-
-
Method Details
-
createBorderBinding
public static ObjectBinding<Border> createBorderBinding(StringProperty stringProperty, BooleanBinding invalidityBinding) Specialized version ofcreateBorderBinding(ObjectProperty, BooleanBinding)for StringProperties.The neutral border is returned if the property is empty (not null).
- Parameters:
stringProperty- the property to create the binding forinvalidityBinding- the binding that determines whether the property is invalid- Returns:
- the created border binding
-
createBorderBinding
public static <T> ObjectBinding<Border> createBorderBinding(ObjectProperty<T> property, BooleanBinding invalidityBinding) Creates a binding that returns a Border depending on the validity of the property.If the property is null, the neutral border is returned. If the invalidity-binding is true, the invalid border is returned. Otherwise, the valid border is returned.
The binding is invalidated when the property or the invalidity-binding changes.
- Type Parameters:
T- the generic type of the property- Parameters:
property- the property to checkinvalidityBinding- the binding that determines whether the property is invalid- Returns:
- the created binding
-
creatRelativeIsJavaFileBinding
public static BooleanBinding creatRelativeIsJavaFileBinding(ObjectProperty<Path> parentDirProperty, ObjectProperty<Path> fileProperty) Creates a binding for whether the file property is a valid java file, relative to the parent directory property.- Parameters:
parentDirProperty- the parent directory propertyfileProperty- the file property- Returns:
- the created binding, telling us whether the file is a valid java file
-
createIsDirectoryBinding
Creates a binding for whether the directory property is a valid directory, relative to the parent directory property.- Parameters:
dirProperty- the directory property- Returns:
- the created binding, telling us whether the directory is a valid directory
-
createRelativeIsDirectoryBinding
public static BooleanBinding createRelativeIsDirectoryBinding(ObjectProperty<Path> parentDirProperty, ObjectProperty<Path> dirProperty) LikecreateIsDirectoryBinding(ObjectProperty), but relative to the parent directory property.- Parameters:
parentDirProperty- the parent directory propertydirProperty- the directory property- Returns:
- the created binding, telling us whether the directory is a valid directory
-
creatRelativeFileExistsBinding
public static BooleanBinding creatRelativeFileExistsBinding(ObjectProperty<Path> parentDirProperty, Path relFilePath) Creates a binding for whether the file path property exists, relative to the parent directory property.- Parameters:
parentDirProperty- the parent directory propertyrelFilePath- the relative file path- Returns:
- the created binding, telling us whether the file exists
-
createSelectedTreeItemBorderBinding
public static ObjectBinding<Border> createSelectedTreeItemBorderBinding(BooleanBinding isOutDir, BooleanBinding isSelectedDir, BooleanBinding isSelectedMain) Create the border binding for aSelectableTreeCell.Returns a brown border for the output directory, a blue border for the sources directory and a green border for the main file.
- Parameters:
isOutDir- whether the item is the output directoryisSelectedDir- whether the item is the selected sources directoryisSelectedMain- whether the item is the selected main file- Returns:
- the border binding depending on the input parameters
-