001/* 002 * $Source: v:/cvsroot/open/projects/WebARTS/ca/bc/webarts/widgets/dnd/FileDropBeanBeanInfo.java,v $ 003 * $Name: $ 004 * $Revision: 1.1 $ 005 * $Date: 2005-04-10 11:53:16 -0700 (Sun, 10 Apr 2005) $ 006 * $Locker: $ 007 */ 008/* 009 * Copyright (C) 2001 WebARTS Design, North Vancouver Canada 010 * http://www..webarts.bc.ca 011 * 012 * This program is free software; you can redistribute it and/or modify 013 * it under the terms of the GNU General Public License as published by 014 * the Free Software Foundation; either version 2 of the License, or 015 * (at your option) any later version. 016 * 017 * This program is distributed in the hope that it will be useful, 018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 020 * GNU General Public License for more details. 021 * 022 * You should have received a copy of the GNU General Public License 023 * along with this program; if not, write to the Free Software 024 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 025 */ 026package ca.bc.webarts.widgets.dnd; 027 028import java.beans.*; 029 030public class FileDropBeanBeanInfo extends SimpleBeanInfo 031{ 032 033 // Properties information will be obtained from introspection.//GEN-FIRST:Properties 034 private static PropertyDescriptor[] properties = null;//GEN-HEADEREND:Properties 035 036 // Here you can add code for customizing the properties array. 037 038 //GEN-LAST:Properties 039 040 // Event set information will be obtained from introspection.//GEN-FIRST:Events 041 private static EventSetDescriptor[] eventSets = null;//GEN-HEADEREND:Events 042 043 // Here you can add code for customizing the event sets array. 044 045 //GEN-LAST:Events 046 047 // Method information will be obtained from introspection.//GEN-FIRST:Methods 048 private static MethodDescriptor[] methods = null;//GEN-HEADEREND:Methods 049 050 // Here you can add code for customizing the methods array. 051 052 //GEN-LAST:Methods 053 054 private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef 055 private static java.awt.Image iconColor32 = null; 056 private static java.awt.Image iconMono16 = null; 057 private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef 058 private static String iconNameC16 = null;//GEN-BEGIN:Icons 059 private static String iconNameC32 = null; 060 private static String iconNameM16 = null; 061 private static String iconNameM32 = null;//GEN-END:Icons 062 063 private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx 064 private static int defaultEventIndex = -1;//GEN-END:Idx 065 066 067 /** 068 * Gets the bean's <code>PropertyDescriptor</code>s. 069 * 070 * @return An array of PropertyDescriptors describing the editable 071 * properties supported by this bean. May return null if the 072 * information should be obtained by automatic analysis. 073 * <p> 074 * If a property is indexed, then its entry in the result array will 075 * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. 076 * A client of getPropertyDescriptors can use "instanceof" to check 077 * if a given PropertyDescriptor is an IndexedPropertyDescriptor. 078 */ 079 public PropertyDescriptor[] getPropertyDescriptors() { 080 return properties; 081 } 082 083 /** 084 * Gets the bean's <code>EventSetDescriptor</code>s. 085 * 086 * @return An array of EventSetDescriptors describing the kinds of 087 * events fired by this bean. May return null if the information 088 * should be obtained by automatic analysis. 089 */ 090 public EventSetDescriptor[] getEventSetDescriptors() { 091 return eventSets; 092 } 093 094 /** 095 * Gets the bean's <code>MethodDescriptor</code>s. 096 * 097 * @return An array of MethodDescriptors describing the methods 098 * implemented by this bean. May return null if the information 099 * should be obtained by automatic analysis. 100 */ 101 public MethodDescriptor[] getMethodDescriptors() { 102 return methods; 103 } 104 105 /** 106 * A bean may have a "default" property that is the property that will 107 * mostly commonly be initially chosen for update by human's who are 108 * customizing the bean. 109 * @return Index of default property in the PropertyDescriptor array 110 * returned by getPropertyDescriptors. 111 * <P> Returns -1 if there is no default property. 112 */ 113 public int getDefaultPropertyIndex() { 114 return defaultPropertyIndex; 115 } 116 117 /** 118 * A bean may have a "default" event that is the event that will 119 * mostly commonly be used by human's when using the bean. 120 * @return Index of default event in the EventSetDescriptor array 121 * returned by getEventSetDescriptors. 122 * <P> Returns -1 if there is no default event. 123 */ 124 public int getDefaultEventIndex() { 125 return defaultPropertyIndex; 126 } 127 128 /** 129 * This method returns an image object that can be used to 130 * represent the bean in toolboxes, toolbars, etc. Icon images 131 * will typically be GIFs, but may in future include other formats. 132 * <p> 133 * Beans aren't required to provide icons and may return null from 134 * this method. 135 * <p> 136 * There are four possible flavors of icons (16x16 color, 137 * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only 138 * support a single icon we recommend supporting 16x16 color. 139 * <p> 140 * We recommend that icons have a "transparent" background 141 * so they can be rendered onto an existing background. 142 * 143 * @param iconKind The kind of icon requested. This should be 144 * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, 145 * ICON_MONO_16x16, or ICON_MONO_32x32. 146 * @return An image object representing the requested icon. May 147 * return null if no suitable icon is available. 148 */ 149 public java.awt.Image getIcon(int iconKind) { 150 switch ( iconKind ) { 151 case ICON_COLOR_16x16: 152 if ( iconNameC16 == null ) 153 return null; 154 else { 155 if( iconColor16 == null ) 156 iconColor16 = loadImage( iconNameC16 ); 157 return iconColor16; 158 } 159 case ICON_COLOR_32x32: 160 if ( iconNameC32 == null ) 161 return null; 162 else { 163 if( iconColor32 == null ) 164 iconColor32 = loadImage( iconNameC32 ); 165 return iconColor32; 166 } 167 case ICON_MONO_16x16: 168 if ( iconNameM16 == null ) 169 return null; 170 else { 171 if( iconMono16 == null ) 172 iconMono16 = loadImage( iconNameM16 ); 173 return iconMono16; 174 } 175 case ICON_MONO_32x32: 176 if ( iconNameM32 == null ) 177 return null; 178 else { 179 if( iconNameM32 == null ) 180 iconMono32 = loadImage( iconNameM32 ); 181 return iconMono32; 182 } 183 } 184 return null; 185 } 186 187} 188 189