dev@javaserverfaces.java.net

Re: (DoubleRange)Validator issue

From: Matthias Wessendorf <matzew_at_apache.org>
Date: Wed, 26 Sep 2007 12:41:28 +0200

Sure, they can implement those properties, that's fine.
They are private, yes maximum is public as I said before.

I just point to something that *can* cause some issues...

-M

On 9/26/07, Gurkan Erdogdu <gurkanerdogdu_at_yahoo.com> wrote:
>
> But in the spec, 3.5.5 It says that
>
>
> Standard Validators accept configuration information as either parameters to
> the
>
> constructor that creates a new instance of that Validator, or as JavaBeans
> component
>
> properties on the Validator implementation class.
>
>
>
> So the only properties in this valiadator is 'maximum' and 'minumum'
> properties, it is not required to implement JavaBean methods for maximumSet
> and minimumSet. Clealry RI obey the rules in spec...
>
>
>
> Maybe you can break IMPL dependency as accounting into using super.save and
> super.restore methods in your codes...
>
>
>
> Gurkan
>
>
>
> ----- Original Message ----
> From: Matthias Wessendorf <matzew_at_apache.org>
> To: dev_at_javaserverfaces.dev.java.net
> Sent: Wednesday, September 26, 2007 12:47:15 PM
> Subject: Re: (DoubleRange)Validator issue
>
>
> Imaging, that there is another IMPL, instead of only MyFaces / RI.
>
> So, for myfaces, it works as of now.
> For RI, we need to add minSet...
> For the other impl, we might need other steps
>
> That's not really a good approach, IMO
>
> -M
>
> On 9/26/07, Matthias Wessendorf <matzew_at_apache.org> wrote:
> > Well,
> >
> > my point was that these minSet / maxSet properties aren't public and
> > therefore, we need to "hack" our validators, to get it working. That's
> > odd.
> >
> > Take a look at MyFaces' (DoubleRange)Validator to see an alternate
> solution.
> >
> > -M
> >
> > On 9/26/07, Gurkan Erdogdu <gurkanerdogdu_at_yahoo.com> wrote:
> > >
> > > Hi;
> > >
> > > Just for comment maybe not clear solution for you:)
> > >
> > > In RI, The maximumSet and minumumSet is setted when any call to the
> > > setMaximum() and setMinimum() method respectively.
> > >
> > > In your validator class, you could add two key property;
> > >
> > > public void setMaximum(){
> > > super.setMaximum();
> > > _facesBean.setProperty(_MAXIMUM_KEY,
> > > Double.valueOf(maximum));
> > > _facesBean.setProperty(_MAXIMUM_SET_KEY, true);
> > > }
> > >
> > >
> > > public void setMinimum(){
> > > super.setMaximum();
> > > _facesBean.setProperty(_MINUMUM_KEY,
> > > Double.valueOf(minumum));
> > > _facesBean.setProperty(_MINIMUM_SET_KEY, true);
> > > }
> > >
> > > and then when restore your state if you got _MAXIMUM_SET_KEY or
> > > _MINUMUM_KEY_SET true, then you call the set methods again the same
> values
> > > with maximum and minumum restore values, if not keys set then no call to
> the
> > > respective methods after restore;
> > >
> > > //Restore Step
> > >
> > > boolean maximumSet = restore _MAXIMUM_SET_KEY in _FacesBean
> > >
> > > boolean minumuSet = restore _MAXIMUM_SET_KEY in _FacesBean
> > > DoubleRangeValidator validator = new DoubleRangeValidator();
> > > if(maximumSet ){
> > > //call this
> > > validator.setMaximum(restore maximum value)
> > > }
> > >
> > >
> > > if(minumumSet ){
> > > //call this
> > > validator.setMinimum(restore maximum value)
> > > }
> > >
> > > So any maximumSet and minumumSet properties will be saved/restored I
> think;
> > >
> > > Gurkan Erdogdu
> > >
> > >
> > > ----- Original Message ----
> > > From: Matthias Wessendorf <matzew_at_apache.org>
> > > To: dev_at_javaserverfaces.dev.java.net
> > > Sent: Wednesday, September 26, 2007 10:41:13 AM
> > > Subject: (DoubleRange)Validator issue
> > >
> > >
> > > Hi guys,
> > >
> > > this mail on the Trinidad list ([1]) lead me to the following issue.
> > >
> > > In Trinidad, we extend the standard validators, like the
> > > doubleRangeValidator, but the "logic" of the validate is inherited.
> > > Inside of save/restore State methods, we delegate to the FacesBean
> > > instance, which takes care of saving / restoring all properties, like
> > > maximum or some Trinidad extra properties like "messageDetailMaximum".
> > > See [2] for the full source code.
> > >
> > > When using Trinidad on top of the RI (and client side validation is
> > > DISABLED), there are some issues (see [1]). It looks like there is a
> > > private property used the the RI (DoubleRange)Validator to indicate if
> > > maximum or minimum has been set (and these properties are also saved /
> > > restored). Since this is private, it's "odd" to add this property to
> > > Trinidad's (DoubleRange)Validator as well, to get it working with the
> > > RI, isnt' it ?
> > >
> > > I checked the MyFaces IMPL code of (DoubleRange)Validator (see [3])
> > > and it doesn't use such a property. So here, this combination (MyFaces
> > > + Trinidad (client validation DISABLED)) works.
> > >
> > > What do you think about this ?
> > > Do you want me to file an issue ?
> > >
> > > Thx,
> > > Matthias
> > >
> > > [1]
> > >
> http://www.mail-archive.com/users@myfaces.apache.org/msg42199.html
> > > [2] http://tinyurl.com/22ojtz
> > > [3] http://tinyurl.com/3bvsdb
> > >
> > > --
> > > Matthias Wessendorf
> > >
> > > further stuff:
> > > blog: http://matthiaswessendorf.wordpress.com/
> > > mail: matzew-at-apache-dot-org
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > dev-unsubscribe_at_javaserverfaces.dev.java.net
> > > For additional commands, e-mail:
> > > dev-help_at_javaserverfaces.dev.java.net
> > >
> > >
> > > ________________________________
> > > Need a vacation? Get great deals to amazing places on Yahoo! Travel.
> >
> >
> > --
> > Matthias Wessendorf
> >
> > further stuff:
> > blog: http://matthiaswessendorf.wordpress.com/
> > mail: matzew-at-apache-dot-org
> >
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://matthiaswessendorf.wordpress.com/
> mail: matzew-at-apache-dot-org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail:
> dev-help_at_javaserverfaces.dev.java.net
>
>
> ________________________________
> Moody friends. Drama queens. Your life? Nope! - their life, your story.
> Play Sims Stories at Yahoo! Games.


-- 
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org