alternatively, instead of passing the new crumb to super, you can pass
around the entire trail, that way you can say

super(trail);
trail.add(new crumb(getstring("my.page.resource")));

-igor

On Sat, Sep 25, 2010 at 9:53 AM, Igor Vaynberg <[email protected]> wrote:
> you dont want to pass a crumb around that contains references to other
> pages anyways, i would put all the resources that crumbs need into the
> application-scoped properties file.
>
> -igor
>
> On Sat, Sep 25, 2010 at 9:35 AM, LutherBaker <[email protected]> wrote:
>>
>> Ah yes, a closure of sorts. Thanks, that was exactly what I was looking for.
>>
>>
>> Since I am passing this to 'super', one issue popped up. I'd like to use a
>> StringResourceModel (and leverage some parameter substitution) but
>> obviously, at page instantiation time, my current page doesn't exist and
>> consequently, can't be used as the StringResourceModel's Component
>> parameter.
>>
>>
>> AreaPage.java
>>        ...
>>        private static Crumb createCrumb(final Area area) {
>>                return new Crumb() {
>>
>>                        private static final long serialVersionUID = 1L;
>>
>>                        public WebPage createReponsePage() {
>>                                return new AreaPage(area);
>>                        }
>>
>>                        public IModel label() {
>>                                return new 
>> StringResourceModel("AreaPage.crumb.label",
>>                                                null,
>>                                                new Model(area));
>>                        }
>>                };
>>        }
>>
>>        public AreaPage(final Area area) {
>>                super(createCrumb(area));
>>
>>
>> Note the 'null' in the StringResourceModel ctor since I can't pass 'this'
>> before super(..) completes.
>>
>>
>> This works for me as long as "AreaPage.crumb.label" is in my global
>> properties but the docs discourage said practice so maybe there is another
>> tweak I can apply?
>>
>>
>> -Luther
>>
>>
>>
>>
>>
>> Igor Vaynberg-2 wrote:
>>>
>>> create a wrapper that can instantiate pages lazily
>>>
>>> interface Crumb { IModel getLabel(); Page gePage(); } put your lazy
>>> logic into getPage() impl.
>>>
>>> -igor
>>>
>>
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/dynamic-crumb-trail-tp2550978p2713647.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> 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