Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 507887

Summary: The "Initial Column Header Width" properties is not taken into account and does not allow hiding the header column
Product: [Modeling] Sirius Reporter: Nathalie Lepine <nathalie.lepine>
Component: TableAssignee: Jessy Mallet <jessy.mallet>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: julien.dupont, pierre-charles.david
Version: unspecifiedKeywords: triaged
Target Milestone: 6.1.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/85430
https://git.eclipse.org/r/128708
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=317db527f7ea3bb2d9067518848c7ad4adbc3873
https://git.eclipse.org/r/129415
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ce314a05de094bd73d714a3be11ec91636815647
Whiteboard: backport
Attachments:
Description Flags
Sample project to reproduce the bug
none
Table header with various initial widths
none
Sample to validate. none

Description Nathalie Lepine CLA 2016-11-21 10:31:44 EST
The "Initial Column Header Width" properties doesn't work
Comment 1 Pierre-Charles David CLA 2016-11-21 11:56:04 EST
Created attachment 265493 [details]
Sample project to reproduce the bug

Steps to reproduce:
1. Import the attached project. It defines a simple table with InitialHeaderColumnWidth set to 500.
2. Open the session and create a table on the top-level package.

The table's header column has a small width, wich corresponds to auto-sizing according to the labels' sizes.
Comment 2 Pierre-Charles David CLA 2016-11-21 12:00:09 EST
Note that even if we take the width into account, the current code which uses it on the UI side considers that a width of "0" means "auto-size", *not* "hide the header". We'll need to allow for negative sides (for example) to explicitly request hiding the header (which is the original request afaict).

I have a small patch which needs some cleanup before posting. It seems to work at first glance, but more work is needed to ensure it does not cause any regression.
Comment 3 Eclipse Genie CLA 2016-11-21 14:18:44 EST
New Gerrit change created: https://git.eclipse.org/r/85430
Comment 4 Pierre-Charles David CLA 2016-11-21 14:23:19 EST
Created attachment 265494 [details]
Table header with various initial widths

The attached screenshot shows the initial state of newly created table with 3 different settings for the initialHeaderColumnWidth property, using the first draft of the patch (https://git.eclipse.org/r/85430):
* width=500: any strictly positive number is interpreted as an explicit size to set, in pixels;
* width=0: interpreted as "auto-size", the size is computed to fit all the labels (it seems this is buggy, at least under Linux; it looks like the width computation does not take the label's icon into account);
* width=-1: this was not possible to set before, but with the patch it can be set. Interpreted as "hide the header column".
Comment 5 Pierre-Charles David CLA 2016-11-22 04:53:48 EST
I'm putting this in 4.1.2, but with relatively low priority. It may slip to a later version if we don't have enough time to review and test the initial patch in time.
Comment 6 Pierre-Charles David CLA 2016-11-28 16:25:05 EST
While the initial patch *seems* to work when testing manually for a few seconds, we won't have time to actually make sure it works in all cases, does not cause any regression, document it, etc. in the timeframe for 4.1.2. Moving to 5.0, with the "backport" keyword. Depending on when it is fixed in the 5.0, we may include it in a later 4.1.x maintenance version.
Comment 7 Eclipse Genie CLA 2018-09-05 04:51:43 EDT
New Gerrit change created: https://git.eclipse.org/r/128708
Comment 9 Jessy Mallet CLA 2018-09-12 04:57:23 EDT
Fixed by 317db527f7ea3bb2d9067518848c7ad4adbc3873
Comment 10 Eclipse Genie CLA 2018-09-14 05:00:59 EDT
New Gerrit change created: https://git.eclipse.org/r/129415
Comment 12 Jessy Mallet CLA 2018-09-17 10:39:59 EDT
To validate :

1. Import the attached project call validateHeader. It defines a simple edition table and cross Table with InitialHeaderColumnWidth set to 200.
2. Open the session and create both table on the top-level package.
--> Check header column is the same on both tables and are bigger than its content.
3. Open VSM called tables.odesign. 
4- From VSM, on testEditionTable representation and "Advanced" tab, change initial column width from 200 to 50. Redo for testCrossTable representation.
--> Check header column is the same on both tables and smaller than previously (all column content is not displayed because of small size of column)
5- From VSM, on testEditionTable representation and "Advanced"tab, change initial column width from 50 to 0. Redo for testCrossTable representation.
--> Check header column is auto-size with the column content.
6- From VSM, on testEditionTable representation and "Advanced"tab, change initial column width from 0 to -1. Redo for testCrossTable representation.
--> check header column disappear on Edition Table whereas it is still auto-size for crossTable. Check also on Edition Table that you resize manually (cursor juste before "Name") the header column to make it visible.
Comment 13 Jessy Mallet CLA 2018-09-17 10:40:47 EDT
Created attachment 275848 [details]
Sample to validate.
Comment 14 Pierre-Charles David CLA 2018-10-19 12:49:09 EDT
Available in Sirius 6.1.0, see https://wiki.eclipse.org/Sirius/6.1.0