Hi,

I'm pasting the current code here.

The Nested.html markup:

<html xmlns:wicket>
<wicket:panel>
 <ul>
   <span wicket:id="rows">
     <li wicket:id="row">
       <a wicket:id="myLink">
         <span wicket:id="label">the label</span>
       </a>
     </li>
     <span wicket:id="nested"/>
   </span>
 </ul>
</wicket:panel>
</html>
I've modified the populatItem(..) to the following:

protected void populateItem(ListItem listItem)
       {
           Object modelObject = listItem.getModelObject();
           WebMarkupContainer row = new WebMarkupContainer("row");


           if(modelObject instanceof List)
           {
               // create a panel that renders the sub lis
NestedList nested = new NestedList("nested", (List)modelObject);
               listItem.add(nested);
// if the current element is a list, we create a dummy row/ label element // as we have to confirm to our HTML definition, and set it's visibility // property to false as we do not want LI tags to be rendered.
               //WebMarkupContainer row = new WebMarkupContainer("row");
               row.setVisible(false);
               row.add(new WebMarkupContainer("label"));

               listItem.add(row);
           }
           else
           {
// if the current element is not a list, we create a dummy panel element // to confirm to our HTML definition, and set this panel's visibility
               // property to false to avoid having the UL tag rendered
               NestedList nested = new NestedList("nested", null);
               nested.setVisible(false);
               listItem.add(nested);

ExternalLink el = new ExternalLink("myLink", "http://www.google.com";);
               el.add(new Label("label", modelObject.toString()));
               row.add(el);
               listItem.add(row);
           }

       }

But I get the error:

wicket.markup.MarkupException: Unable to find component with id 'myLink' in [MarkupContainer [Component id = row, page ...

Any ideas as to what I might be doing wrong?

----- Original Message ----- From: "Eelco Hillenius" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 27, 2005 19:22
Subject: Re: [Wicket-user] NestedLint example



I modified NestedList.html by adding:
 <a wicked:id="myLink">
   <li wicket:id="row"
        <span wicket:id="label">the label</span>
    </li>
</a>
in the <span wicket:id="rows">...</span>
And referenced the "myLink" component in NestedList.java in the void pupulateItem(...) by adding: add(new ExternalLink("myLink", "http://www.google.com";, "Click this link to go to Google"));


in populateItem you have to add components to the List item argument:

item.add(new ExternalLink("myLink", "http://www.google.com";, "Click this link to go to Google"));

Furthermore, in the example you give above, the first <li is not closed, so:

<li wicket:id="row"

should be:

<li wicket:id="row">

could that be what is wrong?

Eelco


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user






-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to