01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.html;
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: * HTMLCharacterUI defines a look and feel for default HTML.
17: * <p>
18: * This class displays special characters.
19: *
20: * @author Robin Sharp
21: */
22:
23: public class HTMLCharacterUI extends HTMLComponentUI 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: * @see com.javelin.swinglets.plaf.wml.SCharacterUI
39: */
40: public String getSpecialText(int character) {
41: return characters[character];
42: }
43:
44: /**
45: * Get the text as special text.
46: */
47: public static String getSpecialCharacter(int character) {
48: return characters[character];
49: }
50:
51: //SPACE = 0; PARAGRAPH = 1; BREAK = 2; QUOTE = 3;
52: //AMPERSAND = 4; APOSTROPHE = 5; GREATER_THAN = 6; LESS_THAN = 7;
53: protected static String[] characters = new String[] { " ",
54: "<P>", "<BR>", "\"", "&", "'", ">", "<" };
55:
56: }
|