01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings.plaf.css;
14:
15: import org.wings.SComponent;
16: import org.wings.SFileChooser;
17: import org.wings.io.Device;
18:
19: import java.io.IOException;
20:
21: public final class FileChooserCG extends AbstractComponentCG implements
22: org.wings.plaf.FileChooserCG {
23:
24: private static final long serialVersionUID = 1L;
25:
26: public void writeInternal(final Device device, final SComponent _c)
27: throws IOException {
28: final SFileChooser component = (SFileChooser) _c;
29:
30: int columns = component.getColumns();
31: /*
32: * for some wierd reason, the 'maxlength' column contains the
33: * maximum content length .. see RFC1867.
34: * .. anyway, all browsers seem to ignore it or worse, render the
35: * file upload unusable (konqueror 2.2.2).
36: */
37: //int maxContent = component.getSession().getMaxContentLength()*1024;
38: // maxLength = maxContent removed, since it does not work.
39: writeTablePrefix(device, component);
40: device.print("<input type=\"file\"");
41: //writeAllAttributes(device, component);
42: Utils.optAttribute(device, "size", columns);
43: Utils.optAttribute(device, "accept", component
44: .getFileNameFilter());
45: Utils.optAttribute(device, "tabindex", component
46: .getFocusTraversalIndex());
47: Utils.optFullSize(device, component);
48: Utils.writeEvents(device, component, null);
49: if (component.isFocusOwner())
50: Utils.optAttribute(device, "foc", component.getName());
51:
52: if (component.isEnabled()) {
53: device.print(" name=\"");
54: Utils.write(device, Utils.event(component));
55: device.print("\"");
56: } else
57: device.print(" readonly=\"true\"");
58:
59: device.print("/>");
60: writeTableSuffix(device, component);
61:
62: }
63: }
|