Bug 262172 - [Table] cell padding
Summary: [Table] cell padding
Status: VERIFIED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 1.2 M6   Edit
Assignee: Ralf Sternberg CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-23 09:26 EST by Wen Ai CLA
Modified: 2009-03-18 07:15 EDT (History)
1 user (show)

See Also:


Attachments
table with spacing (6.12 KB, image/png)
2009-03-16 06:01 EDT, Wen Ai CLA
no flags Details
Screenshot1 (1.90 KB, image/gif)
2009-03-16 14:17 EDT, Markus Krüger CLA
no flags Details
Screenshot2 (1.88 KB, image/gif)
2009-03-16 14:17 EDT, Markus Krüger CLA
no flags Details
Screenshot3 (1.94 KB, image/gif)
2009-03-17 06:59 EDT, Markus Krüger CLA
no flags Details
snippet to reproduce (14.79 KB, text/plain)
2009-03-17 09:24 EDT, Wen Ai CLA
no flags Details
error with the cell editor position 1 (12.44 KB, image/png)
2009-03-17 09:26 EDT, Wen Ai CLA
no flags Details
error with the cell editor position 2 (12.32 KB, image/png)
2009-03-17 09:26 EDT, Wen Ai CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wen Ai CLA 2009-01-23 09:26:54 EST
Table cell has no padding to define.
Comment 1 Ralf Sternberg CLA 2009-03-14 09:19:36 EDT
A custom cell padding can now be applied using the following CSS snippet:
  Table-Cell {
    padding: 4px;
  }
Changes are in CVS HEAD.
Comment 2 Wen Ai CLA 2009-03-16 06:01:53 EDT
Created attachment 128890 [details]
table with spacing

Hi Ralf,

I'm very appreciate for your help. It works fine by me with the spacing in table. I have just found a little problem in it, that by colorizing the table the place for spacing could not be colorized (please see the screenshot).

Steps to reproduce:
1. go to the rap demo project "org.eclipse.rap.demo"
2. under the package "org.eclipse.rap.demo.controls" there is a java datei called "TableViewerTab"
3. at the end of the method "createExampleControls" please paste this code:

  Table table = this.viewer.getTable();
  for( int i = 0; i < table.getItemCount(); i++ ) {
      TableItem item = table.getItem( i );
      if( i % 2 == 0 ) {
        item.setBackground( Graphics.getColor( 244, 246, 245 ) );
      } else {
        item.setBackground( Graphics.getColor( 255, 0, 0 ) );
      }
    }

4. run this demo and then you will see the problem. 

Thanks for your help again!
Comment 3 Wen Ai CLA 2009-03-16 06:10:08 EDT
bug reopened.
Comment 4 Ralf Sternberg CLA 2009-03-16 09:47:17 EDT
Thanks for pointing out this problem. There seems to be no other way to implement cell padding, so we have to keep the current solution and find a workaround for background colors. I opened a separate bug for this: bug 268782.

Wen, do you know that you can also achieve alternating row colors by means of theming (bug 235092)? Here's an example:
  TableItem:even {
    background-color: rgb( 244, 246, 245 );
  }
Comment 5 Wen Ai CLA 2009-03-16 11:15:30 EDT
Hi Ralf,  thanks so much for your help. The way you advised (colorizing the table with css definition) is a declarative solution. What we need to face is a very complicated table-colorizing. So I ask you how it's going programmatically :-)

But I still tested your suggestion with the css definition. I found, the "theme.css" in the rap demo project from the cvs head has already such definition, but the table has shown just no color. The snippet from the css datei:

/* Alternating row colors */

List-Item:even, TableItem:even {
  background-color: rgb(255, 0, 0); // I just change this color in red
}

Can you give me several words about that? Thanks a lot. Wen
Comment 6 Markus Krüger CLA 2009-03-16 14:16:33 EDT
There seems to be an layout error when using images.
I added the following to by css:
Table-Cell {
  spacing: 5px;
  padding: 0px 5px 0px 5px;
}

Now look at the screenshot1. 
The image is shifted to the right 5px, but text seems not to shift.

The spacing also does not seem to take an effect.
Change to:
Table-Cell {
  spacing: 5px;
  padding: 0px 0px 0px 0px;
}

There is no space between image and text, see screenshot2.
Comment 7 Markus Krüger CLA 2009-03-16 14:17:08 EDT
Created attachment 128966 [details]
Screenshot1
Comment 8 Markus Krüger CLA 2009-03-16 14:17:21 EDT
Created attachment 128967 [details]
Screenshot2
Comment 9 Ralf Sternberg CLA 2009-03-16 16:02:00 EDT
(In reply to comment #6)
There was still a bug that shrinked all spacing to zero. This is also fixed in CVS HEAD.
Comment 10 Ralf Sternberg CLA 2009-03-16 16:07:51 EDT
(In reply to comment #5)
Wen, this snippet works as expected here. Do you use RWT from CVS HEAD? Sure you activated the theme? If you have any more questions on how get the theming to work, don't hesitate to ask on our newsgroup.

Best Regards, Ralf
Comment 11 Markus Krüger CLA 2009-03-17 06:59:10 EDT
Hi Ralf,
the layout is still wrong. 
The attached screenshot3 is the result of using:

Table-Cell {
  spacing: 5px;
  padding: 0px 15px 0px 15px;
}
Comment 12 Markus Krüger CLA 2009-03-17 06:59:42 EDT
Created attachment 129061 [details]
Screenshot3
Comment 13 Wen Ai CLA 2009-03-17 09:24:01 EDT
The theming wasn't activated as you said. Now I got it by me to work. Thank you Ralf.

But I found something else. It seems to be another error with the cell padding. But I'm not quite sure about that. 

Steps to reproduce:
1) Open the rap demo project "org.eclipse.rap.demo"
2) Take this snippet TableViewerTab.java under the package
org.eclipse.rap.demo.controls instead of the old one
4) Add in "theme.css" this snippet:

Table-Cell {
  padding: 4px;
}

3) Start this demo, call the entry point with theming and open the tab TableViewer
4) Click the second column (with CheckboxEditor in it) and you will see something wrong with the checkbox position. Click the first or the third column (with TextEditor) you will find the wrong position of the texteditor, too.

Could you take a look at it, Ralf? Thanks a lot. Wen

  
Comment 14 Wen Ai CLA 2009-03-17 09:24:46 EDT
Created attachment 129072 [details]
snippet to reproduce
Comment 15 Wen Ai CLA 2009-03-17 09:26:08 EDT
Created attachment 129073 [details]
error with the cell editor position 1
Comment 16 Wen Ai CLA 2009-03-17 09:26:19 EDT
Created attachment 129074 [details]
error with the cell editor position 2
Comment 17 Ralf Sternberg CLA 2009-03-17 15:10:18 EDT
(In reply to comment #11)
Thanks for the hint. The calculation was still wrong for tables without columns. Fixed in HEAD.
Comment 18 Ralf Sternberg CLA 2009-03-17 15:49:50 EDT
(In reply to comment #13)
Hi Wen, I opened a separate bug for this problem: bug 269065.
In the meantime, you can work around this problem by setting the padding to 0px (as it was before).
Comment 19 Markus Krüger CLA 2009-03-18 07:15:35 EDT
(In reply to comment #17)
> (In reply to comment #11)
> Thanks for the hint. The calculation was still wrong for tables without
> columns. Fixed in HEAD.
> 

Thanks, now it works.