1 14 package org.wings.template; 15 16 import org.wings.SComponent; 17 import org.wings.style.CSSAttributeSet; 18 19 import java.awt.*; 20 21 25 public class SComponentPropertyManager 26 extends DefaultPropertyManager { 27 static final Class [] classes = {SComponent.class}; 28 29 public SComponentPropertyManager() { 30 } 31 32 public void setProperty(SComponent comp, String name, String 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 } 50 } 51 52 public Class [] getSupportedClasses() { 53 return classes; 54 } 55 } 56 57 58 | Popular Tags |