| 1 19 package org.netbeans.modules.j2ee.sun.ide.sunresources.beans; 20 21 import java.beans.*; 22 import org.openide.util.NbBundle; 23 import org.netbeans.modules.j2ee.sun.ide.editors.BooleanEditor; 24 import org.openide.util.Exceptions; 25 26 public class DataSourceBeanBeanInfo extends SimpleBeanInfo { 27 28 static private String getLabel(String key){ 29 return NbBundle.getMessage(DataSourceBean.class,key); 30 } 31 32 39 public BeanDescriptor getBeanDescriptor() { 40 BeanDescriptor beanDescriptor = new BeanDescriptor ( DataSourceBean.class , null ); return beanDescriptor; 42 } 43 44 56 public PropertyDescriptor[] getPropertyDescriptors() { 57 int PROPERTY_connPoolName = 0; 58 int PROPERTY_description = 1; 59 int PROPERTY_isEnabled = 2; 60 int PROPERTY_jndiName = 3; 61 int PROPERTY_name = 4; 62 int PROPERTY_resType = 5; 63 PropertyDescriptor[] properties = new PropertyDescriptor[6]; 64 65 try { 66 properties[PROPERTY_connPoolName] = new PropertyDescriptor ( "connPoolName", DataSourceBean.class, "getConnPoolName", "setConnPoolName" ); 67 properties[PROPERTY_connPoolName].setDisplayName ( getLabel("LBL_PoolName") ); 68 properties[PROPERTY_connPoolName].setShortDescription ( getLabel("DSC_PoolName") ); 69 properties[PROPERTY_description] = new PropertyDescriptor ( "description", DataSourceBean.class, "getDescription", "setDescription" ); 70 properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") ); 71 properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") ); 72 properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", DataSourceBean.class, "getIsEnabled", "setIsEnabled" ); 73 properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") ); 74 properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") ); 75 properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class ); 76 properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", DataSourceBean.class, "getJndiName", "setJndiName" ); 77 properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JndiName") ); 78 properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_JndiName") ); 79 properties[PROPERTY_name] = new PropertyDescriptor ( "name", DataSourceBean.class, "getName", "setName" ); 80 properties[PROPERTY_name].setHidden ( true ); 81 properties[PROPERTY_resType] = new PropertyDescriptor ( "resType", DataSourceBean.class, "getResType", "setResType" ); 82 properties[PROPERTY_resType].setDisplayName ( getLabel("LBL_DSResType") ); 83 properties[PROPERTY_resType].setShortDescription ( getLabel("DSC_DSResType") ); 84 } 85 catch( IntrospectionException e) { 86 Exceptions.printStackTrace(e); 87 } 88 return properties; 89 } 90 91 98 public EventSetDescriptor[] getEventSetDescriptors() { 99 int EVENT_propertyChangeListener = 0; 100 EventSetDescriptor[] eventSets = new EventSetDescriptor[1]; 101 102 try { 103 eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( org.netbeans.modules.j2ee.sun.ide.sunresources.beans.DataSourceBean.class, "propertyChangeListener", java.beans.PropertyChangeListener .class, new String [] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); 104 } 105 catch( IntrospectionException e) { 106 Exceptions.printStackTrace(e); 107 } 108 return eventSets; 109 } 110 111 118 public MethodDescriptor[] getMethodDescriptors() { 119 return new MethodDescriptor[0]; 120 } 121 122 } 123 124 | Popular Tags |