Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Editable TableViewer with background color
Editable TableViewer with background color [message #1073131] Wed, 24 July 2013 07:35 Go to next message
Christian Wrobel is currently offline Christian Wrobel
Messages: 5
Registered: July 2013
Junior Member
Hello everyone,

i want to use tableviewer with colored cells like in rap demo example.

The difference between this example and my table is that my cells are editable.

My table styles are SWT.VIRTUAL | SWT.BORDER | SWT.FULL_SELECTION.

The columns are colored, but when i edit an cell the color change to default color (gray / white). How can i keep my individual cell color after editing an column?

Best Regards,
Christian
Re: Editable TableViewer with background color [message #1073624 is a reply to message #1073131] Thu, 25 July 2013 07:43 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1838
Registered: July 2009
Senior Member
Hi Christian,
could you provide some screenshots to make it more clear?
Thanks,
Ivan

On 7/24/2013 4:27 PM, Christian Wrobel wrote:
> Hello everyone,
>
> i want to use tableviewer with colored cells like in rap demo example.
>
> The difference between this example and my table is that my cells are
> editable.
>
> My table styles are SWT.VIRTUAL | SWT.BORDER | SWT.FULL_SELECTION.
>
> The columns are colored, but when i edit an cell the color change to
> default color (gray / white). How can i keep my individual cell color
> after editing an column?
>
> Best Regards,
> Christian

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Editable TableViewer with background color [message #1074148 is a reply to message #1073624] Fri, 26 July 2013 07:39 Go to previous messageGo to next message
Christian Wrobel is currently offline Christian Wrobel
Messages: 5
Registered: July 2013
Junior Member
Hello Ivan,

here are three screenshots. In first picture you see an example table with two columns.
index.php/fa/15720/0/


The second column is editable and hast another background color. When i edit this field it changes its color to mouseover (second picture).
index.php/fa/15721/0/

After when i select another cell it changes its color to default color (third picture).

index.php/fa/15722/0/

I set color in ColumnLabelProvider on update event:

table.addEditingColumn("editable field", 
				150, 
				new ColumnLabelProvider() {

			@Override
			public void update(ViewerCell cell) {
				super.update(cell);
				DemoObj element = (DemoObj)cell.getElement();
				
				cell.setText(element.getEditableField());
				
				cell.setBackground(new Color(Display.getCurrent(), 123, 123,123));
				
			}
		},



Best Regards,
Christian
  • Attachment: picture1.png
    (Size: 10.30KB, Downloaded 200 times)
  • Attachment: picture2.png
    (Size: 10.58KB, Downloaded 194 times)
  • Attachment: picture3.png
    (Size: 10.75KB, Downloaded 202 times)
Re: Editable TableViewer with background color [message #1074160 is a reply to message #1074148] Fri, 26 July 2013 07:56 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1838
Registered: July 2009
Senior Member
Hi Christian,
I don't have an answer in hand. Please open a bugzilla with yours
snippet attached to it and we will investigate the cause.
Thanks,
Ivan

On 7/26/2013 10:39 AM, Christian Wrobel wrote:
> Hello Ivan,
>
> here are three screenshots. In first picture you see an example table with two columns.
>
>
>
> The second column is editable and hast another background color. When i edit this field it changes its color to mouseover (second picture).
>
>
> After when i select another cell it changes its color to default color (third picture).
>
>
>
> I set color in ColumnLabelProvider on update event:
>
>
> table.addEditingColumn("editable field",
> 150,
> new ColumnLabelProvider() {
>
> @Override
> public void update(ViewerCell cell) {
> super.update(cell);
> DemoObj element = (DemoObj)cell.getElement();
>
> cell.setText(element.getEditableField());
>
> cell.setBackground(new Color(Display.getCurrent(), 123, 123,123));
>
> }
> },
>
>
>
> Best Regards,
> Christian
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Editable TableViewer with background color [message #1074289 is a reply to message #1074160] Fri, 26 July 2013 12:35 Go to previous messageGo to next message
Christian Wrobel is currently offline Christian Wrobel
Messages: 5
Registered: July 2013
Junior Member
Hi Ivan,

thanks for your reply. I opened an bugzilla ticket now:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=413806

Kind Regards,
Christian
Re: Editable TableViewer with background color [message #1074302 is a reply to message #1074289] Fri, 26 July 2013 13:02 Go to previous message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1838
Registered: July 2009
Senior Member
Christian,
I looked in your code more carefully and I think that this issue is
invalid. You must override ColumnLabelProvider#getBackground( element ),
ColumnLabelProvider#getText( element ) and not to set them in
ColumnLabelProvider#update method. See ColumnLabelProvider class - the
default implementation of these methods return null.
Best,
Ivan

On 7/26/2013 3:35 PM, Christian Wrobel wrote:
> Hi Ivan,
>
> thanks for your reply. I opened an bugzilla ticket now:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=413806
>
> Kind Regards,
> Christian

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Check if Browser is closed
Next Topic:NoClassDefFoundError when adding AutoCompleteField
Goto Forum:
  


Current Time: Mon Oct 20 04:46:48 GMT 2014

Powered by FUDForum. Page generated in 0.01636 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software