01: package org.wings.macro;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05:
06: import java.io.IOException;
07:
08: /**
09: * <code>CharacterStep<code>.
10: * <p/>
11: * User: rrd
12: * Date: 13.08.2007
13: * Time: 10:55:01
14: *
15: * @author rrd
16: * @version $Id
17: */
18: public class StringInstruction implements Instruction {
19:
20: private static final Log LOG = LogFactory
21: .getLog(StringInstruction.class);
22:
23: // Contains the characters which get printed to the device.
24: private String characters;
25:
26: /**
27: * Creates a new character step.
28: *
29: * @param characters The characters which will be print to the
30: * device when this step will be executed.
31: */
32: public StringInstruction(String characters) {
33: this .characters = characters;
34: }
35:
36: /**
37: * {@inheritDoc}
38: */
39: public void execute(MacroContext ctx) {
40: try {
41: ctx.getDevice().print(characters);
42: } catch (IOException e) {
43: LOG.error("Couldn't print characters to device.", e);
44: }
45: }
46: }
|