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