Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342541 - [History View] New Branches column: column widths need some work
Summary: [History View] New Branches column: column widths need some work
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-12 07:11 EDT by Dani Megert CLA
Modified: 2011-04-19 06:50 EDT (History)
2 users (show)

See Also:


Attachments
Picture 1 (15.54 KB, image/png)
2011-04-12 07:12 EDT, Dani Megert CLA
no flags Details
Picture 2 (27.34 KB, image/png)
2011-04-12 07:13 EDT, Dani Megert CLA
no flags Details
Picture 2 (20.81 KB, image/png)
2011-04-12 07:25 EDT, Dani Megert CLA
no flags Details
FIx for case 1 (1.53 KB, patch)
2011-04-13 10:57 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (163.04 KB, application/octet-stream)
2011-04-13 10:57 EDT, Tomasz Zarna CLA
no flags Details
Fix for case 1, v02 (1.00 KB, patch)
2011-04-15 09:15 EDT, Tomasz Zarna CLA
daniel_megert: review-
Details | Diff
Picture of wrong History view columns (13.16 KB, image/png)
2011-04-18 04:13 EDT, Dani Megert CLA
no flags Details
Fix for case 1, v03 + tests (13.66 KB, patch)
2011-04-18 07:43 EDT, Tomasz Zarna CLA
no flags Details | Diff
Fix for case 1, v04 + tests (3.26 KB, patch)
2011-04-19 06:20 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2011-04-12 07:11:33 EDT
N20110411-2000.

The new 'Branches' column works quite nicely. There are two issues:

1. Switching to N20110411-2000 using an existing workspace results in very small
   Branches column:
   1. start new workspace using 3.7 M6
   2. check out a project from CVS
   3. select a file in the Package Explorer
   4. Team > Show History
      ==> GOOD: opens without horizontal scroll bar
   5. exit
   6. start same workspace with N20110411-2000
   7. select a file in the Package Explorer
   8. Team > Show History
      ==> 'Branches' column very small (see 'Picture 2')

2. Out of the box the view should not get a horizontal scroll bar:
   1. start new workspace with N20110411-2000
   2. check out a project from CVS
   3. select a file in the Package Explorer
   4. Team > Show History
      ==> opens with horizontal scroll bar (see 'Picture 1')
Comment 1 Dani Megert CLA 2011-04-12 07:12:51 EDT
Created attachment 193026 [details]
Picture 1
Comment 2 Dani Megert CLA 2011-04-12 07:13:11 EDT
Created attachment 193027 [details]
Picture 2
Comment 3 Dani Megert CLA 2011-04-12 07:18:41 EDT
Should polish this for M7 since this will end up in the N&N.
Comment 4 Dani Megert CLA 2011-04-12 07:23:03 EDT
For case 1 I think it's better to make the 'Branches' column a bit wider and accept the horizontal scroll bar.
Comment 5 Dani Megert CLA 2011-04-12 07:25:23 EDT
Created attachment 193032 [details]
Picture 2
Comment 6 Tomasz Zarna CLA 2011-04-13 06:36:05 EDT
(In reply to comment #0)
> 2. Out of the box the view should not get a horizontal scroll bar:
> 1. start new workspace with N20110411-2000
> 2. check out a project from CVS
> 3. select a file in the Package Explorer
> 4. Team > Show History
> ==> opens with horizontal scroll bar (see 'Picture 1')

I'm afraid there's not much I can do about it. As long as you have multiple entries in the History view you will get a vertical scroll bar which will result in adding the horizontal bar as well. The initial weights used for the columns are fine. You can verify it by doing "Team > Show History" for a file which has a small number of revisions.
Comment 7 Dani Megert CLA 2011-04-13 06:51:54 EDT
>As long as you have multiple
>entries in the History view you will get a vertical scroll bar which will
>result in adding the horizontal bar as well.
I manually resized the columns and now I have the vertical scroll bar without the horizontal one - so it is possible to have only one.

FYI: Same problem already in 3.6.
Comment 8 Dani Megert CLA 2011-04-13 07:02:38 EDT
> The initial weights used for the
> columns are fine.
I guess you need to account for the possible vertical scroll bar size and make sure it fits.
Comment 9 Dani Megert CLA 2011-04-13 07:15:42 EDT
For M7 we should at least make the 'Branches' column wider, so that it doesn't look like cheese.
Comment 10 Tomasz Zarna CLA 2011-04-13 10:57:07 EDT
Created attachment 193162 [details]
FIx for case 1

When a new column with a negative width is found (the Branch column in this case) I treat widths for the rest of columns as weights. For the new column(s) I take the last valid width and use it as the weight of this column.
Comment 11 Tomasz Zarna CLA 2011-04-13 10:57:11 EDT
Created attachment 193163 [details]
mylyn/context/zip
Comment 12 Tomasz Zarna CLA 2011-04-13 11:04:13 EDT
(In reply to comment #8)
> I guess you need to account for the possible vertical scroll bar size and make
> sure it fits.

Have anyone done this? I think that using ColumnWeightData I'm not able to leave the margin for the possible vertical scroll bar. Columns will take all available space. I can use ColumnPixelData to layout columns and modify their widths according to the view's width, but I don't think it's the way to go.
Comment 13 Dani Megert CLA 2011-04-14 05:02:08 EDT
> think that using ColumnWeightData I'm not able to
> leave the margin for the possible vertical scroll bar. Columns will take all
> available space. I can use ColumnPixelData to layout columns and modify their
> widths according to the view's width, but I don't think it's the way to go.
I agreed. The TableLayout should have support to reserve space for the vertical ruler if desired (filed bug 342807).
Comment 14 Dani Megert CLA 2011-04-14 05:16:44 EDT
(In reply to comment #10)
> Created attachment 193162 [details] [diff]
> FIx for case 1
> 
> When a new column with a negative width is found (the Branch column in this
> case) I treat widths for the rest of columns as weights. For the new column(s)
> I take the last valid width and use it as the weight of this column.

I don't like that patch for two reasons:
1. You destroy explicitly chosen widths for exiting columns. We should
   leave it to the user to choose which columns to reduce (if any).
2. It looks like you're using the last positive width for negative/new columns,
   which is not too good because the last one is the comment and this is most 
   likely the biggest one.
Comment 15 Tomasz Zarna CLA 2011-04-14 10:16:21 EDT
(In reply to comment #13)
> The TableLayout should have support to reserve space for the vertical
> ruler if desired (filed bug 342807).

Thanks Dani. I filed bug 342837 against Team to make sure we'll consume the fix in UI as soon as it's ready. The new bug is basically about case 2 from comment 0.
Comment 16 Tomasz Zarna CLA 2011-04-15 05:01:49 EDT
(In reply to comment #14)
> I don't like that patch [...]

You're right, this was the first idea that came to my mind, I agree it's not ideal. Here are other options I can think of:
1. Make the new column wide enough to display its title. So, instead of "B.." in Picture 2 you would get "Branches"
2. Keep ratio between existing columns untouched but reduce the space they take to 5/6th of total width. Make the new column take the remaining 1/6th.
3. Rather than using the last positive width for negative/new columns, take the smallest width. This should make the addition less intrusive. If the width is lower than the column's minimum width use the later.
Comment 17 Dani Megert CLA 2011-04-15 06:08:05 EDT
(In reply to comment #16)
> (In reply to comment #14)
> > I don't like that patch [...]
> 
> You're right, this was the first idea that came to my mind, I agree it's not
> ideal. Here are other options I can think of:
> 1. Make the new column wide enough to display its title. So, instead of "B.."
> in Picture 2 you would get "Branches"
> 2. Keep ratio between existing columns untouched but reduce the space they take
> to 5/6th of total width. Make the new column take the remaining 1/6th.
> 3. Rather than using the last positive width for negative/new columns, take the
> smallest width. This should make the addition less intrusive. If the width is
> lower than the column's minimum width use the later.

I would simply make the new column bigger and leave everything else as is.
Comment 18 Tomasz Zarna CLA 2011-04-15 08:16:42 EDT
(In reply to comment #17)
> I would simply make the new column bigger and leave everything else as is.

I'm fine with setting the width for negative/new columns to, let's say 60px, but that would open the view with horizontal scroll bar. Is that ok with you? I was trying to avoid that.
Comment 19 Dani Megert CLA 2011-04-15 08:27:24 EDT
(In reply to comment #18)
> Is that ok with you? I
Yep.
Comment 20 Tomasz Zarna CLA 2011-04-15 09:15:23 EDT
Created attachment 193364 [details]
Fix for case 1, v02
Comment 21 Tomasz Zarna CLA 2011-04-15 09:17:30 EDT
The latest patch has been applied to HEAD. Available in builds >=N20110415-2000. Thanks for your feedback Dani.
Comment 22 Dani Megert CLA 2011-04-18 04:12:52 EDT
Comment on attachment 193364 [details]
Fix for case 1, v02

The fix makes things much worse: instead of giving weights to columns in a new History view in HEAD it assigns fixed 60 pixel to each. See attached screenshot.

The correct fix should only do this if there already exist some columns (with known/stored width) and it should compute the minimal width for the new column based on the length of the column header label.
Comment 23 Dani Megert CLA 2011-04-18 04:13:09 EDT
.
Comment 24 Dani Megert CLA 2011-04-18 04:13:43 EDT
Created attachment 193469 [details]
Picture of wrong History view columns
Comment 25 Tomasz Zarna CLA 2011-04-18 04:39:39 EDT
(In reply to comment #22)
> The correct fix should only do this if there already exist some columns (with
> known/stored width) 
My bad, I missed that case.

> and it should compute the minimal width for the new column
> based on the length of the column header label.
Isn't that 1. from comment 16? I thought that by saying "I would simply make the new column bigger and leave everything else as is." you are fine with setting the column's width to arbitrary 60px (comment 18). Sorry if I misunderstood you.
Comment 26 Dani Megert CLA 2011-04-18 04:46:22 EDT
(In reply to comment #25)
> (In reply to comment #22)
> > The correct fix should only do this if there already exist some columns (with
> > known/stored width) 
> My bad, I missed that case.
> 
> > and it should compute the minimal width for the new column
> > based on the length of the column header label.
> Isn't that 1. from comment 16? I thought that by saying "I would simply make
> the new column bigger and leave everything else as is." you are fine with
> setting the column's width to arbitrary 60px (comment 18). Sorry if I
> misunderstood you.

Yes, I wrote that 60px is also OK, but of course the real/correct fix would measure the column header text. This would also cover the case of new columns added in the future.
Comment 27 Tomasz Zarna CLA 2011-04-18 07:43:22 EDT
Created attachment 193479 [details]
Fix for case 1, v03 + tests

A better fix, this time with tests.
Comment 28 Tomasz Zarna CLA 2011-04-18 10:20:07 EDT
(In reply to comment #27)
> Created attachment 193479 [details]
> Fix for case 1, v03 + tests

Applied to HEAD.
Comment 29 Dani Megert CLA 2011-04-18 12:13:03 EDT
(In reply to comment #28)
> (In reply to comment #27)
> > Created attachment 193479 [details] [diff]
> > Fix for case 1, v03 + tests
> 
> Applied to HEAD.

I'm sorry to be a pain, but: AFAIK the initial widths are:
[-1, -1, -1, -1, -1, -1]
but your code then results in onlyZeroes == true which is obviously wrong.
Comment 30 Dani Megert CLA 2011-04-18 12:17:45 EDT
> I'm sorry to be a pain, but: AFAIK the initial widths are:
> [-1, -1, -1, -1, -1, -1]
> but your code then results in onlyZeroes == true which is obviously wrong.

NOTE: I'm only questioning the code/implementation. Testing showed that it indeed "worked".
Comment 31 Tomasz Zarna CLA 2011-04-19 06:20:36 EDT
Created attachment 193565 [details]
Fix for case 1, v04 + tests

Renamed 'allZeroes' to 'reset' and added an extra test for the case when user hides a column on purpose (width = 0).
Comment 32 Tomasz Zarna CLA 2011-04-19 06:22:14 EDT
In HEAD, available in I20110419-0800.
Comment 33 Dani Megert CLA 2011-04-19 06:50:09 EDT
Looks good now! I only added a break; to the loop, so that it exits when done.