you still have broken validator support for that fcp. also inside
formvalidator.validate() you cannot yet access the model, but only
getconvertedinput() - which will always be null for your fcp so how do
you validate its value inside the form validator? you probably only
use it to trigger formvalidator, but that is a bit hacky...
-igor
On Mon, Mar 17, 2008 at 6:36 PM, Vitaly Tsaplin
<[EMAIL PROTECTED]> wrote:
> Thanks Igor,
>
> With the Date object we have a very nice and consistent example. I
> implemented my DatePicker exactly this way. But sometimes if the data
> is spread over different properties of a bean or even between
> different beans but still needs to be processed in a consistent manner
> the solution is not so elegant. I decided to use the
> FormComponentPanel over a simple panel only because I was keeping in
> my mind a form level validation scenario since the FormValidator
> requires an array of objects of the FormComponent class to be returned
> by one of its methods.
>
> Vitaly
>
>
>
> On Tue, Mar 18, 2008 at 2:21 AM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > well, you dont want to implement input processing, yet you are using
> > setrequired - which is used in that processing...you see the delema?
> >
> > what you should do is:
> >
> > class mypanel extends fcp {
> > public mypanel {
> > super(id, new Model());
> > }
> >
> > convertinput() { setconvertedinput(Boolean.TRUE); }
> > }
> >
> > then everything should work; however, this is not how the fcp is meant
> > to be used. it is meant to allow assembling of inputs from smaller
> > pieces, so a proper implementation would look like
> >
> > class mydatefiled extends fcp {
> > private TextField day,mo,year;
> > public mydatefield(string id, imodel model) {
> > add(new textfield("day", new Model());
> > add(new textfield("mo", new Model());
> > ...
> > }
> >
> > convertinput() {
> > MyDate date=new MyDate();
> > date.setDay(day.getconvertedinput());
> > date.setMonth(month.getConvertedInput());
> > ...
> > setConvertedInput(date.toDate());
> > }
> > }
> >
> > that way
> > 1) set required works properly
> > 2) any validators attached to it work on the resulting Date object
> > 3) you do not need to pass in 3 models, you pass in one and fcp
> > combines its inputs into it
> >
> > makes sense? so in short, you are not using the right tool for the
> > job. sounds like what you are doing can be accomplished with a regular
> > panel that has a setrequired(boolean) method...
> >
> > -igor
> >
> >
> >
> > On Mon, Mar 17, 2008 at 5:41 PM, Vitaly Tsaplin
> >
> >
> > <[EMAIL PROTECTED]> wrote:
> > > My component accepts 3 models as parameters, and uses this models
> > > internally. The component's model is not involved at all. You mean the
> > > method convertinput () must return at least something other then null?
> > >
> > >
> > >
> > > On Tue, Mar 18, 2008 at 1:10 AM, Igor Vaynberg <[EMAIL PROTECTED]>
> wrote:
> > > > i assumed you properly implemented convertinput(). you cannot call
> > > > setrequired(true) on the formcomponentpanel and then expect to
> > > > completely avoid the required check.
> > > >
> > > > the required check is two-pronged. first half is done in the
> > > > checkRequired() and works on the raw input. second part makes sure
> > > > that your type-conversion did not take a non-null input and convert
> it
> > > > into null...this is the part that is failing for you. that is
> > > > something you should properly implement...
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Mon, Mar 17, 2008 at 3:18 PM, Vitaly Tsaplin
> > > >
> > > >
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > True. But I do... unfortunately.
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Mar 17, 2008 at 11:15 PM, Igor Vaynberg <[EMAIL
> PROTECTED]> wrote:
> > > > > > you should not, since checkrequired() will pass.
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Mon, Mar 17, 2008 at 2:47 PM, Vitaly Tsaplin
> > > > > >
> > > > > >
> > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > Ok :)
> > > > > > >
> > > > > > > I have the following
> > > > > > >
> > > > > > > checkRequired () {
> > > > > > > return true;
> > > > > > > }
> > > > > > >
> > > > > > > isRequired () {
> > > > > > > return true;
> > > > > > > }
> > > > > > >
> > > > > > > In the case above Do I have an error message saying that
> the field
> > > > > > > is required?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Mon, Mar 17, 2008 at 10:42 PM, Igor Vaynberg <[EMAIL
> PROTECTED]> wrote:
> > > > > > > > no, that means that effectively required check is
> disabled - eg it always passes
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > > On Mon, Mar 17, 2008 at 2:15 PM, Vitaly Tsaplin
> > > > > > > >
> > > > > > > >
> > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > If the method checkRequired () returns TRUE that
> means, I guess, the
> > > > > > > > > requirement condition check must always pass, but it
> doesn't happens.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Mon, Mar 17, 2008 at 10:09 PM, Igor Vaynberg
> <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > the reason formcomponentpanel.checkrequired()
> always returns true is
> > > > > > > > > > that for a formcomponentpanel it is often a noop.
> so that is the best
> > > > > > > > > > default implementation we can provide. you can
> always override it to
> > > > > > > > > > implement some logic if you need...
> > > > > > > > > >
> > > > > > > > > > -igor
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Mon, Mar 17, 2008 at 1:13 PM, Vitaly Tsaplin
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > I run into this problem implementing my own
> component as a subclass
> > > > > > > > > > > of the FormComponentPanel class. In my case
> the method checkRequired
> > > > > > > > > > > just always returns TRUE but if I set required
> property to TRUE the
> > > > > > > > > > > component always generate a validation error
> (field bla-bla-bla is
> > > > > > > > > > > required).
> > > > > > > > > > >
> > > > > > > > > > > On Mon, Mar 17, 2008 at 9:09 PM, Vitaly Tsaplin
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > I am not sure but I suspect that if the
> method checkRequired
> > > > > > > > > > > > returns true a requirement condition must
> always met in any case or
> > > > > > > > > > > > the behavior is different?
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Mon, Mar 17, 2008 at 8:57 PM, Igor
> Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > why should we call checkrequired() twice?
> > > > > > > > > > > > >
> > > > > > > > > > > > > -igor
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Mon, Mar 17, 2008 at 12:06 PM, Vitaly
> Tsaplin
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > > It should be probably like this
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > if (isValid() &&
> (isRequired() ? !checkRequired
> > > > > > > > > > > > > > () : true) && getConvertedInput() ==
> null && isInputNullable())
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > <<<<---- the second check. Doesn't
> call the chechRequired ()
> > > > > > > > > > > > > > {
> > > > > > > > > > > > > >
> reportRequiredError();
> > > > > > > > > > > > > > }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Mon, Mar 17, 2008 at 8:02 PM,
> Vitaly Tsaplin
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > > > But if checkRequired () returns
> true isRequired () called again
> > > > > > > > > > > > > > > generating a validation error...
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > if
> (isValid() && isRequired() &&
> > > > > > > > > > > > > > > getConvertedInput() == null &&
> isInputNullable()) <<<<---- the second
> > > > > > > > > > > > > > > check. Doesn't call the
> chechRequired ()
> > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > >
> reportRequiredError();
> > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Mon, Mar 17, 2008 at 7:47 PM,
> Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > > > > sure it does, see the first line
> of validate()
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > -igor
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Mon, Mar 17, 2008 at 11:06
> AM, Vitaly Tsaplin
> > > > > > > > > > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > > > > > Hi guys,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > It seams that there is a
> bug in the FormComponent code. I try to
> > > > > > > > > > > > > > > > > override chechRequired
> method but it seams to not work at all.
> > > > > > > > > > > > > > > > > Here is a snippet from the
> sources. As you can see there is a
> > > > > > > > > > > > > > > > > second requirement check.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > /**
> > > > > > > > > > > > > > > > > * Checks if the raw
> input value is not null if this component is required.
> > > > > > > > > > > > > > > > > */
> > > > > > > > > > > > > > > > > protected final void
> validateRequired()
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > if
> (!checkRequired()) <<<<---- the first check
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> reportRequiredError();
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > /**
> > > > > > > > > > > > > > > > > * Performs full
> validation of the form component, which consists of
> > > > > > > > > > > > > > > > > calling validateRequired(),
> > > > > > > > > > > > > > > > > * convertInput(),
> and validateValidators(). This method should only
> > > > > > > > > > > > > > > > > be used if the form
> > > > > > > > > > > > > > > > > * component needs to
> be fully validated outside the form process.
> > > > > > > > > > > > > > > > > */
> > > > > > > > > > > > > > > > > public final void
> validate()
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> validateRequired();
> > > > > > > > > > > > > > > > > if (isValid())
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> convertInput();
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > if
> (isValid() && isRequired() &&
> > > > > > > > > > > > > > > > > getConvertedInput() == null
> && isInputNullable()) <<<<---- the second
> > > > > > > > > > > > > > > > > check. Doesn't call the
> chechRequired ()
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> reportRequiredError();
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > if
> (isValid())
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> validateValidators();
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Vitaly
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > > > > > > > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > > > > > > > > > > > > > > > For additional commands,
> e-mail: [EMAIL PROTECTED]
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > > > > > > > To unsubscribe, e-mail: [EMAIL
> PROTECTED]
> > > > > > > > > > > > > > > > For additional commands,
> e-mail: [EMAIL PROTECTED]
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > > > > > To unsubscribe, e-mail: [EMAIL
> PROTECTED]
> > > > > > > > > > > > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > > > > > > > For additional commands, e-mail: [EMAIL
> PROTECTED]
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > > > > > For additional commands, e-mail: [EMAIL
> PROTECTED]
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]