1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans; 25 26 import java.beans.*; 27 import org.openide.util.NbBundle; 28 import org.netbeans.modules.j2ee.sun.ide.editors.BooleanEditor; 29 import org.netbeans.modules.j2ee.sun.ide.editors.Int0Editor; 30 import org.netbeans.modules.j2ee.sun.ide.editors.LongEditor; 31 import org.netbeans.modules.j2ee.sun.ide.editors.IsolationLevelEditor; 32 import org.netbeans.modules.j2ee.sun.ide.editors.DataSourceTypeEditor; 33 import org.netbeans.modules.j2ee.sun.ide.editors.ValidationMethodEditor; 34 35 38 public class WS70JdbcResourceBeanBeanInfo extends SimpleBeanInfo { 39 40 private static BeanDescriptor beanDescriptor = null; 42 private static BeanDescriptor getBdescriptor(){ 43 BeanDescriptor beanDescriptor = new BeanDescriptor(WS70JdbcResourceBean.class, null ); 45 47 return beanDescriptor; } static private String getLabel(String key){ 49 return NbBundle.getMessage(WS70JdbcResourceBean.class,key); 50 } 51 private static final int PROPERTY_jndiName = 0; 52 private static final int PROPERTY_isEnabled = 1; 53 private static final int PROPERTY_description = 2; 54 private static final int PROPERTY_dsClass = 3; 55 private static final int PROPERTY_minConnections = 4; 56 private static final int PROPERTY_maxConnections = 5; 57 58 private static final int PROPERTY_idleTimeout = 6; 59 private static final int PROPERTY_waitTimeout = 7; 60 private static final int PROPERTY_tranxIsoLevel = 8; 61 private static final int PROPERTY_isIsoLevGuaranteed = 9; 62 private static final int PROPERTY_name = 10; 63 private static final int PROPERTY_connValidation = 11; 64 65 private static final int PROPERTY_validationTableName = 12; 66 private static final int PROPERTY_failAllConns = 13; 67 68 private static PropertyDescriptor[] properties = null; 70 private static PropertyDescriptor[] getPdescriptor(){ 71 PropertyDescriptor[] properties = new PropertyDescriptor[14]; 73 try { 74 properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", WS70JdbcResourceBean.class, "getJndiName", "setJndiName" ); 75 properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JdbcJndiName") ); 76 properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_JdbcJndiName") ); 77 78 properties[PROPERTY_description] = new PropertyDescriptor ( "description", WS70JdbcResourceBean.class, "getDescription", "setDescription" ); 79 properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") ); 80 properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") ); 81 82 properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", WS70JdbcResourceBean.class, "getIsEnabled", "setIsEnabled" ); 83 properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") ); 84 properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") ); 85 properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class ); 86 87 88 properties[PROPERTY_dsClass] = new PropertyDescriptor ( "dsClass", WS70JdbcResourceBean.class, "getDsClass", "setDsClass" ); 89 properties[PROPERTY_dsClass].setDisplayName ( getLabel("LBL_DSClassName") ); 90 properties[PROPERTY_dsClass].setShortDescription ( getLabel("DSC_DSClassName") ); 91 92 properties[PROPERTY_minConnections] = new PropertyDescriptor ( "minConnections", WS70JdbcResourceBean.class, "getMinConnections", "setMinConnections" ); 93 properties[PROPERTY_minConnections].setDisplayName ( getLabel("LBL_min_connections") ); 94 properties[PROPERTY_minConnections].setShortDescription ( getLabel("DSC_min_connections") ); 95 properties[PROPERTY_minConnections].setPropertyEditorClass ( Int0Editor.class ); 96 97 properties[PROPERTY_maxConnections] = new PropertyDescriptor ( "maxConnections", WS70JdbcResourceBean.class, "getMaxConnections", "setMaxConnections" ); 98 properties[PROPERTY_maxConnections].setDisplayName ( getLabel("LBL_max_connections") ); 99 properties[PROPERTY_maxConnections].setShortDescription ( getLabel("DSC_max_connections") ); 100 properties[PROPERTY_maxConnections].setPropertyEditorClass ( Int0Editor.class ); 101 102 103 104 properties[PROPERTY_idleTimeout] = new PropertyDescriptor ( "idleTimeout", WS70JdbcResourceBean.class, "getIdleTimeout", "setIdleTimeout" ); 105 properties[PROPERTY_idleTimeout].setDisplayName ( getLabel("LBL_connection_idle_timeout") ); 106 properties[PROPERTY_idleTimeout].setShortDescription ( getLabel("DSC_connection_idle_timeout") ); 107 properties[PROPERTY_idleTimeout].setPropertyEditorClass ( LongEditor.class ); 108 109 properties[PROPERTY_waitTimeout] = new PropertyDescriptor ( "waitTimeout", WS70JdbcResourceBean.class, "getWaitTimeout", "setWaitTimeout" ); 110 properties[PROPERTY_waitTimeout].setDisplayName ( getLabel("LBL_connection_wait_timeout") ); 111 properties[PROPERTY_waitTimeout].setShortDescription ( getLabel("DSC_connection_wait_timeout") ); 112 properties[PROPERTY_waitTimeout].setPropertyEditorClass ( LongEditor.class ); 113 114 properties[PROPERTY_isIsoLevGuaranteed] = new PropertyDescriptor ( "isolationLevelGuaranteed", WS70JdbcResourceBean.class, "getIsolationLevelGuaranteed", "setIsolationLevelGuaranteed" ); 115 properties[PROPERTY_isIsoLevGuaranteed].setDisplayName ( getLabel("LBL_is_isolation_level_guaranteed") ); 116 properties[PROPERTY_isIsoLevGuaranteed].setShortDescription ( getLabel("DSC_is_isolation_level_guaranteed") ); 117 properties[PROPERTY_isIsoLevGuaranteed].setPropertyEditorClass ( BooleanEditor.class ); 118 119 properties[PROPERTY_tranxIsoLevel] = new PropertyDescriptor ( "isolationLevel", WS70JdbcResourceBean.class, "getIsolationLevel", "setIsolationLevel" ); 120 properties[PROPERTY_tranxIsoLevel].setDisplayName ( getLabel("LBL_transaction_isolation_level") ); 121 properties[PROPERTY_tranxIsoLevel].setShortDescription ( getLabel("DSC_transaction_isolation_level") ); 122 properties[PROPERTY_tranxIsoLevel].setPropertyEditorClass ( IsolationLevelEditor.class ); 123 124 125 properties[PROPERTY_name] = new PropertyDescriptor ( "name", WS70JdbcResourceBean.class, "getName", "setName" ); 126 properties[PROPERTY_name].setHidden ( true ); 127 128 properties[PROPERTY_connValidation] = new PropertyDescriptor ( "connectionValidation", WS70JdbcResourceBean.class, "getConnectionValidation", "setConnectionValidation" ); 129 properties[PROPERTY_connValidation].setDisplayName ( getLabel("LBL_conn_valid_method") ); 130 properties[PROPERTY_connValidation].setShortDescription ( getLabel("DSC_conn_valid_method") ); 131 properties[PROPERTY_connValidation].setPropertyEditorClass ( ValidationMethodEditor.class ); 132 133 properties[PROPERTY_validationTableName] = new PropertyDescriptor ( "connectionValidationTablename", WS70JdbcResourceBean.class, "getConnectionValidationTablename", "setConnectionValidationTablename" ); 134 properties[PROPERTY_validationTableName].setDisplayName ( getLabel("LBL_validation_table_name") ); 135 properties[PROPERTY_validationTableName].setShortDescription ( getLabel("DSC_validation_table_name") ); 136 properties[PROPERTY_failAllConns] = new PropertyDescriptor ( "failAllConnections", WS70JdbcResourceBean.class, "getFailAllConnections", "setFailAllConnections" ); 137 properties[PROPERTY_failAllConns].setDisplayName ( getLabel("LBL_fail_all_connections") ); 138 properties[PROPERTY_failAllConns].setShortDescription ( getLabel("DSC_fail_all_connections") ); 139 properties[PROPERTY_failAllConns].setPropertyEditorClass ( BooleanEditor.class ); 140 } 141 catch( Exception e){ 142 e.printStackTrace(); 143 } 144 146 return properties; } 148 private static EventSetDescriptor[] eventSets = null; 150 private static EventSetDescriptor[] getEdescriptor(){ 151 153 155 return eventSets; } 157 private static MethodDescriptor[] methods = null; 159 private static MethodDescriptor[] getMdescriptor(){ 160 162 164 return methods; } 166 167 private static int defaultPropertyIndex = -1; private static int defaultEventIndex = -1; 170 171 173 175 177 184 public BeanDescriptor getBeanDescriptor() { 185 return getBdescriptor(); 186 } 187 188 200 public PropertyDescriptor[] getPropertyDescriptors() { 201 return getPdescriptor(); 202 } 203 204 211 public EventSetDescriptor[] getEventSetDescriptors() { 212 return getEdescriptor(); 213 } 214 215 222 public MethodDescriptor[] getMethodDescriptors() { 223 return getMdescriptor(); 224 } 225 226 234 public int getDefaultPropertyIndex() { 235 return defaultPropertyIndex; 236 } 237 238 245 public int getDefaultEventIndex() { 246 return defaultEventIndex; 247 } 248 } 249 250 | Popular Tags |