All,
I've been contemplating the CompoundPropertyModel and viewing different angles on its premisses. I think there is room for yet another model (YAM (tm)).
What many people probably want is to be able to navigate using components over their datastructures:
Form f = new Form("foo", new CompoundPropertyModel(new Person()), null) {};
f.add(new TextField("name"));
f.add(new ListView("children") {
void populateItem(ListItem item) {
item.add(new TextField("name"));
item.add(new ListView("phonenumbers") {
void populateItem(ListITem item) {
item.add(new TextField("home"));
item.add(new TextField("office"));
item.add(new TextField("fax"));
item.add(new TextField("mobile"));
}
}
}This code will currently display a ClassCastException, because the second name field accessor tries to cast the Person to a List. What I am proposing is a new model implementation that 'navigates the datastructure using the component ID's'.
Basically this means that the models will become:
form -> CompoundPropertyModel(new Person());
1st listview -> new CompoundPropertyModel(new PropertyModel(parent.getModel(), "children"))
2nd listview -> new CompoundPropertyModel(new PropertyModel(parent.getModel(), "phonenumbers"))
or something similar. The list item models will still be a problem here, as they are currently constructed as non-compound property models.
What do you guys think? Will this fly, is there any interest in this Model?
Martijn
------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
