[API REVIEW] WITHDRAWN - RT-27883: move Size and SizeUnits to public API

David Grieve david.grieve at oracle.com
Mon Jan 28 08:48:51 PST 2013


The driving force behind wanting to make this public API was so StyleConverter#getSizeConverter() could return a StyleConverter<?, Size>. Instead of making Size public API, it occurred to me that I could change the Size converter so that it converts to a Number rather than a Size. Now StyleConverter#getSizeConverter() returns a StyleConverter<?,Number> and Size does not need to be public API.

On Jan 24, 2013, at 7:36 PM, David Grieve <david.grieve at oracle.com> wrote:

> I've updated the description in the bug and added a comment regarding the changes. 
> 
> On Jan 24, 2013, at 2:22 PM, Richard Bair <richard.bair at oracle.com> wrote:
> 
>>> Size and SizeUnit are used for CSS values and units. These currently live in the com.sun.javafx.css package. These classes need to be moved to javafx.css in order to remove raw types from generics in the CSS public API. Some methods in the com.sun.javafx.css API should be renamed to make their purpose clearer. 
>> 
>> OK in general.
>> 
>>> Size: 
>>> public double getValue() - return the number part of the css value 
>>> public SizeUnits getUnits() - return the units, e.g. - em, px, % 
>>> public boolean isFontRelative() - return true if the units are font-relative (em or ex) 
>>> public double actualValue(Font font) - calculate the actual value using the size of the given font if the units are font-relative or percentage 
>>> public double actualValue(double multiplier) - calculate the actual value using the multiplier if the units are font-relative or percentage 
>>> public double actualValue() - same as actualValue(1.0) 
>> 
>> How often is actualValue() used? Is it worth having that convenience API in there?
>> 
>>> enum SizeUnits 
>>> 
>>> public boolean isFontRelative() - return true if the units are font-relative (em or ex) 
>> 
>> Why do we have this method here and in Size? It seems like Size doesn't need it, as I can just getUnits().isFontRelative()?
>> 
>>> public double calculateValue(Font font) - calculate the actual value using the size of the given font if the units are font-relative or percentage 
>>> public double calculateValue(double multiplier) - calculate the actual value using the multiplier if the units are font-relative or percentage 
>> 
>> How does this work? Do these methods simply return a multiplier?
>> 
>> Richard
> 



More information about the openjfx-dev mailing list