tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard M. Lewis Ship (JIRA)" <...@tapestry.apache.org>
Subject [jira] Commented: (TAPESTRY-2495) @Property tag with @Parameter used with Palette Component blanking "selected" parameter
Date Mon, 30 Jun 2008 23:08:45 GMT

    [ https://issues.apache.org/jira/browse/TAPESTRY-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609399#action_12609399
] 

Howard M. Lewis Ship commented on TAPESTRY-2495:
------------------------------------------------

Suspicious:

       public void setSelectedUsers(List<User> selectedUsers) {
               this.selectedUsers.clear();
               this.selectedUsers.addAll(selectedUsers);
       }

Palette uses your List.  It clears the repopulates the list, then invokes the setter method
for good measure.  The latter is because, if the list it obtains is null, it will create a
new List object.

Thus, the code above is equivalent to:

this.selectedUsers.clear();
this.selectedUsers.addAll(this.selectedUsers);

How about this.selectedUsers.clone() ?

> @Property tag with @Parameter used with Palette Component blanking "selected" parameter
> ---------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2495
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2495
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.12
>         Environment: WindowsXP, Java 5.0.12,  tapestry 5.0.12-20080603-110024-79
>            Reporter: Brian Lough
>            Priority: Minor
>
> Have a component AssignUsersToObject.[java/tml]
> Have an Add/Edit page ClientAddEdit.[java/tml] that has  a List property "selectedUsers",
which it uses to reference the above component, ala:
>         <t:assignUserToObject selected="selectedUsers"/>
> "selectedUsers" is a collection instantiated by the ClientAddEdit page with setters/getters
of:
> 	public List<User> getSelectedUsers() {
> 		return selectedUsers;
> 	}
> 	public void setSelectedUsers(List<User> selectedUsers) {
> 		this.selectedUsers.clear();
> 		this.selectedUsers.addAll(selectedUsers);		
> 	}
> In AssignUsersToObject component, there are two distinct behaviors, depending upon on
the "selected" property is defined:
> 1. (which always blanks or doesn't populated the "selected" collection")
>     @Property
>     @Parameter(required=true)
>     private List<User> selected;
> 2. (which populates the "selected" collection fine)
>     @Parameter(required=true)
>     private List<User> selected;
>    with manually created setters/getters of
> 	public List<User> getSelected() {
> 		return selected;
> 	}
> 	public void setSelected(List<User> selected) {
> 		log.debug("Selected: " + selected.size());
> 	}
> Seems @Property shouldn't make a difference, other than less typing.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message