KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > plaf > css > PasswordFieldCG


1 /*
2  * $Id: PasswordFieldCG.java,v 1.21 2005/05/26 13:18:10 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.plaf.css;
15
16
17 import java.io.IOException JavaDoc;
18
19 import org.wings.SComponent;
20 import org.wings.SPasswordField;
21 import org.wings.io.Device;
22
23 public class PasswordFieldCG extends AbstractComponentCG implements
24         org.wings.plaf.PasswordFieldCG {
25
26     public void writeContent(final Device device,
27                              final SComponent _c)
28             throws IOException JavaDoc {
29         final SPasswordField component = (SPasswordField) _c;
30
31         device.print("<input type=\"password\"");
32         Utils.writeEvents(device, component);
33         Utils.optAttribute(device, "size", component.getColumns());
34         Utils.optAttribute(device, "tabindex", component.getFocusTraversalIndex());
35         Utils.optAttribute(device, "maxlength", component.getMaxColumns());
36         Utils.optAttribute(device, "focus", component.getName());
37
38         Utils.printCSSInlineFullSize(device, component.getPreferredSize());
39
40         if (!component.isEditable() || !component.isEnabled()) {
41             device.print(" readonly=\"true\"");
42         }
43         if (component.isEnabled()) {
44             device.print(" name=\"");
45             Utils.write(device, Utils.event(component));
46             device.print("\"");
47         } else {
48             device.print(" disabled=\"true\"");
49         }
50
51         if (component.isFocusOwner())
52             Utils.optAttribute(device, "focus", component.getName());
53
54         Utils.writeEvents(device, component);
55
56         Utils.optAttribute(device, "value", component.getText());
57         device.print("/>");
58     }
59 }
60
Popular Tags