changeset 7369:796678138fdf

[JAVADOC ONLY] RT-36510: reduce CssMetaData boilerplate
author David Grieve<david.grieve@oracle.com>
date Thu, 26 Jun 2014 15:04:59 -0400
parents b96e984f4fd5
children bc10f48ef71f
files modules/graphics/src/main/java/javafx/css/CssMetaData.java modules/graphics/src/main/java/javafx/css/StyleableProperty.java modules/graphics/src/main/java/javafx/css/StyleablePropertyFactory.java modules/graphics/src/main/java/javafx/css/package.html
diffstat 4 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/javafx/css/CssMetaData.java	Thu Jun 26 11:22:02 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/css/CssMetaData.java	Thu Jun 26 15:04:59 2014 -0400
@@ -52,6 +52,8 @@
  * {@code getCssMetaData()} simply return {@code getClassCssMetaData()}. The
  * purpose of {@code getClassCssMetaData()} is to allow sub-classes to easily
  * include the CssMetaData of some ancestor.
+ * <p>The {@link javafx.css.StyleablePropertyFactory StyleablePropertyFactory}
+ * greatly simplifies creating a StyleableProperty and its corresponding CssMetaData.</p>
  * <p>
  * This example is a typical implementation. 
  * <code><pre>
@@ -106,6 +108,7 @@
  * @param <S> The type of Styleable
  * @param <V> The type into which the parsed value is converted. 
  * @since JavaFX 8.0
+ * @see javafx.css.StyleablePropertyFactory
  */
 public abstract class CssMetaData<S extends Styleable, V> {
     
--- a/modules/graphics/src/main/java/javafx/css/StyleableProperty.java	Thu Jun 26 11:22:02 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/css/StyleableProperty.java	Thu Jun 26 15:04:59 2014 -0400
@@ -42,7 +42,10 @@
  * or {@link javafx.scene.Parent#getStylesheets()}</li>
  * <li>a style from {@link javafx.scene.Node#setStyle(java.lang.String)}</li>
  * </ol>
+ * <p>The {@link javafx.css.StyleablePropertyFactory StyleablePropertyFactory}
+ * greatly simplifies creating a StyleableProperty and its corresponding CssMetaData.</p>
  * @since JavaFX 8.0
+ * @see javafx.css.StyleablePropertyFactory
  */
 public interface StyleableProperty<T> extends WritableValue<T> {
     
--- a/modules/graphics/src/main/java/javafx/css/StyleablePropertyFactory.java	Thu Jun 26 11:22:02 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/css/StyleablePropertyFactory.java	Thu Jun 26 15:04:59 2014 -0400
@@ -60,16 +60,16 @@
      }
 
      // Typical JavaFX property implementation
-     public ObservableValue{@literal <}Boolean{@literal >} selectedProperty() { return (ObservableValue{@literal <}Boolean{@literal >})selected; }
+     public{@literal ObservableValue<Boolean>} selectedProperty() { return ({@literal ObservableValue<Boolean>})selected; }
      public boolean isSelected() { return selected.getValue(); }
      public void setSelected(boolean isSelected) { selected.setValue(isSelected); }
 
      // StyleableProperty implementation reduced to one line
-     private final StyleableProperty{@literal <}Boolean{@literal >} selected =
-         StyleablePropertyFactory.getInstance().createStyleableBooleanProperty(this, "selected", "-my-selected", s -{@literal >} ((MyButton) s).selected);
+     private final{@literal StyleableProperty<Boolean>} selected =
+         StyleablePropertyFactory.getInstance().createStyleableBooleanProperty(this, "selected", "-my-selected", s{@literal ->} ((MyButton) s).selected);
 
-     @Override
-     public List{@literal <}CssMetaData{@literal <}? extends Styleable, ?{@literal >}{@literal >} getControlCssMetaData() {
+    {@literal @}Override
+     public{@literal List<CssMetaData<? extends Styleable, ?>>} getControlCssMetaData() {
          return StyleablePropertyFactory.getInstance().getCssMetaData(this);
      }
 
--- a/modules/graphics/src/main/java/javafx/css/package.html	Thu Jun 26 11:22:02 2014 -0700
+++ b/modules/graphics/src/main/java/javafx/css/package.html	Thu Jun 26 15:04:59 2014 -0400
@@ -36,7 +36,8 @@
 <dt>{@link javafx.css.StyleableProperty StyleableProperty}</dt>
 <dd>Defines the interface that the CSS implementation uses to set values on a
     property and provides a link back to the {@code CssMetaData} that 
-    corresponds to the property.</dd>
+    corresponds to the property. The {@link javafx.css.StyleablePropertyFactory StyleablePropertyFactory}
+    greatly simplifies creating a StyleableProperty and its corresponding CssMetaData.</dd>
 
 <dt>{@link javafx.css.PseudoClass PseudoClass}</dt>
 <dd>Defines a pseudo-class which can be set or cleared via the method