Hi Igor & all,
i implemented it the suggested way by using BookmarkablePageLink +
attribute modifier.
For this i havee sub classed the extension tree and have overwritten the
populateTreeItem as followed:
// ------------------------------------------------------------------------
@Override
protected void populateTreeItem(WebMarkupContainer item, int level)
{
if ((item.getModelObject() instanceof
DefaultMutableTreeNode) &&
((DefaultMutableTreeNode)
item.getModelObject()).getUserObject() instanceof IConfigurationPage){
populateMyTreeItem(item, level);
return;
} else
{
super.populateTreeItem(item, level);
return;
}
}
protected void populateMyTreeItem(WebMarkupContainer item, int level)
{
final DefaultMutableTreeNode mutableTreeNode =
(DefaultMutableTreeNode) item.getModelObject();
item.add(newIndentation(item, "indent", (TreeNode)
item.getModelObject(), level));
item.add(newJunctionLink(item, "link", "image",
mutableTreeNode));
MarkupContainer nodeLink = newCustomNodeLink(item,
"nodeLink", (IConfigurationPage) mutableTreeNode.getUserObject());
item.add(nodeLink);
nodeLink.add(newNodeIcon(nodeLink, "icon", mutableTreeNode));
nodeLink.add(new Label("label", new AbstractReadOnlyModel() {
private static final long serialVersionUID = 1L;
public Object getObject(Component c)
{
return renderNode(mutableTreeNode);
}
}));
item.add(new AttributeModifier("class", true, new
Model("row")));
}
protected MarkupContainer newCustomNodeLink(MarkupContainer parent,
String id,
IConfigurationPage page)
{
PageParameters param = new PageParameters();
param.put("configPage", page.getID());
BookmarkablePageLink pLink = new BookmarkablePageLink(id,
ConfigMainPage.class, param);
pLink.add(new AttributeModifier("target", true, new
Model("main")));
return pLink;
}
//------------------------------------------------------------------------
So in this case only the IConfigurationPage nodes will get a different
nodeLink -> newCustomNodeLink.
This works so far pretty good - the only problem is now when i click on
a custom link and afterwards on a plus or minus i receive the following
exception:
//-------------------------------------------------------------------------------------------------------------------------------------------------
WicketMessage: component border:configOutliner:i:1:nodeLink not found on
page de.ponton.box.core.ui.config.tree.ConfigTreePage[id = 18], listener
interface = [RequestListenerInterface name=ILinkListener, method=public
abstract void wicket.markup.html.link.ILinkListener.onLinkClicked()]
Root cause:
wicket.WicketRuntimeException: component
border:configOutliner:i:1:nodeLink not found on page
de.ponton.box.core.ui.config.tree.ConfigTreePage[id = 18], listener
interface = [RequestListenerInterface name=ILinkListener, method=public
abstract void wicket.markup.html.link.ILinkListener.onLinkClicked()]
at
wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:384)
at
wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:430)
at
wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:131)
at wicket.RequestCycle.step(RequestCycle.java:1037)
at wicket.RequestCycle.steps(RequestCycle.java:1138)
at wicket.RequestCycle.request(RequestCycle.java:474)
at wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:256)
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:281)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
//-------------------------------------------------------------------------------------------------------------------------------------------------
Do you know how i can avoid this?
Thanks in advance!
Regards,
Michel
Michel Wichers schrieb:
> Hi Igor,
>
> you're right - we really do not need any AJAX stuff here - i just used
> the extension tree and the ajax stuff is there out of the box (if not
> explicitely disabled).
>
> As you can see I'm still in a learning phase ;-)
>
> I will switch that tree to use regular links instead and use
> bookmarkable links + attribute modifier for target!
>
> Thanks for all your help guys, i really appreciate that!
>
> Cheers,
>
> Michel
>
> Zitat von Igor Vaynberg <[EMAIL PROTECTED]>:
>
>
>> but why use ajax if you are using frames?
>>
>> all you have to do is make those links bookmarkable and append a target
>> attribute to them via an attribute modifier
>>
>> -igor
>>
>>
>> On 3/20/07, Michel Wichers <[EMAIL PROTECTED]> wrote:
>>
>>> Hi guys,
>>>
>>> I'm currently developing a page with two frames. The left frame
>>> "SelectionFrame" contains an extensions Tree and the right frame "Main"
>>> contains any Contents.
>>>
>>> What i now want to do is to respond to the Contents Frame by clicking on
>>> some special tree nodes.
>>>
>>> e.g.:
>>> ...
>>> @Override
>>> protected void onNodeLinkClicked(AjaxRequestTarget target,
>>> TreeNode node)
>>> {
>>> IConfigurationPage userObj = (IConfigurationPage)
>>> ((DefaultMutableTreeNode) node).getUserObject();
>>> setResponsePage(new ConfigMainPage(userObj));
>>> }
>>> ...
>>>
>>> If you know any easy solution it would be great to share that with me.
>>> Any help would be appreciated.
>>>
>>>
>>> cheers!
>>>
>>> Michel
>>>
>>>
>>>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user