Well folks I'm really having a hard time on this. Let me try to point
the situation:
On my visit class I store the user object as soon as the user logs in.
The user object has a Set of groups, and those a Set of categories
(lazy loaded from hibernate).

What I'd like to do is dawn simple. 
Initialize the collection of categories
Set it on the page scope
pass it to the CategoriesBorder componente as a parameter
and on the component deal with this.

Problem is... Its been a nightmare doing this...

So on my StartPage I have:
public void renderPage(IMarkupWriter arg0, IRequestCycle arg1) {
                super.renderPage(arg0, arg1);
TabPanel tabPanel = (TabPanel)getComponent("groupPanel");
                Group group = (Group) tabPanel.getSelectedBlock();
                setCategories(getUserService().getCategories(group));
                        
}

So far so good, The categories are set.
My start.html
<span jwcid="@Border">
      <span jwcid="groupPanel" blockNames="ognl:user.groupList">
                <span jwcid="@CategoriesBorder" categories="ognl:categories"/>
      </span>
</span>

See the categories over there???

But the componet get a categories list with a zero size. How should be
the correct steps to do this? I'm very lost on the sequence here.

Thanks

Vinicius

On 6/16/05, Daniel M Garland <[EMAIL PROTECTED]> wrote:
> Ron,
> 
> So if I have a method that retrieves the values for a page property, is
> it best to put this method in every get/set that requires the property
> to be set, or to have it placed just once in prepareForRender?
> 
> Cheers
> Dan
> 
> Ron Piterman wrote:
> 
> > You don't have to override renderPage for that. Infact what you do is
> > setting the property after thew page was rendered... so its a bit too
> > late ;-)
> >
> > What you should do is pass the list as a parameter, rather than as a
> > property. Then, in your page you do:
> >
> > <span jwcid="myComponent" categories="categories"/>
> >
> > in the class, you implement
> >
> > public List getCategories() {
> >   getComponent(...).get...
> > }
> >
> >
> > Cheers,
> > Ron
> >
> >
> > ציטוט Vinicius Carvalho:
> >
> >> Hello there!
> >> I have a page (Start.page) which has a List of categories objects.
> >> This page has a component, with a nested component on it:
> >>
> >> <span jwcid="@Border">
> >>       <span jwcid="groupPanel" blockNames="ognl:user.groupList">
> >>           <span jwcid="@CategoriesBorder"/>
> >>       </span>
> >> </span>
> >>
> >> User is also a property from my page. And the categoriesBorder:
> >>
> >> <component-specification class="org.apache.tapestry.BaseComponent"
> >> allow-body="yes" allow-informal-parameters="no">
> >>     <property-specification name="categories" type="java.util.List">
> >>         page.categories        </property-specification>
> >> </component-specification>
> >>
> >>
> >> <span jwcid="@Foreach" source="ognl:categories" element="category">
> >> <table border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0"
> >> width="85%" align="center">
> >>         <tr>
> >>             <td jwcid="@Any" element="td"
> >> bgcolor="ognl:category.color" width="30%">
> >>             <span jwcid="@Insert" value="ognl:category.title"/>
> >>             </td>
> >>             <td></td>
> >>         </tr>
> >>         <tr>
> >>             <td jwcid="@Any" element="td"
> >> bgcolor="ognl:category.color" width="100%">
> >>             <table cellspacing="1" width="100%">
> >>             <tr>
> >>                 <td bgcolor="#FFFFFF" width="100%"> </td>
> >>             </tr>
> >>             </table>
> >>             </td>
> >>         </tr>
> >> </table>
> >> <p><br>
> >> </span>
> >>
> >> Problem is, the categories is empty, null...
> >> The page that contains the component (Start.page) has renderPage
> >> overriden
> >> public void renderPage(IMarkupWriter arg0, IRequestCycle arg1) {
> >>         super.renderPage(arg0, arg1);
> >>         TabPanel tabPanel = (TabPanel)getComponent("groupPanel");
> >>         Group group = (Group)tabPanel.getSelectedBlock();
> >>         setCategories(getUserService().getCategories(group));
> >>     }
> >>
> >> I've debug it and the catetories have been set properly. Any ideas?
> >>
> >> Thanks
> >>
> >> ---------------------------------------------------------------------
> >> 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]
> >
> >
> > ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security System.
> > For more information please visit http://www.messagelabs.com/email
> > ______________________________________________________________________
> >
> >
> 
> --
> Regards,
> 
> *Dan Garland*
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> Tel: +44 (0) 207 803 1947
> Mob: +44 (0) 7979 770053
> ICQ: 120963437
> AIM: dmgarland1767
> 
> 
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to