Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361796 - [Table][Tree] Setting vertical alignment
Summary: [Table][Tree] Setting vertical alignment
Status: NEW
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 474715 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-24 07:40 EDT by Stephan Leicht Vogt CLA
Modified: 2018-02-27 04:46 EST (History)
4 users (show)

See Also:


Attachments
Fix for enhancement on Table and Tree (17.67 KB, patch)
2011-10-24 07:41 EDT, Stephan Leicht Vogt CLA
no flags Details | Diff
Correction of last patch (72.24 KB, patch)
2012-06-15 10:26 EDT, Stephan Leicht Vogt CLA
no flags Details | Diff
Screenshot with misaligned text in tree (2.22 KB, image/png)
2013-02-12 10:01 EST, Claudio Guglielmo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Leicht Vogt CLA 2011-10-24 07:40:27 EDT
We need the possibility to set the vertical alignment on a table and tree column.

Fix: See attached patch
Comment 1 Stephan Leicht Vogt CLA 2011-10-24 07:41:01 EDT
Created attachment 205803 [details]
Fix for enhancement on Table and Tree
Comment 2 Stephan Leicht Vogt CLA 2012-06-15 10:26:51 EDT
Created attachment 217431 [details]
Correction of last patch

this patch works with current git-head. (after tree->grid change)
Comment 3 Claudio Guglielmo CLA 2013-02-12 10:00:44 EST
The actual reason, why we would like to control the vertical alignment, is the following line in GridRow.js:

element.style.lineHeight = config.markupEnabled ? "" : element.style.height;

By default, the text is aligned middle. In case of html markup, it's aligned top. This leads to following problem: 
When using simple html like <b>my content</b> with the default row height, it looks quite ugly, especially if an icon is set too. See attached screenshot.
In case of multiline text with custom row height, it looks fine, apart from the icon which still is aligned middle.

So in my opinion setting the lineHeight should not depend on whether there is html markup or not, but rather on whether there is multiline text or not. Additionally the icon should be considered as well. If that was the case, an additional vertical alignment property would not be necessary for us.
Comment 4 Claudio Guglielmo CLA 2013-02-12 10:01:39 EST
Created attachment 226926 [details]
Screenshot with misaligned text in tree
Comment 5 Ivan Furnadjiev CLA 2013-02-15 09:24:34 EST
(In reply to comment #4)
> Created attachment 226926 [details]
> Screenshot with misaligned text in tree
With the fix for bug 373652 the top cell padding is applied on the item text regardless if markup is enabled or not. This should fix the issue shown on the screenshot and the need for setting the vertical alignment is not important anymore. Claudio, could you confirm this?
Comment 6 Claudio Guglielmo CLA 2013-02-18 12:28:38 EST
The fix for bug 373652 solved the vertical alignment issue with the text, thank you for that! 

However, the image still is centered. Would it be possible to position the image centrally to the height of the first line instead of centrally to the whole cell? This should not change the single line behaviour but makes it look better in case of multi line.
Comment 7 Ivan Furnadjiev CLA 2013-02-18 15:46:26 EST
(In reply to comment #6)
> The fix for bug 373652 solved the vertical alignment issue with the text,
> thank you for that! 
> 
> However, the image still is centered. Would it be possible to position the
> image centrally to the height of the first line instead of centrally to the
> whole cell? This should not change the single line behaviour but makes it
> look better in case of multi line.
The image is center aligned in the cell because:
1. Nebula Grid behaves the same in case of milti-line text (we are using the same client-side implementation for RAP Nebula Grid port).
2. Looks better in case of columns with chekboxes.
Comment 8 Ivan Furnadjiev CLA 2018-01-30 04:51:31 EST
*** Bug 474715 has been marked as a duplicate of this bug. ***
Comment 9 David Song CLA 2018-02-27 04:46:53 EST
Is it possible to calculate the value of the CSS top based on the value of the custom_item_height?