I see what you mean. I hadn't considered renderers that extend component 
classes when implementing stylesheet support. It is "unfortunate"  :-) but I 
think it is OK. Renderers and components are not the same thing - for one, 
renderers are much simpler and are meant to be implemented by the application 
developer, whereas skins are more complex and are generally not implemented by 
the application developer. Stylesheets essentially allow a developer to change 
the appearance (or behavior) of all instances of a particular skin type without 
having to write a custom skin. The same isn't necessary for renderers.

So, one approach would be for you to create a custom renderer that extends 
TableViewHeaderDataRenderer and sets the "horizontalAlignment" style in the 
constructor. However, that isn't even necessary - unlike skins, renderers are 
meant to be shared across components. So, you can simply create one instance 
and re-use it:

<TableViewHeaderDataRenderer bxml:id="headerDataRenderer" 
styles="{horizontalAlignment:'center'}"/>

Another thing we could do is make the 
TableView.Column.DEFAULT_HEADER_DATA_RENDERER instance public (it is already 
final). That way, you could set its "horizontalAlignment" style and thus affect 
every default header renderer in your application. We could do something 
similar for all default renderers.


On Aug 21, 2010, at 8:57 AM, Duto wrote:

> 
> I use this for my style :
> 
> "org.apache.pivot.wtk.content.TableViewHeaderDataRenderer":{
>        "horizontalAlignment":"center"
> }
> 
> I would like for all headerdata of TableView the label was "center", but the
> constructor of TableViewHeaderDataRenderer overwrite my horizontalAlignment
> it's very unfortunate :S
> 
> 
> -- 
> View this message in context: 
> http://apache-pivot-users.399431.n3.nabble.com/How-does-the-new-CSS-like-type-selectors-of-pivot-2-0-work-tp1256610p1262521.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply via email to