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.

EierUhrBeanInfo.java 12KB

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