I think I should provide some of the code since I will trying to achieve
that you suggested.  The menu has the list of MenuItems provided in the
code.  But when it renders I want the component to use the correct
component based on its type.  I saw another message in the forum that
outputted apples/orange components in this way.     

Menu Class:

        @Component
        private PageMenuLink _pageMenuLink;
        
        @Component
        private ActionMenuLink _actionMenuLink;

        private List<AbstractMenuItem> _menuItems;
        
        private AbstractMenuItem _item;

        @SetupRender
        private void initialize() {
                _menuItems = new ArrayList<AbstractMenuItem>();
                PageMenuLink item = new PageMenuLink();
                item.setDisplayName("PageMenuLink");
                item.setPage("start");
                _menuItems.add(item);
        }

Menu Template:

        <t:loop source="menuItems" value="item">
                <t:delegate to="item"/> 
      </t:loop>
        
      <t:Block>
        <t:common.nav.pageMenuLink t:id="pageMenuLink"/>
                <t:common.nav.actionMenuLink t:id="actionMenuLink"/>
      </t:Block>

Menu Item:
        PageMenuLink extends AbstractMenuItem



-----Original Message-----
From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 14, 2008 11:01 AM
To: Tapestry users
Subject: Re: _$resources.queueRender($2);

You mentioned "provided dynamically"?

You can't just instantiate components, only Tapestry can do that, once
it has transformed the class.  What you can do is place the
components,
in the template, inside a <t:block> element.

On Jan 14, 2008 7:42 AM, Bret Gregory <[EMAIL PROTECTED]> wrote:
> I am running into a problem with a custom component that I am
attempting
> to write.  The component is a dropdown menu.  Inside the menu there
are
> menu items which are components that are provided dynamically.  These
> components are then looped over and each menu item component is to be
> rendered based on its type.  However, I am getting a Null Pointer when
> attempting to render the individual items.  It looks like the
> transformation of the components adds a render() method to the
component
> that defers to the ComponentResources class's queueRender method.  But
> for my Menu Items the resources is null and I am not sure why that is
> the case.
>
> The MenuItem component class extends an Abstract class from the
> root.base package.  This class also looked to be getting transformed
by
> tapestry which I didn't expect since it wasn't in the pages or
> components package.  The concrete MenuItem component lives in the
> root.components.nav package.
>
> Any ideas on why the ComponentResources are not available in my Menu
> Item components?
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
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