< prev index next >

modules/javafx.base/src/main/java/javafx/beans/property/DoubleProperty.java

Print this page




 102         final String name = getName();
 103         final StringBuilder result = new StringBuilder(
 104                 "DoubleProperty [");
 105         if (bean != null) {
 106             result.append("bean: ").append(bean).append(", ");
 107         }
 108         if ((name != null) && (!name.equals(""))) {
 109             result.append("name: ").append(name).append(", ");
 110         }
 111         result.append("value: ").append(get()).append("]");
 112         return result.toString();
 113     }
 114 
 115     /**
 116      * Returns a {@code DoubleProperty} that wraps a
 117      * {@link javafx.beans.property.Property} and is
 118      * bidirectionally bound to it.
 119      * Changing this property will result in a change of the original property.
 120      *
 121      * <p>
 122      * This is very useful when bidirectionally binding an ObjectProperty<Double> and
 123      * a DoubleProperty.
 124      *
 125      * <blockquote><pre>
 126      *   DoubleProperty doubleProperty = new SimpleDoubleProperty(1.0);
 127      *   ObjectProperty&lt;Double&gt; objectProperty = new SimpleObjectProperty&lt;&gt;(2.0);
 128      *
 129      *   // Need to keep the reference as bidirectional binding uses weak references
 130      *   DoubleProperty objectAsDouble = DoubleProperty.doubleProperty(objectProperty);
 131      *
 132      *   doubleProperty.bindBidirectional(objectAsDouble);
 133      *
 134      * </pre></blockquote>
 135      *
 136      * Another approach is to convert the DoubleProperty to ObjectProperty using
 137      * {@link #asObject()} method.
 138      * <p>
 139      * Note: null values in the source property will be interpreted as 0.0
 140      *
 141      * @param property
 142      *            The source {@code Property}




 102         final String name = getName();
 103         final StringBuilder result = new StringBuilder(
 104                 "DoubleProperty [");
 105         if (bean != null) {
 106             result.append("bean: ").append(bean).append(", ");
 107         }
 108         if ((name != null) && (!name.equals(""))) {
 109             result.append("name: ").append(name).append(", ");
 110         }
 111         result.append("value: ").append(get()).append("]");
 112         return result.toString();
 113     }
 114 
 115     /**
 116      * Returns a {@code DoubleProperty} that wraps a
 117      * {@link javafx.beans.property.Property} and is
 118      * bidirectionally bound to it.
 119      * Changing this property will result in a change of the original property.
 120      *
 121      * <p>
 122      * This is very useful when bidirectionally binding an ObjectProperty&lt;Double&gt; and
 123      * a DoubleProperty.
 124      *
 125      * <blockquote><pre>
 126      *   DoubleProperty doubleProperty = new SimpleDoubleProperty(1.0);
 127      *   ObjectProperty&lt;Double&gt; objectProperty = new SimpleObjectProperty&lt;&gt;(2.0);
 128      *
 129      *   // Need to keep the reference as bidirectional binding uses weak references
 130      *   DoubleProperty objectAsDouble = DoubleProperty.doubleProperty(objectProperty);
 131      *
 132      *   doubleProperty.bindBidirectional(objectAsDouble);
 133      *
 134      * </pre></blockquote>
 135      *
 136      * Another approach is to convert the DoubleProperty to ObjectProperty using
 137      * {@link #asObject()} method.
 138      * <p>
 139      * Note: null values in the source property will be interpreted as 0.0
 140      *
 141      * @param property
 142      *            The source {@code Property}


< prev index next >