01: package wingset;
02:
03: import org.wings.SComponent;
04: import org.wings.SDimension;
05: import org.wings.SLabel;
06: import org.wings.SPanel;
07: import org.wings.SRawTextComponent;
08: import org.wings.STemplateLayout;
09:
10: public class RawTextComponentTest extends WingSetPane {
11: protected SComponent createControls() {
12: return null;
13: }
14:
15: protected SComponent createExample() {
16: final SPanel examplePanel = new SPanel();
17: examplePanel.setPreferredSize(SDimension.FULLWIDTH);
18: try {
19: java.net.URL templateURL = getSession().getServletContext()
20: .getResource(
21: "/templates/RawTextComponentExample.thtml");
22: if (templateURL == null) {
23: examplePanel
24: .add(new SLabel(
25: "Sorry, can't find RawTextComponentExample.thtml. Are you using a JAR-File?"));
26: return examplePanel;
27: }
28: // you can of course directly give files here.
29: STemplateLayout layout = new STemplateLayout(templateURL);
30: examplePanel.setLayout(layout);
31: } catch (java.io.IOException except) {
32: except.printStackTrace();
33: }
34:
35: examplePanel
36: .add(
37: new SRawTextComponent(
38: "This is a raw text. It does not break and has no div's wrapping it."),
39: "contentText");
40: examplePanel
41: .add(
42: new SRawTextComponent(
43: "<a href=\"javascript:alert('Simple but useful...');\">"
44: + "This link was made with a RawTextComponent.</a>"),
45: "linkText");
46:
47: return examplePanel;
48:
49: }
50:
51: }
|