You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ro...@anitefinance.com on 2003/08/07 16:14:13 UTC

RE: getBeans called within renderComponent within AbstractFormCom ponent subclass

Thanks for getting back so quick.

>>>Do you define any beans in your CustomSubmit component?<<<

Not quite sure what you mean here, below is an extract from the page
specification

<page-specification class="com.afs.exampleapp.pages.AFSHomePage">
    
    <bean name="togglerDataBean"
class="com.afs.exampleapp.beans.AFSTogglerBean" lifecycle="request">
        <set-property name="overrunCount" expression="'3'"/>
    </bean>

    <component id="linkToHome" type="PageLink">
        <static-binding name="page">Home</static-binding>
    </component>

    <component id="togglerCreateForm" type="Form"/>

    <component id="createSubmit" type="CreateUserProcessSubmit">
        <static-binding name="label">Create</static-binding>
        <!--<static-binding
name="processDataBeanName">togglerDataBean</static-binding>-->
        <static-binding name="processDataBeanName">toggler</static-binding>
        <static-binding name="processId">toggler</static-binding>
        <static-binding name="processInstanceId">A</static-binding>
    </component>

....

>>>
Why don't you create a bean that implements IActionListener
<<<


The idea is that this is a very self contained component which forms a
bridge between tapestry and a configurable state based process engine. As
such we simply specify a parameter indicating the process to kick off, a
parameter indicating the instance of the process and pass in a bean for the
process to retrieve and set data. Another custom submit button will take the
instance parameter and an event id etc to fire in. Given that
AbstractComponent sports a getBeans method it did not seem necessary to
create a separate bean to do this. 

It occurs to me that I could always pass the bean (togglerDataBean for
example) directly into processDataBeanName if I change it to Object type and
use OGNL.

It would still be interesting to know however why getBeans returns an empty
collection.

>>>
getContainer().getBeans()
<<<

Yup, however this returns IComponent which does not surface getBeans().
Maybe I'm just not reading the JavaDoc correctly with my dislexic eyes :-|


Thanks
Robert
       

-----Original Message-----
From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
Sent: 07- Aug- 03 14:30
To: 'Tapestry users'
Subject: RE: getBeans called within renderComponent within
AbstractFormComponent subclass


Do you define any beans in your CustomSubmit component?

Perhaps you want to invoke getContainer().getBeans().

Why don't you create a bean that implements IActionListener and just set
that as the listener for
the existing Submit component?

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Robert.Stevenson@anitefinance.com 
> [mailto:Robert.Stevenson@anitefinance.com] 
> Sent: Thursday, August 07, 2003 8:44 AM
> To: tapestry-user@jakarta.apache.org
> Subject: getBeans called within renderComponent within 
> AbstractFormComponent subclass
> 
> 
> I have copied the Submit component with the intention of 
> providing some modified functionality.
> 
> Within the "renderComponent" method of the "Submit.java" is 
> the following code snipit
> 
> ....
> IActionListener listener = getListener();
>             
> if (listener != null)
> listener.actionTriggered(this, cycle);
> ....
> 
> To cut a long story short  I have replaced the above code 
> with a call to "getBeans". However this is returning me an 
> empty collection. 
> 
> However if I re-instate the listener then calls to "getBeans" 
> within the listener method return all the beans I expect.
> 
> My design for this component relies on having access to the 
> beans within the page or other enclosing component. 
> 
> Any ideas or explanations would be most gratefully received.
> 
> 
> Thanks
> Robert Stevenson
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


RE: getBeans called within renderComponent within AbstractFormComponent subclass

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
> 
> It would still be interesting to know however why getBeans 
> returns an empty collection.
> 
> >>>
> getContainer().getBeans()
> <<<
> 
> Yup, however this returns IComponent which does not surface 
> getBeans(). Maybe I'm just not reading the JavaDoc correctly 
> with my dislexic eyes :-|
> 
> > 

Do you have any <bean> elements in CreateUserProcessSubmit.jwc?

Sounds like you want to access beans from the container, the page that references
CreateUserProcessSubmit.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry