1 19 package org.netbeans.modules.xml.schema.core; 20 21 import java.beans.*; 22 import java.awt.Image ; 23 import org.openide.util.NbBundle; 24 25 import org.openide.util.Utilities; 26 27 32 public class SchemaDataLoaderBeanInfo extends SimpleBeanInfo { 33 34 private static final String ICON_DIR_BASE = "org/netbeans/modules/xml/schema/core/resources/"; 36 ; 38 private static BeanDescriptor getBdescriptor(){ 39 BeanDescriptor beanDescriptor = new BeanDescriptor ( SchemaDataLoader.class , null ); 40 beanDescriptor.setDisplayName ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "LBL_SchemaDataLoader_name") ); 41 beanDescriptor.setShortDescription ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "LBL_SchemaDataLoader_desc") ); 43 45 return beanDescriptor; } 47 48 private static final int PROPERTY_extensions = 0; 50 private static final int PROPERTY_displayName = 1; 51 private static final int PROPERTY_representationClass = 2; 52 53 ; 55 private static PropertyDescriptor[] getPdescriptor(){ 56 PropertyDescriptor[] properties = new PropertyDescriptor[3]; 57 58 try { 59 properties[PROPERTY_extensions] = new PropertyDescriptor ( "extensions", SchemaDataLoader.class, "getExtensions", "setExtensions" ); 60 properties[PROPERTY_extensions].setPreferred ( true ); 61 properties[PROPERTY_extensions].setDisplayName ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "PROP_SchemaDataLoader_extensions_name") ); 62 properties[PROPERTY_extensions].setShortDescription ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "PROP_SchemaDataLoader_extensions_desc") ); 63 properties[PROPERTY_displayName] = new PropertyDescriptor ( "displayName", SchemaDataLoader.class, "getDisplayName", null ); 64 properties[PROPERTY_displayName].setDisplayName ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "PROP_SchemaDataLoader_dname_name") ); 65 properties[PROPERTY_displayName].setShortDescription ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "PROP_SchemaDataLoader_dname_desc") ); 66 properties[PROPERTY_representationClass] = new PropertyDescriptor ( "representationClass", SchemaDataLoader.class, "getRepresentationClass", null ); 67 properties[PROPERTY_representationClass].setExpert ( true ); 68 properties[PROPERTY_representationClass].setDisplayName ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "PROP_SchemaDataLoader_class_name") ); 69 properties[PROPERTY_representationClass].setShortDescription ( NbBundle.getMessage(SchemaDataLoaderBeanInfo.class, "PROP_SchemaDataLoader_class_desc") ); 70 } 71 catch( IntrospectionException e) {} 73 75 return properties; } 77 79 ; 81 private static EventSetDescriptor[] getEdescriptor(){ 82 EventSetDescriptor[] eventSets = new EventSetDescriptor[0]; 84 86 return eventSets; } 88 90 ; 92 private static MethodDescriptor[] getMdescriptor(){ 93 MethodDescriptor[] methods = new MethodDescriptor[0]; 95 97 return methods; } 99 private static final int defaultPropertyIndex = -1; private static final int defaultEventIndex = -1; 102 103 public BeanInfo[] getAdditionalBeanInfo() { Class superclass = SchemaDataLoader.class.getSuperclass(); 105 BeanInfo sbi = null; 106 try { 107 sbi = Introspector.getBeanInfo(superclass); 109 111 } catch(IntrospectionException ex) { } return new BeanInfo[] { sbi }; } 113 120 public BeanDescriptor getBeanDescriptor() { 121 return getBdescriptor(); 122 } 123 124 136 public PropertyDescriptor[] getPropertyDescriptors() { 137 return getPdescriptor(); 138 } 139 140 147 public EventSetDescriptor[] getEventSetDescriptors() { 148 return getEdescriptor(); 149 } 150 151 158 public MethodDescriptor[] getMethodDescriptors() { 159 return getMdescriptor(); 160 } 161 162 170 public int getDefaultPropertyIndex() { 171 return defaultPropertyIndex; 172 } 173 174 181 public int getDefaultEventIndex() { 182 return defaultEventIndex; 183 } 184 185 206 public Image getIcon (int type) { 207 if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || 208 (type == java.beans.BeanInfo.ICON_MONO_16x16)) { 209 210 return Utilities.loadImage (ICON_DIR_BASE + "Schema_File.gif"); } 212 213 return null; 214 } 215 216 } 217 | Popular Tags |