Re: Breadcrumbs and "raw" URLs

2009-05-07 Thread Wilhelmsen Tor Iver
> Is there a way to use urlFor() or the like to create links 
> that updates the breadcrumb model with our BreadCrumbPanel 
> subclass for the linked id, i.e. 
> IBreadCrumbModel.setActive(new ArticlePanel(...))?

*crickets*

Anyway, I finally found the likely answer in the form of an extended
PageRequestTarget.

However, it seems the call to urlFor() returns a link that does not
invoke the code as expected; it just re-renders the same page and panel
instead of invoking my object. Am I doing something wrong regarding the
urlFor call? Does the request target object need to be registered
somewhere?

// ...

CharSequence urlFor = RequestCycle.get().urlFor(new
ChangeArticleRequestTarget(getPage(), token.getLinkData()));


public static class ChangeArticleRequestTarget extends
PageRequestTarget {

private String articleId;

public ChangeArticleRequestTarget(Page page, String
articleId) {
super(page);
this.articleId = articleId;
}

@Override
public void respond(RequestCycle requestCycle) {
Page page = getPage();
BreadCrumbBar bar = (BreadCrumbBar)
page.get("breadCrumbBar");
try {
ArticlePanel newPanel = new
ArticlePanel("articlePanel", bar, new
Model(Integer.valueOf(articleId)));
page.replace(newPanel);
bar.setActive(newPanel);
page.dirty();
}
catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

super.respond(requestCycle);
}



}

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Breadcrumbs and "raw" URLs

2009-04-20 Thread Wilhelmsen Tor Iver
We have an issue where we are using a CMS that provides an API for
getting article components in a peculiar way: Links are sent over as a
raw HTML "element" followed by a "link element" followed by the rest of
the HTML. So a link like http://foo/fie";> is sent as 
1. HTML: http://foo/fie
3. HTML: ">

Now, some of these links are article ids that we want to turn into
wicket-extensions breadcrumb links in a BreadCrumbBar. Using the
BreadCrumbLink does not work since we don't actually have a HTML
template element to apply the Link to. 

Is there a way to use urlFor() or the like to create links that updates
the breadcrumb model with our BreadCrumbPanel subclass for the linked
id, i.e. IBreadCrumbModel.setActive(new ArticlePanel(...))?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no