1 19 20 package org.netbeans.modules.settings.examples; 21 22 import java.beans.*; 23 24 public class ProxySettingsBeanInfo extends SimpleBeanInfo { 25 26 27 ; 29 private static BeanDescriptor getBdescriptor(){ 30 BeanDescriptor beanDescriptor = new BeanDescriptor ( ProxySettings.class , null ); 31 beanDescriptor.setDisplayName ( getLocalized("LBL_ProxySettings") ); 32 beanDescriptor.setShortDescription ( getLocalized("HINT_ProxySettings") ); 34 return beanDescriptor; } 36 37 private static final int PROPERTY_proxyPort = 0; 39 private static final int PROPERTY_proxyHost = 1; 40 41 ; 43 private static PropertyDescriptor[] getPdescriptor(){ 44 PropertyDescriptor[] properties = new PropertyDescriptor[2]; 45 46 try { 47 properties[PROPERTY_proxyPort] = new PropertyDescriptor ( "proxyPort", ProxySettings.class, "getProxyPort", "setProxyPort" ); 48 properties[PROPERTY_proxyPort].setDisplayName ( getLocalized("LBL_Port") ); 49 properties[PROPERTY_proxyPort].setShortDescription ( getLocalized("HINT_Port") ); 50 properties[PROPERTY_proxyHost] = new PropertyDescriptor ( "proxyHost", ProxySettings.class, "getProxyHost", "setProxyHost" ); 51 properties[PROPERTY_proxyHost].setDisplayName ( getLocalized("LBL_Host") ); 52 properties[PROPERTY_proxyHost].setShortDescription ( getLocalized("HINT_Host") ); 53 } 54 catch( IntrospectionException e) {} 56 58 return properties; } 60 62 ; 64 private static EventSetDescriptor[] getEdescriptor(){ 65 EventSetDescriptor[] eventSets = new EventSetDescriptor[0]; 67 69 return eventSets; } 71 73 ; 75 private static MethodDescriptor[] getMdescriptor(){ 76 MethodDescriptor[] methods = new MethodDescriptor[0]; 78 80 return methods; } 82 83 private static final int defaultPropertyIndex = -1; private static final int defaultEventIndex = -1; 86 87 89 91 93 100 public BeanDescriptor getBeanDescriptor() { 101 return getBdescriptor(); 102 } 103 104 116 public PropertyDescriptor[] getPropertyDescriptors() { 117 return getPdescriptor(); 118 } 119 120 127 public EventSetDescriptor[] getEventSetDescriptors() { 128 return getEdescriptor(); 129 } 130 131 138 public MethodDescriptor[] getMethodDescriptors() { 139 return getMdescriptor(); 140 } 141 142 150 public int getDefaultPropertyIndex() { 151 return defaultPropertyIndex; 152 } 153 154 161 public int getDefaultEventIndex() { 162 return defaultEventIndex; 163 } 164 165 private static String getLocalized(String key) { 166 return org.openide.util.NbBundle.getMessage(ProxySettings.class, key); 167 } 168 } 169 170 | Popular Tags |