Bug 19780

Summary: Table columns not distributing correctly in properties page
Product: [Eclipse Project] Platform Reporter: Ritchie Schacher <schacher>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: n.a.edgar
Version: 2.0   
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 13467    
Bug Blocks:    

Description Ritchie Schacher CLA 2002-06-10 09:26:11 EDT
I have a table in my properties page, with two columns, using ColumnWeightData 
for the columns.  If this page is the first page to come up when the dialog 
opens, then the columns are scrunched together.  It appears that the client area 
is computed incorrectly for the table.

If, however, another page is the default when the dialog opens, and you switch 
to this page, then the columns are distributed evenly.

My workaround for now is to use ColumnPixelData, but that is not optimal because
in that case the columns don't size proportionally when switching from another 
page.
Comment 1 Mike Wilson CLA 2002-06-10 10:30:06 EDT
ColumnWeightData is part of JFace. Moving to UI for consideration.
Comment 2 Nick Edgar CLA 2002-06-11 00:15:17 EDT
TableLayout only runs once, so the problem must be that the initial clientArea 
is too small when the initial layout is computed.
Comment 3 Nick Edgar CLA 2002-07-09 12:06:46 EDT
Please investigate.
Comment 4 Tod Creasey CLA 2002-07-09 12:49:14 EDT
Checking through all of the places where we use the ColumnWeightData we don't 
exhibit this problem. Could you please send us some details as to what widgets 
are in the page and how they are laid out? I suspect that your properties page 
has a different layout look.
Comment 5 Ritchie Schacher CLA 2002-07-09 13:31:42 EDT
You can recreate this with the Team->File Content prefs page, accessible from 
Window->Preferences.  Navigate to the page once; notice that the columns 
distribute proportionally accross the table.

Now close the prefs window with this page focused, and reopen.  Notice the 
columns are now not distributed accross the table.
Comment 6 Tod Creasey CLA 2002-07-09 15:08:08 EDT
I have replicated the fact that the coluymnswill only size thier required size 
when they are created and a full 50% when they are not.

Are you losing any information - i.e. when you say scrunched doi you mean 
minimum size or too small?

Reducing priority to P3.
Comment 7 Ritchie Schacher CLA 2002-07-09 15:54:56 EDT
In my case they are sizing too small, so that information is truncated within 
the columns and you have to manually resize the columns to make the truncated 
text visible.  I suspect if we searched we could find other preference or 
property pages where the same thing happens.
Comment 8 Nick Edgar CLA 2002-07-12 09:12:12 EDT
The problem is that the TableLayout gets told to layout twice, once when the 
page's controls are packed using pack(), and again when the overall size of the 
dialog is determined.  It's not clear that we can avoid this.

For a workaround, see bug 13467.  Recommend adapting the TableResizing example 
by Veronika in your page.  This will let the table adjust its column widths on 
every resize, not just the first. 
Comment 9 Nick Edgar CLA 2002-07-12 14:10:10 EDT
Took out the extra pack() call from PreferenceDialog$PageLayout.layout().
This was doing extra layouts which were overridden by the subsequent setSize().
Verified that all preference pages in the SDK work fine with this change.

The workaround suggested above will not be needed with this change.
This will be available in Tuesday's integration build (July 16) and in the 
nightly builds.
Comment 10 Nick Edgar CLA 2002-08-07 14:53:35 EDT
Needs to be released in 2.0.1 stream.
Comment 11 Tod Creasey CLA 2002-08-07 15:11:33 EDT
Released into 2.0.1 stream