populateItem() not invoked on my custom list

2010-06-01 Thread Romain Pelisse
Hi,

I got a rather dumb issue. As I've been using Wicket only for 2 weeks,
I'm pretty sure that my issue is just a misuse more than a bug.
I implemented a Custom list by inheriting PropertyViewList. This
custom list is then placed into a Panel, which it is itself added to
the Page.

       // The panel constructor
       public MapResultsPanel(String id, MapString,
ListServiceTreeValue results) {
               super(id);
        // Construct the list of Entry
        ListMyEntry myEntries = new ArrayListMyEntry();
        for (EntryString, ListServiceTreeValue servicesEntry :
results.entrySet()) {
         myEntries.add(new
MyEntry(servicesEntry.getKey(),servicesEntry.getValue()));

        }
        // Here comes my custom list
        Entries e = new Entries(entryList, myEntries);
        // Adding entries to the panel
        add(e);
    }


class Entries extends PropertyListViewMyEntry {
        private static final long serialVersionUID = 1L;
        private final ListMyEntry entries;
        public Entries(String id, ListMyEntry entries) {
            super(id);
            this.entries = entries;
        }
       // This is not invoked at run time ...
       �...@override
        protected void populateItem(ListItemMyEntry item) {
            for (MyEntry entry : entries) {
                item.add(new Label(key, entry.id));
                // ...
            }
        }
    }


However, at run time, nothing is displayed on my page and if I debug
the populateItem() method on my custom list implementation is not
called. Somebody on IRC suspected that my model might be empty but how
comes ?

I posted this code on paste bin also : http://pastebin.com/vEVrmDM4
(in case you want to tweak it)

Thanks for any help you can gave me, because I have exhausted most of
my options here...

--
Romain PELISSE,
The trouble with having an open mind, of course, is that people will
insist on coming along and trying to put things in it -- Terry
Pratchett
http://belaran.eu/

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



Re: populateItem() not invoked on my custom list

2010-06-01 Thread Sven Meier
You're not passing the entries to the super implementation - how should 
the PropertListView know what objects to iterate over?


public Entries(String id, ListMyEntry entries) {

   super(id, entries);
}

protected  void  populateItem(ListItemMyEntry  item)  {
  MyEntry entry =  item.getModelObject();

  item.add(new  Label(key, entry.id));
  item.add(new  ServiceTreeValuesList(serviceTreeList, entry.services));
}

Sven



On 06/01/2010 03:41 PM, Romain Pelisse wrote:

Hi,

I got a rather dumb issue. As I've been using Wicket only for 2 weeks,
I'm pretty sure that my issue is just a misuse more than a bug.
I implemented a Custom list by inheriting PropertyViewList. This
custom list is then placed into a Panel, which it is itself added to
the Page.

// The panel constructor
public MapResultsPanel(String id, MapString,
ListServiceTreeValue  results) {
super(id);
 // Construct the list of Entry
 ListMyEntry  myEntries = new ArrayListMyEntry();
 for (EntryString, ListServiceTreeValue  servicesEntry :
results.entrySet()) {
  myEntries.add(new
MyEntry(servicesEntry.getKey(),servicesEntry.getValue()));

 }
 // Here comes my custom list
 Entries e = new Entries(entryList, myEntries);
 // Adding entries to the panel
 add(e);
 }


class Entries extends PropertyListViewMyEntry  {
 private static final long serialVersionUID = 1L;
 private final ListMyEntry  entries;
 public Entries(String id, ListMyEntry  entries) {
 super(id);
 this.entries = entries;
 }
// This is not invoked at run time ...
 @Override
 protected void populateItem(ListItemMyEntry  item) {
 for (MyEntry entry : entries) {
 item.add(new Label(key, entry.id));
 // ...
 }
 }
 }


However, at run time, nothing is displayed on my page and if I debug
the populateItem() method on my custom list implementation is not
called. Somebody on IRC suspected that my model might be empty but how
comes ?

I posted this code on paste bin also : http://pastebin.com/vEVrmDM4
(in case you want to tweak it)

Thanks for any help you can gave me, because I have exhausted most of
my options here...

--
Romain PELISSE,
The trouble with having an open mind, of course, is that people will
insist on coming along and trying to put things in it -- Terry
Pratchett
http://belaran.eu/

-
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