01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.wikitext.widgets;
04:
05: import fitnesse.wikitext.Utils;
06: import fitnesse.wikitext.WikiWidget;
07:
08: public class TextWidget extends WikiWidget implements
09: WidgetWithTextArgument {
10: protected String text;
11:
12: public TextWidget(ParentWidget parent) {
13: super (parent);
14: }
15:
16: public TextWidget(ParentWidget parent, String text) {
17: super (parent);
18: this .text = text;
19: }
20:
21: public String getText() {
22: return text;
23: }
24:
25: public void setText(String newText) {
26: text = newText;
27: }
28:
29: public String render() throws Exception {
30: String html = getText();
31: if (parent.doEscaping())
32: html = Utils.escapeText(html);
33:
34: return html;
35: }
36:
37: public String toString() {
38: return super .toString() + " : " + getText();
39: }
40:
41: public String asWikiText() throws Exception {
42: return getText();
43: }
44: }
|