You might want to try putting the link to a panel and returning panel
from newContentComponent();

-Matej

On Fri, Aug 29, 2008 at 3:38 PM, leroudav <[EMAIL PROTECTED]> wrote:
>
> Hi everyone!
> First of all, thanks for helping 2 french wicket padawan developers :-)
>
> We tried to make a Tree for our wicket application, but we encountered a
> problem.
> The tree is created, with simple file names, but we can't redirect the click
> to the download link, and that's a big problem. We saw that if we try to add
> an ExternalLink to the Tree, it works (see comments in code).
>
> This is the source (simplified for the post):
>
> LinkTree tree = new LinkTree( "tree", new DefaultTreeModel( root ) ) {
>
>                        @Override
>                        protected Component newNodeComponent( String id, 
> IModel model ) {
>                                return new LinkIconPanel( id, model, this ) {
>                                        @Override
>                                        protected Component 
> newContentComponent( String componentId, BaseTree
> tree, IModel model ) {
>                                                Object obj = ( ( 
> DefaultMutableTreeNode )model.getObject()
> ).getUserObject();
>                                                if( obj instanceof 
> AbstractLink ) {
>                                                        // return new 
> ExternalLink( componentId, "http://www.google.fr";,
> "Example ExternalLink" );
>                                                        DownloadLink dl = new 
> DownloadLink( componentId, new File(
> "toto-example.png" ), "Example DownloadLink" );
>                                                        return dl;
>                                                }
>                                                return new Label( componentId, 
> model.getObject().toString() );
>                                        }
>                                };
>                        }
>                };
>
> As you can see, we override the method newNodeComponent(.,.) for allowing
> overriding the method newContentComponent(.,.,.). The problem is that we
> can't see the name of the file nor the DownloadLink, even if we can redirect
> a click on an ExternalLink given to the LinkTree.
>
> We hope our explanations were clear, and will permit you helping us.
> --
> View this message in context: 
> http://www.nabble.com/Can%27t-include-DownloadLink-in-LinkTree-tp19220120p19220120.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to