SimpleStyleable<Foo>Properties API Questions

David Grieve david.grieve at oracle.com
Thu Mar 14 08:20:34 PDT 2013


I'm sorry. I must really be misunderstanding what it is you are suggesting. I don't know how you can have SimpleStyleable<Foo>Property extend both Styleable<Foo>Property and Simple<Foo>Property.

On Mar 14, 2013, at 10:15 AM, Danno Ferrin <danno.ferrin at shemnon.com> wrote:

> 
> >
> > 2.  Why does it extend from Simple<Foo>Property instead of
> > Styleable<Foo>Property?  Just an implementation convenience?  I think it
> > would be more valuable to extend from the Styleable property than the
> > Simple property, since simple only adds implementation but styleable adds
> > implementation for a new interface.  I see myself adding more
> > StyleableDoubleProperties that are backed by a Simple varient than a
> > SimpleDoubleProperty backed by the styleable variant.
> >
> 
> Because we want SimpleStyleable<Foo>Property to be a Simple<Foo>Property _and_ a StyleableProperty. It is the only way to do it since Simple<Foo>Property is a class and StyleableProperty is an interface. To do it the other way around would require that the SimpleStyleable<Foo>Property re-implement the entire Simple<Foo>Property API - <Foo>PropertyBase, <Foo>Property, ReadOnly<Foo>Property and so on.
> 
> I can understand that you want to be able to do 'StyleableDoubleProperty foo = new SimpleStyleableDoubleProperty(FOO);'  But you can do 'StyleableProperty<Double> foo = new SimpleStyleableDoubleProperty(FOO);'
> 
> 
> I want it to be a Simple<Foo>Porperty and a Styleable<Foo>Property, you missed the <foo> on the styleable, very important.  Both of these classes derive from <Foo>PropertyBase, so they both save a lot of overhead there.  It is the implementation in the specialization where the horse trading occurs. The implementation overhead for Simple<Foo>Property is 3 one-line constructors, two fields, and two one line methods for those fields.  The implementation overhead for SimpleStyleable<Foo>Property is 4 constructors, 5 methods, and a total of 8 lines, and two fields.  Really slightly more code duplication and work is being done for the current hierarchy.
>  
> 
> -- 
> Danno



More information about the openjfx-dev mailing list