Yes, you can control. In your RequestFactory fire operation, override
the OnConstraintViolation method in the receiver, like below.
@Override
public void onConstraintViolation(
Set<ConstraintViolation<?>>
violations) {
Iterator<ConstraintViolation<?>> itr =
violations
.iterator();
while (itr.hasNext()) {
ConstraintViolation<?> viola =
itr.next();
log.log(Level.WARNING,
"Violation : [ " +
viola.getMessage() + ": "
+
viola.getPropertyPath() + " : "
+
viola.getInvalidValue() + " ]");
}
// set the contraints in the editor
view.getEditor().setConstraintViolations(violations);
}
Now the violations are passed onto the editor. In the editor you can
use wrap the controls which needs to display the violation messages
using the ValueBoxEditorDecorator
example :
<e:ValueBoxEditorDecorator ui:field="titleDecorator"
addStyleNames="{style.common.separator10} {style.common.txtClrRed}
{style.common.separatorT}">
<e:valuebox>
<g:TextBox ui:field="title"
addStyleNames="{style.common.textHldr}"/>
</e:valuebox>
</e:ValueBoxEditorDecorator>
Thanks
Ashwin
On Wednesday 30 November 2011 04:22:51 PM IST, Elhanan Maayan wrote:
ok let's assume i'm using the server side validation ,is there any
easy to get the control which has the wrong value (i'm assuming the
use of path is needed) from the editorError?
On Wed, Nov 30, 2011 at 12:38 PM, Thomas Broyer <[email protected]
<mailto:[email protected]>> wrote:
RequestFactoryEditorDriver#flush simply copies the data from the
widgets to the EntityProxy, so either you validate data in your
widgets (calling EditorDelegate#recordError; see the
ValueBoxEditor for an example) or you validate your proxy, but
you'd have to flush() first so the proxy is updated.
And if you need a reference to your EntityProxy, well, just keep
it one in a field of your class (this is how you'd do it anyway if
you didn't use the Editors framework; what this one does is for
the most part generating code for "put this object's data into the
widgets" and "put the widgets' value into the object"; see
https://gist.github.com/780560, compare the two commits for a
"without the Editor framework" and "with the Editor framework").
Now, about JSR303 on the client-side, then yes, you'll have to put
annotations on your proxies. You can see it as duplication, or as
a feature in that it allows you to validate differently on the
client-side and the server-side (because you don't have the same
capabilities).
I believe the idea was that proxies would be generated somehow,
rather than maintained by hand; and also that JSR303 support on
the client-side was done without thinking particularly about
RequestFactory.
--
You received this message because you are subscribed to the Google
Groups "Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/9dgB5t-XJIwJ.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:google-web-toolkit%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.
--
You received this message because you are subscribed to the Google Groups "Google
Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.