You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Chuck Deal (JIRA)" <ji...@apache.org> on 2006/10/26 21:27:22 UTC

[jira] Created: (WICKET-19) putting the size attr on ListChoice vs ListMultipleChoice

putting the size attr on ListChoice vs ListMultipleChoice
---------------------------------------------------------

                 Key: WICKET-19
                 URL: http://issues.apache.org/jira/browse/WICKET-19
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 1.2.2
         Environment: JDK 1.5.0_07
            Reporter: Chuck Deal
            Priority: Minor


In working with both ListChoice and ListMultiple choice, the two components are not consistent when applying the size attr.  ListMultipleChoice has a better approach.

from ListMultipleChoice:
	protected final void onComponentTag(final ComponentTag tag)
	{
		super.onComponentTag(tag);
		tag.put("multiple", "multiple");
		
		if (!tag.getAttributes().containsKey("size"))
		{
			tag.put("size", Math.min(maxRows, getChoices().size()));
		}
	}

This is better for extension purposes because the method is final.  It won't blindly set the size attr as it does on ListChoice.  Actually, the real change that I want is the value that gets applied to the attr in ListMultipleChoice.  But, by adjusting the code to include a check for the attr first,  I could attach a behavior to modify the size attr instead.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WICKET-19) putting the size attr on ListChoice vs ListMultipleChoice

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-19?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491826 ] 

Jean-Baptiste Quenot commented on WICKET-19:
--------------------------------------------

What is the purpose of doing Math.min(maxRows, getChoices().size())?  Is that really useful?

> putting the size attr on ListChoice vs ListMultipleChoice
> ---------------------------------------------------------
>
>                 Key: WICKET-19
>                 URL: https://issues.apache.org/jira/browse/WICKET-19
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.2
>         Environment: JDK 1.5.0_07
>            Reporter: Chuck Deal
>            Priority: Minor
>
> In working with both ListChoice and ListMultiple choice, the two components are not consistent when applying the size attr.  ListMultipleChoice has a better approach.
> from ListMultipleChoice:
> 	protected final void onComponentTag(final ComponentTag tag)
> 	{
> 		super.onComponentTag(tag);
> 		tag.put("multiple", "multiple");
> 		
> 		if (!tag.getAttributes().containsKey("size"))
> 		{
> 			tag.put("size", Math.min(maxRows, getChoices().size()));
> 		}
> 	}
> This is better for extension purposes because the method is final.  It won't blindly set the size attr as it does on ListChoice.  Actually, the real change that I want is the value that gets applied to the attr in ListMultipleChoice.  But, by adjusting the code to include a check for the attr first,  I could attach a behavior to modify the size attr instead.

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


[jira] Commented: (WICKET-19) putting the size attr on ListChoice vs ListMultipleChoice

Posted by "Chuck Deal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-19?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491973 ] 

Chuck Deal commented on WICKET-19:
----------------------------------

Actually, that is just what ListMultipleChoice does.  I wasn't commenting so much on that as I was on the check to see if size has already been set.  In ListChoice, it ALWAYS sets the size which means that you have to override this method if you want to supply some other value for the size attribute.  However, ListMultipleChoice is more extension friendly.

Of course, I could just be remembering the problem incorrectly, its been a while.  I think the bigger picture is that the two components should act alike whenever possible, after all, they are both List components.  And in this case, they both handle "size" differently which makes interchanging them more difficult.

> putting the size attr on ListChoice vs ListMultipleChoice
> ---------------------------------------------------------
>
>                 Key: WICKET-19
>                 URL: https://issues.apache.org/jira/browse/WICKET-19
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.2
>         Environment: JDK 1.5.0_07
>            Reporter: Chuck Deal
>            Priority: Minor
>
> In working with both ListChoice and ListMultiple choice, the two components are not consistent when applying the size attr.  ListMultipleChoice has a better approach.
> from ListMultipleChoice:
> 	protected final void onComponentTag(final ComponentTag tag)
> 	{
> 		super.onComponentTag(tag);
> 		tag.put("multiple", "multiple");
> 		
> 		if (!tag.getAttributes().containsKey("size"))
> 		{
> 			tag.put("size", Math.min(maxRows, getChoices().size()));
> 		}
> 	}
> This is better for extension purposes because the method is final.  It won't blindly set the size attr as it does on ListChoice.  Actually, the real change that I want is the value that gets applied to the attr in ListMultipleChoice.  But, by adjusting the code to include a check for the attr first,  I could attach a behavior to modify the size attr instead.

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


[jira] Resolved: (WICKET-19) putting the size attr on ListChoice vs ListMultipleChoice

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-19?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-19.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3

> putting the size attr on ListChoice vs ListMultipleChoice
> ---------------------------------------------------------
>
>                 Key: WICKET-19
>                 URL: https://issues.apache.org/jira/browse/WICKET-19
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.2.2
>         Environment: JDK 1.5.0_07
>            Reporter: Chuck Deal
>            Priority: Minor
>             Fix For: 1.3
>
>
> In working with both ListChoice and ListMultiple choice, the two components are not consistent when applying the size attr.  ListMultipleChoice has a better approach.
> from ListMultipleChoice:
> 	protected final void onComponentTag(final ComponentTag tag)
> 	{
> 		super.onComponentTag(tag);
> 		tag.put("multiple", "multiple");
> 		
> 		if (!tag.getAttributes().containsKey("size"))
> 		{
> 			tag.put("size", Math.min(maxRows, getChoices().size()));
> 		}
> 	}
> This is better for extension purposes because the method is final.  It won't blindly set the size attr as it does on ListChoice.  Actually, the real change that I want is the value that gets applied to the attr in ListMultipleChoice.  But, by adjusting the code to include a check for the attr first,  I could attach a behavior to modify the size attr instead.

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