View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class TransformGroupBeanInfo
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: TransformGroupBeanInfo.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.transform;
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.event.*;
33  
34  /*====================================================================
35              Implementation of class TransformGroupBeanInfo            
36  ====================================================================*/
37  /***
38   * generally describe TransformGroupBeanInfo in here
39   * 
40   * @version $Revision: 1.3 $
41   * @author Masahiro Takatsuka (masa@jbeans.net)
42   * @see JBeansBeanInfo
43   */
44  
45  public final class TransformGroupBeanInfo extends JBeansBeanInfo {
46      private final static Class beanClass = TransformGroup.class;
47  	
48  	private static String iconColor16x16Filename = "resources/TransformGroup/IconColor16.gif";
49  	private static String iconColor32x32Filename = "resources/TransformGroup/IconColor32.gif";
50  	private static String iconMono16x16Filename;
51  	private static String iconMono32x32Filename;
52  	
53  	/***
54  	* Returns a icons of the specified size.
55  	* <PRE>
56  	* </PRE>
57  	* 
58  	* @param iconKind an ID (ICON_COLOR_16x16 or ICON_COLOR_32x32)
59  	* indicating the size of the icon.
60  	* @return Image
61  	*/
62  	public Image getIcon(int iconKind) {
63  		switch (iconKind) {
64  			case BeanInfo.ICON_COLOR_16x16:
65  			  return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;
66  			case BeanInfo.ICON_COLOR_32x32:
67  			  return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;
68  			case BeanInfo.ICON_MONO_16x16:
69  			  return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null;
70  			case BeanInfo.ICON_MONO_32x32:
71  			  return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null;
72  		}
73  		return null;
74  	}
75  
76      protected PropertyDescriptor createPropertyDescriptor(String s, Object aobj[]) {
77          return super.createPropertyDescriptor(beanClass, s, aobj);
78      }
79  
80  	/***
81  	* Returns a BeanDescriptor for TransformGroup bean.
82  	* <PRE>
83  	* </PRE>
84  	* 
85  	* @return BeanDescriptor
86  	*/
87      public BeanDescriptor getBeanDescriptor() {
88          BeanDescriptor bd = createBeanDescriptor(beanClass, new Object[] {
89              "preferred", Boolean.TRUE, "isContainer", Boolean.FALSE, "shortDescription", "An BranchGourp component."
90          });
91  		//bd.setValue("hidden-state", Boolean.TRUE);
92          bd.setValue("helpSetName", "net/jbeans/j3d/transform/resources/TransformGroup/jhelpset.hs");
93  		return bd;
94      }
95  	
96  	/***
97  	 * Returns PropertyDescriptors associated with a TransformGroup bean.
98  	 * <PRE>
99  	 * </PRE>
100 	 * 
101 	 * @return PropertyDescriptor[]
102 	 */
103    	public PropertyDescriptor[] getPropertyDescriptors() {
104   		return (new PropertyDescriptor[] {
105   			createPropertyDescriptor("translation", new Object[] {
106   				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the translation component."}),
107 			createPropertyDescriptor("scale", new Object[] {
108 				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the scale compoennt."}),
109 			createPropertyDescriptor("rotXAngle", new Object[] {
110 				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the rotation angle aroung the X axis."}),
111 			createPropertyDescriptor("rotYAngle", new Object[] {
112 				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the rotation angle aroung the Y axis."}),
113 			createPropertyDescriptor("rotZAngle", new Object[] {
114 				BOUND, Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the rotation angle aroung the Z axis."})
115   		});
116   	}
117 
118 	/***
119 	 * Returns EventSetDescriptors associated with a Shape3D bean.
120 	 * <PRE>
121 	 * </PRE>
122 	 * 
123 	 * @return EventSetDescriptor[]
124 	 */
125   	public EventSetDescriptor[] getEventSetDescriptors() {
126 		try {
127   			String[] lmnames = {"objectChanged"};
128 			EventSetDescriptor objectChanged = new EventSetDescriptor(
129 									beanClass, // sourceClass
130 									"TransformGroup", // eventSetName
131 									SceneGraphObjectListener.class, 
132 									lmnames, // listenerMethodNames
133 									"addSceneGraphObjectListener",
134 									"removeSceneGraphObjectListener");
135 			EventSetDescriptor[] rv = {objectChanged};
136 			return rv;
137 		} catch (IntrospectionException ie) {
138 			ie.printStackTrace();
139 			return null;
140 		}
141   	}
142 }