01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.wml;
06:
07: import java.awt.*;
08: import java.util.*;
09: import java.io.*;
10:
11: import com.javelin.swinglets.*;
12: import com.javelin.swinglets.plaf.*;
13: import com.javelin.swinglets.plaf.html.*;
14:
15: /**
16: * WMLCharacterUI defines a look and feel for default WML.
17: * <p>
18: * This class displays special characters.
19: *
20: * @author Robin Sharp
21: */
22:
23: public class WMLCharacterUI extends WMLComponentUI implements
24: SCharacterUI {
25: /**
26: * Render the UI on the PrintWriter
27: */
28: public void update(PrintWriter out, SComponent c) {
29: if (!c.isVisible())
30: return;
31:
32: SCharacter character = (SCharacter) c;
33:
34: out.print(characters[character.getCharacter()]);
35:
36: }
37:
38: /**
39: * @see com.javelin.swinglets.plaf.wml.SCharacterUI
40: */
41: public String getSpecialText(int character) {
42: return characters[character];
43: }
44:
45: /**
46: * Get the text as special text.
47: */
48: public static String getSpecialCharacter(int character) {
49: return characters[character];
50: }
51:
52: //SPACE = 0; PARAGRAPH = 1; BREAK = 2; QUOTE = 3;
53: //AMPERSAND = 4; APOSTROPHE = 5; GREATER_THAN = 6; LESS_THAN = 7;
54:
55: protected static String[] characters = new String[] { " ",
56: "<p>", "<br/>", """, "&#38;", "'", ">",
57: "&#60;" };
58:
59: }
|