Any component is overridable, nothing prevents my from overriding
the FormComponent in case if my component does not require any complex
markup.
On Wed, Mar 19, 2008 at 11:22 PM, Johan Compagner <[EMAIL PROTECTED]> wrote:
> ì guess checkRequired( ) is only overridable because of FormComponentPanel
> so that again that can be overriden to have there own requirement check?
>
> so yes it should really be at least protected
>
> On Wed, Mar 19, 2008 at 11:10 PM, Igor Vaynberg <[EMAIL PROTECTED]>
>
>
> wrote:
>
> > thats kinda cludge imho. checkrequired() defines the process of
> > checking, whether that needs to be invoked or not is up to the
> > formcomponent and its required attribute.
> >
> > we can make validaterequired() public, although i dont see where you
> > would call only that instead of the entire validate() pipeline.
> >
> > also right now checkrequired() is only ever called from
> > validaterequired() and i think checkrequired() should not be public
> > anyways
> >
> > -igor
> >
> >
> > On Wed, Mar 19, 2008 at 3:06 PM, Johan Compagner <[EMAIL PROTECTED]>
> > wrote:
> > > if you also want to check it in validateRequired() thats fine by me by
> > the
> > > way
> > > But i dont want it to be removed in checkRequired()
> > >
> > > And the javadoc must be updated anyway
> > >
> > > johan
> > >
> > >
> > > On Wed, Mar 19, 2008 at 11:05 PM, Johan Compagner <[EMAIL PROTECTED]
> > >
> > >
> > >
> > > wrote:
> > >
> > > > nope
> > > > i am against that
> > > > validateRequired is protected
> > > > checkRequired is public
> > > >
> > > > And if i want to test for requirement from outside i dont want to
> > call
> > > > first for every thing isRequired first
> > > > i find it very odd that a method can return very funny stuff when you
> > dont
> > > > call one method before it first
> > > > it should be self contained
> > > >
> > > > And this way it works for quite some time now, so i dont really
> > change
> > > > anything.
> > > > it is just stupid to have a method which behavior is not really
> > defined
> > > > based on that you can call it or not.
> > > > it doesn't make any sense to me to not call isRequired() in
> > > > checkRequired()
> > > >
> > > > johan
> > > >
> > > >
> > > > On Wed, Mar 19, 2008 at 10:57 PM, Igor Vaynberg <
> > [EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > why dont we build that check into validateRequired()
> > > > >
> > > > > so validateRequired() { if (isrequired() { ...current code } }
> > > > >
> > > > > that way you never have to call checkrequired() directly, just call
> > > > > validaterequired()
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Wed, Mar 19, 2008 at 2:54 PM, Johan Compagner <
> > [EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > i dont agree
> > > > > > then you have to do everywhere
> > > > > >
> > > > > > if (isRequired()) checkRequired()
> > > > > >
> > > > > > thats horrible, checkRequired() can test that just as fine
> > > > > > i will update the javadoc
> > > > > >
> > > > > > johan
> > > > > >
> > > > > > On Wed, Mar 19, 2008 at 10:51 PM, Vitaly Tsaplin <
> > > > > [EMAIL PROTECTED]>
> > > > > >
> > > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > But the javadoc says:
> > > > > > >
> > > > > > > public boolean checkRequired()
> > > > > > > "Checks if the form component's 'required' requirement is met.
> > This
> > > > > > > method should typically only be called when
> > > > > FormComponent.isRequired()
> > > > > > > returns true."
> > > > > > >
> > > > > > > And I agree with javadoc :)
> > > > > > > checkRequired () should be called only to know "if the form
> > > > > > > component's 'required' requirement is met". In case
> > isRequired()
> > > > > > > returns false this call does not make any sense...
> > > > > > >
> > > > > > > Basically if isRequired () returns true you know that a
> > component
> > > > > > > is required but what you don't know is whether the requirement
> > > > > > > condition is met or not and so to check it out you call
> > > > > checkRequired
> > > > > > > (). checkRequired () shouldn't call isRequired () itself.
> > > > > > >
> > > > > > > On Wed, Mar 19, 2008 at 10:39 PM, Johan Compagner <
> > > > > [EMAIL PROTECTED]>
> > > > > > > wrote:
> > > > > > > > it checks if the required needs to be checked and if that is
> > the
> > > > > case it
> > > > > > > > checks if the input is set
> > > > > > > >
> > > > > > > >
> > > > > > > > On Wed, Mar 19, 2008 at 10:32 PM, Vitaly Tsaplin <
> > > > > > > [EMAIL PROTECTED]>
> > > > > > > >
> > > > > > > >
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > checkRequired () itself shouldn't be called at all
> > unless
> > > > > > > > > setRequired is true...
> > > > > > > > >
> > > > > > > > > On Wed, Mar 19, 2008 at 9:43 PM, Johan Compagner <
> > > > > > > [EMAIL PROTECTED]>
> > > > > > > > > wrote:
> > > > > > > > > > and did you look at checkRequired?
> > > > > > > > > >
> > > > > > > > > > public boolean checkRequired()
> > > > > > > > > > {
> > > > > > > > > > if (isRequired())
> > > > > > > > > > {
> > > > > > > > > >
> > > > > > > > > > On Wed, Mar 19, 2008 at 2:24 PM, Vitaly Tsaplin <
> > > > > > > > > [EMAIL PROTECTED]>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > Hi guys,
> > > > > > > > > > >
> > > > > > > > > > > According to the wicket javadoc the method
> > > > > checkRequired () of
> > > > > > > the
> > > > > > > > > > > FormComponent class "...should typically only be
> > called
> > > > > when
> > > > > > > > > > > isRequired() returns true."
> > > > > > > > > > > But it seems to be different...
> > > > > > > > > > >
> > > > > > > > > > > public final void validate()
> > > > > > > > > > > {
> > > > > > > > > > > validateRequired();
> > > > > <<<-------------------- here
> > > > > > > > > > > if (isValid())
> > > > > > > > > > > {
> > > > > > > > > > > convertInput();
> > > > > > > > > > >
> > > > > > > > > > > if (isValid() && isRequired()
> > &&
> > > > > > > > > > > getConvertedInput() == null &&
> > > > > > > > > > > isInputNullable())
> > > > > > > > > > > {
> > > > > > > > > > >
> > reportRequiredError();
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > > > if (isValid())
> > > > > > > > > > > {
> > > > > > > > > > > validateValidators();
> > > > > > > > > > > }
> > > > > > > > > > > }
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > > > protected final void validateRequired()
> > > > > > > > > > > {
> > > > > > > > > > > if (!checkRequired())
> > > > > <<<---------------------
> > > > > > > and
> > > > > > > > > here
> > > > > > > > > > > {
> > > > > > > > > > > reportRequiredError();
> > > > > > > > > > > }
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > > > As you can see the checkRequired () is called
> > > > > unconditionally.
> > > > > > > > > > >
> > > > > > > > > > > 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]
> >
> >
>