Hi,

the method you want to override is the following:

protected void onNodeLinkClicked(Object node, BaseTree tree, AjaxRequestTarget target)
    {
    }

Sven

On 05/18/2011 05:27 PM, hubert_hupe wrote:
Oh my goodness,

ok. there was an object that was null. error is gone.
BUT still no event is fired when i click on a node in the tree.

as a kind of template i tried to adapt the following for the tree:
add(new AjaxLink("expandAll") {
@Override
public void onClick(AjaxRequestTarget target) {
        tree.getTreeState().expandAll();
        tree.updateTree(target);
        System.out.println("Click");
        }
});

here is the current snippet:
        

add(new LinkTree("tree", createTreeModel()) {
protected void onNodeClicked(AjaxRequestTarget ajaxRequestTarget, TreeNode 
node) {
        System.out.println("Click");
        }
});

the problem is that the line with "system.out" is never reached when i click 
the tree node.
an @Override is not possible as in the AjaxLink onClik Method.

has anyone ever used  
org.apache.wicket.markup.html.tree.LinkTree.LinkTree(String id, TreeModel model)
i got the exampe from here: 
http://www.wicket-library.com/wicket-examples/ajax/tree/simple?0
but there is no sample to get the clicked node

cheers

Am 18.05.2011 um 15:28 schrieb Martijn Dashorst:

Take a look at line 217 of your SignIn class and see why it throws a NPE.

Martijn

On Wed, May 18, 2011 at 3:24 PM, hubert_hupe<hubert_h...@gmx.de>  wrote:
hi sven,

here it is. cheers hubert

WicketMessage: Can't instantiate page using constructor public 
com.reporting.SignIn(org.apache.wicket.PageParameters) and argument

Root cause:

java.lang.NullPointerException
     at com.reporting.SignIn.<init>(SignIn.java:217)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at 
org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
     at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
     at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
     at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
     at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
     at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
     at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
     at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
     at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
     at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
     at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
     at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
     at org.mortbay.jetty.Server.handle(Server.java:295)
     at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
     at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
     at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
     at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
     at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
     at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
     at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

Complete stack:

org.apache.wicket.WicketRuntimeException: Can't instantiate page using 
constructor public com.reporting.SignIn(org.apache.wicket.PageParameters) and 
argument
     at 
org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
     at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
     at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
     at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)

java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at 
org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
     at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
     at 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
     at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
     at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)


Am 18.05.2011 um 14:59 schrieb Sven Meier:

Hi,

error: WicketMessage: Can't instantiate page using constructor
public com.test.Test(org.apache.wicket.PageParameters) and argument
an exception stacktrace would give us a clue on what goes wrong here.

Sven

Am 18.05.2011 11:44, schrieb hubert_hupe:
hello,

after hours of researching and trying get a simple tree running iam completely 
frustrated.

i added a tree to the website in this way:

public class Test extends WebPage {

protected TreeModel createTreeModel() {
              List<Object>   l1 = new ArrayList<Object>();
              l1.add("test 1.1");
....
}

public Test(final PageParameters parameters) {
      tree = new LinkTree("tree", createTreeModel());
      add(tree);
}
markup:

         <div wicket:id="tree" class="my-tree">    </div>

now the problem: i am not able to fetch the selected node. iam not able to 
fetch the event...
i tried the following:

add(new LinkTree("tree") {
public void onClick(AjaxRequestTarget target) {
      System.out.println("Click");
      }
});
error: WicketMessage: Can't instantiate page using constructor public 
com.test.Test(org.apache.wicket.PageParameters) and argument

what works is: to get an event from a link:

add(new AjaxLink("expandAll") {
@Override
public void onClick(AjaxRequestTarget target) {
      tree.getTreeState().expandAll();
      tree.updateTree(target);
      System.out.println("Click");
      }
});

the same must be possible with the tree?!

any help is appreciated...

cheers hubert





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




--
Become a Wicket expert, learn from the best: http://wicketinaction.com

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




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

Reply via email to