[8u40] Review Request (second iteration): (RT-36510) [CSS] Reduce CssMetaData boilerplate code

David Grieve david.grieve at oracle.com
Tue Jun 24 23:22:32 UTC 2014

I am seeking feedback on 
http://cr.openjdk.java.net/~dgrieve/RT-36510/webrev.00 which addresses 

This iteration reduces the boiler-plate to one line to create the 
StyleableProperty and one method to return the CssMetaData list.

Example use:

public class MyButton extends Button {

     public MyButton(String text) {

     public ObservableValue<String> fooProperty() { return 
(ObservableValue<String>)foo; }
     public String getFoo() { return foo.getValue(); }
     public void setFoo(String value) { foo.setValue(value); }
     private final StyleableProperty<String> foo = 
"foo", "-my-foo", s -> ((MyButton)s).foo);

     public ObservableValue<Double> offsetProperty() { return 
(ObservableValue<Double>)offset; }
     public Double getOffset() { return offset.getValue().doubleValue(); }
     public void setOffset(Double value) { offset.setValue(value); }
     private final StyleableProperty<Number> offset = 
"offset", "-my-offset", s -> ((MyButton)s).offset);

     public ObservableValue<Integer> countProperty() { return 
(ObservableValue<Integer>)count; }
     public Integer getCount() { return count.getValue().intValue(); }
     public void setCount(Integer value) { count.setValue(value); }
     private final StyleableProperty<Number> count = 
"count", "-my-count", s -> ((MyButton)s).count);

     public List<CssMetaData<? extends Styleable, ?>> 
getControlCssMetaData() {
         return StyleablePropertyFactory.getInstance().getCssMetaData(this);


More information about the openjfx-dev mailing list