- java.lang.Object
-
- javafx.beans.binding.When
-
public class When extends Object
Starting point for a binding that calculates a ternary expression.A ternary expression has the basic form
new When(cond).then(value1).otherwise(value2);. The expressioncondneeds to be aObservableBooleanValue. Based on the value ofcond, the binding contains the value ofvalue1(ifcond.getValue() == true) orvalue2(ifcond.getValue() == false). The valuesvalue1andvalue2have to be of the same type. They can be constant values or implementations ofObservableValue.- Since:
- JavaFX 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classWhen.BooleanConditionBuilderAn intermediate class needed while assembling the ternary expression.classWhen.NumberConditionBuilderIf-then-else expression returning a number.classWhen.ObjectConditionBuilder<T>An intermediate class needed while assembling the ternary expression.classWhen.StringConditionBuilderAn intermediate class needed while assembling the ternary expression.
-
Constructor Summary
Constructors Constructor Description When(ObservableBooleanValue condition)The constructor ofWhen.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description When.BooleanConditionBuilderthen(boolean thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.When.NumberConditionBuilderthen(double thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.When.NumberConditionBuilderthen(float thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.When.NumberConditionBuilderthen(int thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.When.NumberConditionBuilderthen(long thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.When.StringConditionBuilderthen(String thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.When.BooleanConditionBuilderthen(ObservableBooleanValue thenValue)Defines theObservableBooleanValuewhich value is returned by the ternary expression if the condition istrue.When.NumberConditionBuilderthen(ObservableNumberValue thenValue)Defines theObservableNumberValuewhich value is returned by the ternary expression if the condition istrue.<T> When.ObjectConditionBuilder<T>then(ObservableObjectValue<T> thenValue)Defines theObservableObjectValuewhich value is returned by the ternary expression if the condition istrue.When.StringConditionBuilderthen(ObservableStringValue thenValue)Defines theObservableStringValuewhich value is returned by the ternary expression if the condition istrue.<T> When.ObjectConditionBuilder<T>then(T thenValue)Defines a constant value of the ternary expression, that is returned if the condition istrue.
-
-
-
Constructor Detail
-
When
public When(ObservableBooleanValue condition)
The constructor ofWhen.- Parameters:
condition- the condition of the ternary expression
-
-
Method Detail
-
then
public When.NumberConditionBuilder then(ObservableNumberValue thenValue)
Defines theObservableNumberValuewhich value is returned by the ternary expression if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.NumberConditionBuilder then(double thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.NumberConditionBuilder then(float thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.NumberConditionBuilder then(long thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.NumberConditionBuilder then(int thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.BooleanConditionBuilder then(ObservableBooleanValue thenValue)
Defines theObservableBooleanValuewhich value is returned by the ternary expression if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.BooleanConditionBuilder then(boolean thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.StringConditionBuilder then(ObservableStringValue thenValue)
Defines theObservableStringValuewhich value is returned by the ternary expression if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public When.StringConditionBuilder then(String thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public <T> When.ObjectConditionBuilder<T> then(ObservableObjectValue<T> thenValue)
Defines theObservableObjectValuewhich value is returned by the ternary expression if the condition istrue.- Type Parameters:
T- the type of the intermediate result- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
then
public <T> When.ObjectConditionBuilder<T> then(T thenValue)
Defines a constant value of the ternary expression, that is returned if the condition istrue.- Type Parameters:
T- the type of the intermediate result- Parameters:
thenValue- the value- Returns:
- the intermediate result which still requires the otherwise-branch
-
-