Thanks Igor. This really helped, and along the way I realized I missed a
few fundamentals. One more question below:
d) Now I am iterating using ListView. How exactly do I initialize the
> ListView so that it uses the "installed" detachable model?
what do you mean? you just pass it into the constructor.
Ok I get it. Also, when you do "getModel()" Wicket will search upwards the
component hierarchy right? So it does not matter even if you are on a child
panel within the page or something, yes?
e) While rendering each row of the ListView, how do I initialize Labels so
> that they in turn get the right chunk of the detachable model?
just what you did above - new PropertyModel(item.,getModel(), "name");
or if you use PropertyListView just add(new Label("name")) :)
Yep. Honestly was not aware of PropertyListView and will look into that as
well.
f) And suppose I have a Label that has to be derived by say some string
> concatenation or formula and OGNL notation will not work. Will new
> Label("foo", fooModel.getFoo() + "bar")kind of hardcoding conflict in
> some subtle way with the concept of detachable models?
write a simple model
private static class foomodel extends abstractreadonlymodel {
private final imodel wrapped;
public foomodel(imodel wrapped) { this.wrapped=wrapped; }
public object getobject() { return wrapped.getobject()+"bar"; }
public void detach() { wrapped.detach(); // important }
}
you do this a lot, so it is very helpful to create a superclass of the
above that helps with setting and detaching. i leave that as an excercise to
you.
Thanks, will try that out!
- Peter.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user