1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.jbeans.j3d.renderer;
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
30 import javax.media.j3d.*;
31
32 import net.jbeans.bean.*;
33 import net.jbeans.j3d.util.picking.behavior.*;
34
35
36
37
38 /***
39 * Defines several bean information.
40 *
41 * @version $Revision: 1.3 $
42 * @author Masahiro Takatsuka (masa@jbeans.net)
43 * @see JBeansBeanInfo
44 */
45
46 public class RendererBeanInfo extends JBeansBeanInfo {
47 private final static Class beanClass = Renderer.class;
48
49 private static String iconColor16x16Filename = "resources/Renderer/IconColor16.gif";
50 private static String iconColor32x32Filename = "resources/Renderer/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 Renderer 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", "A component that displays Java3D obejct."
91 });
92
93 bd.setValue("helpSetName", "net/jbeans/j3d/renderer/resources/Renderer/jhelpset.hs");
94 return bd;
95 }
96
97 /***
98 * Returns PropertyDescriptors associated with a Renderer bean.
99 * <PRE>
100 * </PRE>
101 *
102 * @return PropertyDescriptor[]
103 */
104 public PropertyDescriptor[] getPropertyDescriptors() {
105
106 Object[] projectionmode = {
107 "PERSPECTIVE", new Integer(View.PERSPECTIVE_PROJECTION), "View.PERSPECTIVE_PROJECTION",
108 "PARALLEL", new Integer(View.PARALLEL_PROJECTION), "View.PARALLEL_PROJECTION"
109 };
110 Object viewingmode[] = {
111 "EXAMINE", new Integer(ManipulatableRenderer.EXAMINE), "ManipulatableRenderer.EXAMINE",
112 "WALK", new Integer(ManipulatableRenderer.WALK), "ManipulatableRenderer.WALK",
113 "FLY", new Integer(ManipulatableRenderer.FLY), "ManipulatableRenderer.FLY",
114 "PLANE", new Integer(ManipulatableRenderer.PLANE), "ManipulatableRenderer.PLANE",
115 };
116 Object lookatmode[] = {
117 "ALWAYS", new Integer(Renderer.LOOK_AT_ALWAYS), "Renderer.LOOK_AT_ALWAYS",
118 "NEVER", new Integer(Renderer.LOOK_AT_NEVER), "Renderer.LOOK_AT_NEVER",
119 "1ST OBJ", new Integer(Renderer.LOOK_AT_1ST), "Renderer.LOOK_AT_1ST",
120 };
121 Object eyepointpolicy[] = {
122 "RELATIVE_TO_SCREEN", new Integer(View.RELATIVE_TO_SCREEN), "View.RELATIVE_TO_SCREEN",
123 "RELATIVE_TO_WINDOW", new Integer(View.RELATIVE_TO_WINDOW), "View.RELATIVE_TO_WINDOW",
124 "RELATIVE_TO_FIELD_OF_VIEW", new Integer(View.RELATIVE_TO_FIELD_OF_VIEW), "View.RELATIVE_TO_FIELD_OF_VIEW",
125 "RELATIVE_TO_COEXISTENCE", new Integer(View.RELATIVE_TO_COEXISTENCE), "View.RELATIVE_TO_COEXISTENCE"
126 };
127
128 return (new PropertyDescriptor[] {
129 createPropertyDescriptor("border", new Object[] {
130 "bound", Boolean.TRUE, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the border."}),
131 createPropertyDescriptor("backgroundColor", new Object[] {
132 "bound", Boolean.TRUE, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the background color."}),
133 createPropertyDescriptor("projection", new Object[] {
134 "bound", Boolean.TRUE, "enumerationValues", projectionmode, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the projection mode."}),
135 createPropertyDescriptor("viewingMode", new Object[] {
136 "bound", Boolean.TRUE, "enumerationValues", viewingmode, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the viewingMode."}),
137 createPropertyDescriptor("dialsVisible", new Object[] {
138 "bound", Boolean.TRUE, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the visibility of dials."}),
139 createPropertyDescriptor("lookAtMode", new Object[] {
140 "bound", Boolean.TRUE, "enumerationValues", lookatmode, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the lookAtMode."}),
141 createPropertyDescriptor("windowEyepointPolicy", new Object[] {
142 "bound", Boolean.TRUE, "enumerationValues", eyepointpolicy, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the windowEyepointPolicy."}),
143 createPropertyDescriptor("eyeSeparation", new Object[] {
144 "bound", Boolean.TRUE, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the eye separation."})
145
146 });
147 }
148
149 /***
150 * Returns EventSetDescriptors associated with a Renderer bean.
151 * <PRE>
152 * </PRE>
153 *
154 * @return EventSetDescriptor[]
155 */
156 public EventSetDescriptor[] getEventSetDescriptors() {
157 try {
158 String[] pickedCommand = {"picked"};
159 EventSetDescriptor pick = new EventSetDescriptor(
160 beanClass,
161 "Object Picked",
162 PickMouseListener.class,
163 pickedCommand,
164 "addPickMouseListener",
165 "removePickMouseListener");
166 String[] selectCommand = {"selected"};
167 EventSetDescriptor select = new EventSetDescriptor(
168 beanClass,
169 "Object Selected",
170 PickMouseListener.class,
171 selectCommand,
172 "addPickMouseListener",
173 "removePickMouseListener");
174 EventSetDescriptor[] rv = {pick, select};
175 return rv;
176 } catch (IntrospectionException ie) {
177 ie.printStackTrace();
178 return null;
179 }
180 }
181 }