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.modeler.scene;
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 net.jbeans.bean.*;
31 import net.jbeans.j3d.event.*;
32
33
34
35
36 /***
37 * generally describe ImageModelerBeanInfo in here
38 *
39 * @version $Revision: 1.3 $
40 * @author Masahiro Takatsuka (masa@jbeans.net)
41 * @see JBeansBeanInfo
42 */
43
44 public class ImageModelerBeanInfo extends JBeansBeanInfo {
45 private final static Class beanClass = ImageModeler.class;
46
47 private static String iconColor16x16Filename = "resources/ImageModeler/IconColor16.gif";
48 private static String iconColor32x32Filename = "resources/ImageModeler/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 Imagemodeler 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", "A component that creates image model."
89 });
90 bd.setValue("hidden-state", Boolean.TRUE);
91 bd.setValue("helpSetName", "net/jbeans/j3d/modeler/scene/resources/ImageModeler/jhelpset.hs");
92 return bd;
93 }
94
95 /***
96 * Returns PropertyDescriptors associated with a DEM bean.
97 * <PRE>
98 * </PRE>
99 *
100 * @return PropertyDescriptor[]
101 */
102 public PropertyDescriptor[] getPropertyDescriptors() {
103 Object aobj[] = {
104 "FASTEST", new Integer(0), "TransparencyAttributes.FASTEST",
105 "NICEST", new Integer(1), "TransparencyAttributes.NICEST",
106 "BLENDED", new Integer(2), "TransparencyAttributes.BLENDED",
107 "SCREEN_DOOR", new Integer(3), "TransparencyAttributes.SCREEN_DOOR",
108 "NONE", new Integer(4), "TransparencyAttributes.NONE"
109 };
110 Object bobj[] = {
111
112
113 "MODULATE", new Integer(2), "TextureAttributes.MODULATE",
114 "DECAL", new Integer(3), "TextureAttributes.DECAL",
115 "BLEND", new Integer(4), "TextureAttributes.BLEND",
116 "REPLACE", new Integer(5), "TextureAttributes.REPLACE"
117 };
118 return (new PropertyDescriptor[] {
119 createPropertyDescriptor("byReference", new Object[] {
120 "bound", Boolean.TRUE, HIDDEN, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the BY_REFERENCE flag."}),
121 createPropertyDescriptor("transparencyMode", new Object[] {
122 "bound", Boolean.TRUE, "enumerationValues", aobj, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the mode of transparency."}),
123 createPropertyDescriptor("transparencyValue", new Object[] {
124 "bound", Boolean.TRUE, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the value of transparency."}),
125 createPropertyDescriptor("textureMode", new Object[] {
126 "bound", Boolean.TRUE, "enumerationValues", bobj, PREFERRED, Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the texture mode."}),
127 });
128 }
129
130 /***
131 * Returns EventSetDescriptors associated with a ImageModeler bean.
132 * <PRE>
133 * </PRE>
134 *
135 * @return EventSetDescriptor[]
136 */
137 /***
138 * Returns EventSetDescriptors associated with a GlyphModeler bean.
139 * <PRE>
140 * </PRE>
141 *
142 * @return EventSetDescriptor[]
143 */
144 public EventSetDescriptor[] getEventSetDescriptors() {
145 try {
146 String[] gc = {"objectCreated"};
147 EventSetDescriptor sceneCreated = new EventSetDescriptor(
148 SceneModeler.class,
149 "Scene",
150 SceneGraphObjectListener.class,
151 gc,
152 "addSceneListener",
153 "removeSceneListener");
154 EventSetDescriptor[] rv = {sceneCreated};
155 return rv;
156 } catch (IntrospectionException ie) {
157 ie.printStackTrace();
158 return null;
159 }
160 }
161 }