0

I 'm trying to build my own simple breadcrumb component that pushes a PageRefence onto a List for each and every Link in the application.

Unfortunately, setResponsePage() is final (I use wicket 6).

The only other option that comes to my mind is to add a parameter to my base page constructor. But this would require me to change every link in the app..

Are there any other options?

bert
  • 7,566
  • 3
  • 31
  • 47
  • There are two problems with this approach: 1. your breadcrumb would never get shorter. 2. Breadcrumbs are links too :) – biziclop Jul 03 '12 at 15:20
  • @biziclop: good point. esp. the 2. remark. I would store the list of past pages in the pages, this would cope with multiple tabs and the growing of the list.. – bert Jul 03 '12 at 15:29

2 Answers2

3

Since you already have a base page, it's easier to override onBeforeRender() in your base page to update the breadcrumbs list that you'd store in your Session object.

Or am I missing something?

biziclop
  • 48,926
  • 12
  • 77
  • 104
  • I do not want the history in the session (because of multiple tabs/windows). I will post my solution as an answer. Thnaks for your help and effort. – bert Jul 04 '12 at 20:11
0

To answer my own question:

In the end I realized, that I do not want to have the breadcrumb updated on each new page.

Therefore I created an object that holds a List of Pagereferences. When I navigate to a new Page, I take the list of the current page, make a copy of it an add the current page. The resulting list is pased onto the new page.

All this is handeld in the base page.

Keeping it in the page, avoids problems with multiple tabs / windows.

Thanks for the help.

bert
  • 7,566
  • 3
  • 31
  • 47