Hi,

I am trying to extend newNodeComponent on a LinkTree to make nodes
DownLoadLink.

tree = new LinkTree("tree", createTreeModel()){

private static final long serialVersionUID = 1L;

@Override
             protected Component newNodeComponent( String id, IModel model )
{
                     return new LinkIconPanel( id, model, this ) {

                        private static final long serialVersionUID = 1L;

@Override
                             protected Component newContentComponent( String
componentId, BaseTree tree, IModel model ) {
                                     Object obj = ( ( DefaultMutableTreeNode
)model.getObject() ).getUserObject();
                                     if( !obj.equals("1:subtree...,
2:subtree..., 3:subtree...") ) {
                                     LOGGER.debug("link");
                                     return new MyPanel(componentId);
                                     }

                                     return new Label( componentId,
model.getObject().toString() );
                             }

                     };
             }
 };
     form.add(tree);
     tree.getTreeState().collapseAll();



       public class MyPanel extends Form   {


         private static final long serialVersionUID = 1L;

         MyPanel(String id) {
         super(id);

         DownloadLink dl = new DownloadLink( id, new File(
"wat-application/images/addmore.jpg" ), "Example DownloadLink" );
         add(dl);
         }
 }


I copied the example from:
http://www.wicket-library.com/wicket-examples/ajax/tree/simple.0


But i get the following error:
WicketMessage: Component content must be applied to a tag of type 'form',
not '<span wicket:id="content" class="content" id="content21">' (line 0,
column 0)


<wicket:panel>
<table class="icon-panel"><tr><td wicket:id="iconLink"><img wicket:id="icon"
class="icon"/></td><td class="content"><a wicket:id="contentLink"><span
wicket:id="content" class="content"></span></a></td></tr></table>
</wicket:panel>, index = 8, current = '<span wicket:id="content"
class="content">' (line 19, column 144)]

Thanks

Reply via email to