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.

MethodEventSource.java 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* *************************************************************************
  2. IT Mill Toolkit
  3. Development of Browser User Intarfaces Made Easy
  4. Copyright (C) 2000-2006 IT Mill Ltd
  5. *************************************************************************
  6. This product is distributed under commercial license that can be found
  7. from the product package on license/license.txt. Use of this product might
  8. require purchasing a commercial license from IT Mill Ltd. For guidelines
  9. on usage, see license/licensing-guidelines.html
  10. *************************************************************************
  11. For more information, contact:
  12. IT Mill Ltd phone: +358 2 4802 7180
  13. Ruukinkatu 2-4 fax: +358 2 4802 7181
  14. 20540, Turku email: info@itmill.com
  15. Finland company www: www.itmill.com
  16. Primary source for information and releases: www.itmill.com
  17. ********************************************************************** */
  18. package com.itmill.toolkit.event;
  19. import java.lang.reflect.Method;
  20. /** <p>Interface for classes supporting registeration of methods as event
  21. * receivers.</p>
  22. *
  23. * <p>For more information on the inheritable event mechanism
  24. * see the
  25. * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
  26. *
  27. * @author IT Mill Ltd.
  28. * @version @VERSION@
  29. * @since 3.0
  30. */
  31. public interface MethodEventSource {
  32. /** <p>Registers a new event listener with the specified activation
  33. * method to listen events generated by this component. If the
  34. * activation method does not have any arguments the event object will
  35. * not be passed to it when it's called.</p>
  36. *
  37. * <p>For more information on the inheritable event mechanism
  38. * see the
  39. * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
  40. *
  41. * @param eventType type of the listened event. Events of this type or
  42. * its subclasses activate the listener.
  43. * @param object the object instance who owns the activation method
  44. * @param method the activation method
  45. * @throws java.lang.IllegalArgumentException unless <code>method</code>
  46. * has exactly one match in <code>object</code>
  47. */
  48. public void addListener(Class eventType, Object object, Method method);
  49. /** <p>Registers a new listener with the specified activation method to
  50. * listen events generated by this component. If the activation method
  51. * does not have any arguments the event object will not be passed to it
  52. * when it's called.</p>
  53. *
  54. * <p>This version of <code>addListener</code> gets the name of the
  55. * activation method as a parameter. The actual method is reflected from
  56. * <code>object</code>, and unless exactly one match is found,
  57. * <code>java.lang.IllegalArgumentException</code> is thrown.</p>
  58. *
  59. * <p>For more information on the inheritable event mechanism
  60. * see the
  61. * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
  62. *
  63. * @param eventType type of the listened event. Events of this type or
  64. * its subclasses activate the listener.
  65. * @param object the object instance who owns the activation method
  66. * @param methodName the name of the activation method
  67. * @throws java.lang.IllegalArgumentException unless <code>method</code>
  68. * has exactly one match in <code>object</code>
  69. */
  70. public void addListener(Class eventType, Object object, String methodName);
  71. /** Removes all registered listeners matching the given parameters.
  72. * Since this method receives the event type and the listener object as
  73. * parameters, it will unregister all <code>object</code>'s methods that
  74. * are registered to listen to events of type <code>eventType</code>
  75. * generated by this component.
  76. *
  77. * <p>For more information on the inheritable event mechanism
  78. * see the
  79. * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
  80. *
  81. * @param eventType exact event type the <code>object</code> listens to
  82. * @param target target object that has registered to listen to events
  83. * of type <code>eventType</code> with one or more methods
  84. */
  85. public void removeListener(Class eventType, Object target);
  86. /** Removes one registered listener method. The given method owned by
  87. * the given object will no longer be called when the specified events
  88. * are generated by this component.
  89. *
  90. * <p>For more information on the inheritable event mechanism
  91. * see the
  92. * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
  93. *
  94. * @param eventType exact event type the <code>object</code> listens to
  95. * @param target target object that has registered to listen to events
  96. * of type <code>eventType</code> with one or more methods
  97. * @param method the method owned by <code>target</code> that's
  98. * registered to listen to events of type <code>eventType</code>
  99. */
  100. public void removeListener(Class eventType, Object target, Method method);
  101. /** <p>Removes one registered listener method. The given method owned by
  102. * the given object will no longer be called when the specified events
  103. * are generated by this component.</p>
  104. *
  105. * <p>This version of <code>removeListener</code> gets the name of the
  106. * activation method as a parameter. The actual method is reflected from
  107. * <code>target</code>, and unless exactly one match is found,
  108. * <code>java.lang.IllegalArgumentException</code> is thrown.</p>
  109. *
  110. * <p>For more information on the inheritable event mechanism
  111. * see the
  112. * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.</p>
  113. *
  114. * @param eventType exact event type the <code>object</code> listens to
  115. * @param target target object that has registered to listen to events
  116. * of type <code>eventType</code> with one or more methods
  117. * @param methodName name of the method owned by <code>target</code>
  118. * that's registered to listen to events of type <code>eventType</code>
  119. */
  120. public void removeListener(Class eventType, Object target, String methodName);
  121. }