KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TextAreaCG.java,v 1.20 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.STextArea;
21 import org.wings.io.Device;
22
23 public class TextAreaCG extends AbstractComponentCG implements
24         org.wings.plaf.TextAreaCG {
25
26     public void writeContent(final Device device,
27                              final SComponent _c)
28             throws IOException JavaDoc {
29         final STextArea component = (STextArea) _c;
30
31         device.print("<textarea");
32         Utils.optAttribute(device, "tabindex", component.getFocusTraversalIndex());
33         Utils.optAttribute(device, "cols", component.getColumns());
34         Utils.optAttribute(device, "rows", component.getRows());
35
36         switch (component.getLineWrap()) {
37             case STextArea.VIRTUAL_WRAP:
38                 device.print(" wrap=\"virtual\"");
39                 break;
40             case STextArea.PHYSICAL_WRAP:
41                 device.print(" wrap=\"physical\"");
42                 break;
43         }
44
45         Utils.printCSSInlineFullSize(device, component.getPreferredSize());
46
47         if (!component.isEditable() || !component.isEnabled()) {
48             device.print(" readonly=\"true\"");
49         }
50         if (component.isEnabled()) {
51             device.print(" name=\"");
52             Utils.write(device, Utils.event(component));
53             device.print("\"");
54         } else {
55             device.print(" disabled=\"true\"");
56         }
57
58         if (component.isFocusOwner())
59             Utils.optAttribute(device, "focus", component.getName());
60
61         Utils.writeEvents(device, component);
62         device.print(">");
63         Utils.writeRaw(device, component.getText());
64         device.print("</textarea>\n");
65     }
66 }
67
Popular Tags