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;
04:
05: import fitnesse.wiki.WikiPage;
06: import fitnesse.wikitext.widgets.ParentWidget;
07:
08: public abstract class WikiWidget {
09: protected ParentWidget parent = null;
10:
11: protected WikiWidget(ParentWidget parent) {
12: this .parent = parent;
13: addToParent();
14: }
15:
16: protected void addToParent() {
17: if (this .parent != null)
18: this .parent.addChild(this );
19: }
20:
21: //TODO-DaC what's a better name for this?
22: public abstract String render() throws Exception;
23:
24: public void acceptVisitor(WidgetVisitor visitor) throws Exception {
25: visitor.visit(this );
26: }
27:
28: public WikiPage getWikiPage() {
29: return parent.getWikiPage();
30: }
31:
32: public String asWikiText() throws Exception {
33: return getClass().toString() + ".asWikiText()";
34: }
35: }
|