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