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: import com.javelin.swinglets.plaf.html.*;
14:
15: /**
16: * WMLPasswordFieldUI defines a look and feel for default WML.
17: *
18: * @author Robin Sharp
19: */
20:
21: public class WMLPasswordFieldUI extends WMLComponentUI {
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: SPasswordField passwordField = (SPasswordField) c;
30:
31: out.print("<input");
32:
33: if (passwordField.getName() != null) {
34: out.print(" name=\"");
35: out.print(passwordField.getName());
36: out.print("\"");
37: }
38:
39: out.print(" type=\"password\"");
40:
41: Object format = passwordField.getClientProperty("wml.format");
42: if (format != null) {
43: out.print(" format=\"");
44: out.print(format.toString());
45: out.print("\"");
46: }
47:
48: format = passwordField.getClientProperty("wml.emptyok");
49: if (format != null) {
50: out.print(" emptyok=\"true");
51: }
52:
53: if (passwordField.getSize() != null
54: && passwordField.getSize().width > 0) {
55: out.print(" size=\"");
56: out.print(passwordField.getSize().width);
57: out.print("\"");
58: }
59:
60: if (passwordField.getMaxLength() > 0) {
61: out.print(" maxlength=\"");
62: out.print(passwordField.getMaxLength());
63: out.print("\"");
64: }
65:
66: if (passwordField.getToolTipText() != null) {
67: out.print(" title=\"");
68: out.print(passwordField.getToolTipText());
69: out.print("\"");
70: }
71:
72: out.println("/>");
73: }
74: }
|