-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to integrate JSR 303 with PresentationModel pattern?
PostPosted: Sun Jul 26, 2009 1:55 pm 
Beginner
Beginner

Joined: Tue Dec 26, 2006 3:50 pm
Posts: 22
Ideally, JSR 303 should be applicable in all layers (presentation, domain, persistence).

One common approach in Swing rich clients is the use of the PresentationModel pattern,
for example using JGoodies Binding as an implementation.
A short introduction can be found here.

What is the recommended way to integrate JSR 303 with such an approach, did you consider this at all?

In particular, with JGoodies Binding's PresentationModel you have the option to bind the property values of a bean to the GUI components and buffer the edited values. So, in this scenario, you would want to validate against the buffered values and show the validation results in the GUI. The problem here is, that you don't have a JavaBean instance to validate, but a PresentationModel instance with property access methods like
Code:
Object getBufferedValue("<property name>")


So to increase the flexibility of JSR 303, it would be extremly useful to have some kind of a (pluggable) property accessor API/mechanism.

The second problem here is how to specify the constraints, because you cannot annotate the PresentationModel class.
But you can annotate the real bean class and pass that as "constraint spec" to an overloaded validate-method as an additional parameter.

A third aspect concerning GUI integration is how to associate validation errors with GUI components to be able to show appropriate feedback icons, for example.
A common approach for Swing GUIs is to associate the relevant Swing components with some kind of key that is matched against the keys of the validation errors.
How would you assign such keys/ids to constraint violations in JSR 303?
Using property paths or payloads?
Maybe there should be an additional id property for constraint defs?

Just some thoughts and ideas...

Hope this makes sense,
Holger


Top
 Profile  
 
 Post subject: Re: How to integrate JSR 303 with PresentationModel pattern?
PostPosted: Mon Mar 07, 2011 4:28 pm 
Beginner
Beginner

Joined: Tue Dec 26, 2006 3:50 pm
Posts: 22
In reply to this blog post
http://in.relation.to/Bloggers/JSRBeanV ... hatToPutIn
I would like to ask you to consider the issues I raised in this forum post.

Please let me know, if something is unclear.

It would be a pity if JSR 303 could not be used in such a scenario...

Thanks,
Holger


Top
 Profile  
 
 Post subject: Re: How to integrate JSR 303 with PresentationModel pattern?
PostPosted: Tue Mar 08, 2011 6:17 am 
Newbie

Joined: Tue Mar 08, 2011 6:12 am
Posts: 2
I would also like to know if there are any plans for integrating this validation framework in the presentation layer (Swing, JavaFX, NetBeans Platform,...).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.