[API Review] RT-21094 - Styleable interface

Tom Schindl tom.schindl at bestsolution.at
Tue Jan 22 13:42:01 PST 2013


Hi,

The problem I see with this is that CssMetaData accepts 2 generic
parameters but your API returns a RAW-Type, this looks bogus to me!

BTW the JIRA is not public.

Tom

Am 22.01.13 22:09, schrieb David Grieve:
> http://javafx-jira.kenai.com/browse/RT-21094
> 
> There is a class in private implementation called Styleable which allows SceneBuilder to look at a Tooltip (for example) and get the info it needs for styling. What I'd like to do is make Styleable part of the public API _and_ have Node and PopupControl (there may be a couple of other controls) implement Styleable. From the CSS standpoint, Styleable contains the API that CSS needs to match selectors and set calculated values on properties.
> 
> By making Styleable public API, I can change CssMetaData from CssMetaData<N extends Node, V> to CssMetaData<N extends Styleable, V>. This is important to do now before the CSS API is fully baked so that we can, in the future, have Scene be Styleable. 
> 
> public interface Styleable { 
> 
>     /** 
>      * The type of this {@code Styleable} that is to be used in selector matching. 
>      * This is analogous to an "element" in HTML. 
>      * (<a href=" http://www.w3.org/TR/CSS2/selector.html#type-selectors">CSS Type Selector</a>). 
>      */ 
>     String getType(); 
> 
>     /** 
>      * The id of this {@code Styleable}. This simple string identifier is useful for 
>      * finding a specific Node within the scene graph. While the id of a Node 
>      * should be unique within the scene graph, this uniqueness is not enforced. 
>      * This is analogous to the "id" attribute on an HTML element 
>      * (<a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">CSS ID Specification</a>). 
>      * <p> 
>      * For example, if a Node is given the id of "myId", then the lookup method can 
>      * be used to find this node as follows: <code>scene.lookup("#myId");</code>. 
>      * </p> 
>      */ 
>     String getId(); 
> 
>     /** 
>      * A list of String identifiers which can be used to logically group 
>      * Nodes, specifically for an external style engine. This variable is 
>      * analogous to the "class" attribute on an HTML element and, as such, 
>      * each element of the list is a style class to which this Node belongs. 
>      * 
>      * @see <a href="http://www.w3.org/TR/css3-selectors/#class-html">CSS3 class selectors</a> 
>      */ 
>    List<String> getStyleClass(); 
> 
>     /** 
>      * The inline style. This is analogous to the "style" attribute of an 
>      * HTML element.
>      */ 
>    String getStyle(); 
>      
>     /** 
>      * Return the parent of this Styleable, or null if there is no parent. 
>      */ 
>     Styleable getStyleableParent(); 
>      
>     /** 
>      * The CssMetaData of this Styleable 
>      */ 
>     List<CssMetaData> getCssMetaData(); 
>             
> } 
> 


-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                 geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
http://www.BestSolution.at                      phone    ++43 512 935834


More information about the openjfx-dev mailing list