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.template.propertymanagers;
14:
15: import org.wings.SComponent;
16: import org.wings.SFileChooser;
17: import org.wings.template.propertymanagers.SComponentPropertyManager;
18:
19: /**
20: * Property manager for a file chooser component.
21: *
22: */
23: public class SFileChooserPropertyManager extends
24: SComponentPropertyManager {
25: static final Class[] classes = { SFileChooser.class };
26:
27: public SFileChooserPropertyManager() {
28: }
29:
30: public void setProperty(SComponent comp, String name, String value) {
31: SFileChooser c = (SFileChooser) comp;
32: if (name.equals("SIZE") || name.equals("COLS"))
33: c.setColumns(Integer.parseInt(value));
34: /* maxsize should be the maximum content length, according to
35: * RFC 1867. So we should set the sessions' content length here.
36: * But people often think this is the maximum number of columns
37: * -- so just ignore it.
38: else if ( name.equals("MAXSIZE") )
39: c.getSession().setMaxContentLength(Integer.parseInt(value)*1024);
40: */
41: else if (name.equals("ACCEPT") || name.equals("FILTER"))
42: c.setFileNameFilter(value);
43: else
44: super .setProperty(comp, name, value);
45: }
46:
47: public Class[] getSupportedClasses() {
48: return classes;
49: }
50: }
|