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 JavaMailSessionBeanBeanInfo extends SimpleBeanInfo { 27 28 static private String getLabel(String key){ 29 return NbBundle.getMessage(JavaMailSessionBean.class,key); 30 } 31 32 39 public BeanDescriptor getBeanDescriptor() { 40 BeanDescriptor beanDescriptor = new BeanDescriptor ( JavaMailSessionBean.class , null ); return beanDescriptor; 42 } 43 44 56 public PropertyDescriptor[] getPropertyDescriptors() { 57 int PROPERTY_description = 0; 58 int PROPERTY_fromAddr = 1; 59 int PROPERTY_hostName = 2; 60 int PROPERTY_isDebug = 3; 61 int PROPERTY_isEnabled = 4; 62 int PROPERTY_jndiName = 5; 63 int PROPERTY_name = 6; 64 int PROPERTY_storeProt = 7; 65 int PROPERTY_storeProtClass = 8; 66 int PROPERTY_transProt = 9; 67 int PROPERTY_transProtClass = 10; 68 int PROPERTY_userName = 11; 69 PropertyDescriptor[] properties = new PropertyDescriptor[12]; 70 71 try { 72 properties[PROPERTY_description] = new PropertyDescriptor ( "description", JavaMailSessionBean.class, "getDescription", "setDescription" ); 73 properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") ); 74 properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") ); 75 properties[PROPERTY_fromAddr] = new PropertyDescriptor ( "fromAddr", JavaMailSessionBean.class, "getFromAddr", "setFromAddr" ); 76 properties[PROPERTY_fromAddr].setDisplayName ( getLabel("LBL_from") ); 77 properties[PROPERTY_fromAddr].setShortDescription ( getLabel("DSC_from") ); 78 properties[PROPERTY_hostName] = new PropertyDescriptor ( "hostName", JavaMailSessionBean.class, "getHostName", "setHostName" ); 79 properties[PROPERTY_hostName].setDisplayName ( getLabel("LBL_host") ); 80 properties[PROPERTY_hostName].setShortDescription ( getLabel("DSC_host") ); 81 properties[PROPERTY_isDebug] = new PropertyDescriptor ( "isDebug", JavaMailSessionBean.class, "getIsDebug", "setIsDebug" ); 82 properties[PROPERTY_isDebug].setDisplayName ( getLabel("LBL_debug") ); 83 properties[PROPERTY_isDebug].setShortDescription ( getLabel("DSC_debug") ); 84 properties[PROPERTY_isDebug].setPropertyEditorClass ( BooleanEditor.class ); 85 properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", JavaMailSessionBean.class, "getIsEnabled", "setIsEnabled" ); 86 properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") ); 87 properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") ); 88 properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class ); 89 properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", JavaMailSessionBean.class, "getJndiName", "setJndiName" ); 90 properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JndiName") ); 91 properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_MailJndiName") ); 92 properties[PROPERTY_name] = new PropertyDescriptor ( "name", JavaMailSessionBean.class, "getName", "setName" ); 93 properties[PROPERTY_name].setHidden ( true ); 94 properties[PROPERTY_storeProt] = new PropertyDescriptor ( "storeProt", JavaMailSessionBean.class, "getStoreProt", "setStoreProt" ); 95 properties[PROPERTY_storeProt].setDisplayName ( getLabel("LBL_StoreProtocol") ); 96 properties[PROPERTY_storeProt].setShortDescription ( getLabel("DSC_StoreProtocol") ); 97 properties[PROPERTY_storeProtClass] = new PropertyDescriptor ( "storeProtClass", JavaMailSessionBean.class, "getStoreProtClass", "setStoreProtClass" ); 98 properties[PROPERTY_storeProtClass].setDisplayName ( getLabel("LBL_StoreProtocolClass") ); 99 properties[PROPERTY_storeProtClass].setShortDescription ( getLabel("DSC_StoreProtocolClass") ); 100 properties[PROPERTY_transProt] = new PropertyDescriptor ( "transProt", JavaMailSessionBean.class, "getTransProt", "setTransProt" ); 101 properties[PROPERTY_transProt].setDisplayName ( getLabel("LBL_TransportProtocol") ); 102 properties[PROPERTY_transProt].setShortDescription ( getLabel("DSC_TransportProtocol") ); 103 properties[PROPERTY_transProtClass] = new PropertyDescriptor ( "transProtClass", JavaMailSessionBean.class, "getTransProtClass", "setTransProtClass" ); 104 properties[PROPERTY_transProtClass].setDisplayName ( getLabel("LBL_TransportProtocol") ); 105 properties[PROPERTY_transProtClass].setShortDescription ( getLabel("DSC_TransportProtocol") ); 106 properties[PROPERTY_userName] = new PropertyDescriptor ( "userName", JavaMailSessionBean.class, "getUserName", "setUserName" ); 107 properties[PROPERTY_userName].setDisplayName ( getLabel("LBL_user") ); 108 properties[PROPERTY_userName].setShortDescription ( getLabel("DSC_user") ); 109 } 110 catch( IntrospectionException e) { 111 Exceptions.printStackTrace(e); 112 } 113 return properties; 114 } 115 116 123 public EventSetDescriptor[] getEventSetDescriptors() { 124 int EVENT_propertyChangeListener = 0; 125 EventSetDescriptor[] eventSets = new EventSetDescriptor[1]; 126 127 try { 128 eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( org.netbeans.modules.j2ee.sun.ide.sunresources.beans.JavaMailSessionBean.class, "propertyChangeListener", java.beans.PropertyChangeListener .class, new String [] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); 129 } 130 catch( IntrospectionException e) { 131 Exceptions.printStackTrace(e); 132 } 133 return eventSets; 134 } 135 136 143 public MethodDescriptor[] getMethodDescriptors() { 144 return new MethodDescriptor[0]; 145 } 146 147 } 148 149 | Popular Tags |