In theory, it should be easy enough for a developer to replace the header
renderer with something that does whatever
they want, displaying different stuff for each header.
But in practice, the most common usage is to override just one or two columns
with something special, so I would say
that, yes, we should make the header-renderer a per-column thing.
-- Noel
Greg Brown wrote:
> The reason it is done automatically is because a developer may want to
> combine both icon-only and text headers in a table view, but TableViewHeader
> only supports only a single header data renderer that is common to all
> headers. As a result, the renderer needs to make some assumptions about how
> the data should be presented.
>
> Perhaps it would be better to allow the caller to define the header data
> renderer on a per-column basis, in the TableView.Column class. The header
> data itself lives in the column, so arguably the header data renderer should
> go there as well.
>
> cc'ing the dev list for comments.
>
> G
>
> On Aug 5, 2010, at 2:44 AM, Olivier Dutrieux wrote:
>
>> Thanks Greg for your answer.
>>
>> Why it's not the developper to decide where the icon + text or text only or
>> only icon will be display ? It's will more flexible. or maybe that could be
>> use by defaut this actually display (only icon : centered-aligned, icon +
>> text or text only : left-aligned) but if the user defined the value
>> horizontalAlignment via the styles property that use property value :
>>
>> if (getStyles().get("horizontalAlignment") == null) {
>> getStyles().put("horizontalAlignment", (text == null) ?
>> HorizontalAlignment.CENTER : HorizontalAlignment.LEFT);
>> }
>>
>> Duto
>>
>> Le 05/08/2010 01:39, Greg Brown a écrit :
>>> No, it's not a bug. It is done that way so headers that contain only an
>>> icon will be centered, but icon+text or text only will be left-aligned.
>>>
>>> On Aug 4, 2010, at 4:53 PM, Duto wrote:
>>>
>>>> I found this process too^^ :
>>>>
>>>> src : TableViewHeaderDataRenderer
>>>>
>>>> 76: // Left-align the content
>>>> 77: getStyles().put("horizontalAlignment", (text == null) ?
>>>> 78: HorizontalAlignment.CENTER : HorizontalAlignment.LEFT);
>>>>
>>>> Why It's do like that ? It's a bug or ... ?
>>>>
>>>> Best regards
>>>>
>>>> Duto
>>>> --
>>>> View this message in context:
>>>> http://apache-pivot-users.399431.n3.nabble.com/center-the-text-of-header-columns-of-tableView-tp1022087p1023905.html
>>>> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.