Hi all,
How can I specify a list of components in ognl for element bindings?

Background:
I have made some progress on this issue since my previous post.  Using
the example below, I am able to render out a [single] button if I change
the TableButtonBar.jwc to be:
<component id="buttonList" type="For">
        <binding name="source" value="buttonList"/>
        <binding name="value" value="currentButton"/>
      <binding name="volatile" value="true" />
</component>    
<component id="insertButtonRenderer" type="Delegator">
        <binding name="delegate" value="ognl:currentButton"/>
</component>

And the TableButtonBar.html becomes:
<span jwcid="buttonList">
        <span jwcid="insertButtonRenderer"/>
</span>

My problem is now I want to add more than one button and I am having
trouble specifying more than one component on my main .page file to pass
into my custom TableButtonBar component.  This is what I have:

<component id="tableButtonBar" type="TableButtonBar">
        <binding name="buttons" value="ognl:components.addButton,
components.deleteButton"/>
</component>

For the value of buttons, I have tried:
component:addButton, deleteButton
component:addButton, component:deleteButton
component:[addButton, deleteButton]

I would prefer to not have to return a list in Java for the value of
buttons.  I would prefer to do it all in the page specification where I
define by button components.  How can I specify a list of components in
ognl?

Thanks,
D DeFrance

-----Original Message-----
From: Daun DeFrance [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 18, 2006 9:05 AM
To: Tapestry users
Subject: 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to