Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] using ValidationStatusProvider to link external validation framework
[Databinding] using ValidationStatusProvider to link external validation framework [message #331772] Sun, 21 September 2008 19:03 Go to next message
Eclipse UserFriend
Originally posted by: zx.code9.com

So here is my use case.

(1) I have some Java beans that act as model code.
(2) Databinding is used to bind the model some some UI widgets
(3) Databinding is also used to do validation
(4) There is also an external "global" validator that is used to do
validation to simplify the pain of writing validators for users. This
was done mainly to handle the complexities of validation when it is
across bindings... that is... you have elements that depend on each
other. I believe this could be done with MultiValidator in Databinding,
but we are trying hard to hide any Databinding code from developers.

I was looking at linking this "ICustomValidator" with databinding to
have one unified front of managing interactions. I believe this is
possible via ValidationStatusProvider but things are a bit tricky.

Any advice how to tackle this problem? Was anything done in EMF
Databinding to link EMF Validators with databinding?

This problem is slightly similar to what Riena is trying to with its
"Ridgets"

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&vie w=markup

We are trying to prevent users from writing complex databinding if they
don't have to.
Re: [Databinding] using ValidationStatusProvider to link external validation framework [message #331773 is a reply to message #331772] Sun, 21 September 2008 19:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020107080908040302060807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Chris,

In EMF you can defined name constraints on EClassifiers (EClasses and
EDataTypes). Things like the facet constraints on simple types from XML
Schema are directly supported and you can add your own hand-implemented
named constraints:

http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.Validation.html

I'll bet it wouldn't be hard to hook up things like
Diagnostician.INSTANCE.validate to the data binding stuff. I'd be happy
to help explore that for the 2.5 release. Right now things like
EMFUpdateValueStrategy just help with the conversion from a String to a
value, which will yield messages about conversion problems, but it would
be interesting to ensure that the constraints are also enforce. E.g.,
10 might be a valid integer, but if the values are constrained to be > 2
and < 9 then it's still wrong...



Chris Aniszczyk wrote:
> So here is my use case.
>
> (1) I have some Java beans that act as model code.
> (2) Databinding is used to bind the model some some UI widgets
> (3) Databinding is also used to do validation
> (4) There is also an external "global" validator that is used to do
> validation to simplify the pain of writing validators for users. This
> was done mainly to handle the complexities of validation when it is
> across bindings... that is... you have elements that depend on each
> other. I believe this could be done with MultiValidator in
> Databinding, but we are trying hard to hide any Databinding code from
> developers.
>
> I was looking at linking this "ICustomValidator" with databinding to
> have one unified front of managing interactions. I believe this is
> possible via ValidationStatusProvider but things are a bit tricky.
>
> Any advice how to tackle this problem? Was anything done in EMF
> Databinding to link EMF Validators with databinding?
>
> This problem is slightly similar to what Riena is trying to with its
> "Ridgets"
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&vie w=markup
>
>
> We are trying to prevent users from writing complex databinding if
> they don't have to.

--------------020107080908040302060807
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Chris,<br>
<br>
In EMF you can defined name constraints on EClassifiers (EClasses and
EDataTypes).&nbsp; Things like the facet constraints on simple types from
XML Schema are directly supported and you can add your own
hand-implemented named constraints:<br>
<blockquote><a
href=" http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.Validation.html"> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.Validation.html</a><br>
</blockquote>
I'll bet it wouldn't be hard to hook up things like
Diagnostician.INSTANCE.validate to the data binding stuff.&nbsp; I'd be
happy to help explore that for the 2.5 release.&nbsp; Right now things like
EMFUpdateValueStrategy just help with the conversion from a String to a
value, which will yield messages about conversion problems, but it
would be interesting to ensure that the constraints are also enforce.&nbsp;
E.g., 10 might be a valid integer, but if the values are constrained to
be &gt; 2 and &lt; 9 then it's still wrong...<br>
<br>
<br>
<br>
Chris Aniszczyk wrote:
<blockquote cite="mid:gb65qm$av0$1@build.eclipse.org" type="cite">So
here is my use case.
<br>
<br>
(1) I have some Java beans that act as model code.
<br>
(2) Databinding is used to bind the model some some UI widgets
<br>
(3) Databinding is also used to do validation
<br>
(4) There is also an external "global" validator that is used to do
validation to simplify the pain of writing validators for users. This
was done mainly to handle the complexities of validation when it is
across bindings... that is... you have elements that depend on each
other. I believe this could be done with MultiValidator in Databinding,
but we are trying hard to hide any Databinding code from developers.
<br>
<br>
I was looking at linking this "ICustomValidator" with databinding to
have one unified front of managing interactions. I believe this is
possible via ValidationStatusProvider but things are a bit tricky.
<br>
<br>
Any advice how to tackle this problem? Was anything done in EMF
Databinding to link EMF Validators with databinding?
<br>
<br>
This problem is slightly similar to what Riena is trying to with its
"Ridgets"
<br>
<br>
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&vie w=markup"> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&amp;view=markup</a>
<br>
<br>
We are trying to prevent users from writing complex databinding if they
don't have to.
<br>
</blockquote>
</body>
</html>

--------------020107080908040302060807--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Databinding] using ValidationStatusProvider to link external validation framework [message #331774 is a reply to message #331772] Sun, 21 September 2008 20:41 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
This is also on the list for UFacekit but I didn't wrapped by head
around it.

Tom

Chris Aniszczyk schrieb:
> So here is my use case.
>
> (1) I have some Java beans that act as model code.
> (2) Databinding is used to bind the model some some UI widgets
> (3) Databinding is also used to do validation
> (4) There is also an external "global" validator that is used to do
> validation to simplify the pain of writing validators for users. This
> was done mainly to handle the complexities of validation when it is
> across bindings... that is... you have elements that depend on each
> other. I believe this could be done with MultiValidator in Databinding,
> but we are trying hard to hide any Databinding code from developers.
>
> I was looking at linking this "ICustomValidator" with databinding to
> have one unified front of managing interactions. I believe this is
> possible via ValidationStatusProvider but things are a bit tricky.
>
> Any advice how to tackle this problem? Was anything done in EMF
> Databinding to link EMF Validators with databinding?
>
> This problem is slightly similar to what Riena is trying to with its
> "Ridgets"
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&vie w=markup
>
>
> We are trying to prevent users from writing complex databinding if they
> don't have to.


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: [Databinding] using ValidationStatusProvider to link external validation framework [message #331777 is a reply to message #331772] Mon, 22 September 2008 08:58 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi Chris,

I believe a have a similar use case. I have also a cross-ui binding
validation which also depends on some external data (which is not part
of the UI).

I tried to address this via a own Validator and then to trigger the
validator via an own listener, e.g. if the user presses a certain button.

Currently it seems not possible to trigger the validation directly:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=245176

Best regards, Lars


Chris Aniszczyk wrote:
> So here is my use case.
>
> (1) I have some Java beans that act as model code.
> (2) Databinding is used to bind the model some some UI widgets
> (3) Databinding is also used to do validation
> (4) There is also an external "global" validator that is used to do
> validation to simplify the pain of writing validators for users. This
> was done mainly to handle the complexities of validation when it is
> across bindings... that is... you have elements that depend on each
> other. I believe this could be done with MultiValidator in Databinding,
> but we are trying hard to hide any Databinding code from developers.
>
> I was looking at linking this "ICustomValidator" with databinding to
> have one unified front of managing interactions. I believe this is
> possible via ValidationStatusProvider but things are a bit tricky.
>
> Any advice how to tackle this problem? Was anything done in EMF
> Databinding to link EMF Validators with databinding?
>
> This problem is slightly similar to what Riena is trying to with its
> "Ridgets"
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&vie w=markup
>
>
> We are trying to prevent users from writing complex databinding if they
> don't have to.


--
Lars Vogel
http://www.vogella.de/eclipse.html - Tutorials about Eclipse
http://www.vogella.de/articles/RichClientPlatform/article.ht ml - Eclipse
RCP Tutorial
Re: [Databinding] using ValidationStatusProvider to link external validation framework [message #331818 is a reply to message #331772] Tue, 23 September 2008 20:28 Go to previous message
Boris Bokowski is currently offline Boris BokowskiFriend
Messages: 272
Registered: July 2009
Senior Member
Initially, DataBindingContext only had a list of bindings (all producing
validation statuses). In 3.4, we introduced the more abstract
ValidationStatusProvider with exactly your use case in mind - you may have
additional logic (usually on the model side) that also produces validation
statuses. Note that this does not change how the bindings work, i.e. they
will not stop updating the model when there are validation errors - the
whole point of doing model-side validation is that you change the model
objects so that you can run your validation logic on them. You might need a
"working copy" of model objects that can tolerate invalid values
temporarily.

I would look at how MultiValidator is implemented, but it sounds like you
may want to subclass ValidationStatusProvider yourself. All you need to do
is return something useful for getValidationStatus() - getTargets() and
getModels() is optional, it can be useful if you have any code that needs to
know how the bindings or other validation status producers are connected to
model or target observables. One example for this (the only so far) is how
WizardPageSupport uses getTargets() to detect when the user has started
interacting with the UI so that it does not produce warnings or errors
before that.

I hope this helps - if it doesn't, you can always file a bug and ask for a
code snippet. ;-)

Boris

"Chris Aniszczyk" <zx@code9.com> wrote in message
news:gb65qm$av0$1@build.eclipse.org...
> So here is my use case.
>
> (1) I have some Java beans that act as model code.
> (2) Databinding is used to bind the model some some UI widgets
> (3) Databinding is also used to do validation
> (4) There is also an external "global" validator that is used to do
> validation to simplify the pain of writing validators for users. This was
> done mainly to handle the complexities of validation when it is across
> bindings... that is... you have elements that depend on each other. I
> believe this could be done with MultiValidator in Databinding, but we are
> trying hard to hide any Databinding code from developers.
>
> I was looking at linking this "ICustomValidator" with databinding to have
> one unified front of managing interactions. I believe this is possible via
> ValidationStatusProvider but things are a bit tricky.
>
> Any advice how to tackle this problem? Was anything done in EMF
> Databinding to link EMF Validators with databinding?
>
> This problem is slightly similar to what Riena is trying to with its
> "Ridgets"
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/o rg.eclipse.riena.sample.snippets/src/org/eclipse/riena/sampl e/snippets/SnippetTextRidget001.java?root=RT_Project&vie w=markup
>
> We are trying to prevent users from writing complex databinding if they
> don't have to.
Previous Topic:Tycho build 0.3.0-DEV-1572
Next Topic:releng plugins CVS checkout
Goto Forum:
  


Current Time: Wed Sep 18 12:02:46 GMT 2024

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

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

Back to the top