View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class GStringBeanInfo
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: GStringBeanInfo.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.modeler.scene.glyph;
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                 Implementation of class GStringBeanInfo                
35  ====================================================================*/
36  /***
37   * generally describe GStringBeanInfo in here
38   * 
39   * @version $Revision: 1.3 $
40   * @author Masahiro Takatsuka (masa@jbeans.net)
41   * @see JBeansBeanInfo
42   */
43  
44  public class GStringBeanInfo extends JBeansBeanInfo {
45      private final static Class beanClass = GString.class;
46  
47      private static String iconColor16x16Filename = "resources/GString/IconColor16.gif";
48      private static String iconColor32x32Filename = "resources/GString/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 Glyphmodeler 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 glyph source that creates Shape3D of a string."
89          });
90  		bd.setValue("hidden-state", Boolean.TRUE);
91          bd.setValue("helpSetName", "jh9gpz/j3d/modeler/scene/glyph/resources/GString/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 			"2D", new Integer(0), "GString.STRING_2D",
105 			"3D", new Integer(1), "GString.STRING_3D"
106   		};
107   		Object bobj[] = {
108 			"CENTER", new Integer(0), "Text3D.ALIGN_CENTER",
109 			"FIRST", new Integer(1), "Text3D.ALIGN_FIRST",
110 			"LAST", new Integer(2), "Text3D.ALIGN_LAST"
111   		};
112   		Object cobj[] = {
113 			"LEFT", new Integer(0), "Text3D.PATH_LEFT",
114 			"RIGHT", new Integer(1), "Text3D.PATH_RIGHT",
115 			"UP", new Integer(2), "Text3D.PATH_UP",
116 			"DOWN", new Integer(3), "Text3D.PATH_DOWN"
117   		};
118 		
119   		return (new PropertyDescriptor[] {
120   			createPropertyDescriptor("type", new Object[] {
121   				"bound", Boolean.TRUE, "enumerationValues", aobj, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Set the type of string shape3d."}),
122 			createPropertyDescriptor("font", new Object[] {
123 				"bound", Boolean.TRUE, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "The base font of String glyph."}),
124   			createPropertyDescriptor("alignment", new Object[] {
125   				"bound", Boolean.TRUE, "enumerationValues", bobj, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Alignment for Text3D."}),
126   			createPropertyDescriptor("path", new Object[] {
127   				"bound", Boolean.TRUE, "enumerationValues", cobj, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "Path for Text3D."}),
128   			createPropertyDescriptor("stringForNull", new Object[] {
129   				"bound", Boolean.TRUE, "preferred", Boolean.TRUE, "visualUpdate", Boolean.TRUE, "shortDescription", "A string to represents a null value."})
130   		});
131     }
132 	
133     /***
134 	 * Returns EventSetDescriptors associated with a GString bean.
135 	 * <PRE>
136 	 * </PRE>
137 	 * 
138 	 * @return EventSetDescriptor[]
139 	 */
140 //      public EventSetDescriptor[] getEventSetDescriptors() {
141 //  		try {
142 //  			String[] gc = {"objectCreated"};
143 //  			EventSetDescriptor geomCreated = new EventSetDescriptor(
144 //  								    GeometryModeler.class, // sourceClass
145 //  								    "Geometry", // eventSetName
146 //  								    GeometryListener.class, 
147 //  								    gc, // listenerMethodNames
148 //  								    "addGeometryListener",
149 //  								    "removeGeometryListener");
150 //  			EventSetDescriptor[] rv = {geomCreated};
151 //  			return rv;
152 //  		} catch (IntrospectionException ie) {
153 //  			ie.printStackTrace();
154 //  			return null;
155 //  		}
156 //      }
157 
158     /***
159 	 * Returns MethodDescriptors associated with a GString bean.
160 	 * this is needed for GlyphModeler (Pretentder).
161 	 * 
162 	 * @return PropertyDescriptor[]
163 	 */
164 //      public MethodDescriptor[] getMethodDescriptors() {
165 //    		return (new MethodDescriptor[] {
166 //    		});
167 //      }
168 }