Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 233614 - [Table] Column texts initially truncated
Summary: [Table] Column texts initially truncated
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.5 M2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-23 02:33 EDT by Setya Nugdjaja CLA
Modified: 2011-08-26 05:01 EDT (History)
1 user (show)

See Also:


Attachments
Screenshot of truncated table header from RAP (5.34 KB, image/png)
2008-05-23 02:33 EDT, Setya Nugdjaja CLA
no flags Details
Screenshot of table header in RCP (5.17 KB, image/png)
2008-05-23 02:38 EDT, Setya Nugdjaja CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Setya Nugdjaja CLA 2008-05-23 02:33:10 EDT
Created attachment 101693 [details]
Screenshot of truncated table header from RAP

Hi,

I use the following snippet to layout TableViewer in a ScrolledForm :

...
TableViewer tableViewer = new TableViewer(toolkit.createTable(form.getBody(), SWT.VIRTUAL));
tableViewer.getTable().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
tableViewer.getTable().setLinesVisible(true);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.setUseHashlookup(true);
tableViewer.setItemCount(0);

String[] titles = new String[]{"Template Name","Product ID","Product Name"};
for (String title : titles)
{
TableColumn column = new TableColumn(tableViewer.getTable(),SWT.NONE);
column.setText(title);
column.pack();
}
...

The result is some of the table header texts are truncated, user has to resize the columns in order to make them visible.

Attached is the screenshot from RAP & RCP.

Regards,

Setya
Comment 1 Setya Nugdjaja CLA 2008-05-23 02:38:43 EDT
Created attachment 101694 [details]
Screenshot of table header in RCP
Comment 2 Ivan Furnadjiev CLA 2008-05-23 02:43:19 EDT
Is this happened only first time when you start the application? Is reload of the page in browser fixed the problem?
Comment 3 Rüdiger Herrmann CLA 2008-05-23 05:41:01 EDT
This is probably related to the text-size-determination.
When pack() is called the first time and the column texts haven't beed measured yet, it uses an estimation adn tells the client to measure these texts properly.
This results in a further request that contains the actual text sizes. So far so good. 
When processing this request, the table is resized (grow 100px, then shrink 100px or so). Only resizing a table does not affect its column sizes, which is usually desired, but not helpful in this case.
I assume that the same applies for TreeColumns also.
Comment 4 Setya Nugdjaja CLA 2008-05-23 06:17:31 EDT
(In reply to comment #2)
> Is this happened only first time when you start the application? Is reload of
> the page in browser fixed the problem?
> 

No, reloading the browser won't do it.
Comment 5 Ivan Furnadjiev CLA 2011-08-02 08:02:49 EDT
Currently, there is a mechanism (RePackControlsVisitor) to re-pack the packed controls after the correct text size determination. We have to extend/change it to support widgets like TreeColumn/TableColumn.
Comment 6 Ivan Furnadjiev CLA 2011-08-26 05:01:56 EDT
Fixed in CVS HEAD by extending the RePackVisitor to pack the columns after the shell enlargement.