Here it is: import java.util.List;
import org.apache.log4j.Logger; import org.apache.tapestry.annotations.Parameter; import com.philips.lighting.guidecontrol.view.BreadcrumbBean; /** * The heading component holds the following pieces of Heading information. * * <pre> * <div id="heading"> * <ul id="breadcrumbs"> * <li id="prefix">[ &aposyou-are-here&apos ]>/li> * { when loginPage } * <li>&aposlogin-page&apos</li> * { when not loginPage } * { for all crumbs } * { if crumb is last } * <li>[ crumb text ]</li> * { if crumb is not last } * <li><a href="[ crumb link ]">[ crumb text ]</a> > </li> * </ul> * </div> * </pre> * * @author Cumquat Information Technology * */ public class Heading { private static final Logger logger = Logger.getLogger(Heading.class); @Parameter private boolean loginPage = false; @Parameter private List<BreadcrumbBean> breadCrumbs; private int index; private BreadcrumbBean crumb; public boolean isLoginPage() { return loginPage; } public List<BreadcrumbBean> getBreadCrumbs() { return breadCrumbs; } public void setBreadCrumbs(List<BreadcrumbBean> breadCrumbs) { logger.debug("Setting breadcrumbs: "+breadCrumbs); this.breadCrumbs = breadCrumbs; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public BreadcrumbBean getCrumb() { return crumb; } public void setCrumb(BreadcrumbBean crumb) { this.crumb = crumb; } public boolean isLastCrumb() { return (index == breadCrumbs.size() - 1); } } On Fri, 2008-04-18 at 16:22 +0200, Chris Lewis wrote: > We still haven't seen your template code, where you declare this > component and pass it the model. I can't be sure but perhaps it will > shed some light... > > Jan Vissers wrote: > > The problem is somehow related to the way my page and component are > > hooked up/working. > > > > For testing purposes I now create the Breadcrumb list in the component > > itself, simply returning a created list on the fly whenever > > getBreadCrumbs() is called. This works as expected!!! > > > > Strange thing is that via passing the 'model' to the component via a > > page binding the same thing doesn't work. This must be a bug?! > > > > -J. > > > > On Fri, 2008-04-18 at 15:59 +0200, Chris Lewis wrote: > > > >> That looks good to me. I don't have an example I can look at with a > >> loop, but I do have one with a t:grid in which I reference a bean > >> property of a custom class. It's possible that the two are vastly > >> different, but I wouldn't think that. > >> > >> Jan Vissers wrote: > >> > >>> On the component I have: > >>> > >>> @Parameter > >>> private List<BreadcrumbBean> breadCrumbs; > >>> > >>> This is passed in via the containg (base)page. > >>> And in the same component class I have: > >>> > >>> private BreadcrumbBean crumb; > >>> > >>> public BreadcrumbBean getCrumb() { > >>> return crumb; > >>> } > >>> > >>> public void setCrumb(BreadcrumbBean crumb) { > >>> this.crumb = crumb; > >>> } > >>> > >>> This should be right, right? > >>> > >>> -J. > >>> > >>> On Fri, 2008-04-18 at 14:00 +0100, nicholas Krul wrote: > >>> > >>> > >>>> ? is your crumb property of type BreadCrumbBean, or is it type String? > >>>> should be same as breadCrumbs<?TYPE> > >>>> > >>>> On Fri, Apr 18, 2008 at 1:56 PM, Chris Lewis <[EMAIL PROTECTED]> > >>>> wrote: > >>>> > >>>> > >>>> > >>>>> I can't speak about your t:if bit because I don't know what "LastCrumb" > >>>>> would be, but assuming that your page class has getters/setters (or the > >>>>> property is annotated with @Property) for the "crumb" property, a getter > >>>>> for your "breadCrumbs," and your crumb bean defines a "getName" method, > >>>>> you *should* be good. > >>>>> > >>>>> It would be helpful if you can include the exception, specifically the > >>>>> line it references, etc. > >>>>> > >>>>> chris > >>>>> > >>>>> PS the list is good, the IRC channel (irc.freenode.net #tapestry) is > >>>>> better ;-) > >>>>> > >>>>> Jan Vissers wrote: > >>>>> > >>>>> > >>>>>> Yep, sure, I may I add - This mailing list is great and Tapestry rocks! > >>>>>> > >>>>>> <t:loop source="breadCrumbs" value="crumb" index="index"> > >>>>>> <t:if test="LastCrumb"> > >>>>>> ${crumb.name} > >>>>>> <t:parameter name="else"> > >>>>>> <a href="#" > >>>>>> t:type="pageLink" ....>${crumb.name}</a> > >>>>>> > > >>>>>> </t:parameter> > >>>>>> </t:if> > >>>>>> </t:loop> > >>>>>> > >>>>>> -J. > >>>>>> > >>>>>> On Fri, 2008-04-18 at 14:34 +0200, Chris Lewis wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>>> Can you share some code? At least the relevant part from template > >>>>>>> would > >>>>>>> be helpful. > >>>>>>> > >>>>>>> chris > >>>>>>> > >>>>>>> Jan Vissers wrote: > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> Hi, > >>>>>>>> > >>>>>>>> Just to make sure I'm not missing something. > >>>>>>>> > >>>>>>>> In T4 when I wrote a @For construct I could use value="..." as long > >>>>>>>> as > >>>>>>>> > >>>>>>>> > >>>>> I > >>>>> > >>>>> > >>>>>>>> provided a setter|getter pair for the class involved - in this case > >>>>>>>> BreadcrumbBean. I want to iterate over a list of beans and use each > >>>>>>>> instance individually. Now T5 throws up on me with this nice coercion > >>>>>>>> message. Does this mean I need to contribute my own coercion - or is > >>>>>>>> there a more simple way? In my case BreadcrumbBean is a simple class > >>>>>>>> holding three String members. > >>>>>>>> > >>>>>>>> Thanks (again :-)) > >>>>>>>> -J. > >>>>>>>> > >>>>>>>> > >>>>>>>> --------------------------------------------------------------------- > >>>>>>>> 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] > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>> -- > >>>>> http://thegodcode.net > >>>>> > >>>>> > >>>>> > >>>>> > >>> --------------------------------------------------------------------- > >>> 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] > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]