1 package org.compiere.grid.ed; 2 3 import java.beans.*; 4 5 11 12 public class VDateBeanInfo extends SimpleBeanInfo 13 { 14 private Class beanClass = VDate.class; 15 private String iconColor16x16Filename; 16 private String iconColor32x32Filename; 17 private String iconMono16x16Filename; 18 private String iconMono32x32Filename; 19 20 public VDateBeanInfo() 21 { 22 } 23 public PropertyDescriptor[] getPropertyDescriptors() 24 { 25 try 26 { 27 PropertyDescriptor _background = new PropertyDescriptor("background", beanClass, null, "setBackground"); 28 PropertyDescriptor _display = new PropertyDescriptor("display", beanClass, "getDisplay", null); 29 PropertyDescriptor _field = new PropertyDescriptor("field", beanClass, null, "setField"); 30 PropertyDescriptor _foreground = new PropertyDescriptor("foreground", beanClass, null, "setForeground"); 31 PropertyDescriptor _mandatory = new PropertyDescriptor("mandatory", beanClass, "isMandatory", "setMandatory"); 32 PropertyDescriptor _readWrite = new PropertyDescriptor("readWrite", beanClass, "isReadWrite", "setReadWrite"); 33 PropertyDescriptor _timestamp = new PropertyDescriptor("timestamp", beanClass, "getTimestamp", null); 34 PropertyDescriptor _value = new PropertyDescriptor("value", beanClass, "getValue", "setValue"); 35 PropertyDescriptor[] pds = new PropertyDescriptor[] { 36 _background, 37 _display, 38 _field, 39 _foreground, 40 _mandatory, 41 _readWrite, 42 _timestamp, 43 _value}; 44 return pds; 45 } 46 catch(IntrospectionException ex) 47 { 48 ex.printStackTrace(); 49 return null; 50 } 51 } 52 public java.awt.Image getIcon(int iconKind) 53 { 54 switch (iconKind) { 55 case BeanInfo.ICON_COLOR_16x16: 56 return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null; 57 case BeanInfo.ICON_COLOR_32x32: 58 return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null; 59 case BeanInfo.ICON_MONO_16x16: 60 return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null; 61 case BeanInfo.ICON_MONO_32x32: 62 return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null; 63 } 64 return null; 65 } 66 public BeanInfo[] getAdditionalBeanInfo() 67 { 68 Class superclass = beanClass.getSuperclass(); 69 try 70 { 71 BeanInfo superBeanInfo = Introspector.getBeanInfo(superclass); 72 return new BeanInfo[] { superBeanInfo }; 73 } 74 catch(IntrospectionException ex) 75 { 76 ex.printStackTrace(); 77 return null; 78 } 79 } 80 } | Popular Tags |