Skip to content

Instantly share code, notes, and snippets.

@heimp
Created September 26, 2012 02:11
Show Gist options
  • Save heimp/3785600 to your computer and use it in GitHub Desktop.
Save heimp/3785600 to your computer and use it in GitHub Desktop.
Xtend extensions for JavaFX
import java.util.Collection
import java.util.List
import java.util.Map
import java.util.Set
import javafx.animation.Animation
import javafx.animation.Animation$Status
import javafx.animation.FadeTransition
import javafx.animation.FillTransition
import javafx.animation.Interpolator
import javafx.animation.KeyFrame
import javafx.animation.KeyValue
import javafx.animation.PathTransition
import javafx.animation.PathTransition$OrientationType
import javafx.animation.PauseTransition
import javafx.animation.RotateTransition
import javafx.animation.ScaleTransition
import javafx.animation.StrokeTransition
import javafx.animation.Timeline
import javafx.animation.TranslateTransition
import javafx.beans.binding.Bindings
import javafx.beans.property.BooleanProperty
import javafx.beans.property.DoubleProperty
import javafx.beans.property.FloatProperty
import javafx.beans.property.IntegerProperty
import javafx.beans.property.ListProperty
import javafx.beans.property.LongProperty
import javafx.beans.property.MapProperty
import javafx.beans.property.ObjectProperty
import javafx.beans.property.Property
import javafx.beans.property.ReadOnlyBooleanProperty
import javafx.beans.property.ReadOnlyDoubleProperty
import javafx.beans.property.ReadOnlyFloatProperty
import javafx.beans.property.ReadOnlyIntegerProperty
import javafx.beans.property.ReadOnlyListProperty
import javafx.beans.property.ReadOnlyLongProperty
import javafx.beans.property.ReadOnlyMapProperty
import javafx.beans.property.ReadOnlyObjectProperty
import javafx.beans.property.ReadOnlySetProperty
import javafx.beans.property.ReadOnlyStringProperty
import javafx.beans.property.SetProperty
import javafx.beans.property.SimpleBooleanProperty
import javafx.beans.property.SimpleDoubleProperty
import javafx.beans.property.SimpleFloatProperty
import javafx.beans.property.SimpleIntegerProperty
import javafx.beans.property.SimpleListProperty
import javafx.beans.property.SimpleLongProperty
import javafx.beans.property.SimpleMapProperty
import javafx.beans.property.SimpleObjectProperty
import javafx.beans.property.SimpleSetProperty
import javafx.beans.property.SimpleStringProperty
import javafx.beans.property.StringProperty
import javafx.beans.value.ObservableBooleanValue
import javafx.beans.value.ObservableNumberValue
import javafx.beans.value.ObservableObjectValue
import javafx.beans.value.ObservableStringValue
import javafx.beans.value.ObservableValue
import javafx.beans.value.WritableValue
import javafx.collections.FXCollections
import javafx.collections.ObservableList
import javafx.collections.ObservableMap
import javafx.collections.ObservableSet
import javafx.event.ActionEvent
import javafx.event.EventHandler
import javafx.geometry.Point3D
import javafx.scene.Node
import javafx.scene.paint.Color
import javafx.scene.shape.Shape
import javafx.util.Duration
import org.eclipse.xtend.lib.Data
import static FXExtensions.*
class FXExtensions {
// Binding extensions
/**
* Binds a's value to b. a will change to match b's value.
* @param a the property that receives the data
* @param b the value that a is bound to
* @see javafx.beans.property.Property
*/
def static <T> operator_doubleArrow(javafx.beans.property.Property<T> a, ObservableValue<? extends T> b) {
a.bind(b)
}
/**
* Binds a and b's value together. a will change to match b's value and vice versa.
* @param a the first property
* @param b the second property
* @see javafx.beans.property.Property
*/
def static <T> operator_spaceship(javafx.beans.property.Property<T> a, javafx.beans.property.Property<T> b) {
a.bindBidirectional(b)
}
///////////////////////////
// bind content. don't think they work. generics errors
// def static <E> operator_doubleArrow(java.util.List<E> a, ObservableList<? extends E> b) {
// Bindings::bindContent(a, b)
// }
//
// def static <K, V> operator_doubleArrow(java.util.Map<K, V> a, ObservableMap<? extends K,? extends V> b) {
// Bindings::bindContent(a, b)
// }
//
// def static <E> operator_doubleArrow(java.util.Set<E> a, ObservableSet<? extends E> b) {
// Bindings::bindContent(a, b)
// }
//
// def static <E> operator_spaceship(ObservableList<E> a, ObservableList<E> b) {
// Bindings::bindContentBidirectional(a, b)
// }
//
// def static <K, V> operator_spaceship(ObservableMap<K, V> a, ObservableMap<K, V> b) {
// Bindings::bindContentBidirectional(a, b)
// }
//
// def static <E> operator_spaceship(ObservableSet<E> a, ObservableSet<E> b) {
// Bindings::bindContentBidirectional(a, b)
// }
//////////////////////////////
// addtition
/*
* Creates a number binding that stores the sum of a + b.
* @param a double
* @param b observable and changeable number
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(double a, ObservableNumberValue b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a float
* @param b observable and changeable number
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(float a, ObservableNumberValue b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a int
* @param b observable and changeable number
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(int a, ObservableNumberValue b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a long
* @param b observable and changeable number
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(long a, ObservableNumberValue b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a observable and changeable number
* @param b double
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(ObservableNumberValue a, double b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a observable and changeable number
* @param b float
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(ObservableNumberValue a, float b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a observable and changeable number
* @param b int
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(ObservableNumberValue a, int b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a observable and changeable number
* @param b long
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(ObservableNumberValue a, long b) {
Bindings::add(a, b)
}
/*
* Creates a number binding that stores the sum of a + b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a + b
* @see javafx.beans.binding.Bindings
*/
def static operator_plus(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::add(a, b)
}
///////////////////////
// boolean
/*
* Creates a boolean binding that stores the result of a && b.
* @param a observable and changeable boolean
* @param b observable and changeable boolean
* @return a binding to a && b
* @see javafx.beans.binding.Bindings
*/
def static operator_and(ObservableBooleanValue a, ObservableBooleanValue b) {
Bindings::and(a, b)
}
/////////////////////////
// division
/*
* Creates a number binding that stores the result of a / b.
* @param a double
* @param b observable and changeable number
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(double a, ObservableNumberValue b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a float
* @param b observable and changeable number
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(float a, ObservableNumberValue b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a int
* @param b observable and changeable number
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(int a, ObservableNumberValue b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a long
* @param b observable and changeable number
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(long a, ObservableNumberValue b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a observable and changeable number
* @param b double
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(ObservableNumberValue a, double b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a observable and changeable number
* @param b float
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(ObservableNumberValue a, float b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a observable and changeable number
* @param b int
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(ObservableNumberValue a, int b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a observable and changeable number
* @param b long
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(ObservableNumberValue a, long b) {
Bindings::divide(a, b)
}
/*
* Creates a number binding that stores the result of a / b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a / b
* @see javafx.beans.binding.Bindings
*/
def static operator_divide(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::divide(a, b)
}
//////////////////////////////////////
// these are helper functions to deal with the epsilon variable in the Bindings.equal methods
/**
* Use to deal with rounding errors for the equal methods. Usage: a == b.widthError(0.01).
* a will equal b if there is 0.01 difference between them.
*/
def static withError(double number, Number epsilon) {
new DoubleWithError(epsilon.doubleValue, number)
}
/**
* Use to deal with rounding errors for the equal methods. Usage: a == b.widthError(0.01).
* a will equal b if there is 0.01 difference between them.
*/
def static withError(float number, Number epsilon) {
new FloatWithError(epsilon.doubleValue, number)
}
/**
* Use to deal with rounding errors for the equal methods. Usage: a == b.widthError(0.01).
* a will equal b if there is 0.01 difference between them.
*/
def static withError(int number, Number epsilon) {
new IntWithError(epsilon.doubleValue, number)
}
/**
* Use to deal with rounding errors for the equal methods. Usage: a == b.widthError(0.01).
* a will equal b if there is 0.01 difference between them.
*/
def static withError(long number, Number epsilon) {
new LongWithError(epsilon.doubleValue, number)
}
/**
* Use to deal with rounding errors for the equal methods. Usage: a == b.widthError(0.01).
* a will equal b if there is 0.01 difference between them.
*/
def static withError(ObservableNumberValue number, Number epsilon) {
new ObservableNumberWithError(epsilon.doubleValue, number)
}
//////////////////////////////////
// equality
// is there a good default for this? 0.0001? 10% of the largest parameter?
static val EPSILON = 0.0
/*
* Creates a boolean binding that stores the result of a == b.
* @param a double
* @param b observable and changeable number
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(double a, ObservableNumberValue b) {
Bindings::equal(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a double
* @param b observable and changeable number with an allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(double a, ObservableNumberWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a float
* @param b observable and changeable number
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(float a, ObservableNumberValue b) {
Bindings::equal(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a float
* @param b observable and changeable number with an allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(float a, ObservableNumberWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a int
* @param b observable and changeable number
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(int a, ObservableNumberValue b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a int
* @param b observable and changeable number with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(int a, ObservableNumberWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a long
* @param b observable and changeable number
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(long a, ObservableNumberValue b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a long
* @param b observable and changeable number with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(long a, ObservableNumberWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a Object
* @param b observable and changeable object
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(Object a, ObservableObjectValue b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable boolean
* @param b observable and changeable boolean
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableBooleanValue a, ObservableBooleanValue b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b double
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, double b) {
Bindings::equal(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b double with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, DoubleWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b float
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, float b) {
Bindings::equal(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b float with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, FloatWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b int
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, int b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b int with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, IntWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b long
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, long b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b long with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, LongWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable object
* @param b object
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableObjectValue a, Object b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable number
* @param b observable and changeable number with allowance for error
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableNumberValue a, ObservableNumberWithError b) {
Bindings::equal(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable object
* @param b observable and changeable object
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableObjectValue a, ObservableObjectValue b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable string
* @param b observable and changeable string
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableStringValue a, ObservableStringValue b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a observable and changeable string
* @param b string
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(ObservableStringValue a, String b) {
Bindings::equal(a, b)
}
/*
* Creates a boolean binding that stores the result of a == b.
* @param a string
* @param b observable and changeable string
* @return a binding to a == b
* @see javafx.beans.binding.Bindings
*/
def static operator_equals(String a, ObservableStringValue b) {
Bindings::equal(a, b)
}
////////////////////////////////////
//greater than
/*
* Creates a boolean binding that stores the result of a > b.
* @param a double
* @param b observable and changeable number
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(double a, ObservableNumberValue b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a float
* @param b observable and changeable number
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(float a, ObservableNumberValue b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a int
* @param b observable and changeable number
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(int a, ObservableNumberValue b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a long
* @param b observable and changeable number
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(long a, ObservableNumberValue b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable number
* @param b double
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableNumberValue a, double b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable number
* @param b float
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableNumberValue a, float b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable number
* @param b int
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableNumberValue a, int b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable number
* @param b long
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableNumberValue a, long b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable string
* @param b observable and changeable string
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableStringValue a, ObservableStringValue b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a observable and changeable string
* @param b string
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(ObservableStringValue a, String b) {
Bindings::greaterThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a > b.
* @param a string
* @param b observable and changeable string
* @return a binding to a > b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterThan(String a, ObservableStringValue b) {
Bindings::greaterThan(a, b)
}
///////////////////////////
//greater than or equal to
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a double
* @param b observable and changeable number
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(double a, ObservableNumberValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a float
* @param b observable and changeable number
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(float a, ObservableNumberValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a int
* @param b observable and changeable number
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(int a, ObservableNumberValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a long
* @param b observable and changeable number
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(long a, ObservableNumberValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable number
* @param b double
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableNumberValue a, double b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable number
* @param b float
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableNumberValue a, float b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable number
* @param b int
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableNumberValue a, int b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable number
* @param b long
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableNumberValue a, long b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable string
* @param b observable and changeable string
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableStringValue a, ObservableStringValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a observable and changeable string
* @param b string
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(ObservableStringValue a, String b) {
Bindings::greaterThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a >= b.
* @param a string
* @param b observable and changeable string
* @return a binding to a >= b
* @see javafx.beans.binding.Bindings
*/
def static operator_greaterEqualsThan(String a, ObservableStringValue b) {
Bindings::greaterThanOrEqual(a, b)
}
/////////////
//less than
/*
* Creates a boolean binding that stores the result of a < b.
* @param a double
* @param b observable and changeable number
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(double a, ObservableNumberValue b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a float
* @param b observable and changeable number
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(float a, ObservableNumberValue b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a int
* @param b observable and changeable number
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(int a, ObservableNumberValue b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a long
* @param b observable and changeable number
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(long a, ObservableNumberValue b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable number
* @param b double
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableNumberValue a, double b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable number
* @param b float
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableNumberValue a, float b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable number
* @param b int
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableNumberValue a, int b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable number
* @param b long
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableNumberValue a, long b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable string
* @param b observable and changeable string
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableStringValue a, ObservableStringValue b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a observable and changeable string
* @param b string
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(ObservableStringValue a, String b) {
Bindings::lessThan(a, b)
}
/*
* Creates a boolean binding that stores the result of a < b.
* @param a string
* @param b observable and changeable string
* @return a binding to a < b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessThan(String a, ObservableStringValue b) {
Bindings::lessThan(a, b)
}
//////////////////////
//less than or equal to
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a double
* @param b observable and changeable number
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(double a, ObservableNumberValue b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a float
* @param b observable and changeable number
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(float a, ObservableNumberValue b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a int
* @param b observable and changeable number
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(int a, ObservableNumberValue b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a long
* @param b observable and changeable number
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(long a, ObservableNumberValue b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable number
* @param b double
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableNumberValue a, double b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable number
* @param b float
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableNumberValue a, float b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable number
* @param b int
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableNumberValue a, int b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable number
* @param b long
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableNumberValue a, long b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable string
* @param b observable and changeable string
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableStringValue a, ObservableStringValue b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a observable and changeable string
* @param b string
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(ObservableStringValue a, String b) {
Bindings::lessThanOrEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a <= b.
* @param a string
* @param b observable and changeable string
* @return a binding to a <= b
* @see javafx.beans.binding.Bindings
*/
def static operator_lessEqualsThan(String a, ObservableStringValue b) {
Bindings::lessThanOrEqual(a, b)
}
/////////////////////////
//multiply
/*
* Creates a boolean binding that stores the product of a * b.
* @param a double
* @param b observable and changeable number
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(double a, ObservableNumberValue b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a float
* @param b observable and changeable number
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(float a, ObservableNumberValue b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a int
* @param b observable and changeable number
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(int a, ObservableNumberValue b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a long
* @param b observable and changeable number
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(long a, ObservableNumberValue b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a observable and changeable number
* @param b double
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(ObservableNumberValue a, double b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a observable and changeable number
* @param b float
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(ObservableNumberValue a, float b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a observable and changeable number
* @param b int
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(ObservableNumberValue a, int b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a observable and changeable number
* @param b long
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(ObservableNumberValue a, long b) {
Bindings::multiply(a, b)
}
/*
* Creates a boolean binding that stores the product of a * b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a * b
* @see javafx.beans.binding.Bindings
*/
def static operator_multiply(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::multiply(a, b)
}
/////////////////////////
//negation
/*
* Creates a boolean binding that stores the product of -a
* @param a observable and changeable number
* @return a binding to -a
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(ObservableNumberValue a) {
Bindings::negate(a)
}
/*
* Creates a boolean binding that stores the product of !a
* @param a observable and changeable boolean
* @return a binding to !a
* @see javafx.beans.binding.Bindings
*/
def static operator_not(ObservableBooleanValue a) {
Bindings::not(a)
}
//////////////////////////////////////
//not equal
/*
* Creates a boolean binding that stores the result of a != b.
* @param a double
* @param b observable and changeable number
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(double a, ObservableNumberValue b) {
Bindings::notEqual(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a double
* @param b observable and changeable number with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(double a, ObservableNumberWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a float
* @param b observable and changeable number
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(float a, ObservableNumberValue b) {
Bindings::notEqual(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a float
* @param b observable and changeable number with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(float a, ObservableNumberWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a int
* @param b observable and changeable number
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(int a, ObservableNumberValue b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a int
* @param b observable and changeable number with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(int a, ObservableNumberWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a long
* @param b observable and changeable number
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(long a, ObservableNumberValue b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a long
* @param b observable and changeable number with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(long a, ObservableNumberWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a Object
* @param b observable and changeable Object
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(Object a, ObservableObjectValue b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable boolean
* @param b observable and changeable boolean
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableBooleanValue a, ObservableBooleanValue b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b double
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, double b) {
Bindings::notEqual(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b double with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, DoubleWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b float
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, float b) {
Bindings::notEqual(a, b, EPSILON)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b float with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, FloatWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b int
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, int b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b int with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, IntWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b long
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, long b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b long with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, LongWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable Object
* @param b Object
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableObjectValue a, Object b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable number
* @param b observable and changeable number with allowance for error
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableNumberValue a, ObservableNumberWithError b) {
Bindings::notEqual(a, b.number, b.epsilon)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable Object
* @param b observable and changeable Object
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableObjectValue a, ObservableObjectValue b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable String
* @param b observable and changeable String
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableStringValue a, ObservableStringValue b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a observable and changeable string
* @param b string
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(ObservableStringValue a, String b) {
Bindings::notEqual(a, b)
}
/*
* Creates a boolean binding that stores the result of a != b.
* @param a string
* @param b observable and changeable string
* @return a binding to a != b
* @see javafx.beans.binding.Bindings
*/
def static operator_notEquals(String a, ObservableStringValue b) {
Bindings::notEqual(a, b)
}
///////////////////////////////////////////////
//or
/*
* Creates a boolean binding that stores the result of a || b.
* @param a observable and changeable boolean
* @param b observable and changeable boolean
* @return a binding to a || b
* @see javafx.beans.binding.Bindings
*/
def static operator_or(ObservableBooleanValue a, ObservableBooleanValue b) {
Bindings::or(a, b)
}
//////////////////////////////
//subtraction
/*
* Creates a boolean binding that stores the result of a - b.
* @param a double
* @param b observable and changeable number
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(double a, ObservableNumberValue b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a float
* @param b observable and changeable number
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(float a, ObservableNumberValue b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a int
* @param b observable and changeable number
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(int a, ObservableNumberValue b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a long
* @param b observable and changeable number
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(long a, ObservableNumberValue b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a observable and changeable number
* @param b double
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(ObservableNumberValue a, double b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a observable and changeable number
* @param b float
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(ObservableNumberValue a, float b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a observable and changeable number
* @param b int
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(ObservableNumberValue a, int b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a observable and changeable number
* @param b long
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(ObservableNumberValue a, long b) {
Bindings::subtract(a, b)
}
/*
* Creates a boolean binding that stores the result of a - b.
* @param a observable and changeable number
* @param b observable and changeable number
* @return a binding to a - b
* @see javafx.beans.binding.Bindings
*/
def static operator_minus(ObservableNumberValue a, ObservableNumberValue b) {
Bindings::subtract(a, b)
}
////////////////////////////////////////////
/*
* Creates a duration of hours
* @param d number
* @return d number of hours
* @see javafx.util.Duration
*/
def static h(Number d) {
Duration::hours(d.doubleValue)
}
/*
* Creates a duration of milliseconds
* @param d number
* @return d number of milliseconds
* @see javafx.util.Duration
*/
def static ms(Number d) {
Duration::millis(d.doubleValue)
}
/*
* Creates a duration of minutes
* @param d number
* @return d number of minutes
* @see javafx.util.Duration
*/
def static m(Number d) {
Duration::minutes(d.doubleValue)
}
/*
* Creates a duration of seconds
* @param d number
* @return d number of seconds
* @see javafx.util.Duration
*/
def static s(Number d) {
Duration::seconds(d.doubleValue)
}
/*
* Adds two durations
* @param a duration
* @param b duration
* @return the sum of a and b
* @see javafx.util.Duration
*/
def static operator_plus(Duration a, Duration b) {
a.add(b)
}
/*
* Divides a duration by a number
* @param a duration
* @param b number
* @return the result of a / b
* @see javafx.util.Duration
*/
def static operator_divide(Duration a, Number b) {
a.divide(b.doubleValue)
}
/*
* Tests whether duration a is greater than duration b
* @param a duration
* @param b duration
* @return the result of a > b
* @see javafx.util.Duration
*/
def static operator_greaterThan(Duration a, Duration b) {
a.greaterThan(b)
}
/*
* Tests whether duration a is greater or equal to duration b
* @param a duration
* @param b duration
* @return the result of a >= b
* @see javafx.util.Duration
*/
def static operator_greaterEqualsThan(Duration a, Duration b) {
a.greaterThanOrEqualTo(b)
}
/*
* Tests whether duration a is less than duration b
* @param a duration
* @param b duration
* @return the result of a < b
* @see javafx.util.Duration
*/
def static operator_lessThan(Duration a, Duration b) {
a.lessThan(b)
}
/*
* Tests whether duration a is less than or equal to duration b
* @param a duration
* @param b duration
* @return the result of a < b
* @see javafx.util.Duration
*/
def static operator_lessEqualsThan(Duration a, Duration b) {
a.lessThanOrEqualTo(b)
}
/*
* Multiplies a duration by a number
* @param a duration
* @param b number
* @return the result of a * b
* @see javafx.util.Duration
*/
def static operator_multiply(Duration a, Number b) {
a.multiply(b.doubleValue)
}
/*
* Multiplies a duration by a number
* @param a number
* @param b duration
* @return the result of a * b
* @see javafx.util.Duration
*/
def static operator_multiply(Number a, Duration b) {
b.multiply(a.doubleValue)
}
/*
* Subtracts a duration from another duration
* @param a duration
* @param b duration
* @return the result of a - b
* @see javafx.util.Duration
*/
def static operator_minus(Duration a, Duration b) {
a.subtract(b)
}
/*
* Negates a duration
* @param a duration
* @return -a
* @see javafx.util.Duration
*/
def static operator_minus(Duration a) {
a.negate()
}
/*
* Creates a duration from a string such as "3s" or "978.398ms"
* @param a string
* @return a duration
* @see javafx.util.Duration
*/
def static asDuration(String s) {
Duration::valueOf(s)
}
/////////////////////////////////////////
//animation
/*
* The tween operator. Creates a KeyValue consisting of a writable value and an end value that it will change to.
* @param a a writable value such as a node's location or colour
* @param b the end value that we are tweening toward
* @return a KeyValue
* @see javafx.animation.KeyValue
*/
def static <T> operator_doubleGreaterThan(WritableValue<T> a, T b) {
new KeyValue(a, b)
}
/*
* Specifies the Interpolator used in the KeyValue
* @param a KeyValue
* @param b Interpolator
* @return a KeyValue with an interpolator
* @see javafx.animation.KeyValue
*/
def static operator_add(KeyValue a, Interpolator b) {
new KeyValue(a.target as WritableValue<Object>, a.endValue, b)
}
/**
* Creates a keyframe for a timeline
* @param time the time when the keyframe is played
* @param onFinished a function that will run when the keyframe is finished
* @param values the key values
* @return KeyFrame
* @see javafx.animation.KeyFrame
*/
def static key(Duration time, EventHandler<ActionEvent> onFinished, KeyValue... values) {
new KeyFrame(time, onFinished, values)
}
/**
* Creates a keyframe for a timeline
* @param time the time when the keyframe is played
* @param values the key values
* @return KeyFrame
* @see javafx.animation.KeyFrame
*/
def static key(Duration time, KeyValue... values) {
new KeyFrame(time, values)
}
/**
* Creates a keyframe for a timeline
* @param time the time when the keyframe is played
* @param name the name of the keyframe
* @param onFinished a function that will run when the keyframe is finished
* @param values the key values
* @return KeyFrame
* @see javafx.animation.KeyFrame
*/
def static key(Duration time, String name, EventHandler<ActionEvent> onFinished, Collection<KeyValue> values) {
new KeyFrame(time, name, onFinished, values)
}
/**
* Creates a keyframe for a timeline
* @param time the time when the keyframe is played
* @param name the name of the keyframe
* @param onFinished a function that will run when the keyframe is finished
* @param values the key values
* @return KeyFrame
* @see javafx.animation.KeyFrame
*/
def static key(Duration time, String name, EventHandler<ActionEvent> onFinished, KeyValue... values) {
new KeyFrame(time, name, onFinished, values)
}
/**
* Creates a keyframe for a timeline
* @param time the time when the keyframe is played
* @param name the name of the keyframe
* @param values the key values
* @return KeyFrame
* @see javafx.animation.KeyFrame
*/
def static key(Duration time, String name, KeyValue... values) {
new KeyFrame(time, name, values)
}
/////////////////////////////
//"transitions"
/**
* Fades a node to a specified opacity in the specified time.
* Note: You need to call play on this afterwards, eg: rect.fadeTo(1s, 0.5).play()
* @param node the node that will be animated
* @param duration how long this animation takes
* @param to the target opacity. 1 is opaque and 0 is transparent
* @return FadeTransition
* @see javafx.animation.FadeTransition
*/
def static fadeTo(Node node, Duration duration, double to) {
val trans = new FadeTransition(duration, node) => [
toValue = to
]
trans
}
/**
* Fades a node by a specified step value and time.
* Note: You need to call play on this transition, eg: rect.fadeBy(1s, 0.005).play()
* @param node the node that will be animated
* @param duration how long this animation takes
* @param by the amount that the node will fade every frame
* @return FadeTransition
* @see javafx.animation.FadeTransition
*/
def static fadeBy(Node node, Duration duration, double by) {
val trans = new FadeTransition(duration, node) => [
byValue = by
]
trans
}
/**
* Fades out a node to total transparency.
* Note: You need to call play on this afterwards, eg: rect.fadeOut(1s).play()
* @param node the node that will disappear
* @param duration the time it will take
* @return FadeTransition
* @see javafx.animation.FadeTransition
*/
def static fadeOut(Node node, Duration duration) {
fadeTo(node, duration, 0)
}
/**
* Fades in a node to total opaqueness
* Note: You need to call play on this afterwards, eg: rect.fadeIn(1s).play()
* @param node the node that will appear
* @param duration the time it will take
* @return FadeTransition
* @see javafx.animation.FadeTransition
*/
def static fadeIn(Node node, Duration duration) {
fadeTo(node, duration, 100)
}
/**
* Changes a shape's fill colour.
* Note: You need to call play on this afterwards, eg: rect.changeFill(1s, RED).play()
* @param node the node that will appear
* @param duration the time it will take
* @param to the colour that the fill will be
* @return FillTransition
* @see javafx.animation.FillTransition
*/
def static changeFill(Shape shape, Duration duration, Color to) {
new FillTransition(duration, shape, null, to)
}
/**
* Moves a node along a path
* Note: You need to call play on this afterwards, eg: car.move(1s, road, true).play()
* @param node the node that will appear
* @param duration the time it will take
* @param path
* @param orientToPath if this if true the node will rotate to follow the path. If not it will remain upright.
* @return PathTransition
* @see javafx.animation.PathTransition
*/
def static move(Node node, Duration duration, Shape path, boolean orientToPath) {
val trans = new PathTransition(duration, path, node) => [
orientation = if(orientToPath) PathTransition$OrientationType::ORTHOGONAL_TO_TANGENT else PathTransition$OrientationType::NONE
]
trans
}
/**
* Moves a node along a path. Will not rotate to remain orthogonal to the path.
* Note: You need to call play on this afterwards, eg: car.move(1s, road).play()
* @param node the node that will appear
* @param duration the time it will take
* @param path
* @return PathTransition
* @see javafx.animation.PathTransition
*/
def static move(Node node, Duration duration, Shape path) {
move(node, duration, path, false)
}
def static pause(Duration d) {
new PauseTransition(d)
}
def static rotateTo(Node node, Duration duration, double to, Point3D axis) {
val trans = new RotateTransition(duration, node) => [
toAngle = to
it.axis = axis
]
trans
}
def static rotateTo(Node node, Duration duration, double to) {
rotateTo(node, duration, to, null)
}
def static rotateBy(Node node, Duration duration, double by, Point3D axis) {
val trans = new RotateTransition(duration, node) => [
byAngle = by
it.axis = axis
]
trans
}
def static rotateBy(Node node, Duration duration, double by) {
rotateBy(node, duration, by, null)
}
def static scaleTo(Node node, Duration duration, double toX, double toY, double toZ) {
val trans = new ScaleTransition(duration, node) => [
it.toX = toX
it.toY = toY
it.toZ = toZ
]
trans
}
def static scaleTo(Node node, Duration duration, double toX, double toY) {
val trans = new ScaleTransition(duration, node) => [
it.toX = toX
it.toY = toY
]
trans
}
def static scaleBy(Node node, Duration duration, double byX, double byY, double byZ) {
val trans = new ScaleTransition(duration, node) => [
it.byX = byX
it.byY = byY
it.byZ = byZ
]
trans
}
def static scaleBy(Node node, Duration duration, double byX, double byY) {
val trans = new ScaleTransition(duration, node) => [
it.byX = byX
it.byY = byY
]
trans
}
def static changeStroke(Shape shape, Duration duration, Color to) {
new StrokeTransition(duration, shape, null, to)
}
def static move(Node node, Duration duration, double dx, double dy, double dz) {
new TranslateTransition(duration, node) => [
it.toX = dx
it.toY = dy
it.toZ = dz
]
}
def static move(Node node, Duration duration, double dx, double dy) {
new TranslateTransition(duration, node) => [
it.toX = dx
it.toY = dy
]
}
def static moveBy(Node node, Duration duration, double byX, double byY, double byZ) {
new TranslateTransition(duration, node) => [
it.byX = byX
it.byY = byY
it.byZ = byZ
]
}
def static moveBy(Node node, Duration duration, double byX, double byY) {
new TranslateTransition(duration, node) => [
it.byX = byX
it.byY = byY
]
}
def static isRunning(Animation anim) {
anim.status == Animation$Status::RUNNING
}
def static isPaused(Animation anim) {
anim.status == Animation$Status::PAUSED
}
def static isStopped(Animation anim) {
anim.status == Animation$Status::STOPPED
}
def static play(Animation anim, boolean togglePause) {
if(togglePause) {
if(anim.status == Animation$Status::RUNNING) {
anim.pause
} else {
anim.play
}
}
}
def static loop(Animation anim, int times, boolean togglePause) {
anim.cycleCount = times
play(anim, togglePause)
}
def static loop(Animation anim, int times) {
loop(anim, times, false)
}
def static loop(Animation anim, boolean togglePause) {
loop(anim, Animation::INDEFINITE, togglePause)
}
def static loop(Animation anim) {
loop(anim, Animation::INDEFINITE, false)
}
def static oscillate(Animation anim, int times, boolean togglePause) {
anim.autoReverse = true
loop(anim, times, togglePause)
}
def static oscillate(Animation anim, int times) {
oscillate(anim, times, false)
}
def static oscillate(Animation anim, boolean togglePause) {
oscillate(anim, Animation::INDEFINITE, togglePause)
}
def static oscillate(Animation anim) {
oscillate(anim, Animation::INDEFINITE, false)
}
def static asProperty(boolean b) {
new SimpleBooleanProperty(b)
}
def static asProperty(double d) {
new SimpleDoubleProperty(d)
}
def static asProperty(float f) {
new SimpleFloatProperty(f)
}
def static asProperty(int i) {
new SimpleIntegerProperty(i)
}
def static asProperty(long l) {
new SimpleLongProperty(l)
}
def static <E> asProperty(List<E> o) {
new SimpleListProperty<E>(FXCollections::observableList(o))
}
def static <K, V> asProperty(Map<K, V> o) {
new SimpleMapProperty<K, V>(FXCollections::observableMap(o))
}
def static <E> asProperty(Set<E> o) {
new SimpleSetProperty<E>(FXCollections::observableSet(o))
}
def static asProperty(String s) {
new SimpleStringProperty(s)
}
def static asProperty(Object o) {
new SimpleObjectProperty(o)
}
/////
def static asReadOnly(BooleanProperty b) {
b as ReadOnlyBooleanProperty
}
def static asReadOnly(DoubleProperty d) {
d as ReadOnlyDoubleProperty
}
def static asReadOnlyProperty(FloatProperty f) {
f as ReadOnlyFloatProperty
}
def static asReadOnly(IntegerProperty i) {
i as ReadOnlyIntegerProperty
}
def static asReadOnly(LongProperty l) {
l as ReadOnlyLongProperty
}
def static <E> asReadOnly(ListProperty<E> o) {
o as ReadOnlyListProperty<E>
}
def static <K, V> asReadOnly(MapProperty<K, V> o) {
o as ReadOnlyMapProperty<K, V>
}
def static <E> asReadOnly(SetProperty<E> o) {
o as ReadOnlySetProperty<E>
}
def static asReadOnly(StringProperty s) {
s as ReadOnlyStringProperty
}
def static asReadOnly(ObjectProperty o) {
o as ReadOnlyObjectProperty
}
//////////////////////
def static asReadOnlyProperty(boolean b) {
new SimpleBooleanProperty(b) as ReadOnlyBooleanProperty
}
def static asReadOnlyProperty(double d) {
new SimpleDoubleProperty(d) as ReadOnlyDoubleProperty
}
def static asReadOnlyProperty(float f) {
new SimpleFloatProperty(f) as ReadOnlyFloatProperty
}
def static asReadOnlyProperty(int i) {
new SimpleIntegerProperty(i) as ReadOnlyIntegerProperty
}
def static asReadOnlyProperty(long l) {
new SimpleLongProperty(l) as ReadOnlyLongProperty
}
def static <E> asReadOnlyProperty(List<E> o) {
new SimpleListProperty<E>(FXCollections::observableList(o)) as ReadOnlyListProperty<E>
}
def static <K, V> asReadOnlyProperty(Map<K, V> o) {
new SimpleMapProperty<K, V>(FXCollections::observableMap(o)) as ReadOnlyMapProperty<K, V>
}
def static <E> asReadOnlyProperty(Set<E> o) {
new SimpleSetProperty<E>(FXCollections::observableSet(o)) as ReadOnlySetProperty<E>
}
def static asReadOnlyProperty(String s) {
new SimpleStringProperty(s) as ReadOnlyStringProperty
}
def static asReadOnlyProperty(Object o) {
new SimpleObjectProperty(o) as ReadOnlyObjectProperty
}
def static <T> asObservable(List<T> list) {
FXCollections::observableList(list)
}
def static <K, V> asObservable(Map<K, V> map) {
FXCollections::observableMap(map)
}
def static <T> asObservable(Set<T> set) {
FXCollections::observableSet(set)
}
}
@Data
class WithError {
double epsilon
}
@Data
class DoubleWithError extends WithError {
double number
}
@Data
class FloatWithError extends WithError {
float number
}
@Data
class IntWithError extends WithError {
int number
}
@Data
class LongWithError extends WithError {
long number
}
@Data
class ObservableNumberWithError extends WithError {
ObservableNumberValue number
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment