01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Display.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package tutorial.friends;
09:
10: import com.uwyn.rife.database.DbBeanFetcher;
11: import com.uwyn.rife.engine.Element;
12: import com.uwyn.rife.template.Template;
13: import tutorial.friends.backend.Friend;
14: import tutorial.friends.backend.FriendManager;
15:
16: /**
17: * Display the list of friends with their sites.
18: *
19: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
20: * @version $Revision: 3634 $
21: */
22: public class Display extends Element {
23: /**
24: * The element's entry point.
25: */
26: public void processElement() {
27: final Template template = getHtmlTemplate("display");
28:
29: FriendManager manager = new FriendManager();
30: manager.display(new DbBeanFetcher<Friend>(manager
31: .getDatasource(), Friend.class) {
32: public boolean gotBeanInstance(Friend friend) {
33: template.setBean(friend);
34: template.appendBlock("rows", "row");
35: return true;
36: }
37: });
38:
39: print(template);
40: }
41: }
|