1 13 package info.magnolia.cms.taglibs.util; 14 15 import java.beans.IntrospectionException ; 16 import java.beans.PropertyDescriptor ; 17 import java.beans.SimpleBeanInfo ; 18 import java.util.ArrayList ; 19 import java.util.List ; 20 21 import org.apache.commons.lang.StringUtils; 22 import org.apache.commons.lang.UnhandledException; 23 24 25 30 public class TableTagBeanInfo extends SimpleBeanInfo { 31 32 35 private String [] properties = new String []{"header", "class", "style", "id", "cellspacing", "cellpadding"}; 36 37 40 public PropertyDescriptor [] getPropertyDescriptors() { 41 42 try { 43 List proplist = new ArrayList (); 44 for (int j = 0; j < properties.length; j++) { 45 proplist.add(createPropertyDescriptor(properties[j])); 46 } 47 PropertyDescriptor [] result = new PropertyDescriptor [proplist.size()]; 48 return ((PropertyDescriptor []) proplist.toArray(result)); 49 50 } 51 catch (IntrospectionException ex) { 52 throw new UnhandledException(ex.getMessage(), ex); 54 } 55 56 } 57 58 64 private PropertyDescriptor createPropertyDescriptor(String propertyName) throws IntrospectionException { 65 return new PropertyDescriptor (propertyName, TableTag.class, null, "set" + StringUtils.capitalize(propertyName)); 66 } 67 68 } 69 | Popular Tags |