| StyledCellLabelProvider right aligned text [message #727463] |
Wed, 21 September 2011 07:23  |
Thomas Singer Messages: 75 Registered: July 2009 |
Member |
|
|
How to make a StyledCellLabelProvider draw right-aligned text? For normal ColumnLabelProviders it is sufficient to initialize the belonging TableViewerColumn's style with SWT.RIGHT. But if the viewerColumn a StyledCellLabelProvider is registered, it ignores this style.
Thanks in advance.
|
|
|
|
|
| Re: StyledCellLabelProvider right aligned text [message #727891 is a reply to message #727499] |
Thu, 22 September 2011 03:08  |
Vijay Raj Messages: 603 Registered: July 2009 |
Senior Member |
|
|
Thomas Singer wrote on Wed, 21 September 2011 18:49Quote:This is a jface related question,but since the solution may b a simple one will resolve it here,but if the problem continues please post your further queries to Jface forum.
Done. Looks like a JFace bug. 
Quote:Try setting SWT.RIGHT_TO_LEFT
Just for the records: it does not work.
ohh...
i noticed this SWT.RIGHT_TO_LEFT style check code of StyledCellLabelProvider
private TextLayout getSharedTextLayout(Display display) {
if (cachedTextLayout == null) {
int orientation = viewer.getControl().getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
//viewer.getColumnViewerOwner(getColumn().)
cachedTextLayout = new TextLayout(display);
cachedTextLayout.setOrientation(orientation);
}
return cachedTextLayout;
}
thats why i thought that would be the solution,but then again it is also used by the table control to right align the columns.
possible fix can be updating TextLayout orientation in updateTextLayout method according to the column style.
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
Powered by
FUDForum. Page generated in 0.01572 seconds