/projects/batik-1.7/sources/org/apache/batik/gvt/event/EventDispatcher.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 149 lines · 22 code · 20 blank · 107 comment · 0 complexity · e7e28a30a817b1a649c82e99cfcbfa41 MD5 · raw file

  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. */
  15. package org.apache.batik.gvt.event;
  16. import java.awt.event.InputEvent;
  17. import java.awt.geom.AffineTransform;
  18. import java.util.EventListener;
  19. import java.util.EventObject;
  20. import org.apache.batik.gvt.GraphicsNode;
  21. /**
  22. * Interface for receiving and dispatching events down to a GVT tree.
  23. *
  24. * <p>Mouse events are dispatched to their "containing" node (the
  25. * GraphicsNode corresponding to the mouse event coordinate). Searches
  26. * for containment are performed from the EventDispatcher's "root"
  27. * node.</p>
  28. *
  29. * @author <a href="mailto:bill.haneman@ireland.sun.com">Bill Haneman</a>
  30. * @author <a href="mailto:tkormann@ilog.fr">Thierry Kormann</a>
  31. * @version $Id: EventDispatcher.java 475477 2006-11-15 22:44:28Z cam $ */
  32. public interface EventDispatcher {
  33. /**
  34. * Sets the root node for MouseEvent dispatch containment searches
  35. * and field selections.
  36. * @param root the root node
  37. */
  38. void setRootNode(GraphicsNode root);
  39. /**
  40. * Returns the root node for MouseEvent dispatch containment
  41. * searches and field selections.
  42. */
  43. GraphicsNode getRootNode();
  44. /**
  45. * Sets the base transform applied to MouseEvent coordinates prior
  46. * to dispatch.
  47. * @param t the affine transform
  48. */
  49. void setBaseTransform(AffineTransform t);
  50. /**
  51. * Returns the base transform applied to MouseEvent coordinates prior
  52. * to dispatch.
  53. */
  54. AffineTransform getBaseTransform();
  55. /**
  56. * Dispatched the specified event object.
  57. *
  58. * <p>Converts the EventObject to a corresponding GraphicsNodeEvent
  59. * and dispatch it to the appropriate GraphicsNode(s). If the
  60. * event is a MouseEvent the dispatch is performed to each
  61. * GraphicsNode which contains the MouseEvent coordinate, until
  62. * the event is consumed. If the event is a KeyEvent, it is
  63. * dispatched to the currently selected GraphicsNode.</p>
  64. *
  65. * @param e the event to dispatch
  66. */
  67. void dispatchEvent(EventObject e);
  68. //
  69. // Global GVT listeners support
  70. //
  71. /**
  72. * Adds the specified 'global' GraphicsNodeMouseListener which is
  73. * notified of all MouseEvents dispatched.
  74. * @param l the listener to add
  75. */
  76. void addGraphicsNodeMouseListener(GraphicsNodeMouseListener l);
  77. /**
  78. * Removes the specified 'global' GraphicsNodeMouseListener which is
  79. * notified of all MouseEvents dispatched.
  80. * @param l the listener to remove
  81. */
  82. void removeGraphicsNodeMouseListener(GraphicsNodeMouseListener l);
  83. /**
  84. * Adds the specified 'global' GraphicsNodeMouseWheelListener which is
  85. * notified of all MouseWheelEvents dispatched.
  86. * @param l the listener to add
  87. */
  88. void addGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l);
  89. /**
  90. * Removes the specified 'global' GraphicsNodeMouseWheelListener which is
  91. * notified of all MouseWheelEvents dispatched.
  92. * @param l the listener to remove
  93. */
  94. void removeGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l);
  95. /**
  96. * Adds the specified 'global' GraphicsNodeKeyListener which is
  97. * notified of all KeyEvents dispatched.
  98. * @param l the listener to add
  99. */
  100. void addGraphicsNodeKeyListener(GraphicsNodeKeyListener l);
  101. /**
  102. * Removes the specified 'global' GraphicsNodeKeyListener which is
  103. * notified of all KeyEvents dispatched.
  104. * @param l the listener to remove
  105. */
  106. void removeGraphicsNodeKeyListener(GraphicsNodeKeyListener l);
  107. /**
  108. * Returns an array of listeners that were added to this event
  109. * dispatcher and of the specified type.
  110. * @param listenerType the type of the listeners to return
  111. */
  112. EventListener [] getListeners(Class listenerType);
  113. /**
  114. * Associates all InputEvents of type <tt>e.getID()</tt>
  115. * with "incrementing" of the currently selected GraphicsNode.
  116. */
  117. void setNodeIncrementEvent(InputEvent e);
  118. /**
  119. * Associates all InputEvents of type <tt>e.getID()</tt>
  120. * with "decrementing" of the currently selected GraphicsNode.
  121. * The notion of "currently selected" GraphicsNode is used
  122. * for dispatching KeyEvents.
  123. */
  124. void setNodeDecrementEvent(InputEvent e);
  125. }