Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Change Icon in Text editor control decoration
Change Icon in Text editor control decoration [message #1219521] Wed, 04 December 2013 06:54 Go to next message
Ali Malik is currently offline Ali Malik
Messages: 27
Registered: August 2013
Junior Member
Hi,

I want to change the warning/error icon that is displayed when data validation fails, through error decoration of the editor.

Is there any way to change this icon? Actually this icon is very small, I would like to make it a bit bigger.

Also, I want to know that why only TextCellEditor shows red font in case of wrong data input, or when validation applies?
Is there a way to apply this on custom made editors or not?

Please answer the above questions separately Smile

Tony
Re: Change Icon in Text editor control decoration [message #1219529 is a reply to message #1219521] Wed, 04 December 2013 07:24 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1248
Registered: July 2012
Senior Member
Quote:
I want to change the warning/error icon that is displayed when data validation fails, through error decoration of the editor. Is there any way to change this icon?


The TextCellEditor is using JFace ControlDecoration for this. If it is possible to change icons in that case, it is possible in NatTable too. Have a look at FieldDecorationRegistry to learn about it.

But looking into the implementation I can see there is something missing. You are not able to change the fieldDecorationId after the TextCellEditor is created. Please create a ticket so you are able to change that. This way you could register another icon in the registry against your custom id at the time registering it.

Quote:
Also, I want to know that why only TextCellEditor shows red font in case of wrong data input, or when validation applies?


Because the TextCellEditor has listeners applied that validate directly while typing. This is special as only the TextCellEditor needs just in time validation. A ComboBox or Checkbox don't need to do that.

Usually the validation takes place when a user tries to commit the data. So it is executed before it will be transfered to the model, and if the value is invalid, the model will not get updated.

Quote:
Is there a way to apply this on custom made editors or not?


That depends on your on your custom made editor!

Quote:
Please answer the above questions separately


I hope this is separate enough!

BTW, regarding editing and validation, these two links might be helpful:
http://eclipse.org/nattable/documentation.php?page=editing
http://blog.vogella.com/2013/03/02/crossweak-validation-in-nattable-by-dirk-fauth/
Re: Change Icon in Text editor control decoration [message #1219678 is a reply to message #1219529] Thu, 05 December 2013 06:33 Go to previous message
Ali Malik is currently offline Ali Malik
Messages: 27
Registered: August 2013
Junior Member
Thank you for the reply, Dirk.

I will add a ticket for it, for the time being I am forced to use the default icon.

I will see which listeners you have attached to the text cell editor, and will find a way to attach them to my custom editor.

Tony
Previous Topic:Unable to retrieve index in model from selection
Next Topic:Change Even/Odd Row Configuration
Goto Forum:
  


Current Time: Wed Aug 20 00:56:53 EDT 2014

Powered by FUDForum. Page generated in 0.02129 seconds