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:
14: /**
15: * HTMLCheckBoxUI defines a look and feel for default HTML.
16: *
17: * @author Robin Sharp
18: */
19:
20: public class HTMLCheckBoxUI extends HTMLComponentUI {
21: /**
22: * Render the UI on the PrintWriter
23: */
24: public void update(PrintWriter out, SComponent c) {
25: if (!c.isVisible())
26: return;
27:
28: SCheckBox check = (SCheckBox) c;
29:
30: if (check.getTextAlignment() == SConstants.LEFT) {
31: HTMLUtility.updateText(out, check.getText(), check
32: .getFont(), check.getForeground(), check
33: .getHorizontalAlignment());
34: }
35:
36: out.print("<INPUT TYPE=\"checkbox\"");
37:
38: if (c.isEnabled()) {
39: HTMLUtility.setName(out, check);
40: }
41:
42: HTMLUtility.setTabIndex(out, c);
43:
44: out.print(" VALUE=\"true\" ");
45:
46: if (!c.isEnabled()) {
47: out.print(" DISABLED");
48: }
49:
50: HTMLUtility.setMouseOverStatusText(out, c.getToolTipText());
51:
52: updateEvent(out, c);
53:
54: if (check.isSelected()) {
55: out.print(" CHECKED >");
56: } else {
57: out.print(" >");
58: }
59:
60: if (check.getTextAlignment() == SConstants.RIGHT) {
61: HTMLUtility.updateText(out, check.getText(), check
62: .getFont(), check.getForeground(), check
63: .getHorizontalAlignment());
64: }
65: }
66: }
|