View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class SpotLightBeanInfo
3    * 
4    * Copyright (c), 2003, Masahiro Takatsuka.
5    * All Rights Researved.
6    * 
7    * Original Author: Masahiro Takatsuka (masa@jbeans.net)
8    * $Author: takatsukam $
9    * 
10   * $Date: 2004/03/03 11:53:05 $
11   * 
12   * $Id: SpotLightBeanInfo.java,v 1.3 2004/03/03 11:53:05 takatsukam Exp $
13   * 
14   * Reference:		Document no:
15   * ___				___
16   * 
17   * To Do:
18   * ___
19   * 
20  ------------------------------------------------------------------- */
21  
22  /* --------------------------- Package ---------------------------- */
23  package net.jbeans.j3d.light;
24  
25  /* ------------------ Import classes (packages) ------------------- *//package-summary/html">class="comment"> ------------------ Import classes (packages) ------------------- *//package-summary.html">class="comment">/* ------------------ Import classes (packages) ------------------- *//package-summary.html">class="comment"> ------------------ Import classes (packages) ------------------- */
26  import java.awt.*;
27  import java.awt.event.*;
28  import java.beans.*;
29  import javax.swing.event.*;
30  
31  import net.jbeans.bean.*;
32  import net.jbeans.j3d.bean.*;
33  
34  /*====================================================================
35                Implementation of class SpotLightBeanInfo               
36  ====================================================================*/
37  /***
38   * Defines several bean information.
39   * 
40   * @version $Revision: 1.3 $
41   * @author Masahiro Takatsuka (masa@jbeans.net)
42   * @see JBeansBeanInfo
43   */
44  
45  public final class SpotLightBeanInfo extends JBeansBeanInfo {
46  	static {
47  		Class clazz = J3DBeanUtil.class;
48  	}
49      private final static Class beanClass = SpotLight.class;
50  	private static String iconColor16x16Filename = "resources/SpotLight/IconColor16.gif";
51  	private static String iconColor32x32Filename = "resources/SpotLight/IconColor32.gif";
52  	private static String iconMono16x16Filename;
53  	private static String iconMono32x32Filename;
54  	
55  	/***
56  	* Returns a icons of the specified size.
57  	* <PRE>
58  	* </PRE>
59  	* 
60  	* @param iconKind an ID (ICON_COLOR_16x16 or ICON_COLOR_32x32)
61  	* indicating the size of the icon.
62  	* @return Image
63  	*/
64  	public Image getIcon(int iconKind) {
65  		switch (iconKind) {
66  			case BeanInfo.ICON_COLOR_16x16:
67  			  return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;
68  			case BeanInfo.ICON_COLOR_32x32:
69  			  return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;
70  			case BeanInfo.ICON_MONO_16x16:
71  			  return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null;
72  			case BeanInfo.ICON_MONO_32x32:
73  			  return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null;
74  		}
75  		return null;
76  	}
77  
78      protected PropertyDescriptor createPropertyDescriptor(String s, Object aobj[]) {
79          return super.createPropertyDescriptor(beanClass, s, aobj);
80      }
81  
82  	/***
83  	* Returns a BeanDescriptor for SpotLight bean.
84  	* <PRE>
85  	* </PRE>
86  	* 
87  	* @return BeanDescriptor
88  	*/
89      public BeanDescriptor getBeanDescriptor() {
90          BeanDescriptor bd = createBeanDescriptor(beanClass, new Object[] {
91              "preferred", Boolean.TRUE, "isContainer", Boolean.FALSE, "shortDescription", "A spot light component."
92          });
93  		//bd.setValue("hidden-state", Boolean.TRUE);
94          bd.setValue("helpSetName", "net/jbeans/j3d/light/resources/SpotLight/jhelpset.hs");
95  		return bd;
96      }
97  	
98  	/***
99  	 * Returns PropertyDescriptors associated with a SpotLight bean.
100 	 * <PRE>
101 	 * </PRE>
102 	 * 
103 	 * @return PropertyDescriptor[]
104 	 */
105    	public PropertyDescriptor[] getPropertyDescriptors() {
106   		return (new PropertyDescriptor[] {
107   			createPropertyDescriptor("color", new Object[] {
108   				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the directional light's color."}),
109     			createPropertyDescriptor("position", new Object[] {
110     				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the position."}),
111     			createPropertyDescriptor("attenuation", new Object[] {
112     				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the attenuation."}),
113     			createPropertyDescriptor("direction", new Object[] {
114     				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the direction."})
115   		});
116   	}
117 
118 	/***
119 	 * Returns EventSetDescriptors associated with a SpotLight bean.
120 	 * <PRE>
121 	 * </PRE>
122 	 * 
123 	 * @return EventSetDescriptor[]
124 	 */
125   	public EventSetDescriptor[] getEventSetDescriptors() {
126 		EventSetDescriptor[] rv = {};
127 		return rv;
128   	}	
129 }