Bug 208335 - [JFace] AbstractColumnLayout does not handle columns with minimum and weight correctly
Summary: [JFace] AbstractColumnLayout does not handle columns with minimum and weight ...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-10-31 18:43 EDT by Micah Hainline CLA
Modified: 2008-02-06 15:15 EST (History)
1 user (show)

See Also:


Attachments
Test identifying the problem (3.46 KB, text/plain)
2007-11-15 10:27 EST, Micah Hainline CLA
no flags Details
Patch correcting the problem (4.38 KB, patch)
2007-11-15 10:29 EST, Micah Hainline CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Micah Hainline CLA 2007-10-31 18:43:55 EDT
When calculating the widths of columns that have a ColumnWeightData with both weight and minimum width, the AbstractColumnLayout appends the minimum width on to the width calculation rather than using it as an actual minimum value.  This causes the widths of the columns not to honor their weight settings correctly.

Say for instance that you construct a table or tree with two columns, the first with a weight of 1 and a min width of 50, the second with a weight of 1 and a min width of 100.  If there are 400 pixels of available space we should see both columns having equal width.  The minimums should not come in to play in this instance.  Instead the second column is larger than the first.

The algorithm in question is located in AbstractColumnLayout#layoutTableTree
Comment 1 Thomas Schindl CLA 2007-10-31 19:00:02 EDT

*** This bug has been marked as a duplicate of bug 204712 ***
Comment 2 Micah Hainline CLA 2007-10-31 19:12:07 EDT
The issue outlined here isn't really related to the columns allowing themselves to be resized to a value smaller than their minimum size, it is more concerned with the initial width the columns receive when they have both a weight and minimum size.  If you want to tackle both of the issues at once though, that would be great though! :)

If you would like any help with this one let me know and I'll see what I can do Tom.
Comment 3 Thomas Schindl CLA 2007-10-31 19:28:09 EDT
Accepted, go a head and provide a patch :-)
Comment 4 Micah Hainline CLA 2007-11-15 10:27:54 EST
Created attachment 82966 [details]
Test identifying the problem

This is a test outlining the problem.  I couldn't find the other tests for this layout or I would have included this one among the others.
Comment 5 Micah Hainline CLA 2007-11-15 10:29:38 EST
Created attachment 82967 [details]
Patch correcting the problem

This is a patch that changes the behavior of the layout to calculate the widths based on weight, but use the minimum if the weighted width falls below the minimum.
Comment 6 Thomas Schindl CLA 2008-01-18 16:58:50 EST
released fix to CVS-HEAD >= 20080118 (I modified the patch to giving kudos to you for the work)
Comment 7 Thomas Schindl CLA 2008-02-06 15:15:02 EST
verified by because tests are run and passed in I20080205