01: package dinamica.security;
02:
03: import dinamica.*;
04:
05: /**
06: * Class description.
07: * <br><br>
08: * (c) 2004 Martin Cordova<br>
09: * This code is released under the LGPL license<br>
10: * Dinamica Framework - http://www.martincordova.com
11: * @author Martin Cordova (dinamica@martincordova.com)
12: * */
13: public class MenuOutput extends GenericOutput {
14:
15: /* (non-Javadoc)
16: * @see dinamica.GenericOutput#print(dinamica.TemplateEngine, dinamica.GenericTransaction)
17: */
18: public void print(TemplateEngine te, GenericTransaction data)
19: throws Throwable {
20:
21: //reuse superclass code
22: super .print(te, data);
23:
24: //retrieve main recordset (menu titles)
25: Recordset menu = data.getRecordset("menu");
26:
27: //load repeatable subtemplate
28: String section = getResource("section.txt");
29:
30: //buffer
31: StringBuffer buf = new StringBuffer();
32:
33: while (menu.next()) {
34:
35: //getmenu items
36: GetMenu m = (GetMenu) data;
37: Recordset items = m.getMenuItems(menu);
38:
39: //build subpage
40: TemplateEngine t = new TemplateEngine(getContext(),
41: getRequest(), section);
42: t.replace(menu, "");
43: t.replace(items, "", "rows");
44:
45: //append subpage section
46: buf.append(t.toString());
47:
48: }
49:
50: //replace into main template
51: te.replace("${menu}", buf.toString());
52:
53: }
54:
55: }
|