1 19 package org.netbeans.modules.xml.schema; 20 21 import java.beans.*; 22 import java.awt.Image ; 23 import org.openide.loaders.UniFileLoader; 24 import org.openide.util.Exceptions; 25 26 import org.openide.util.Utilities; 27 28 33 public class SchemaLoaderBeanInfo extends SimpleBeanInfo { 34 35 private static final String ICON_DIR_BASE = "org/netbeans/modules/xml/schema/resources/"; 37 private static final int PROPERTY_extensions = 0; 38 private static final int PROPERTY_displayName = 1; 39 private static final int PROPERTY_representationClass = 2; 40 41 public BeanInfo[] getAdditionalBeanInfo() { 42 BeanInfo sbi = null; 43 try { 44 sbi = Introspector.getBeanInfo(UniFileLoader.class); } catch(IntrospectionException ex) { 46 Exceptions.printStackTrace(ex); 47 } 48 return new BeanInfo[] { sbi }; } 50 57 public BeanDescriptor getBeanDescriptor() { 58 BeanDescriptor beanDescriptor = new BeanDescriptor ( SchemaLoader.class , null ); 59 beanDescriptor.setDisplayName ( Util.THIS.getString("SchemaLoader_name") ); 60 beanDescriptor.setShortDescription ( Util.THIS.getString("SchemaLoader_desc") ); 62 64 return beanDescriptor; 65 } 66 67 79 public PropertyDescriptor[] getPropertyDescriptors() { 80 PropertyDescriptor[] properties = new PropertyDescriptor[3]; 81 82 try { 83 properties[PROPERTY_extensions] = new PropertyDescriptor ( "extensions", SchemaLoader.class, "getExtensions", "setExtensions" ); 84 properties[PROPERTY_extensions].setPreferred ( true ); 85 properties[PROPERTY_extensions].setDisplayName ( Util.THIS.getString("PROP_SchemaLoader_extensions_name") ); 86 properties[PROPERTY_extensions].setShortDescription ( Util.THIS.getString("PROP_SchemaLoader_extensions_desc") ); 87 properties[PROPERTY_displayName] = new PropertyDescriptor ( "displayName", SchemaLoader.class, "getDisplayName", null ); 88 properties[PROPERTY_displayName].setDisplayName ( Util.THIS.getString("PROP_SchemaLoader_dname_name") ); 89 properties[PROPERTY_displayName].setShortDescription ( Util.THIS.getString("PROP_SchemaLoader_dname_desc") ); 90 properties[PROPERTY_representationClass] = new PropertyDescriptor ( "representationClass", SchemaLoader.class, "getRepresentationClass", null ); 91 properties[PROPERTY_representationClass].setExpert ( true ); 92 properties[PROPERTY_representationClass].setDisplayName ( Util.THIS.getString("PROP_SchemaLoader_class_name") ); 93 properties[PROPERTY_representationClass].setShortDescription ( Util.THIS.getString("PROP_SchemaLoader_class_desc") ); 94 } 95 catch( IntrospectionException e) { 96 Exceptions.printStackTrace(e); 97 } 98 99 101 return properties; 102 } 103 104 111 public EventSetDescriptor[] getEventSetDescriptors() { 112 EventSetDescriptor[] eventSets = new EventSetDescriptor[0]; 113 114 116 return eventSets; 117 } 118 119 126 public MethodDescriptor[] getMethodDescriptors() { 127 MethodDescriptor[] methods = new MethodDescriptor[0]; 128 return methods; 129 } 130 131 152 public Image getIcon (int type) { 153 if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || 154 (type == java.beans.BeanInfo.ICON_MONO_16x16)) { 155 156 return Utilities.loadImage (ICON_DIR_BASE + "xmlSchemaObject.gif"); } else { 158 return Utilities.loadImage (ICON_DIR_BASE + "xmlSchemaObject32.gif"); } 160 } 161 162 } 163 | Popular Tags |