You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FassadeBeanInfo.java 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package eieruhr;
  7. import java.beans.*;
  8. /**
  9. *
  10. * @author Apollo
  11. */
  12. public class FassadeBeanInfo extends SimpleBeanInfo
  13. {
  14. // Bean descriptor//GEN-FIRST:BeanDescriptor
  15. /*lazy BeanDescriptor*/
  16. private static BeanDescriptor getBdescriptor(){
  17. BeanDescriptor beanDescriptor = new BeanDescriptor ( eieruhr.Fassade.class , null ); // NOI18N//GEN-HEADEREND:BeanDescriptor
  18. // Here you can add code for customizing the BeanDescriptor.
  19. return beanDescriptor; }//GEN-LAST:BeanDescriptor
  20. // Property identifiers//GEN-FIRST:Properties
  21. private static final int PROPERTY_zahl = 0;
  22. // Property array
  23. /*lazy PropertyDescriptor*/
  24. private static PropertyDescriptor[] getPdescriptor(){
  25. PropertyDescriptor[] properties = new PropertyDescriptor[1];
  26. try {
  27. properties[PROPERTY_zahl] = new PropertyDescriptor ( "zahl", eieruhr.Fassade.class, "getZahl", "setZahl" ); // NOI18N
  28. }
  29. catch(IntrospectionException e) {
  30. e.printStackTrace();
  31. }//GEN-HEADEREND:Properties
  32. // Here you can add code for customizing the properties array.
  33. return properties; }//GEN-LAST:Properties
  34. // EventSet identifiers//GEN-FIRST:Events
  35. // EventSet array
  36. /*lazy EventSetDescriptor*/
  37. private static EventSetDescriptor[] getEdescriptor(){
  38. EventSetDescriptor[] eventSets = new EventSetDescriptor[0];//GEN-HEADEREND:Events
  39. // Here you can add code for customizing the event sets array.
  40. return eventSets; }//GEN-LAST:Events
  41. // Method identifiers//GEN-FIRST:Methods
  42. private static final int METHOD_addEigenerListener0 = 0;
  43. private static final int METHOD_addPropertyChangeListener1 = 1;
  44. private static final int METHOD_isWarten2 = 2;
  45. private static final int METHOD_isWeiterlaufen3 = 3;
  46. private static final int METHOD_removeEignerListener4 = 4;
  47. private static final int METHOD_removePropertyChangeListener5 = 5;
  48. private static final int METHOD_setaktuelleZahl6 = 6;
  49. private static final int METHOD_starten7 = 7;
  50. // Method array
  51. /*lazy MethodDescriptor*/
  52. private static MethodDescriptor[] getMdescriptor(){
  53. MethodDescriptor[] methods = new MethodDescriptor[8];
  54. try {
  55. methods[METHOD_addEigenerListener0] = new MethodDescriptor(eieruhr.Fassade.class.getMethod("addEigenerListener", new Class[] {eieruhr.TimerListener.class})); // NOI18N
  56. methods[METHOD_addEigenerListener0].setDisplayName ( "" );
  57. methods[METHOD_addPropertyChangeListener1] = new MethodDescriptor(java.awt.Container.class.getMethod("addPropertyChangeListener", new Class[] {java.lang.String.class, java.beans.PropertyChangeListener.class})); // NOI18N
  58. methods[METHOD_addPropertyChangeListener1].setDisplayName ( "" );
  59. methods[METHOD_isWarten2] = new MethodDescriptor(eieruhr.Fassade.class.getMethod("isWarten", new Class[] {})); // NOI18N
  60. methods[METHOD_isWarten2].setDisplayName ( "" );
  61. methods[METHOD_isWeiterlaufen3] = new MethodDescriptor(eieruhr.Fassade.class.getMethod("isWeiterlaufen", new Class[] {})); // NOI18N
  62. methods[METHOD_isWeiterlaufen3].setDisplayName ( "" );
  63. methods[METHOD_removeEignerListener4] = new MethodDescriptor(eieruhr.Fassade.class.getMethod("removeEignerListener", new Class[] {eieruhr.TimerListener.class})); // NOI18N
  64. methods[METHOD_removeEignerListener4].setDisplayName ( "" );
  65. methods[METHOD_removePropertyChangeListener5] = new MethodDescriptor(java.awt.Component.class.getMethod("removePropertyChangeListener", new Class[] {java.lang.String.class, java.beans.PropertyChangeListener.class})); // NOI18N
  66. methods[METHOD_removePropertyChangeListener5].setDisplayName ( "" );
  67. methods[METHOD_setaktuelleZahl6] = new MethodDescriptor(eieruhr.Fassade.class.getMethod("setaktuelleZahl", new Class[] {})); // NOI18N
  68. methods[METHOD_setaktuelleZahl6].setDisplayName ( "" );
  69. methods[METHOD_starten7] = new MethodDescriptor(eieruhr.Fassade.class.getMethod("starten", new Class[] {})); // NOI18N
  70. methods[METHOD_starten7].setDisplayName ( "" );
  71. }
  72. catch( Exception e) {}//GEN-HEADEREND:Methods
  73. // Here you can add code for customizing the methods array.
  74. return methods; }//GEN-LAST:Methods
  75. private static java.awt.Image iconColor16 = null;//GEN-BEGIN:IconsDef
  76. private static java.awt.Image iconColor32 = null;
  77. private static java.awt.Image iconMono16 = null;
  78. private static java.awt.Image iconMono32 = null;//GEN-END:IconsDef
  79. private static String iconNameC16 = null;//GEN-BEGIN:Icons
  80. private static String iconNameC32 = null;
  81. private static String iconNameM16 = null;
  82. private static String iconNameM32 = null;//GEN-END:Icons
  83. private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
  84. private static final int defaultEventIndex = -1;//GEN-END:Idx
  85. //GEN-FIRST:Superclass
  86. // Here you can add code for customizing the Superclass BeanInfo.
  87. //GEN-LAST:Superclass
  88. /**
  89. * Gets the bean's <code>BeanDescriptor</code>s.
  90. *
  91. * @return BeanDescriptor describing the editable properties of this bean. May
  92. * return null if the information should be obtained by automatic analysis.
  93. */
  94. @Override
  95. public BeanDescriptor getBeanDescriptor()
  96. {
  97. return getBdescriptor();
  98. }
  99. /**
  100. * Gets the bean's <code>PropertyDescriptor</code>s.
  101. *
  102. * @return An array of PropertyDescriptors describing the editable properties
  103. * supported by this bean. May return null if the information should be
  104. * obtained by automatic analysis.
  105. * <p>
  106. * If a property is indexed, then its entry in the result array will belong to
  107. * the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of
  108. * getPropertyDescriptors can use "instanceof" to check if a given
  109. * PropertyDescriptor is an IndexedPropertyDescriptor.
  110. */
  111. @Override
  112. public PropertyDescriptor[] getPropertyDescriptors()
  113. {
  114. return getPdescriptor();
  115. }
  116. /**
  117. * Gets the bean's <code>EventSetDescriptor</code>s.
  118. *
  119. * @return An array of EventSetDescriptors describing the kinds of events
  120. * fired by this bean. May return null if the information should be obtained
  121. * by automatic analysis.
  122. */
  123. @Override
  124. public EventSetDescriptor[] getEventSetDescriptors()
  125. {
  126. return getEdescriptor();
  127. }
  128. /**
  129. * Gets the bean's <code>MethodDescriptor</code>s.
  130. *
  131. * @return An array of MethodDescriptors describing the methods implemented by
  132. * this bean. May return null if the information should be obtained by
  133. * automatic analysis.
  134. */
  135. @Override
  136. public MethodDescriptor[] getMethodDescriptors()
  137. {
  138. return getMdescriptor();
  139. }
  140. /**
  141. * A bean may have a "default" property that is the property that will mostly
  142. * commonly be initially chosen for update by human's who are customizing the
  143. * bean.
  144. *
  145. * @return Index of default property in the PropertyDescriptor array returned
  146. * by getPropertyDescriptors.
  147. * <P>
  148. * Returns -1 if there is no default property.
  149. */
  150. @Override
  151. public int getDefaultPropertyIndex()
  152. {
  153. return defaultPropertyIndex;
  154. }
  155. /**
  156. * A bean may have a "default" event that is the event that will mostly
  157. * commonly be used by human's when using the bean.
  158. *
  159. * @return Index of default event in the EventSetDescriptor array returned by
  160. * getEventSetDescriptors.
  161. * <P>
  162. * Returns -1 if there is no default event.
  163. */
  164. @Override
  165. public int getDefaultEventIndex()
  166. {
  167. return defaultEventIndex;
  168. }
  169. /**
  170. * This method returns an image object that can be used to represent the bean
  171. * in toolboxes, toolbars, etc. Icon images will typically be GIFs, but may in
  172. * future include other formats.
  173. * <p>
  174. * Beans aren't required to provide icons and may return null from this
  175. * method.
  176. * <p>
  177. * There are four possible flavors of icons (16x16 color, 32x32 color, 16x16
  178. * mono, 32x32 mono). If a bean choses to only support a single icon we
  179. * recommend supporting 16x16 color.
  180. * <p>
  181. * We recommend that icons have a "transparent" background so they can be
  182. * rendered onto an existing background.
  183. *
  184. * @param iconKind The kind of icon requested. This should be one of the
  185. * constant values ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, or
  186. * ICON_MONO_32x32.
  187. * @return An image object representing the requested icon. May return null if
  188. * no suitable icon is available.
  189. */
  190. @Override
  191. public java.awt.Image getIcon(int iconKind)
  192. {
  193. switch (iconKind)
  194. {
  195. case ICON_COLOR_16x16:
  196. if (iconNameC16 == null)
  197. {
  198. return null;
  199. }
  200. else
  201. {
  202. if (iconColor16 == null)
  203. {
  204. iconColor16 = loadImage(iconNameC16);
  205. }
  206. return iconColor16;
  207. }
  208. case ICON_COLOR_32x32:
  209. if (iconNameC32 == null)
  210. {
  211. return null;
  212. }
  213. else
  214. {
  215. if (iconColor32 == null)
  216. {
  217. iconColor32 = loadImage(iconNameC32);
  218. }
  219. return iconColor32;
  220. }
  221. case ICON_MONO_16x16:
  222. if (iconNameM16 == null)
  223. {
  224. return null;
  225. }
  226. else
  227. {
  228. if (iconMono16 == null)
  229. {
  230. iconMono16 = loadImage(iconNameM16);
  231. }
  232. return iconMono16;
  233. }
  234. case ICON_MONO_32x32:
  235. if (iconNameM32 == null)
  236. {
  237. return null;
  238. }
  239. else
  240. {
  241. if (iconMono32 == null)
  242. {
  243. iconMono32 = loadImage(iconNameM32);
  244. }
  245. return iconMono32;
  246. }
  247. default:
  248. return null;
  249. }
  250. }
  251. }