You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Norris <CN...@widen.com> on 2003/11/24 18:31:30 UTC
A little confused about the component rendering
Here is what I am trying to do: make a component that takes in a
java.util.Set. Here's the main part of the component:
<td class="subFiller"><div jwcid="@ListEdit" source="ognl:validRolesId"
value="ognl:currentRoleId">
<input jwcid="@Checkbox" selected="ognl:roleChecked" /> <span
jwcid="@Insert" value="ognl:currentRole.name" /><br/>
</div></td>
So the component basically edits a list of roles. The thing is, the set
must always have at least one role in it. I was going to make the
setRoleChecked method not allow the last role to be deleted, but that
doesn't always work. Say, for instance, that there are 3 roles, the first
two of which are initially checked. If a user unchecks the first two and
checks the third, this is valid. But if I check in setRoleChecked, it won't
allow the unchecking of the 2nd role, because it doesn't know that the third
will be checked. I hope that makes sense
So my solution was to make a temporary Set to store the roles in. If I can
populate the set via a parameter passed in when the component is first
rendered, and then operate just on the set, I should be okay. But I would
have to use the temporary Set to modify the real Set passed in as a
parameter when the form the component is in is submitted. So, first of all,
is my solution misguided? I may be going about this all wrong. If I'm on
the right path, what methods will I need to override? Between all the
renders and beginRenders and things, I'm not sure which to use.
Any thoughts would be appreciated.
-chris