Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Painter for custom editor component.(How can we apply painter for a complex editor component.)
Painter for custom editor component. [message #1066604] Wed, 03 July 2013 12:14 Go to next message
Courtney Jines is currently offline Courtney JinesFriend
Messages: 13
Registered: September 2012
Junior Member
Hello Dirk,

I have to apply painter for a editor component which has three labels and four text components. Predefined painters are not suitable for that so I am thinking to create an image by custom drawing same as editor component? Please suggest if there is any good approach than what i am thinking.

Thanks in advance.

Re: Painter for custom editor component. [message #1066639 is a reply to message #1066604] Wed, 03 July 2013 14:17 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

I'm not sure what you mean. First you need to differentiate between editor and painter. The editor is Control based, while the painter is simply drawing on the GC. If your editor is complex, I assume it is handled in a subdialog? Otherwise I'm not sure if NatTable supports a complex editor control inline. Never tried it before, so to be honest I'm not sure.

Implementing a custom painter is straight forward. You simply need to draw on a GC whatever you want to draw. Labels, Images or whatever. The TextPainter does nothing else.

Greez,
Dirk
Re: Painter for custom editor component. [message #1066973 is a reply to message #1066639] Fri, 05 July 2013 10:09 Go to previous messageGo to next message
Courtney Jines is currently offline Courtney JinesFriend
Messages: 13
Registered: September 2012
Junior Member
Thanks for reply Dirk.

As in NatTable, odd row and even row have different background colors so according to that i want to set the background color in my image. but don't know how can i get that color to set in my image.

setWrappedPainter(new BeveledBorderDecorator(new ImagePainter() {
      @Override
      protected Image getImage(ILayerCell cell, IConfigRegistry configRegistry) {
     
      //how to get color......  


      return _image;
        }
      }));


Please suggest any appropriate approach to get the color according to odd or even rows.
Thanks in advance.
Re: Painter for custom editor component. [message #1066979 is a reply to message #1066973] Fri, 05 July 2013 10:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Not sure if it works because of possible time related issues (when is which style applied?), but technically this should work:
IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
Re: Painter for custom editor component. [message #1067001 is a reply to message #1066979] Fri, 05 July 2013 11:53 Go to previous message
Courtney Jines is currently offline Courtney JinesFriend
Messages: 13
Registered: September 2012
Junior Member
Thanks Dirk it is working fine. Smile

[Updated on: Fri, 05 July 2013 11:56]

Report message to a moderator

Previous Topic:RowHeaderLayer configuration not reflecting.
Next Topic:NatTable 1.0.1 released!
Goto Forum:
  


Current Time: Thu Apr 25 23:13:05 GMT 2024

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

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

Back to the top