1 package org.compiere.plaf; 2 3 import java.beans.BeanInfo ; 4 import java.beans.IntrospectionException ; 5 import java.beans.PropertyDescriptor ; 6 import java.beans.SimpleBeanInfo ; 7 8 12 13 public class CompiereColorBeanInfo extends SimpleBeanInfo 14 { 15 private Class beanClass = CompiereColor.class; 16 private String iconColor16x16Filename; 17 private String iconColor32x32Filename; 18 private String iconMono16x16Filename; 19 private String iconMono32x32Filename; 20 21 public CompiereColorBeanInfo() 22 { 23 } 24 public PropertyDescriptor [] getPropertyDescriptors() 25 { 26 try 27 { 28 PropertyDescriptor _flat = new PropertyDescriptor ("flat", beanClass, "isFlat", null); 29 PropertyDescriptor _flatColor = new PropertyDescriptor ("flatColor", beanClass, "getFlatColor", "setFlatColor"); 30 PropertyDescriptor _gradient = new PropertyDescriptor ("gradient", beanClass, "isGradient", null); 31 PropertyDescriptor _gradientLowerColor = new PropertyDescriptor ("gradientLowerColor", beanClass, "getGradientLowerColor", "setGradientLowerColor"); 32 PropertyDescriptor _gradientRepeatDistance = new PropertyDescriptor ("gradientRepeatDistance", beanClass, "getGradientRepeatDistance", "setGradientRepeatDistance"); 33 PropertyDescriptor _gradientStartPoint = new PropertyDescriptor ("gradientStartPoint", beanClass, "getGradientStartPoint", "setGradientStartPoint"); 34 PropertyDescriptor _gradientUpperColor = new PropertyDescriptor ("gradientUpperColor", beanClass, "getGradientUpperColor", "setGradientUpperColor"); 35 PropertyDescriptor _line = new PropertyDescriptor ("line", beanClass, "isLine", null); 36 PropertyDescriptor _lineBackColor = new PropertyDescriptor ("lineBackColor", beanClass, "getLineBackColor", "setLineBackColor"); 37 PropertyDescriptor _lineColor = new PropertyDescriptor ("lineColor", beanClass, "getLineColor", "setLineColor"); 38 PropertyDescriptor _lineDistance = new PropertyDescriptor ("lineDistance", beanClass, "getLineDistance", "setLineDistance"); 39 PropertyDescriptor _lineWidth = new PropertyDescriptor ("lineWidth", beanClass, "getLineWidth", "setLineWidth"); 40 PropertyDescriptor _texture = new PropertyDescriptor ("texture", beanClass, "isTexture", null); 41 PropertyDescriptor _textureCompositeAlpha = new PropertyDescriptor ("textureCompositeAlpha", beanClass, "getTextureCompositeAlpha", "setTextureCompositeAlpha"); 42 PropertyDescriptor _textureImage = new PropertyDescriptor ("textureImage", beanClass, "getTextureImage", null); 43 PropertyDescriptor _textureTaintColor = new PropertyDescriptor ("textureTaintColor", beanClass, "getTextureTaintColor", "setTextureTaintColor"); 44 PropertyDescriptor _textureURL = new PropertyDescriptor ("textureURL", beanClass, "getTextureURL", "setTextureURL"); 45 PropertyDescriptor _type = new PropertyDescriptor ("type", beanClass, "getType", null); 46 PropertyDescriptor [] pds = new PropertyDescriptor [] { 47 _flat, 48 _flatColor, 49 _gradient, 50 _gradientLowerColor, 51 _gradientRepeatDistance, 52 _gradientStartPoint, 53 _gradientUpperColor, 54 _line, 55 _lineBackColor, 56 _lineColor, 57 _lineDistance, 58 _lineWidth, 59 _texture, 60 _textureCompositeAlpha, 61 _textureImage, 62 _textureTaintColor, 63 _textureURL, 64 _type}; 65 return pds; 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 } 85 catch(IntrospectionException ex) 86 { 87 ex.printStackTrace(); 88 return null; 89 } 90 } 91 public java.awt.Image getIcon(int iconKind) 92 { 93 switch (iconKind) { 94 case BeanInfo.ICON_COLOR_16x16: 95 return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null; 96 case BeanInfo.ICON_COLOR_32x32: 97 return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null; 98 case BeanInfo.ICON_MONO_16x16: 99 return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null; 100 case BeanInfo.ICON_MONO_32x32: 101 return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null; 102 } 103 return null; 104 } 105 } | Popular Tags |