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

Bug 361796

Summary: [Table][Tree] Setting vertical alignment
Product: [RT] RAP Reporter: Stephan Leicht Vogt <stephan.leichtvogt>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: claudio.guglielmo, ivan, michael.weiner, micromms
Version: 1.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix for enhancement on Table and Tree
none
Correction of last patch
none
Screenshot with misaligned text in tree none

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?