[ 
https://issues.apache.org/jira/browse/PIVOT-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829072#action_12829072
 ] 

Greg Brown commented on PIVOT-398:
----------------------------------

Hi Alfred,

The easiest way to do this would be to extend the default 
org.apache.pivot.wtk.content.TableViewHeaderDataRenderer class and override the 
render() method:

public class CustomTableViewHeaderDataRenderer extends 
TableViewHeaderDataRenderer {
    @Override
    public void render(Object data, int columnIndex, TableViewHeader 
tableViewHeader,
        String columnName, boolean highlighted) {
        super.render(data, columnIndex, tableViewHeader, columnName, 
highlighted);
        
        if (columnName.equals("foo")) {
            getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
        } else {
            getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
        }
    }
}

This class will left-align the "foo" column header but center-align all other 
column headers. To use it in your table view header, just pass an instance of 
it to TableViewHeader#setDataRenderer().

Hope this helps.



> table Header does not have "align" property so can not set text left or 
> center or right
> ---------------------------------------------------------------------------------------
>
>                 Key: PIVOT-398
>                 URL: https://issues.apache.org/jira/browse/PIVOT-398
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>    Affects Versions: 1.4
>            Reporter: alfred zhang
>            Assignee: Greg Brown
>            Priority: Minor
>             Fix For: 1.4.1
>
>
> table Header does not have "align" property so can not set text left or 
> center or right

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to