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