Bug 258090 - [Tree] Alignment for columns is broken
Summary: [Tree] Alignment for columns is broken
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.2   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 1.3 M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2008-12-09 09:43 EST by Walter Mising name CLA
Modified: 2010-04-23 08:48 EDT (History)
3 users (show)

See Also:


Attachments
Checkbox Viewer which aligns the 2nd Column towards RIGHT (4.65 KB, application/octet-stream)
2009-01-07 09:19 EST, Walter Mising name CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Mising name CLA 2008-12-09 09:43:21 EST
When setting the Right alignment for a Tree Column in CheckboxTreeViewer ( Multiple Column ), the Header is right aligned but not the rows of that column.
Comment 1 Ivan Furnadjiev CLA 2008-12-17 05:57:47 EST
Is this working in RCP?
Comment 2 Walter Mising name CLA 2008-12-21 04:44:43 EST
(In reply to comment #1)
> Is this working in RCP?
> 

Yes.
Comment 3 Ivan Furnadjiev CLA 2008-12-22 02:48:42 EST
Can you provide a snippet to reproduce it?
Comment 4 Walter Mising name CLA 2008-12-25 08:21:38 EST
    final Composite composite = new Composite ( parent, SWT.NONE ) ;
    composite.setLayoutData ( new GridData ( SWT.LEFT, SWT.CENTER, true, true ) ) ;
    final GridLayout gridLayout_2 = new GridLayout ( ) ;
    gridLayout_2.numColumns = 2 ;
    composite.setLayout ( gridLayout_2 ) ;

    final CheckboxTreeViewer viewer = new CheckboxTreeViewer ( composite, SWT.FULL_SELECTION ) ;
    final GridData gd_tree_1 = new GridData ( SWT.FILL, SWT.TOP, true, true, 2, 1 ) ;
    gd_tree_1.heightHint = 219 ;
    gd_tree_1.widthHint = 479 ;
    viewer.setContentProvider ( new MyTreeContentProvider ( ) ) ;
    viewer.setLabelProvider ( new MyTreeLabelProvider ( ) ) ;

    tree = viewer.getTree ( ) ;
    tree.setLayoutData ( gd_tree_1 ) ;
    tree.setHeaderVisible ( true ) ;
    tree.setLinesVisible ( true ) ;

    TreeColumn column1 = new TreeColumn ( tree, SWT.LEFT | SWT.FILL ) ;

    TreeColumn column2 = new TreeColumn ( tree, SWT.RIGHT | SWT.FILL ) ;

    TreeColumn column3 = new TreeColumn ( tree, SWT.RIGHT | SWT.FILL ) ;

    TreeColumn column4 = new TreeColumn ( tree, SWT.RIGHT | SWT.BORDER ) ;
...
Comment 5 Ivan Furnadjiev CLA 2009-01-05 10:22:53 EST
Hi Walter,
I've created a simple standalone SWT test case:
-------------
Tree tree = new Tree( shell, SWT.FULL_SELECTION | SWT.CHECK );
for( int i = 0; i < 3; i++ ) {
    TreeItem ti = new TreeItem( tree, SWT.NONE );
    ti.setText( "Item "+i );
    for( int j = 0; j < 3; j++ ) {
        TreeItem sti = new TreeItem( ti, SWT.NONE );
        sti.setText( "Subitem "+j+" of Item "+i );
    }
}
tree.setSize( 800,600 );
tree.setHeaderVisible( true );
TreeColumn col1 = new TreeColumn( tree, SWT.RIGHT );
col1.setText( "Col 1" );
col1.setWidth( 250 );
TreeColumn col2 = new TreeColumn( tree, SWT.LEFT );
col2.setText( "Col 2" );
col2.setWidth( 250 );
-----------------------
Setting the tree column alignment to SWT.RIGHT does not affect the data alignment in SWT too - only header text is right aligned.
Comment 6 Walter Mising name CLA 2009-01-07 09:19:47 EST
Created attachment 121806 [details]
Checkbox Viewer which aligns the 2nd Column towards RIGHT

By changing the line 
 TreeColumn oc = new TreeColumn(tree, SWT.RIGHT) ;
to
 TreeColumn oc = new TreeColumn(tree, SWT.LEFT) ;

the 2nd column aligns towards left.
Comment 7 Ivan Furnadjiev CLA 2009-01-07 11:30:34 EST
Thank you Walter, for providing this example. I've always looked at the first column with the checkboxes, which is always left justified.
Comment 8 Ivan Furnadjiev CLA 2010-04-23 08:48:14 EDT
Fixed in CVS HEAD. The column alignment is applied to tree item text too. First column tree item text is always right aligned as in SWT.