KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: SComponentPropertyManager.java,v 1.5 2005/05/27 09:17:36 blueshift 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.style.CSSAttributeSet;
18
19 import java.awt.*;
20
21 /**
22  * @author <a HREF="mailto:haaf@mercatis.de">Armin Haaf</a>
23  * @version $Revision: 1.5 $
24  */

25 public class SComponentPropertyManager
26         extends DefaultPropertyManager {
27     static final Class JavaDoc[] classes = {SComponent.class};
28
29     public SComponentPropertyManager() {
30     }
31
32     public void setProperty(SComponent comp, String JavaDoc name, String JavaDoc value) {
33         if ("BACKGROUND".equals(name))
34             comp.setBackground(Color.decode(value));
35         else if ("FOREGROUND".equals(name))
36             comp.setForeground(Color.decode(value));
37         else if ("FONT".equals(name))
38             comp.setFont(TemplateUtil.parseFont(value));
39         else if ("TABINDEX".equals(name))
40             comp.setFocusTraversalIndex(Integer.parseInt(value));
41         else if ("STYLE".equals(name)) {
42             PropertyValueConverter valueConverter = getValueConverter(CSSAttributeSet.class);
43             comp.setAttributes((CSSAttributeSet) valueConverter.convertPropertyValue(value, CSSAttributeSet.class));
44         } else if ("CLASS".equals(name)) {
45             comp.setStyle(value);
46         } else {
47             super.setProperty(comp, name, value);
48         } // end of else
49

50     }
51
52     public Class JavaDoc[] getSupportedClasses() {
53         return classes;
54     }
55 }
56
57
58
Popular Tags