Yeah, I know that it's simple when one wants to pass single listener, but I
need list of them.
In case of single one, you just pass it using "listener:doSomething", and it
is called after link is pressed. But, I have to pass list of them, and since
there's no "listener:doSomething1, doSomething2", I have to create them
manually in my page using:
List list = new ArrayList();
list.add(getListenerMap().getListener("doSomething1"));
list.add(getListenerMap().getListener("doSomething2"));
return list;
and as I can recall it didn't work. Since these listeners are basically
callbacks to page object, I guess it's not possible to pass page references
around just like that ?
-V.
----- Original Message -----
From: "Patrick Casey" <[EMAIL PROTECTED]>
To: "'Tapestry users'" <[email protected]>
Sent: Tuesday, November 01, 2005 8:57 AM
Subject: RE: How to pass list of IActionListeners to component?
I haven't ever tried to pass a list of listeners before, but the
usual syntax for passing a listner into a component is:
In the component .jwc
<component-specification class="components.EditButtonBar" allow-body="yes"
allow-informal-parameters="yes">
<parameter name="mode" required="yes" type="java.lang.String"
direction="in"/>
<parameter name="update" direction="auto" required="yes"
type="org.apache.tapestry.IActionListener"/>
<parameter name="ok" direction="auto" required="yes"
type="org.apache.tapestry.IActionListener" />
<parameter name="delete" direction="auto" required="yes"
type="org.apache.tapestry.IActionListener"/>
<parameter name="add" direction="auto" required="yes"
type="org.apache.tapestry.IActionListener"/>
<context-asset name="save_image" path="/img/save.png"/>
<context-asset name="add_image" path="/img/add.gif"/>
<context-asset name="delete_image" path="/img/delete.gif"/>
<context-asset name="back_image" path="/img/e_back.gif" />
<context-asset name="ok_image" path="/img/ok.gif" />
<context-asset name="delta_image" path="/img/cfield.gif" />
</component-specification>
When you invoke the component:
<span jwcid="@EditButtonBar" mode="ognl:page.mode"
add="ognl:page.listeners.add" update="ognl:page.listeners.update"
delete="ognl:page.listeners.delete" ok="ognl:page.listeners.ok"/>
-----Original Message-----
From: Vjeran Marcinko [mailto:[EMAIL PROTECTED]
Sent: Monday, October 31, 2005 10:58 PM
To: Tapestry users
Subject: How to pass list of IActionListeners to component?
This seems as advanced problem...
I have a "navigation" component that is supose to render passed list of
links (in a form of List of IActionListeners). Meaning, it should just
render DirectLinks by looping IActionListeners.
Parent page/component should just create List of IActionListeners by
calling
getListenerMap().getListener("doSomething")
in itself for constructing each IActionListener, and pass that list to
navigation component, thus clicking on link inside this navigation should
execute any action that was passed to it.
Has anyone done something similar?
I recall trying it some weeks ago, but it raised some exceptions, cannot
remember exactly what (soory for vague description)...
BTW, I don't want to use ExternalLinks inside my navigation component,
since
I guess things are much easier then, I want Directlinks.
-Vjeran
---------------------------------------------------------------------
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]
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.6/152 - Release Date: 31.10.2005
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]