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.awt.event.*;
09: import java.util.*;
10: import java.io.*;
11:
12: import javax.swing.*;
13:
14: import com.javelin.swinglets.*;
15: import com.javelin.swinglets.plaf.*;
16:
17: /**
18: * HTMLListUI defines a look and feel for default HTML.
19: *
20: * @author Robin Sharp
21: */
22:
23: public class HTMLListUI extends HTMLComponentUI {
24: /**
25: * Render the UI on the PrintWriter
26: */
27: public void update(PrintWriter out, SComponent c) {
28: if (!c.isVisible())
29: return;
30:
31: SList list = (SList) c;
32:
33: out.print("<SELECT SIZE=\"");
34: out.print(list.getVisibleRowCount());
35: out.print("\"");
36:
37: if (c.isEnabled()) {
38: HTMLUtility.setName(out, list);
39: }
40:
41: if (!c.isEnabled()) {
42: out.print(" DISABLED");
43: }
44:
45: HTMLUtility.setMouseOverStatusText(out, c.getToolTipText());
46:
47: updateEvent(out, c);
48:
49: if (list.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) {
50: out.println(" MULTIPLE >");
51: } else {
52: out.println(" >");
53: }
54:
55: for (int index = 0; index < list.getElementCount(); index++) {
56: out.print("<OPTION VALUE=\"");
57: out.print(index);
58: out.print("\"");
59:
60: if (list.isSelectedIndex(index)) {
61: out.println(" SELECTED >");
62: } else {
63: out.println(">");
64: }
65:
66: out.println(list.getElementAt(index).toString());
67: }
68:
69: out.println("</SELECT>");
70:
71: }
72:
73: }
|