Hi,

Need some advice. In T4 I had a breadcrumb component that got its
information from a breadcrumb model structure. Each page that needed to go
onto the crumb path would implement some base page class. This page class
implemented PageRenderListener and IExternalPage. The former to add info
to the model and the latter to remove info from the model (btw the
breadcrumb model was an ASO).

Basically the model consisted of some key, name/title and (constructed)
link tuple. The link basically pointed to an IExternalPage implemented
page class - so to be precise the whole breadcrumb path consisted of
bookmarkable pages.

I'm trying to mimic this behavior with T5, using the BeginRender
annotation on a basepage class method called initPage() and also on the
basepage class a onActivate() method. I have some questions about it.
Below the specific base page code:

    protected String getBreadCrumbTitle() {
        return resources.getMessages().get("title-" +
           resources.getPageName().toLowerCase());
    }

    protected Object[] getLinkParameters() {
        return null;
    }

    @BeginRender
    public void initPage() {
        String pageName = resources.getPageName();
        Link link = resources.createPageLink(resources.getPageName(),
              true, getLinkParameters());
        breadCrumbHolder.checkBreadCrumbForAdd(pageName,
              getBreadCrumbTitle(), link.toRedirectURI());
    }

    public void onActivate() {
        String pageName = resources.getPageName();
        breadCrumbHolder.checkBreadCrumbForRemove(pageName);
    }

Q1: the initPage() method is there to create a 'bookmarkable' link -
amongst others - and store that information in the breadcrumb model. The
getLinkParameters() is there for a subclass to provide its specific
activation parameters to be used. Should I use another way to create
bookmarable links?

Q2: the onActivate() method is there to remove one (or more) crumbs from
the crumbpath. Since other pages will also need activation - potentially
with additional arguments - is this onActivate() the best way/place to
manipulate the model? I'm getting the idea that onActivate() is not the
designated alternative for T4's activateExternalPage(Object[] parameters,
IRequestCycle cycle) in IExternalPage interface.

Currently all of this works - although haven't tested activation with
activation context parameters yet.

Thx.
-J.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to