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:
14: /**
15: * WMLLabelUI defines a look and feel for default WML.
16: *
17: * @author Robin Sharp
18: */
19:
20: public class WMLLabelUI extends WMLComponentUI {
21: /**
22: * Render the UI on the PrintWriter. The default font size is 10.
23: * Anything bigger means 'big', anyhing less is 'small'.
24: */
25: public void update(PrintWriter out, SComponent c) {
26: if (!c.isVisible())
27: return;
28:
29: SLabel label = (SLabel) c;
30:
31: if (label.getFont() != null) {
32: if (label.getFont().isBold())
33: out.print("<b>");
34: if (label.getFont().isItalic())
35: out.print("<i>");
36: if (label.getFont().getSize() < 10
37: || label.getFont().isSmall())
38: out.print("<small>");
39: if (label.getFont().getSize() > 10
40: || label.getFont().isBig())
41: out.print("<big>");
42: }
43:
44: if (label.getLink() != null) {
45: out.print("<a href=\"");
46: out.print(label.getLink().getUrl());
47: out.print("\">");
48:
49: /*
50: out.print( "<anchor>" );
51: out.print( "<go method=\"post\" " );
52: out.print( "href=\"" );
53: out.print( label.getLink().getUrl() );
54: out.print( "\">" );
55: */
56: }
57:
58: //TEXT
59: out.print(label.getText());
60:
61: if (label.getLink() != null) {
62: out.println("</a>");
63: //out.println( "</go>" );
64: //out.println( "</anchor>" );
65: }
66:
67: if (label.getFont() != null) {
68: if (label.getFont().getSize() > 10
69: || label.getFont().isBig())
70: out.print("</big>");
71: if (label.getFont().getSize() < 10
72: || label.getFont().isSmall())
73: out.print("</small>");
74: if (label.getFont().isBold())
75: out.print("</b>");
76: if (label.getFont().isItalic())
77: out.print("</i>");
78: }
79:
80: }
81: }
|