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: // Copyright (C) 2003,2004 by Robert C. Martin and Micah D. Martin. All rights reserved.
04: // Released under the terms of the GNU General Public License version 2 or later.
05: package fitnesse.wikitext.widgets;
06:
07: import fitnesse.wikitext.WikiWidget;
08:
09: public class EmailWidget extends WikiWidget {
10:
11: public static final String REGEXP = "[\\w-_.]+@[\\w-_.]+\\.[\\w-_.]+";
12:
13: private String emailAddress;
14:
15: public EmailWidget(ParentWidget parent, String text) {
16: super (parent);
17: emailAddress = text;
18: }
19:
20: public String render() throws Exception {
21: StringBuffer html = new StringBuffer("<a href=\"mailto:");
22: html.append(emailAddress);
23: html.append("\">");
24: html.append(emailAddress);
25: html.append("</a>");
26:
27: return html.toString();
28: }
29:
30: public String asWikiText() {
31: return emailAddress;
32: }
33: }
|