Here is the same pseudo code, but now laid out for better readability.
I appreciate any background before I file this as a bug.

-- The data classes
class Course {...}
class Person { List addresses; ...getter/setters.. }
class Address { String street; String city; ...getter/setters... }

-- The components
class MyPage extends Page {
   public MyPage(...) {
       ...
       // setting a *Course* as model object
       setModel(new CompoundPropertyModel(new Course(...)));    
       add(new MyPanel(...));
   }
}
class MyPanel extends Panel {
    public MyPanel(...) {
        // setting a *Person* as model object
        setModel(new CompoundPropertyModel(new Person()));

        add(new ListView("addresses")) {
            protected void populateItem(ListItem item) {
                // assertion succeeds, model object is an *Address*
                assert item.getModelObject() instanceof Address;
                // *WicketException* during rendering phase
                item.add(new Label("street"));
            }
        }
    }
}

--The problem.
The assert in the method populateItem holds. However, the label will try
to get the "street" property from a _Course_ instance. I expected it to
get the property from the _Address_ instance that was also seen in the 
assert.

--A possible cause.
If you debug the method onComponentTagBody() in Label(), you eventually
see that the parent of the Label is a ListItem, but the parent of the
ListItem is MyPage! I expected the parents to be a ListView, and then a
MyPanel and only then a MyPage.

I am missing something or is this a bug?

Regards,
     Erik.

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to