You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daun DeFrance <Da...@novusedge.com> on 2006/02/18 16:04:56 UTC

For loop of Button components

Hi all,
I am attempting to write a custom component to augment the Contrib:Table
component which would place a custom button bar alongside the table
pagination component.  I am nearly there.  The use case I have is that
each page which uses the table component can specify a different set of
buttons to display in the table.  The way I have designed the solution
is that each page defines button components and then passes them into my
custom TableButtonBar component.  The TableButtonBar component performs
a For component loop over the buttons.  I would then like it to emit
each button component "fully formed" so to speak.  All of the examples I
have found, including Kent Tong's loop over objects and then assign
fields in them to things like Insert components or text field
components.  I just want it to take the button object and emit it.  

The problem I *think* I have is that the For component assigns each
button to a Property of the component and then if I try to reference it
using a jwcid, there is no Component by that id.  How can I get a For
component to emit a Button directly?

For reference:

Defining the buttons to add to the button bar in the page (only one
button for now):
<component id="tableButtonBar" type="TableButtonBar">
        <binding name="buttons" value="component:addButton"/>
</component>
<component id="addButton" type="Button">
        <binding name="listener" value="listener:addController"/>
        <binding name="value" value="message:addButtonLabel"/>
</component>

The .jwc object for the TableButtonBar component:
<property name="currentButton" />
<component id="buttonList" type="For">
	<binding name="source" value="buttonList"/>
	<binding name="value" value="currentButton"/>
      <binding name="volatile" value="true" /> <!-- Must be true because
Buttons are not Serializable -->
</component>

The .html for the TableButtonBar component:
<span jwcid="buttonList">
      <input type="button" jwcid="currentButton"/>
</span>

Thanks in advance!  Of course, if my entire approach is not best
practices (i.e., defining components which do not directly appear in the
page and throw a Tapestry warning even though they are in the
component), please advise on that as well!

Best,
D DeFrance


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