You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Eelco Hillenius (JIRA)" <ji...@apache.org> on 2007/08/12 10:23:43 UTC

[jira] Updated: (WICKET-839) FormComponent#checkRequired should implement only the input check

     [ https://issues.apache.org/jira/browse/WICKET-839?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eelco Hillenius updated WICKET-839:
-----------------------------------

    Description: 
Currently, checkRequired starts with calling isRequired(), so that method is actually doing two things where it should do one. The check should be done before the method is called in validateRequired instead

Currently the multiply example in wicket-examples/forminput would have to have the check implemented like this:

	public boolean checkRequired()
	{
		return isRequired() ? left.setRequired(true).checkRequired() &&
				right.setRequired(true).checkRequired() : true;
	}

which is a pretty ugly hack, while after the change, it can be coded like this:

	public boolean checkRequired()
	{
		return left.checkRequired() && right.checkRequired();
	}


  was:
Currently, checkRequired starts with calling isRequired(), so that method is actually doing two things where it should do one. I believe the check should actually be done before the method is called, so that people who override this method don't have to think about checking isRequired first.

Currently the multiply example in wicket-examples/forminput would have to have the check implemented like this:

	public boolean checkRequired()
	{
		return isRequired() ? left.setRequired(true).checkRequired() &&
				right.setRequired(true).checkRequired() : true;
	}

which is a pretty ugly hack, while after the change, it can be coded like this:

	public boolean checkRequired()
	{
		return left.checkRequired() && right.checkRequired();
	}


        Summary: FormComponent#checkRequired should implement only the input check  (was: FormComponent#checkRequired needs various improvement)

> FormComponent#checkRequired should implement only the input check
> -----------------------------------------------------------------
>
>                 Key: WICKET-839
>                 URL: https://issues.apache.org/jira/browse/WICKET-839
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, checkRequired starts with calling isRequired(), so that method is actually doing two things where it should do one. The check should be done before the method is called in validateRequired instead
> Currently the multiply example in wicket-examples/forminput would have to have the check implemented like this:
> 	public boolean checkRequired()
> 	{
> 		return isRequired() ? left.setRequired(true).checkRequired() &&
> 				right.setRequired(true).checkRequired() : true;
> 	}
> which is a pretty ugly hack, while after the change, it can be coded like this:
> 	public boolean checkRequired()
> 	{
> 		return left.checkRequired() && right.checkRequired();
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.