本文整理汇总了Java中javafx.beans.property.FloatProperty类的典型用法代码示例。如果您正苦于以下问题:Java FloatProperty类的具体用法?Java FloatProperty怎么用?Java FloatProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FloatProperty类属于javafx.beans.property包,在下文中一共展示了FloatProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalize
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@SuppressWarnings("unchecked")
static Object normalize(Property<?> prop, Class<?> clz) {
if (clz.isAssignableFrom(IntegerProperty.class)) {
return toInteger((Property<Integer>) prop);
} else if (clz.isAssignableFrom(LongProperty.class)) {
return toLong((Property<Long>) prop);
} else if (clz.isAssignableFrom(FloatProperty.class)) {
return toFloat((Property<Float>) prop);
} else if (clz.isAssignableFrom(DoubleProperty.class)) {
return toDouble((Property<Double>) prop);
} else if (clz.isAssignableFrom(StringProperty.class)) {
return toString((Property<String>) prop);
} else if (clz.isAssignableFrom(ObjectProperty.class)) {
return toObject((Property<Object>) prop);
}
return prop;
}
示例2: testGeneratedOutputTypes
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@Test
public void testGeneratedOutputTypes() throws Exception {
ObjectFactory of = new ObjectFactory();
TestType cut = of.createTestType();
assertTrue("StringProperty expected!", cut.aStringProperty() instanceof StringProperty);
assertTrue("ObjectProperty expected!", cut.aBooleanProperty() instanceof ObjectProperty);
assertTrue("ObjectProperty expected!", cut.aDoubleProperty() instanceof ObjectProperty);
assertTrue("ObjectProperty expected!", cut.aFloatProperty() instanceof ObjectProperty);
assertTrue("ObjectProperty expected!", cut.aLongProperty() instanceof ObjectProperty);
cut.getAList();
assertTrue("ListProperty expected!", cut.aListProperty() instanceof ListProperty);
assertTrue("ObjectProperty expected!", cut.anIntegerProperty() instanceof ObjectProperty);
assertTrue("BooleanProperty expected!", cut.aPrimitiveBooleanProperty() instanceof BooleanProperty);
assertTrue("DoubleProperty expected!", cut.aPrimitiveDoubleProperty() instanceof DoubleProperty);
assertTrue("FloatProperty expected!", cut.aPrimitiveFloatProperty() instanceof FloatProperty);
assertTrue("LongProperty expected!", cut.aPrimitiveLongProperty() instanceof LongProperty);
assertTrue("IntegerProperty expected!", cut.aPrimitiveIntegerProperty() instanceof IntegerProperty);
}
示例3: propertyValueClass
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
/**
* Provides the underlying value class for a given {@link Property}
*
* @param property
* the {@link Property} to check
* @return the value class of the {@link Property}
*/
@SuppressWarnings("unchecked")
protected static <T> Class<T> propertyValueClass(final Property<T> property) {
Class<T> clazz = null;
if (property != null) {
if (StringProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) String.class;
} else if (IntegerProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Integer.class;
} else if (BooleanProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Boolean.class;
} else if (DoubleProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Double.class;
} else if (FloatProperty.class
.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Float.class;
} else if (LongProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Long.class;
} else if (ListProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) List.class;
} else if (MapProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Map.class;
} else {
clazz = (Class<T>) Object.class;
}
}
return clazz;
}
示例4: primitivePropertyClasses
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@DataPoints
public static Class<?>[] primitivePropertyClasses() {
return new Class<?>[]{
BooleanProperty.class,
IntegerProperty.class,
LongProperty.class,
FloatProperty.class,
DoubleProperty.class,
};
}
示例5: testNullPropertiesAccepted
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@Theory
public void testNullPropertiesAccepted(@FromDataPoints("safeProperties") Gson gson) {
testSerialize(WithBooleanProp.class, "{\"prop\":null}", (BooleanProperty) null, (o, v) -> o.prop = v, gson);
testSerialize(WithIntegerProp.class, "{\"prop\":null}", (IntegerProperty) null, (o, v) -> o.prop = v, gson);
testSerialize(WithLongProp.class, "{\"prop\":null}", (LongProperty) null, (o, v) -> o.prop = v, gson);
testSerialize(WithFloatProp.class, "{\"prop\":null}", (FloatProperty) null, (o, v) -> o.prop = v, gson);
testSerialize(WithDoubleProp.class, "{\"prop\":null}", (DoubleProperty) null, (o, v) -> o.prop = v, gson);
}
示例6: TableItemTask
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
/**
* constructor
*
* @param doc
* @param cNames
* @param classificationName
* @param tableView
*/
public TableItemTask(Document doc, String[] cNames, String classificationName, Set<Integer> classIds, TableView<TableItem> tableView, FloatProperty maxBitScore, FloatProperty maxNormalizedBitScore, IntegerProperty maxReadLength, ReadOnlyDoubleProperty layoutWidth) {
this.doc = doc;
this.cNames = cNames;
this.classificationName = classificationName;
this.classIds = classIds;
this.tableView = tableView;
this.maxBitScore = maxBitScore;
this.maxNormalizedBitScore = maxNormalizedBitScore;
this.maxReadLength = maxReadLength;
this.layoutWidth = layoutWidth;
}
示例7: bind
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
/**
* @see #bind(ObjectProperty, String)
*
* @param property {@link Property} to bind
* @param key unique application store key
*/
public void bind(FloatProperty property, String key) {
try {
property.set(prefs.getFloat(validateKey(key), property.get()));
} catch (NumberFormatException e) {
prefs.putFloat(key, property.getValue());
}
property.addListener(o -> prefs.putFloat(key, property.getValue()));
}
示例8: createPersistentThicknessPreference
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
public static FloatProperty createPersistentThicknessPreference(final String name, final float defaultValue) {
FloatProperty property = new PositiveFloatThicknessProperty(name, defaultValue);
property.set(getUserPreferences().getFloat(name, defaultValue));
property.addListener((v, o, n) -> getUserPreferences().putFloat(name, n.floatValue()));
// Triggered when reset is called
resetProperty.addListener((c, o, v) -> property.setValue(defaultValue));
return property;
}
示例9: wrapFloatProperty
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
/**
* Create a JavaFX {@link javafx.beans.property.FloatProperty} as a wrapper for a dolphin platform property
*
* @param dolphinProperty the dolphin platform property
* @return the JavaFX property
*/
public static FloatProperty wrapFloatProperty(final Property<Float> dolphinProperty) {
Assert.requireNonNull(dolphinProperty, "dolphinProperty");
final FloatProperty property = new SimpleFloatProperty();
FXBinder.bind(property).bidirectionalToNumeric(dolphinProperty);
return property;
}
示例10: getFloatBinding
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
public Optional<FloatProperty> getFloatBinding(String key) {
Optional<Property<?>> b = getBinding(key);
if (!b.isPresent() || !FloatProperty.class.isInstance(b.get())) {
return Optional.empty();
}
return Optional.of((FloatProperty) b.get());
}
示例11: testFloatProperty
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@Test
public void testFloatProperty() {
FloatProperty actual = new SimpleFloatProperty(10f);
assertThat(actual).hasValue(10f);
assertThat(actual).hasSameValue(actual);
}
示例12: propertyValueClass
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
/**
* Provides the underlying value class for a given {@linkplain Property}
*
* @param property
* the {@linkplain Property} to check
* @return the value class of the {@linkplain Property}
*/
@SuppressWarnings("unchecked")
protected static <T> Class<T> propertyValueClass(final Property<T> property) {
Class<T> clazz = null;
if (property != null) {
if (StringProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) String.class;
} else if (IntegerProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Integer.class;
} else if (BooleanProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Boolean.class;
} else if (DoubleProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Double.class;
} else if (FloatProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Float.class;
} else if (LongProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Long.class;
} else if (ListProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) List.class;
} else if (MapProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Map.class;
} else {
clazz = (Class<T>) Object.class;
}
}
return clazz;
}
示例13: toFloat
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
public static FloatProperty toFloat(Property<Float> p) {
return andFinal(() -> new SimpleFloatProperty(), np -> BidirectionalBinding.bindNumber(np, p));
}
示例14: extractPrimitiveValue
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@Override
protected Float extractPrimitiveValue(FloatProperty property) {
return property.get();
}
示例15: createDefaultProperty
import javafx.beans.property.FloatProperty; //导入依赖的package包/类
@Override
protected FloatProperty createDefaultProperty() {
return new SimpleFloatProperty();
}