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 ImgTagBeanInfo extends SimpleBeanInfo { 31 32 35 private String [] properties = new String []{ 36 "nodeDataName", 37 "contentNodeName", 38 "contentNodeCollectionName", 39 "inherit", 40 "altNodeDataName", 41 "class", 42 "style", 43 "id", 44 "width", 45 "height"}; 46 47 50 public PropertyDescriptor [] getPropertyDescriptors() { 51 52 try { 53 List proplist = new ArrayList (); 54 for (int j = 0; j < properties.length; j++) { 55 proplist.add(createPropertyDescriptor(properties[j])); 56 } 57 PropertyDescriptor [] result = new PropertyDescriptor [proplist.size()]; 58 return ((PropertyDescriptor []) proplist.toArray(result)); 59 60 } 61 catch (IntrospectionException ex) { 62 throw new UnhandledException(ex.getMessage(), ex); 64 } 65 66 } 67 68 74 private PropertyDescriptor createPropertyDescriptor(String propertyName) throws IntrospectionException { 75 return new PropertyDescriptor (propertyName, ImgTag.class, null, "set" + StringUtils.capitalize(propertyName)); 76 } 77 78 } 79 | Popular Tags |