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: StatefulExplicitProcessed.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine.testelements.embedding.embedded;
09:
10: import com.uwyn.rife.engine.Element;
11: import com.uwyn.rife.engine.annotations.Elem;
12: import com.uwyn.rife.engine.annotations.InputProperty;
13: import com.uwyn.rife.engine.annotations.OutputProperty;
14: import com.uwyn.rife.engine.annotations.SubmissionHandler;
15: import com.uwyn.rife.template.Template;
16:
17: @Elem(url="")
18: public class StatefulExplicitProcessed extends Element {
19: private boolean enabled = true;
20:
21: @InputProperty
22: public void setEnabled(boolean enabled) {
23: this .enabled = enabled;
24: }
25:
26: @OutputProperty
27: public boolean getEnabled() {
28: return enabled;
29: }
30:
31: @SubmissionHandler
32: public void doDisable() {
33: enabled = false;
34: processElement();
35: }
36:
37: public void processElement() {
38: Template t = getHtmlTemplate("engine_embedding_statefulexplicitprocessed");
39: Object embed_data = getEmbedData();
40: t.setValue("text", encodeHtml(String.valueOf(embed_data)));
41: if (!enabled) {
42: t.setBlock("content", "disabled");
43: }
44: print(t);
45: }
46: }
|