1 23 24 package org.apache.slide.event; 25 26 import java.util.EventObject ; 27 28 33 public class VetoableEventCollector implements GlobalListener { 34 private static ThreadLocal eventCollection = new ThreadLocal (); 35 36 public void vetoableEventFired(VetoableEventMethod method, EventObject event) throws VetoException { 37 if ( method == TransactionEvent.COMMIT ) { 38 if ( EventCollection.VETOABLE_COLLECTED.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(EventCollection.VETOABLE_COLLECTED, (EventCollection)eventCollection.get()); 39 } else if ( eventCollection.get() != null ) { 40 ((EventCollection)eventCollection.get()).addEvent(method, event); 41 } 42 } 43 44 public void eventFired(EventMethod method, EventObject event) { 45 if ( method == TransactionEvent.BEGIN ) { 46 eventCollection.set(new EventCollection(this)); 47 } else if ( eventCollection.get() != null ) { 48 ((EventCollection)eventCollection.get()).addEvent(method, event); 49 } 50 } 51 } | Popular Tags |