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]

Reply via email to