View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class RenderingAttributesBeanInfo
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: RenderingAttributesBeanInfo.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 net.jbeans.bean.*;
32  
33  /*====================================================================
34           Implementation of class RenderingAttributesBeanInfo          
35  ====================================================================*/
36  /***
37   * generally describe RenderingAttributesBeanInfo in here
38   * 
39   * @version $Revision: 1.3 $
40   * @author Masahiro Takatsuka (masa@jbeans.net)
41   * @see JBeansBeanInfo
42   */
43  
44  public final class RenderingAttributesBeanInfo extends JBeansBeanInfo {
45      private final static Class beanClass = RenderingAttributes.class;
46  	
47  	private static String iconColor16x16Filename = "resources/RenderingAttributes/IconColor16.gif";
48  	private static String iconColor32x32Filename = "resources/RenderingAttributes/IconColor32.gif";
49  	private static String iconMono16x16Filename;
50  	private static String iconMono32x32Filename;
51  	
52  	/***
53  	* Returns a icons of the specified size.
54  	* <PRE>
55  	* </PRE>
56  	* 
57  	* @param iconKind an ID (ICON_COLOR_16x16 or ICON_COLOR_32x32)
58  	* indicating the size of the icon.
59  	* @return Image
60  	*/
61  	public Image getIcon(int iconKind) {
62  		switch (iconKind) {
63  			case BeanInfo.ICON_COLOR_16x16:
64  			  return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;
65  			case BeanInfo.ICON_COLOR_32x32:
66  			  return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;
67  			case BeanInfo.ICON_MONO_16x16:
68  			  return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null;
69  			case BeanInfo.ICON_MONO_32x32:
70  			  return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null;
71  		}
72  		return null;
73  	}
74  
75      protected PropertyDescriptor createPropertyDescriptor(String s, Object aobj[]) {
76          return super.createPropertyDescriptor(beanClass, s, aobj);
77      }
78  
79  	/***
80  	* Returns a BeanDescriptor for MtAmbientLight bean.
81  	* <PRE>
82  	* </PRE>
83  	* 
84  	* @return BeanDescriptor
85  	*/
86      public BeanDescriptor getBeanDescriptor() {
87          BeanDescriptor bd = createBeanDescriptor(beanClass, new Object[] {
88              "preferred", Boolean.TRUE, "isContainer", Boolean.FALSE, "shortDescription", " rendering attribute component."
89          });
90  		//bd.setValue("hidden-state", Boolean.TRUE);
91          bd.setValue("helpSetName", "net/jbeans/j3d/scenegraph/resources/RenderingAttributes/jhelpset.hs");
92  		return bd;
93      }
94  	
95  	/***
96  	 * Returns PropertyDescriptors associated with a MtAmbientLight bean.
97  	 * <PRE>
98  	 * </PRE>
99  	 * 
100 	 * @return PropertyDescriptor[]
101 	 */
102    	public PropertyDescriptor[] getPropertyDescriptors() {
103   		Object alphaTF[] = {
104 			"ALWAYS", new Integer(RenderingAttributes.ALWAYS), "RenderingAttributes.ALWAYS",
105 			"NEVER", new Integer(RenderingAttributes.NEVER), "RenderingAttributes.NEVER",
106 			"EQUAL", new Integer(RenderingAttributes.EQUAL), "RenderingAttributes.EQUAL",
107 			"NOT_EQUAL", new Integer(RenderingAttributes.NOT_EQUAL), "RenderingAttributes.NOT_EQUAL",
108 			"LESS", new Integer(RenderingAttributes.LESS), "RenderingAttributes.LESS",
109 			"LESS_OR_EQUAL", new Integer(RenderingAttributes.LESS_OR_EQUAL), "RenderingAttributes.LESS_OR_EQUAL",
110 			"GREATER", new Integer(RenderingAttributes.GREATER), "RenderingAttributes.GREATER",
111 			"GREATER_OR_EQUAL", new Integer(RenderingAttributes.GREATER_OR_EQUAL), "RenderingAttributes.GREATER_OR_EQUAL"
112   		};
113   		Object rasterOP[] = {
114 			"ROP_COPY", new Integer(RenderingAttributes.ROP_COPY), "RenderingAttributes.ROP_COPY",
115 			"ROP_XOR", new Integer(RenderingAttributes.ROP_XOR), "RenderingAttributes.ROP_XOR"
116   		};
117   		return (new PropertyDescriptor[] {
118   			createPropertyDescriptor("alphaTestFunction", new Object[] {
119   				BOUND, Boolean.TRUE, "enumerationValues", alphaTF, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the alpha test function."}),
120   			createPropertyDescriptor("alphaTestValue", new Object[] {
121  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the alpha test value."}),
122   			createPropertyDescriptor("depthBufferEnable", new Object[] {
123  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the alpha test value."}),
124 			createPropertyDescriptor("ignoreVertexColors", new Object[] {
125  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the ignoreVertexColors."}),
126   			createPropertyDescriptor("depthBufferWriteEnable", new Object[] {
127  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the depthbufferewritenable."}),
128   			createPropertyDescriptor("ignoreVertexColors", new Object[] {
129  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the ignoreVertexColors."}),
130   			createPropertyDescriptor("rasterOp", new Object[] {
131  				BOUND, Boolean.TRUE, "enumerationValues", rasterOP, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the raster operation."}),
132   			createPropertyDescriptor("rasterOpEnable", new Object[] {
133  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Enable raster operation.."}),
134   			createPropertyDescriptor("visible", new Object[] {
135  				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the visible."})
136   		});
137   	}
138 
139 	/***
140 	 * Returns EventSetDescriptors associated with a MtAmbientLight bean.
141 	 * <PRE>
142 	 * </PRE>
143 	 * 
144 	 * @return EventSetDescriptor[]
145 	 */
146   	public EventSetDescriptor[] getEventSetDescriptors() {
147 		EventSetDescriptor[] rv = {};
148 		return rv;
149   	}	
150 }