changeset 7313:1e5d13781725

[JAVADOC-ONLY] RT-33600 [Timeline, Javadoc]: Javadocs should be more clear on references made and other things Also improved other javadoc related to references
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 19 Jun 2014 11:42:29 +0200
parents fa4f2204bfc5
children aaa59aad08d8
files modules/base/src/main/java/javafx/beans/binding/Binding.java modules/base/src/main/java/javafx/beans/property/BooleanPropertyBase.java modules/base/src/main/java/javafx/beans/property/Property.java modules/graphics/src/main/java/javafx/animation/Timeline.java
diffstat 4 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/base/src/main/java/javafx/beans/binding/Binding.java	Wed Jun 18 17:42:27 2014 -0700
+++ b/modules/base/src/main/java/javafx/beans/binding/Binding.java	Thu Jun 19 11:42:29 2014 +0200
@@ -39,7 +39,7 @@
  * implements {@code ObservableValue} allowing to use it in another binding.
  * With that one can assemble very complex bindings from simple bindings.
  * <p>
- * All bindings in the JavaFX 2.0 runtime are calculated lazily. That means, if
+ * All bindings in the JavaFX runtime are calculated lazily. That means, if
  * a dependency changes, the result of a binding is not immediately
  * recalculated, but it is marked as invalid. Next time the value of an invalid
  * binding is requested, it is recalculated.
--- a/modules/base/src/main/java/javafx/beans/property/BooleanPropertyBase.java	Wed Jun 18 17:42:27 2014 -0700
+++ b/modules/base/src/main/java/javafx/beans/property/BooleanPropertyBase.java	Thu Jun 19 11:42:29 2014 +0200
@@ -154,6 +154,7 @@
 
     /**
      * {@inheritDoc}
+     * Note:
      */
     @Override
     public void bind(final ObservableValue<? extends Boolean> rawObservable) {
--- a/modules/base/src/main/java/javafx/beans/property/Property.java	Wed Jun 18 17:42:27 2014 -0700
+++ b/modules/base/src/main/java/javafx/beans/property/Property.java	Thu Jun 19 11:42:29 2014 +0200
@@ -41,6 +41,9 @@
 
     /**
      * Create a unidirection binding for this {@code Property}.
+     * <p>
+     * Note that JavaFX has all the bind calls implemented through weak listeners. This means the bound property
+     * can be garbage collected and stopped from being updated.
      * 
      * @param observable
      *            The observable this {@code Property} should be bound to.
@@ -53,12 +56,14 @@
      * Remove the unidirectional binding for this {@code Property}.
      * 
      * If the {@code Property} is not bound, calling this method has no effect.
+     * @see #bind(javafx.beans.value.ObservableValue)
      */
     void unbind();
 
     /**
      * Can be used to check, if a {@code Property} is bound.
-     * 
+     * @see #bind(javafx.beans.value.ObservableValue)
+     *
      * @return {@code true} if the {@code Property} is bound, {@code false}
      *         otherwise
      */
@@ -70,8 +75,11 @@
      * Bidirectional bindings exists independently of unidirectional bindings. So it is possible to
      * add unidirectional binding to a property with bidirectional binding and vice-versa. However, this practice is
      * discouraged.
-     *
+     * <p>
      * It is possible to have multiple bidirectional bindings of one Property.
+     * <p>
+     * JavaFX bidirectional binding implementation use weak listeners. This means bidirectional binding does not prevent
+     * properties from being garbage collected.
      * 
      * @param other
      *            the other {@code Property}
--- a/modules/graphics/src/main/java/javafx/animation/Timeline.java	Wed Jun 18 17:42:27 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/animation/Timeline.java	Thu Jun 19 11:42:29 2014 +0200
@@ -60,6 +60,21 @@
  * It is not possible to change the {@code keyFrames} of a running {@code Timeline}.
  * If the value of {@code keyFrames} is changed for a running {@code Timeline}, it 
  * has to be stopped and started again to pick up the new value.
+ * <p>
+ * A simple Timeline can be created like this:
+ * <pre>{@code
+ * final Timeline timeline = new Timeline();
+ * timeline.setCycleCount(2);
+ * timeline.setAutoReverse(true);
+ * timeline.getKeyFrames().add(new KeyFrame(Duration.millis(5000),
+ *   new KeyValue (node.translateXProperty(), 25)));
+ * timeline.play();
+ * }</pre>
+ * <p>
+ * This Timeline will run for 10s, animating the node by x axis to value 25 and then back to 0 on the second cycle.
+ * <p>
+ * <b>Warning :</b> A running Timeline is being referenced from the FX runtime. Infinite Timeline
+ * might result in a memory leak if not stopped properly. All the objects with animated properties would not be garbage collected.
  * 
  * @see Animation
  * @see KeyFrame