< prev index next >

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

Print this page




  60         if (bean != null) {
  61             result.append("bean: ").append(bean).append(", ");
  62         }
  63         if ((name != null) && !name.equals("")) {
  64             result.append("name: ").append(name).append(", ");
  65         }
  66         result.append("value: ").append(get()).append("]");
  67         return result.toString();
  68     }
  69 
  70     /**
  71      * Returns a {@code ReadOnlyLongProperty} that wraps a
  72      * {@link javafx.beans.property.ReadOnlyProperty}. If the
  73      * {@code ReadOnlyProperty} is already a {@code ReadOnlyLongProperty}, it
  74      * will be returned. Otherwise a new
  75      * {@code ReadOnlyLongProperty} is created that is bound to
  76      * the {@code ReadOnlyProperty}.
  77      *
  78      * Note: null values will be interpreted as 0L
  79      *

  80      * @param property
  81      *            The source {@code ReadOnlyProperty}
  82      * @return A {@code ReadOnlyLongProperty} that wraps the
  83      *         {@code ReadOnlyProperty} if necessary
  84      * @throws NullPointerException
  85      *             if {@code property} is {@code null}
  86      * @since JavaFX 8.0
  87      */
  88     public static <T extends Number> ReadOnlyLongProperty readOnlyLongProperty(final ReadOnlyProperty<T> property) {
  89         if (property == null) {
  90             throw new NullPointerException("Property cannot be null");
  91         }
  92 
  93         return property instanceof ReadOnlyLongProperty ? (ReadOnlyLongProperty) property:
  94            new ReadOnlyLongPropertyBase() {
  95             private boolean valid = true;
  96             private final InvalidationListener listener = observable -> {
  97                 if (valid) {
  98                     valid = false;
  99                     fireValueChangedEvent();




  60         if (bean != null) {
  61             result.append("bean: ").append(bean).append(", ");
  62         }
  63         if ((name != null) && !name.equals("")) {
  64             result.append("name: ").append(name).append(", ");
  65         }
  66         result.append("value: ").append(get()).append("]");
  67         return result.toString();
  68     }
  69 
  70     /**
  71      * Returns a {@code ReadOnlyLongProperty} that wraps a
  72      * {@link javafx.beans.property.ReadOnlyProperty}. If the
  73      * {@code ReadOnlyProperty} is already a {@code ReadOnlyLongProperty}, it
  74      * will be returned. Otherwise a new
  75      * {@code ReadOnlyLongProperty} is created that is bound to
  76      * the {@code ReadOnlyProperty}.
  77      *
  78      * Note: null values will be interpreted as 0L
  79      *
  80      * @param <T> The type of Number to be wrapped
  81      * @param property
  82      *            The source {@code ReadOnlyProperty}
  83      * @return A {@code ReadOnlyLongProperty} that wraps the
  84      *         {@code ReadOnlyProperty} if necessary
  85      * @throws NullPointerException
  86      *             if {@code property} is {@code null}
  87      * @since JavaFX 8.0
  88      */
  89     public static <T extends Number> ReadOnlyLongProperty readOnlyLongProperty(final ReadOnlyProperty<T> property) {
  90         if (property == null) {
  91             throw new NullPointerException("Property cannot be null");
  92         }
  93 
  94         return property instanceof ReadOnlyLongProperty ? (ReadOnlyLongProperty) property:
  95            new ReadOnlyLongPropertyBase() {
  96             private boolean valid = true;
  97             private final InvalidationListener listener = observable -> {
  98                 if (valid) {
  99                     valid = false;
 100                     fireValueChangedEvent();


< prev index next >