Skip to main content



      Home
Home » Archived » Sapphire » Simple custom constraint on a property editor
Simple custom constraint on a property editor [message #948778] Thu, 18 October 2012 07:13 Go to next message
Eclipse UserFriend
Hello again Smile

Let's say I have a composite with 2 property editors:

<property-editor>dimension</property-editor>
<property-editor>values</property-editor>


Property "dimension" is expected to be entered in the style "2x3" with 2 integers separated by "x"
Property "values" is expected to be something like "12,2,4,2,0,-5" with 6 integers separated by "," while if the dimension is changed to be "1x3" values should be 3 integers.

more generally, I'd like to write Java code that describes the validation of each property editor and the dependency between each other. How can I achieve that?

Thanks for concern Smile
Re: Simple custom constraint on a property editor [message #949118 is a reply to message #948778] Thu, 18 October 2012 14:03 Go to previous messageGo to next message
Eclipse UserFriend
To implement a custom constraint, you need to implement ValidationService and attach it to the property using @Service annotation. Take a look at DuplicateContactValidationService in the contacts sample.

- Konstantin
Re: Simple custom constraint on a property editor [message #952079 is a reply to message #949118] Sun, 21 October 2012 02:13 Go to previous messageGo to next message
Eclipse UserFriend
Just what I needed Smile Thnx a lot Smile
Re: Simple custom constraint on a property editor [message #952138 is a reply to message #952079] Sun, 21 October 2012 03:20 Go to previous messageGo to next message
Eclipse UserFriend
I just don't really understand what you did in the "init" and "dispose" functions .. could you give a simple illustration?
Re: Simple custom constraint on a property editor [message #953870 is a reply to message #952138] Mon, 22 October 2012 11:52 Go to previous message
Eclipse UserFriend
A ValidationService implementation is responsible for informing the system when the state of its validation is likely to have changed. That's done via the broadcast() method that you see being called in the listener. The listener is attached to properties that are involved in the validation computation during init(). In dispose(), the listener is removed.

- Konstantin
Previous Topic:Element ordering not according to XSD
Next Topic:Different editors for same file-extensions
Goto Forum:
  


Current Time: Tue Jul 22 22:35:25 EDT 2025

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

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

Back to the top