View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class ColoringAttributesBeanInfo
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:06 $
11   * 
12   * $Id: ColoringAttributesBeanInfo.java,v 1.3 2004/03/03 11:53:06 takatsukam Exp $
13   * 
14   * Reference:		Document no:
15   * ___				___
16   * 
17   * To Do:
18   * ___
19   * 
20  ------------------------------------------------------------------- */
21  
22  /* --------------------------- Package ---------------------------- */
23  package net.jbeans.j3d.scenegraph;
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 javax.media.j3d.*;
32  
33  import net.jbeans.bean.*;
34  
35  /*====================================================================
36            Implementation of class ColoringAttributesBeanInfo          
37  ====================================================================*/
38  /***
39   * generally describe ColoringAttributesBeanInfo in here
40   * 
41   * @version $Revision: 1.3 $
42   * @author Masahiro Takatsuka (masa@jbeans.net)
43   * @see JBeansBeanInfo
44   */
45  
46  public final class ColoringAttributesBeanInfo extends JBeansBeanInfo {
47      private final static Class beanClass = ColoringAttributes.class;
48  	
49  	private static String iconColor16x16Filename = "resources/ColoringAttributes/IconColor16.gif";
50  	private static String iconColor32x32Filename = "resources/ColoringAttributes/IconColor32.gif";
51  	private static String iconMono16x16Filename;
52  	private static String iconMono32x32Filename;
53  	
54  	/***
55  	* Returns a icons of the specified size.
56  	* <PRE>
57  	* </PRE>
58  	* 
59  	* @param iconKind an ID (ICON_COLOR_16x16 or ICON_COLOR_32x32)
60  	* indicating the size of the icon.
61  	* @return Image
62  	*/
63  	public Image getIcon(int iconKind) {
64  		switch (iconKind) {
65  			case BeanInfo.ICON_COLOR_16x16:
66  			  return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;
67  			case BeanInfo.ICON_COLOR_32x32:
68  			  return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;
69  			case BeanInfo.ICON_MONO_16x16:
70  			  return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null;
71  			case BeanInfo.ICON_MONO_32x32:
72  			  return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null;
73  		}
74  		return null;
75  	}
76  
77      protected PropertyDescriptor createPropertyDescriptor(String s, Object aobj[]) {
78          return super.createPropertyDescriptor(beanClass, s, aobj);
79      }
80  
81  	/***
82  	* Returns a BeanDescriptor for MtAmbientLight bean.
83  	* <PRE>
84  	* </PRE>
85  	* 
86  	* @return BeanDescriptor
87  	*/
88      public BeanDescriptor getBeanDescriptor() {
89          BeanDescriptor bd = createBeanDescriptor(beanClass, new Object[] {
90              "preferred", Boolean.TRUE, "isContainer", Boolean.FALSE, "shortDescription", "An ambient light component."
91          });
92  		//bd.setValue("hidden-state", Boolean.TRUE);
93          bd.setValue("helpSetName", "net/jbeans/j3d/scenegraph/resources/ColoringAttributes/jhelpset.hs");
94  		return bd;
95      }
96  	
97  	/***
98  	 * Returns PropertyDescriptors associated with a MtAmbientLight bean.
99  	 * <PRE>
100 	 * </PRE>
101 	 * 
102 	 * @return PropertyDescriptor[]
103 	 */
104    	public PropertyDescriptor[] getPropertyDescriptors() {
105   		Object shademodel[] = {
106 			"FASTEST", new Integer(ColoringAttributes.FASTEST), "ColoringAttributes.FASTEST",
107 			"NICEST", new Integer(ColoringAttributes.NICEST), "ColoringAttributes.NICEST",
108 			"SHADE_FLAT", new Integer(ColoringAttributes.SHADE_FLAT), "ColoringAttributes.SHADE_FLAT",
109 			"SHADE_GOURAUD", new Integer(ColoringAttributes.SHADE_GOURAUD), "ColoringAttributes.SHADE_GOURAUD"
110   		};
111   		return (new PropertyDescriptor[] {
112   			createPropertyDescriptor("shadeModel", new Object[] {
113   				"bound", Boolean.TRUE, "enumerationValues", shademodel, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the shading model."}),
114   			createPropertyDescriptor("color", new Object[] {
115   				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the color."})
116   		});
117   	}
118 
119 	/***
120 	 * Returns EventSetDescriptors associated with a MtAmbientLight bean.
121 	 * <PRE>
122 	 * </PRE>
123 	 * 
124 	 * @return EventSetDescriptor[]
125 	 */
126   	public EventSetDescriptor[] getEventSetDescriptors() {
127 		EventSetDescriptor[] rv = {};
128 		return rv;
129   	}	
130 }