KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > template > SFileChooserPropertyManager


1 /*
2  * $Id: SFileChooserPropertyManager.java,v 1.3 2004/12/01 07:54:28 hengels 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.template;
15
16 import org.wings.SComponent;
17 import org.wings.SFileChooser;
18
19 /**
20  * Property manager for a file chooser component.
21  *
22  * @version $Revision: 1.3 $
23  */

24 public class SFileChooserPropertyManager
25         extends SComponentPropertyManager {
26     static final Class JavaDoc[] classes = {SFileChooser.class};
27
28     public SFileChooserPropertyManager() {
29     }
30
31     public void setProperty(SComponent comp, String JavaDoc name, String JavaDoc value) {
32         SFileChooser c = (SFileChooser) comp;
33         if (name.equals("SIZE") || name.equals("COLS"))
34             c.setColumns(Integer.parseInt(value));
35         /* maxsize should be the maximum content length, according to
36          * RFC 1867. So we should set the sessions' content length here.
37          * But people often think this is the maximum number of columns
38          * -- so just ignore it.
39         else if ( name.equals("MAXSIZE") )
40             c.getSession().setMaxContentLength(Integer.parseInt(value)*1024);
41         */

42         else if (name.equals("ACCEPT") || name.equals("FILTER"))
43             c.setFileNameFilter(value);
44         else
45             super.setProperty(comp, name, value);
46     }
47
48     public Class JavaDoc[] getSupportedClasses() {
49         return classes;
50     }
51 }
52
53
54
Popular Tags