Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Validation with own AbstractObservableValue
icon5.gif  Validation with own AbstractObservableValue [message #490066] Wed, 07 October 2009 07:18 Go to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Ups... the most simple bugs are the hardest to find Sad

Thanks anyway,
Thomas

[Updated on: Wed, 07 October 2009 07:30]

Report message to a moderator

Re: Validation with own AbstractObservableValue [message #490129 is a reply to message #490066] Wed, 07 October 2009 13:23 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Could you paste the binding code?

Matthew

T. Wilhelm wrote:
> Hey all,
>
> i use databinding in my RCP application and i needed my own
> AbstractObservableValue. So i create a class (MyObservableValue), extend
> it from AbstractObservableValue and everything works fine first. Then i
> added a validator to my binding. My Problem now is that the validator is
> never called :( I´m not sure but i think this is because of my class
> MyObservableValue, maybe i have to do something there so my validator is
> called?
>
> Thanks alot,
> Thomas
Re: Validation with own AbstractObservableValue [message #490730 is a reply to message #490066] Fri, 09 October 2009 21:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: TheRealHawk.Freenet.de

Could it be, that you've only implemented doGetValue() and doSetValue()?
You also have to observe your property or control and fire the events by
your self.
--> If you want to observe a control you should extend
AbstractSWTObservableValue

Greetings

Markus

"T. Wilhelm" <t.wilhelm@msh.de> schrieb im Newsbeitrag
news:hahfbq$sh5$1@build.eclipse.org...
> Hey all,
>
> i use databinding in my RCP application and i needed my own
> AbstractObservableValue. So i create a class (MyObservableValue), extend
> it from AbstractObservableValue and everything works fine first. Then i
> added a validator to my binding. My Problem now is that the validator is
> never called :( I
Re: Validation with own AbstractObservableValue [message #490736 is a reply to message #490730] Fri, 09 October 2009 22:19 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
AbstractSWTObservableValue is not public API and was removed in the
latest version of DataBinding (June '09). The recommended approach is
to use the new property API, there is a new API class
WidgetValueProperty for this purpose.

To extend WidgetValueProperty properly you need to do just a few things:
* Implement the abstract getter and setter methods.
* Implement the getValueType() method
* If the widget property fires change events, pass the SWT event
constant(s) to the superconstructor in your custom property's constructor
* (Recommended) Implement toString() to provide a programmer-friendly
description of the property.

IWidgetValueProperty myCustomProp = new MyCustomWidgetProperty();
ISWTObservableValue observable = myCustomProp.observe(theWidget);

Hope this helps,

Matthew

Markus Koch wrote:
> Could it be, that you've only implemented doGetValue() and doSetValue()?
> You also have to observe your property or control and fire the events by
> your self.
> --> If you want to observe a control you should extend
> AbstractSWTObservableValue
>
> Greetings
>
> Markus
>
> "T. Wilhelm" <t.wilhelm@msh.de> schrieb im Newsbeitrag
> news:hahfbq$sh5$1@build.eclipse.org...
>> Hey all,
>>
>> i use databinding in my RCP application and i needed my own
>> AbstractObservableValue. So i create a class (MyObservableValue), extend
>> it from AbstractObservableValue and everything works fine first. Then i
>> added a validator to my binding. My Problem now is that the validator is
>> never called :( I´m not sure but i think this is because of my class
>> MyObservableValue, maybe i have to do something there so my validator is
>> called?
>>
>> Thanks alot,
>> Thomas
>
>
Re: Validation with own AbstractObservableValue [message #491027 is a reply to message #490736] Mon, 12 October 2009 21:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: TheRealHawk.Freenet.de

Where can I find more informations about the new api?
Currently I only work with SWTObservables, BeansObservables, PojoObservables
and ViewersObservables.
What are IValueProperties and how to I use them?

Thanks

Markus

"Matthew Hall" <matthall@woodcraftmill.com> schrieb im Newsbeitrag
news:haoctv$69l$1@build.eclipse.org...
> AbstractSWTObservableValue is not public API and was removed in the latest
> version of DataBinding (June '09). The recommended approach is to use the
> new property API, there is a new API class WidgetValueProperty for this
> purpose.
>
> To extend WidgetValueProperty properly you need to do just a few things:
> * Implement the abstract getter and setter methods.
> * Implement the getValueType() method
> * If the widget property fires change events, pass the SWT event
> constant(s) to the superconstructor in your custom property's constructor
> * (Recommended) Implement toString() to provide a programmer-friendly
> description of the property.
>
> IWidgetValueProperty myCustomProp = new MyCustomWidgetProperty();
> ISWTObservableValue observable = myCustomProp.observe(theWidget);
>
> Hope this helps,
>
> Matthew
>
> Markus Koch wrote:
>> Could it be, that you've only implemented doGetValue() and doSetValue()?
>> You also have to observe your property or control and fire the events by
>> your self.
>> --> If you want to observe a control you should extend
>> AbstractSWTObservableValue
>>
>> Greetings
>>
>> Markus
>>
>> "T. Wilhelm" <t.wilhelm@msh.de> schrieb im Newsbeitrag
>> news:hahfbq$sh5$1@build.eclipse.org...
>>> Hey all,
>>>
>>> i use databinding in my RCP application and i needed my own
>>> AbstractObservableValue. So i create a class (MyObservableValue), extend
>>> it from AbstractObservableValue and everything works fine first. Then i
>>> added a validator to my binding. My Problem now is that the validator is
>>> never called :( I
Re: Validation with own AbstractObservableValue [message #491029 is a reply to message #491027] Mon, 12 October 2009 22:44 Go to previous message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Markus Koch wrote:
> Where can I find more informations about the new api?
> Currently I only work with SWTObservables, BeansObservables, PojoObservables
> and ViewersObservables.
> What are IValueProperties and how to I use them?

You need to have Eclipse 3.5.1 or Eclipse 3.6M2 to see the new API in
the built-in API reference. The new packages didn't get included in the
javadocs for the Galileo release (my fault).

Also see the new WidgetValueProperty in
org.eclipse.jface.databinding.swt package.

Also if you check out the databinding examples project from CVS there
are several snippets that show how to use properties (mostly the newer
ones, although several old snippets have been backported).

Hope this helps. Let me know if you have any other questions and I'll
do my best to help out.

Matthew
Previous Topic:Table/TableViewer paging rows
Next Topic:Need to change font size in ContentAssistant.
Goto Forum:
  


Current Time: Fri Apr 19 22:48:35 GMT 2024

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

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

Back to the top