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: Frames.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package tutorial.inheritance;
09:
10: import com.uwyn.rife.engine.Element;
11: import com.uwyn.rife.template.Template;
12:
13: /**
14: * This element ensures that all elements that inherit it are surrounded with
15: * frames and become visible as the content part of the frameset.
16: *
17: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
18: * @version $Revision: 3634 $
19: */
20: public class Frames extends Element {
21: /**
22: * The element's entry point.
23: */
24: public void processElement() {
25: // obtain the template that contains the main frameset
26: Template template = getHtmlTemplate("frames.main");
27:
28: // set the url in the frameset for the content frame
29: setExitQuery(template, "content", new String[] {
30: "show_content", "1" });
31:
32: // obtain the template of the target content element, extract the title
33: // from it and set it as the title of the main frameset
34: String template_name = getTarget().getPropertyString("name");
35: if (template_name != null) {
36: Template target_template = getHtmlTemplate(template_name);
37: template.setValue("title", target_template
38: .getBlock("title"));
39: }
40:
41: print(template);
42: }
43:
44: /**
45: * This method is called when the <code>show_content</code> child trigger
46: * variable is set. When it's presence is detected, the processing will
47: * simply be forwarded to the child element, otherwise this element's
48: * (this main frameset) content will be generated.
49: */
50: public boolean childTriggered(String name, String[] values) {
51: if (name.equals("show_content")) {
52: return true;
53: }
54:
55: return false;
56: }
57: }
|