- java.lang.Object
-
- javafx.beans.binding.When
-
public class When extends Object
计算三元表达式的绑定的起始点。三元表达式具有
new When(cond).then(value1).otherwise(value2);的基本形式。 表达式cond需要是一个ObservableBooleanValue。 根据cond的值,该值包含value1(如果为cond.getValue() == true)或value2(如果为cond.getValue() == false)的值。 值value1和value2必须是相同的类型。 它们可以是常数值或ObservableValue的实现。- 从以下版本开始:
- JavaFX 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 描述 classWhen.BooleanConditionBuilder组装三元表达时需要一个中间类。classWhen.NumberConditionBuilderif-then-else表达式返回一个数字。classWhen.ObjectConditionBuilder<T>组装三元表达时需要一个中间类。classWhen.StringConditionBuilder组装三元表达时需要一个中间类。
-
构造方法摘要
构造方法 Constructor 描述 When(ObservableBooleanValue condition)构造函数为When。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 When.BooleanConditionBuilderthen(boolean thenValue)定义三元表达式的常量值,如果条件为true则返回。When.NumberConditionBuilderthen(double thenValue)定义三元表达式的常量值,如果条件为true则返回。When.NumberConditionBuilderthen(float thenValue)定义三元表达式的常量值,如果条件为true则返回。When.NumberConditionBuilderthen(int thenValue)定义三元表达式的常量值,如果条件为true则返回。When.NumberConditionBuilderthen(long thenValue)定义三元表达式的常量值,如果条件为true,则返回该true。When.StringConditionBuilderthen(String thenValue)定义三元表达式的常量值,如果条件为true则返回。When.BooleanConditionBuilderthen(ObservableBooleanValue thenValue)定义ObservableBooleanValue如果条件为true则由三元表达式返回哪个值。When.NumberConditionBuilderthen(ObservableNumberValue thenValue)定义ObservableNumberValue,如果条件为true,那么三元表达式返回哪个值。<T> When.ObjectConditionBuilder<T>then(ObservableObjectValue<T> thenValue)定义ObservableObjectValue如果条件为true, 则该值由三元表达式返回。When.StringConditionBuilderthen(ObservableStringValue thenValue)定义ObservableStringValue如果条件为true, 则该值由三元表达式返回。<T> When.ObjectConditionBuilder<T>then(T thenValue)定义三元表达式的常量值,如果条件为true则返回。
-
-
-
构造方法详细信息
-
When
public When(ObservableBooleanValue condition)
构造函数为When。- 参数
-
condition- 三元表达的条件
-
-
方法详细信息
-
then
public When.NumberConditionBuilder then(ObservableNumberValue thenValue)
定义ObservableNumberValue如果条件为true则由三元表达式返回哪个值。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.NumberConditionBuilder then(double thenValue)
定义三元表达式的常量值,如果条件为true则返回。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.NumberConditionBuilder then(float thenValue)
定义三元表达式的常量值,如果条件为true则返回。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.NumberConditionBuilder then(long thenValue)
定义三元表达式的常量值,如果条件为true则返回。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.NumberConditionBuilder then(int thenValue)
定义三元表达式的常量值,如果条件为true,则返回该true。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.BooleanConditionBuilder then(ObservableBooleanValue thenValue)
定义ObservableBooleanValue如果条件为true则由三元表达式返回该值。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.BooleanConditionBuilder then(boolean thenValue)
定义三元表达式的常量值,如果条件为true则返回。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.StringConditionBuilder then(ObservableStringValue thenValue)
定义ObservableStringValue如果条件为true, 则该值由三元表达式返回。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public When.StringConditionBuilder then(String thenValue)
定义三元表达式的常量值,如果条件为true则返回。- 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public <T> When.ObjectConditionBuilder<T> then(ObservableObjectValue<T> thenValue)
定义ObservableObjectValue如果条件为true, 则该值由三元表达式返回。- 参数类型
-
T- 中间结果的类型 - 参数
-
thenValue- 值 - 结果
- 中间结果仍然需要否则分支
-
then
public <T> When.ObjectConditionBuilder<T> then(T thenValue)
定义三元表达式的常量值,如果条件为true则返回。- 参数类型
-
T- 中间结果的类型 - 参数
-
thenValue- 值 - 结果
- the intermediate result which still requires the otherwise-branch
-
-