Changeset 17
- Timestamp:
- 07/21/05 10:37:15 (3 years ago)
- Files:
-
- trunk/src/net/schst/EventDispatcher/CallbackListener.java (modified) (1 diff)
- trunk/src/net/schst/EventDispatcher/EventDispatcher.java (modified) (1 diff)
- trunk/src/net/schst/EventDispatcher/EventListenerCollection.java (modified) (2 diffs)
- trunk/src/net/schst/EventDispatcher/EventListenerContainer.java (modified) (1 diff)
- trunk/src/net/schst/EventDispatcher/Examples/ExampleIntrospect.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/net/schst/EventDispatcher/CallbackListener.java
r1 r17 49 49 50 50 /** 51 * Handl 51 * Handle the event 52 52 */ 53 53 public void handleEvent(Event event) { trunk/src/net/schst/EventDispatcher/EventDispatcher.java
r16 r17 267 267 return this.listeners.keySet(); 268 268 } 269 270 /** 271 * Get all event listeners of the speficied event 272 * 273 * @param eventName 274 * @return 275 */ 276 public EventListenerCollection getEventListeners(String eventName) { 277 if (this.listeners.containsKey(eventName)) { 278 return (EventListenerCollection)this.listeners.get(eventName); 279 } 280 return new EventListenerCollection(); 281 } 269 282 } trunk/src/net/schst/EventDispatcher/EventListenerCollection.java
r11 r17 44 44 45 45 // remove the listener 46 if (container. autoRemoveEnabled()) {46 if (container.isAutoRemoveEnabled()) { 47 47 remove.add(new Integer(i)); 48 48 } … … 88 88 return null; 89 89 } 90 91 /** 92 * Get an iterator to iterate over the event listeners in this 93 * Collection 94 * 95 * @return 96 */ 97 public Iterator iterator() { 98 return this.listeners.iterator(); 99 } 90 100 } trunk/src/net/schst/EventDispatcher/EventListenerContainer.java
r4 r17 5 5 * some additional configuration for the event listener 6 6 * 7 * Currently it only stores the the autoRemove flag, 8 * but this will probably extended in future versions 9 * 7 10 * @author Stephan Schmidt <stephan.schmidt@schlund.de> 8 11 */ 9 class EventListenerContainer { 12 public class EventListenerContainer { 13 14 /** 15 * The actual event listener 16 */ 17 private EventListener listener = null; 10 18 11 private EventListener listener = null; 19 /** 20 * Whether to use autoRemove 21 */ 12 22 private boolean autoRemove = false; 13 23 24 /** 25 * Create a new event listener container based 26 * on an event listener 27 * 28 * @param listener 29 */ 14 30 public EventListenerContainer(EventListener listener) { 15 31 this.listener = listener; 16 32 } 17 33 34 /** 35 * Enable auto-remove for this listener 36 * 37 * @param enable 38 */ 18 39 public void enableAutoRemove(boolean enable) { 19 40 this.autoRemove = enable; 20 41 } 21 42 22 public boolean autoRemoveEnabled() { 43 /** 44 * Check, whether auto-remove has been enabled. 45 * 46 * @return 47 */ 48 public boolean isAutoRemoveEnabled() { 23 49 return this.autoRemove; 24 50 } 25 51 52 /** 53 * Get the event listener 54 * 55 * @return 56 */ 26 57 public EventListener getListener() { 27 58 return this.listener;
