Bug 21764 - [Coolbar] Use minimumSize of preferred size for items
Summary: [Coolbar] Use minimumSize of preferred size for items
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Lynne Kues CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-22 11:31 EDT by Lynne Kues CLA
Modified: 2002-08-08 13:12 EDT (History)
0 users

See Also:


Attachments
code (10.09 KB, application/octet-stream)
2002-07-24 15:07 EDT, Lynne Kues CLA
no flags Details
jar file (10.08 KB, application/octet-stream)
2002-08-01 17:37 EDT, Lynne Kues CLA
no flags Details
java file based on 1.33 (23.56 KB, text/plain)
2002-08-05 15:02 EDT, Lynne Kues CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lynne Kues CLA 2002-07-22 11:31:29 EDT
Look into using a minimum size of preferred size for the cool items, which will 
make cool items remain their maximum size.  Other applications do this and only 
use chevrons when the coolbar width changes (e.g., resizing window smaller).  
Would need to hook resize callback and reset minimum size for cool items during 
resize to get this behavior.
Comment 1 Lynne Kues CLA 2002-07-22 17:47:54 EDT
Experimented with resetting minimumSize during resize callback for coolbar and 
the approach is problematic.  In some instances, the platform wraps before the 
resize callback.  Also, ran into some cheese problems.  What I did was hook the 
resize callback and calculated the preferred width for each row (i.e., such 
that all coolitems would be fully displayed). Compared this width to client are 
width - if items do not fit on the row set minimum size for each item on the 
row to the size of its first item; if items do fit on the row, set minimum size 
for each item on the row to its maximum size.

Would need to have SWT intervene to get Word/VisualBasic like behavior.  Or we 
could just allow the platform to wrap.  If we did this, chevrons will never 
appear and cool items would be clipped when resizing to a size that is smaller 
than the minimum width (i.e., this would happen after autowrapping by 
platform).  Note that when you resize back to a larger size, the original 
layout will be preserved.
Comment 2 Lynne Kues CLA 2002-07-24 14:59:05 EDT
Using the maximumSize as the minimumSize would also decrease the complexity of 
the CoolBarManager code.  Currently, the CoolBarManager does auto wrapping of 
items.  Since the platform automatically wraps when the minimumSize of the item 
can no longer be displayed, CoolBarManager wrap code would no longer be 
necessary.

Should also retry the resize approach by hooking the callback on the Composite 
vs. the CoolBar - according to NE this approach may solve some of the problems 
I was seeing. 
Comment 3 Lynne Kues CLA 2002-07-24 15:07:53 EDT
Created attachment 1732 [details]
code
Comment 4 Lynne Kues CLA 2002-07-24 15:08:49 EDT
Attached code for later reference.  Code based on the following versions:

CoolBarManager 1.32
CoolItemToolBarManager 1.4
ContributionManager 1.7
Comment 5 Lynne Kues CLA 2002-08-01 17:36:53 EDT
Attaching updated jar.
Comment 6 Lynne Kues CLA 2002-08-01 17:37:13 EDT
Created attachment 1785 [details]
jar file
Comment 7 Lynne Kues CLA 2002-08-01 17:38:51 EDT
This bug depends on [Bug 21870] Coolbar - platform wrapping should not change 
item sizes. 
Comment 8 Lynne Kues CLA 2002-08-05 12:49:48 EDT
Also depends on the fix for [Bug 19664].
Comment 9 Lynne Kues CLA 2002-08-05 15:02:45 EDT
Created attachment 1795 [details]
java file based on 1.33
Comment 10 Lynne Kues CLA 2002-08-07 09:34:10 EDT
The above referenced bug should be [Bug 19964] Coolbar - can "lose" items when 
platform widget wraps. 
Comment 11 Lynne Kues CLA 2002-08-07 09:36:38 EDT
To see the affects of 21870, run with the new code and do the following:

1.  Open a Java Perspective.  Resize the window smaller so that the Launch and 
External Tools cool items go to the next row.  Notice that the size of the Java 
Elements cool item is increased for "free".
2.  Switch perspectives.
3.  Switch back to the Java perspective and resize the window larger.  Notice 
that the extra space remains for the Jave Element cool item.  This is because 
the layout was remembered and restored when switching to the new perspective.

If the extra space was not added, this saving/restoring the layout would not 
cause a problem.
Comment 12 Lynne Kues CLA 2002-08-08 13:12:57 EDT
Released into 2.1 and 2.0.1 stream.