Package dk.gtz.graphedit.util
Class BindingsUtil
java.lang.Object
dk.gtz.graphedit.util.BindingsUtil
General static utilities for various types bindings (
javafx.beans.binding)-
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.beans.binding.DoubleBindingcreateAffineOffsetXBinding(javafx.beans.property.DoubleProperty dependency, javafx.scene.transform.Affine offset) Create a newDoubleBindingfor binding the provided dependency to a scaled, rotated and translated offset (X-values)static javafx.beans.binding.DoubleBindingcreateAffineOffsetYBinding(javafx.beans.property.DoubleProperty dependency, javafx.scene.transform.Affine offset) Create a newDoubleBindingfor binding the provided dependency to a scaled, rotated and translated offset (Y-values)static javafx.beans.binding.DoubleBindingcreateLineOffsetXBinding(javafx.scene.shape.Line line, javafx.beans.property.DoubleProperty scalar) Create a newDoubleBindingthat is bound to somewhere along the line by some scalar offset (X-values)static javafx.beans.binding.DoubleBindingcreateLineOffsetYBinding(javafx.scene.shape.Line line, javafx.beans.property.DoubleProperty scalar) Create a newDoubleBindingthat is bound to somewhere along the line by some scalar offset (Y-values)static javafx.beans.binding.DoubleBindingcreateOvalXBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the x-value on the edge of the provided shape and target position in an oval mannerstatic javafx.beans.binding.DoubleBindingcreateOvalYBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the y-value on the edge of the provided shape and target position in an oval mannerstatic javafx.beans.binding.DoubleBindingcreateRectangularXBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the x-value on the edge of the provided shape and target position in a rectangular mannerstatic javafx.beans.binding.DoubleBindingcreateRectangularYBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the y-value on the edge of the provided shape and target position in a rectangular mannerstatic javafx.beans.binding.DoubleBindingcreateRotationAtLineEndBinding(javafx.scene.shape.Line line) Create a newDoubleBindingfor a line that is bound to the end of a line This is useful for "sticking" something to the end of a line and have it follow the rotationstatic javafx.beans.binding.DoubleBindingcreateShapedXBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the x-value on the edge of the provided shape and target positionstatic javafx.beans.binding.DoubleBindingcreateShapedYBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the y-value on the edge of the provided shape and target positionstatic javafx.beans.binding.DoubleBindingcreateStringInterpretedDoubleBinding(javafx.beans.property.StringProperty dependency) Create a newDoubleBindingthat maps a providedStringPropertyusingDouble.valueOf(java.lang.String)Note that the binding itself may throw aNumberFormatExceptionif the string dependency has a non-int valuestatic javafx.beans.binding.IntegerBindingcreateStringInterpretedIntegerBinding(javafx.beans.property.StringProperty dependency) Create a newIntegerBindingthat maps a providedStringPropertyusingInteger.valueOf(java.lang.String, int)Note that the binding itself may throw aNumberFormatExceptionif the string dependency has a non-int valuestatic <T> javafx.beans.binding.StringBindingcreateToStringBinding(String prefix, javafx.beans.property.Property<T> dependency) Create a newStringBindingthat maps a T-typedPropertyto a string representation using the toString method.static <T> javafx.beans.binding.StringBindingcreateToStringBinding(String prefix, javafx.beans.property.Property<T> dependency, String postfix) Create a newStringBindingthat maps a T-typedPropertyto a string representation using the toString method.static <T> javafx.beans.binding.StringBindingcreateToStringBinding(javafx.beans.property.Property<T> dependency) Create a newStringBindingthat maps a T-typedPropertyto a string representation using the toString method
-
Method Details
-
createShapedXBinding
public static javafx.beans.binding.DoubleBinding createShapedXBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the x-value on the edge of the provided shape and target position- Parameters:
sourcePosition- The source positiontargetPosition- The target position. This will be the binding positionshape- The shape dimensions to use- Returns:
- The new binding
- Throws:
RuntimeException- if the providedViewModelVertexShapevalue is not supported- See Also:
-
createRectangularXBinding(dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelVertexShape)createOvalXBinding(dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelVertexShape)
-
createRectangularXBinding
public static javafx.beans.binding.DoubleBinding createRectangularXBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the x-value on the edge of the provided shape and target position in a rectangular manner- Parameters:
sourcePosition- The source positiontargetPosition- The target position. This will be the binding positionshape- The shape dimensions to use- Returns:
- The new binding
-
createOvalXBinding
public static javafx.beans.binding.DoubleBinding createOvalXBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the x-value on the edge of the provided shape and target position in an oval manner- Parameters:
sourcePosition- The source positiontargetPosition- The target position. This will be the binding positionshape- The shape dimensions to use- Returns:
- The new binding
-
createShapedYBinding
public static javafx.beans.binding.DoubleBinding createShapedYBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the y-value on the edge of the provided shape and target position- Parameters:
sourcePosition- The source positiontargetPosition- The target position. This will be the binding positionshape- The shape dimensions to use- Returns:
- The new binding
- Throws:
RuntimeException- if the providedViewModelVertexShapevalue is not supported- See Also:
-
createRectangularYBinding(dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelVertexShape)createOvalYBinding(dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelPoint,dk.gtz.graphedit.viewmodel.ViewModelVertexShape)
-
createRectangularYBinding
public static javafx.beans.binding.DoubleBinding createRectangularYBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the y-value on the edge of the provided shape and target position in a rectangular manner- Parameters:
sourcePosition- The source positiontargetPosition- The target position. This will be the binding positionshape- The shape dimensions to use- Returns:
- The new binding
-
createOvalYBinding
public static javafx.beans.binding.DoubleBinding createOvalYBinding(ViewModelPoint sourcePosition, ViewModelPoint targetPosition, ViewModelVertexShape shape) Create a newDoubleBindingfor the y-value on the edge of the provided shape and target position in an oval manner- Parameters:
sourcePosition- The source positiontargetPosition- The target position. This will be the binding positionshape- The shape dimensions to use- Returns:
- The new binding
-
createRotationAtLineEndBinding
public static javafx.beans.binding.DoubleBinding createRotationAtLineEndBinding(javafx.scene.shape.Line line) Create a newDoubleBindingfor a line that is bound to the end of a line This is useful for "sticking" something to the end of a line and have it follow the rotation- Parameters:
line- The line to reference- Returns:
- The new binding
-
createAffineOffsetXBinding
public static javafx.beans.binding.DoubleBinding createAffineOffsetXBinding(javafx.beans.property.DoubleProperty dependency, javafx.scene.transform.Affine offset) Create a newDoubleBindingfor binding the provided dependency to a scaled, rotated and translated offset (X-values)- Parameters:
dependency- The double to offsetoffset- The offset to use- Returns:
- A new binding that offsets dependency in a scaled and rotated manner by the translation of the provided offset
-
createAffineOffsetYBinding
public static javafx.beans.binding.DoubleBinding createAffineOffsetYBinding(javafx.beans.property.DoubleProperty dependency, javafx.scene.transform.Affine offset) Create a newDoubleBindingfor binding the provided dependency to a scaled, rotated and translated offset (Y-values)- Parameters:
dependency- The double to offsetoffset- The offset to use- Returns:
- A new binding that offsets dependency in a scaled and rotated manner by the translation of the provided offset
-
createStringInterpretedIntegerBinding
public static javafx.beans.binding.IntegerBinding createStringInterpretedIntegerBinding(javafx.beans.property.StringProperty dependency) Create a newIntegerBindingthat maps a providedStringPropertyusingInteger.valueOf(java.lang.String, int)Note that the binding itself may throw aNumberFormatExceptionif the string dependency has a non-int value- Parameters:
dependency- The string property to interpret- Returns:
- The new binding
-
createStringInterpretedDoubleBinding
public static javafx.beans.binding.DoubleBinding createStringInterpretedDoubleBinding(javafx.beans.property.StringProperty dependency) Create a newDoubleBindingthat maps a providedStringPropertyusingDouble.valueOf(java.lang.String)Note that the binding itself may throw aNumberFormatExceptionif the string dependency has a non-int value- Parameters:
dependency- The string property to interpret- Returns:
- The new binding
-
createToStringBinding
public static <T> javafx.beans.binding.StringBinding createToStringBinding(javafx.beans.property.Property<T> dependency) Create a newStringBindingthat maps a T-typedPropertyto a string representation using the toString method- Type Parameters:
T- The type of the wrapped value- Parameters:
dependency- The property to stringify- Returns:
- The new binding
-
createToStringBinding
public static <T> javafx.beans.binding.StringBinding createToStringBinding(String prefix, javafx.beans.property.Property<T> dependency) Create a newStringBindingthat maps a T-typedPropertyto a string representation using the toString method. with a constant prefix prepended to the string value- Type Parameters:
T- The type of the wrapped value- Parameters:
prefix- The prefix to prependdependency- The property to stringify- Returns:
- The new binding
-
createToStringBinding
public static <T> javafx.beans.binding.StringBinding createToStringBinding(String prefix, javafx.beans.property.Property<T> dependency, String postfix) Create a newStringBindingthat maps a T-typedPropertyto a string representation using the toString method. with a constant prefix and postfix prepended and appended respectively to the string value- Type Parameters:
T- The type of the wrapped value- Parameters:
prefix- The prefix to prependdependency- The property to stringifypostfix- The postfix to prepend- Returns:
- The new binding
-
createLineOffsetXBinding
public static javafx.beans.binding.DoubleBinding createLineOffsetXBinding(javafx.scene.shape.Line line, javafx.beans.property.DoubleProperty scalar) Create a newDoubleBindingthat is bound to somewhere along the line by some scalar offset (X-values)- Parameters:
line- The line to offset alongscalar- The offset amount ranging from [0..1], lower or higher will extend the point past the line- Returns:
- The new binding
-
createLineOffsetYBinding
public static javafx.beans.binding.DoubleBinding createLineOffsetYBinding(javafx.scene.shape.Line line, javafx.beans.property.DoubleProperty scalar) Create a newDoubleBindingthat is bound to somewhere along the line by some scalar offset (Y-values)- Parameters:
line- The line to offset alongscalar- The offset amount ranging from [0..1], lower or higher will extend the point past the line- Returns:
- The new binding
-