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: StepBack.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine.testelements.continuations;
09:
10: import com.uwyn.rife.engine.Element;
11: import com.uwyn.rife.template.Template;
12:
13: public class StepBack extends Element {
14: private int mTotal = -5;
15:
16: private boolean mStart = false;
17:
18: public void setStart(boolean start) {
19: mStart = start;
20: }
21:
22: public void processElement() {
23: Template template = getHtmlTemplate("engine_continuation_stepback");
24:
25: if (mTotal < 0) {
26: mTotal++;
27: stepBack();
28: }
29:
30: template.setValue("stepback", duringStepBack());
31: print(template);
32: pause();
33:
34: if (mStart) {
35: template.setValue("subtotal", mTotal);
36: template.setValue("stepback", duringStepBack());
37: print(template);
38: pause();
39: mTotal += getParameterInt("answer", 0);
40:
41: if (mTotal < 50) {
42: stepBack();
43: }
44: }
45:
46: template.setValue("subtotal", "got a total of " + mTotal);
47: template.setValue("stepback", duringStepBack());
48: print(template);
49: }
50: }
|