Really appreciate the feedback! Although the approach I currently use
works, yours looks far cleaner and better. I'll have a go at it tomorrow
and let you know how this works out.

Again - really appreciate it.

-J.

>> One 'event' is when the application flows from one page to another.
> ...
>> The other event is when a user clicks on one of the individual crumbs on
>> the breadcrumb path,
>
> Ah... I think I understand. I'm pretty sure then that the events you
> are using don't work they way you think. Have you put tracing debug
> calls into your pages to watch the control flow? That's one of the
> best ways to understand the anatomy of a request.
>
> The activate event is triggered when either an action or render
> request is made to your page. When a render request is made then the
> beginRender event is triggered. When you are navigating between pages
> I assume you are just using render requests (pagelinks). So, whether
> you are changing pages between requests or not, by clicking on a
> breadcrumb or typing the url into the browser, you are still going to
> get both events triggered for the page being rendered. Since you are
> always getting both events triggered, you should be able to combine
> them into a single event.
>
> I imagine your process something like this:
>
> @Persist
> @Property
> private LinkedList<Breadcrumb> _breadcrumbs;
>
> // I prefer this to beginRender since technically you are in setup
> mode and not actually rendering anything
> protected void setupRender() {
>   // new sessions will have null breadcrumbs
>   if ( _breadcrumbs == null ) _breadcrumbs = new LinkedList<Breadcrumb>();
>
>   Breadcrumb myBreadcrumb = new Breadcrumb();
>   myBreadcrumb.setTitle(getContext());
>   myBreadcrumb.setLink(_resources.createPageLink("start", false,
> getContext()));
>
>   int index = _breadcrumbs.indexOf(myBreadcrumb);
>   if (index != -1) {  // we're in the list already, so axe everything
> after us
>     _breadcrumbs.subList(index+1, _breadcrumbs.size()).clear();
>   } else { // we're not in the list, so add us (probably want some
> logic to keep the list from getting too long)
>     _breadcrumbs.add(myBreadcrumb);
>   }
> }
>
>
> Hope that helps,
> Josh
>
> On Thu, Apr 24, 2008 at 12:07 AM, Jan Vissers <[EMAIL PROTECTED]>
> wrote:
>> Well, let's see.
>>
>> I use two different handlers because I think there are two different
>> events that manipulate the breadcrumb path.
>>
>> One 'event' is when the application flows from one page to another. This
>> other page must have the opportunity to create its 'crumb' information
>> and
>> have it stored in the breadcrumb model.
>>
>> The other event is when a user clicks on one of the individual crumbs on
>> the breadcrumb path, visualized on the screen. As a result the page
>> should
>> be displayed (possibly with context) that was visualized by the crumb,
>> and
>> at the same time the breadcrumb model should be updated to reflect the
>> new
>> trail. Meaning; all crumbs that follow the click crumb should be removed
>> from the model.
>>
>> To me it makes senses to split this up, and to be honest I don't see a
>> way
>> to centralize them into one handler. But if you could tell me how - I
>> would be more than willing to think about it.
>>
>> -J.
>>
>>
>> >> I'm not sure if I understand...
>> >> Do you mean to say that manipulating the breadcrumb path (adding or
>> >> removing crumbs) should/could all go into one event handler?
>> >
>> > Sure, couldn't they? I'm not sure why they are split up into the two
>> > different event handlers. Except in the case of action links and form
>> > submission both the onAction and beginRender events are going to fire
>> > in a request. You haven't mentioned a need to do anything different
>> > with the information between when the two events fire, so why not
>> > handle it in one place?
>> >
>> > Or am I missing something?
>> >
>> > On Wed, Apr 23, 2008 at 2:27 PM, Jan Vissers <[EMAIL PROTECTED]>
>> > wrote:
>> >> Hi,
>> >>
>> >> I'm not sure if I understand...
>> >> Do you mean to say that manipulating the breadcrumb path (adding or
>> >> removing crumbs) should/could all go into one event handler?
>> >>
>> >> -J.
>> >>
>> >>
>> >> > Ah, by workflow I meant to ask when you expected the events to get
>> >> > fired, which you answered for the onactivate handler.
>> >> >
>> >> > So, why not do this all in one event handler, perhaps setupRender?
>> >> >
>> >> >
>> >> >
>> >> > On Wed, Apr 23, 2008 at 11:44 AM, Jan Vissers
>> <[EMAIL PROTECTED]>
>> >> > wrote:
>> >> >> > I used T4 for a short period a long time ago, so I'm not
>> >> understanding
>> >> >> > the parallels that you are making. Can you describe the workflow
>> >> that
>> >> >> > you are shooting for? I'm not clear why you'd remove the
>> breadcrumb
>> >> in
>> >> >> > the activate event and the add it again the beginrender event.
>> >> >>
>> >> >> beginRender will
>> >> >>  : create a bookmarkable link
>> >> >>  : store (if necessary) in the model of breadcrumbs.
>> >> >>
>> >> >> onActivate gets called whenever a breadcrumb - rendered as link is
>> >> >> clicked
>> >> >> and will
>> >> >>  : remove a crumbs that are listed after the clicked link,
>> cleaning
>> >> up
>> >> >>    the trail
>> >> >>
>> >> >> I think the workflow is okay - as it is proven in T4. I'm just
>> >> looking
>> >> >> for
>> >> >> the correct points to hook it into T5.
>> >> >>
>> >> >> Thx,
>> >> >> -J.
>> >> >>
>> >> >>
>> >> >> >
>> >> >> >
>> >> >> > Josh
>> >> >> >
>> >> >> > On Wed, Apr 23, 2008 at 8:19 AM, Jan Vissers
>> >> <[EMAIL PROTECTED]>
>> >> >> > wrote:
>> >> >> >> 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]
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > --
>> >> >> > TheDailyTube.com. Sign up and get the best new videos on the
>> >> internet
>> >> >> > delivered fresh to your inbox.
>> >> >> >
>> >> >> > ---------------------------------------------------------------------
>> >> >> > 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]
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > --
>> >> > TheDailyTube.com. Sign up and get the best new videos on the
>> internet
>> >> > delivered fresh to your inbox.
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > 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]
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > --
>> > TheDailyTube.com. Sign up and get the best new videos on the internet
>> > delivered fresh to your inbox.
>> >
>> > ---------------------------------------------------------------------
>> > 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]
>>
>>
>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> 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