Hi Federico,
you gain a lot of flexibility when overriding newNodeComponent()
instead. There, you return a custom Panel where you can do what you
want, i.e., add the link with all desired functionality. And you can
of course give your Panel any constructor you like.
An example from our project:
protected Component newNodeComponent(String id, IModel model) {
return new SenseLinkPanel(id, SensesTabPanel.this,
(DefaultMutableTreeNode)
model.getObject())
.setOutputMarkupId(true);
}
SenseLinkPanel is basically an AjaxLink with the right onClick()
functionality. You see that via the constructor it gets the TreeNode
it represents, and the Panel the tree is in to update it via AJAX.
Cheers,
Thomas
On Thu, Apr 24, 2008 at 12:38 PM, Federico Fanton <[EMAIL PROTECTED]> wrote:
> Hi all!
> First of all, I'd like to celebrate the achieved complete elimination of JSF
> from our project here, thanks to Wicket :)
>
> Next, I'm facing a little problem..
> I have a LinkTree and I'd like to make it ask for confirmation (via a JS
> alert) whenever the user clicks on a leaf.. If the user confirms, a component
> of the page should be AJAX-refreshed, otherwise nothing happens.
> The AJAX part works right now, I need to add the "confirmation" bit.. I
> thought I'd override BaseTree.newLink and decorate the AJAX call, but from
> that method I can't tell if the link will be related to a leaf or a folder..
> Am I going the wrong way? Maybe newLink(id, callback) could be expanded to
> something like newLink(id, callback, model)?
>
> Many thanks for your attention!
>
>
> ---------------------------------------------------------------------
> 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]