Changeset 44

Show
Ignore:
Timestamp:
08/08/06 13:43:51 (2 years ago)
Author:
schst
Message:

Reverted last commit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/java/net/schst/EventDispatcher/EventDispatcher.java

    r43 r44  
    108108     * @param eventName      name of the event to listen on 
    109109     * @param listener       instance of the event listener 
    110      * @throws Throwable  
    111      */ 
    112      public void addListener(String eventName, EventListener listener) throws Throwable
     110     * @throws Exception  
     111     */ 
     112     public void addListener(String eventName, EventListener listener) throws Exception
    113113         this.addListener(eventName, listener, false); 
    114114     } 
     
    120120    * @param listener       instance of the event listener 
    121121    * @param autoRemove     whether to remove the listener after the first event it has handled 
    122     * @throws Throwable  
    123     */ 
    124     public void addListener(String eventName, EventListener listener, boolean autoRemove) throws Throwable
     122    * @throws Exception  
     123    */ 
     124    public void addListener(String eventName, EventListener listener, boolean autoRemove) throws Exception
    125125        if (!this.listeners.containsKey(eventName)) { 
    126126            this.listeners.put(eventName, new EventListenerCollection()); 
     
    181181     * @param eventName      name of the event to listen on 
    182182     * @param listener       instance of the event listener 
    183      * @throws Throwable  
    184      */ 
    185      public void addGlobalListener(EventListener listener) throws Throwable
     183     * @throws Exception  
     184     */ 
     185     public void addGlobalListener(EventListener listener) throws Exception
    186186         this.addGlobalListener(listener, false); 
    187187     } 
     
    193193     * @param listener       instance of the event listener 
    194194     * @param autoRemove     whether to remove the listener after the first event it has handled 
    195      * @throws Throwable  
    196      */ 
    197      public void addGlobalListener(EventListener listener, boolean autoRemove) throws Throwable
     195     * @throws Exception  
     196     */ 
     197     public void addGlobalListener(EventListener listener, boolean autoRemove) throws Exception
    198198         this.globalListeners.addListener(listener, autoRemove); 
    199199          
     
    242242     * @param e  Event that will be triggered 
    243243     * @return   The event object 
    244      * @throws Throwable  
    245      */ 
    246      public Event triggerEvent(Event e) throws Throwable
     244     * @throws Exception  
     245     */ 
     246     public Event triggerEvent(Event e) throws Exception
    247247         return this.propagate(e, false); 
    248248     } 
     
    255255    * @param queue  Whether to queue the event 
    256256    * @return       The event object 
    257     * @throws Throwable  
    258     */ 
    259     public Event triggerEvent(Event e, boolean queue) throws Throwable
     257    * @throws Exception  
     258    */ 
     259    public Event triggerEvent(Event e, boolean queue) throws Exception
    260260        return this.propagate(e, queue); 
    261261    } 
     
    268268    * @param name   name of the event 
    269269    * @return       The Event object 
    270     * @throws Throwable  
    271     */ 
    272     public Event triggerEvent(String name) throws Throwable
     270    * @throws Exception  
     271    */ 
     272    public Event triggerEvent(String name) throws Exception
    273273        Event e = new Event(name); 
    274274        return this.propagate(e, false); 
     
    281281    * @param queue  Whether to queue the event 
    282282    * @return       The Event object 
    283     * @throws Throwable  
    284     */ 
    285     public Event triggerEvent(String name, boolean queue) throws Throwable
     283    * @throws Exception  
     284    */ 
     285    public Event triggerEvent(String name, boolean queue) throws Exception
    286286        Event e = new Event(name); 
    287287        return this.propagate(e, queue); 
     
    295295     * @param context   Context of the event 
    296296     * @return          The Event object 
    297      * @throws Throwable  
    298      */ 
    299     public Event triggerEvent(String name, boolean queue, Object context) throws Throwable
     297     * @throws Exception  
     298     */ 
     299    public Event triggerEvent(String name, boolean queue, Object context) throws Exception
    300300        Event e = new Event(name, context); 
    301301        return this.propagate(e, queue); 
     
    310310     * @param userInfo  Any additional information for the event  
    311311     * @return          The Event object 
    312      * @throws Throwable  
    313      */ 
    314     public Event triggerEvent(String name, boolean queue, Object context, Object userInfo) throws Throwable
     312     * @throws Exception  
     313     */ 
     314    public Event triggerEvent(String name, boolean queue, Object context, Object userInfo) throws Exception
    315315        Event e = new Event(name, context, userInfo); 
    316316        return this.propagate(e, queue); 
     
    324324    * @return       The modified event 
    325325    */ 
    326     private Event propagate(Event e, boolean queue) throws Throwable
     326    private Event propagate(Event e, boolean queue) throws Exception
    327327        if (this.listeners.containsKey(e.getName())) { 
    328328            EventListenerCollection col = (EventListenerCollection)this.listeners.get(e.getName()); 
  • trunk/src/main/java/net/schst/EventDispatcher/EventListener.java

    r43 r44  
    55 */ 
    66public interface EventListener { 
    7     public void handleEvent(Event e) throws Throwable
     7    public void handleEvent(Event e) throws Exception
    88} 
  • trunk/src/main/java/net/schst/EventDispatcher/EventListenerCollection.java

    r43 r44  
    3737    * @return       event 
    3838    */ 
    39     public Event propagate(Event e) throws Throwable
     39    public Event propagate(Event e) throws Exception
    4040        ArrayList<EventListener> remove = new ArrayList<EventListener>(); 
    4141        for (int i = 0; i < this.listeners.size(); i++) { 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/BlackListCheck.java

    r43 r44  
    99public class BlackListCheck implements EventListener { 
    1010 
    11     public void handleEvent(Event e) throws Throwable
     11    public void handleEvent(Event e) throws Exception
    1212        Customer temp = (Customer)e.getContext(); 
    1313        if (temp.getMandant() == 1) { 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/CallbackListener.java

    r43 r44  
    5454    * Handle the event 
    5555    */ 
    56     public void handleEvent(Event event) throws Throwable
     56    public void handleEvent(Event event) throws Exception
    5757        Class cl; 
    5858        Method me; 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/Customer.java

    r43 r44  
    2525    } 
    2626     
    27     public boolean login() throws Throwable
     27    public boolean login() throws Exception
    2828        Event e = (Event)this.disp.triggerEvent("onLogin", true, this); 
    2929        if (e.isCancelled()) { 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/DebugHandler.java

    r43 r44  
    2121     * Handle the event 
    2222     */ 
    23     public void handleEvent(Event e) throws Throwable
     23    public void handleEvent(Event e) throws Exception
    2424        System.out.println("Event caught by '" + this.name + "'"); 
    2525        System.out.println("Event-name    : " + e.getName()); 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/EchoHandler.java

    r43 r44  
    99public class EchoHandler implements EventListener { 
    1010 
    11     public void handleEvent(Event e) throws Throwable
     11    public void handleEvent(Event e) throws Exception
    1212        Customer cus = (Customer)e.getContext(); 
    1313        System.out.println("Event handled: " + e.getName() + "("+cus.getName()+")"); 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/Example1.java

    r43 r44  
    1111 */ 
    1212public class Example1 { 
    13     public static void main(String[] args) throws Throwable
     13    public static void main(String[] args) throws Exception
    1414        EventListener echo = new EchoHandler(); 
    1515        EventDispatcher disp = EventDispatcher.getInstance(); 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/Example2.java

    r43 r44  
    88 */ 
    99public class Example2 { 
    10     public static void main(String[] args) throws Throwable
     10    public static void main(String[] args) throws Exception
    1111         
    1212        Customer cus1 = new Customer(1, "Stephan Schmidt"); 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/ExampleAutoRemove.java

    r43 r44  
    99public class ExampleAutoRemove { 
    1010 
    11     public static void main(String[] args) throws Throwable
     11    public static void main(String[] args) throws Exception
    1212        EventDispatcher disp = EventDispatcher.getInstance(); 
    1313 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/ExampleGlobal.java

    r43 r44  
    1212public class ExampleGlobal { 
    1313 
    14     public static void main(String[] args) throws Throwable
     14    public static void main(String[] args) throws Exception
    1515        EventDispatcher disp = EventDispatcher.getInstance(); 
    1616 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/ExampleIntrospect.java

    r43 r44  
    1313public class ExampleIntrospect { 
    1414 
    15     public static void main(String[] args) throws Throwable
     15    public static void main(String[] args) throws Exception
    1616        EventListener echo1 = new DebugHandler(); 
    1717        EventListener echo2 = new DebugHandler(); 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/ExampleQueue.java

    r43 r44  
    99public class ExampleQueue { 
    1010 
    11     public static void main(String[] args) throws Throwable
     11    public static void main(String[] args) throws Exception
    1212        Customer cus1 = new Customer(1, "Stephan Schmidt"); 
    1313        cus1.login(); 
  • trunk/src/test/java/net/schst/EventDispatcher/Examples/ExampleRemove.java

    r43 r44  
    1111public class ExampleRemove { 
    1212 
    13     public static void main(String[] args) throws Throwable
     13    public static void main(String[] args) throws Exception
    1414        EventDispatcher disp = EventDispatcher.getInstance(); 
    1515 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/AddListenersTestCase.java

    r43 r44  
    1717         * Test method for 'net.schst.EventDispatcher.EventDispatcher.addListener(String, EventListener)' 
    1818         */ 
    19         public void testAddListenerStringEventListener() throws Throwable
     19        public void testAddListenerStringEventListener() throws Exception
    2020                this.dispatcher.addListener("onTest", new DummyEventListener()); 
    2121        } 
     
    2424         * Test method for 'net.schst.EventDispatcher.EventDispatcher.addListener(String, EventListener, boolean)' 
    2525         */ 
    26         public void testAddListenerStringEventListenerBoolean() throws Throwable
     26        public void testAddListenerStringEventListenerBoolean() throws Exception
    2727                this.dispatcher.addListener("onTest", new DummyEventListener(), true); 
    2828                this.dispatcher.addListener("onTest", new DummyEventListener(), false); 
     
    3232         * Test method for 'net.schst.EventDispatcher.EventDispatcher.addGlobalListener(EventListener)' 
    3333         */ 
    34         public void testAddGlobalListenerEventListener() throws Throwable
     34        public void testAddGlobalListenerEventListener() throws Exception
    3535                this.dispatcher.addGlobalListener(new DummyEventListener()); 
    3636        } 
     
    3939         * Test method for 'net.schst.EventDispatcher.EventDispatcher.addGlobalListener(EventListener, boolean)' 
    4040         */ 
    41         public void testAddGlobalListenerEventListenerBoolean() throws Throwable
     41        public void testAddGlobalListenerEventListenerBoolean() throws Exception
    4242                this.dispatcher.addGlobalListener(new DummyEventListener(), true); 
    4343                this.dispatcher.addGlobalListener(new DummyEventListener(), false); 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/AutoRemoveTestCase.java

    r43 r44  
    1010         * Test method for 'net.schst.EventDispatcher.EventDispatcher.addListener(String, EventListener, boolean)' 
    1111         */ 
    12         public void testAddListenerStringEventListenerBoolean() throws Throwable
     12        public void testAddListenerStringEventListenerBoolean() throws Exception
    1313                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    1414                 
     
    2525         * Test method for 'net.schst.EventDispatcher.EventDispatcher.addGlobalListener(EventListener, boolean)' 
    2626         */ 
    27         public void testAddGlobalListenerEventListenerBoolean() throws Throwable
     27        public void testAddGlobalListenerEventListenerBoolean() throws Exception
    2828                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    2929                CountCaughtEventsListener listener = new CountCaughtEventsListener(); 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/CancellingEventsTestCase.java

    r43 r44  
    2323         * Test cancelling a simple event without context 
    2424         * or user information 
    25          * @throws Throwable  
     25         * @throws Exception  
    2626         */ 
    27         public void testSimpleEvent() throws Throwable
     27        public void testSimpleEvent() throws Exception
    2828                this.dispatcher.addListener("onTest", new CancellingEventListener()); 
    2929                Event event = this.dispatcher.triggerEvent("onTest"); 
     
    3434         * Test cancelling a simple event without context 
    3535         * or user information 
    36          * @throws Throwable  
     36         * @throws Exception  
    3737         */ 
    38         public void testContextEvent() throws Throwable
     38        public void testContextEvent() throws Exception
    3939                this.dispatcher.addListener("onTest", new CancellingEventListener()); 
    4040                Event event = this.dispatcher.triggerEvent("onTest", false, new Object()); 
     
    4545         * Test cancelling a simple event without context 
    4646         * or user information 
    47          * @throws Throwable  
     47         * @throws Exception  
    4848         */ 
    49         public void testContextAndUserInfoEvent() throws Throwable
     49        public void testContextAndUserInfoEvent() throws Exception
    5050                this.dispatcher.addListener("onTest", new CancellingEventListener()); 
    5151                Event event = this.dispatcher.triggerEvent("onTest", false, new Object(), new Object()); 
     
    6060        class CancellingEventListener implements EventListener { 
    6161 
    62                 public void handleEvent(Event e) throws Throwable
     62                public void handleEvent(Event e) throws Exception
    6363                        e.cancel(); 
    6464                } 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/EventNamesTestCase.java

    r43 r44  
    99        private EventDispatcher dispatcher; 
    1010         
    11         public void setUp() { 
     11        public void setUp() throws Exception { 
     12                super.setUp(); 
    1213                this.dispatcher = EventDispatcher.getInstance(); 
    1314        } 
     
    1617         * Test method for 'net.schst.EventDispatcher.EventDispatcher.getRegisteredEventNames()' 
    1718         */ 
    18         public void testGetRegisteredEventNames() throws Throwable
     19        public void testGetRegisteredEventNames() throws Exception
    1920                this.dispatcher.addListener("onTest", new CountCaughtEventsListener()); 
    2021                this.dispatcher.addListener("onFoo", new CountCaughtEventsListener()); 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/EventQueueTestCase.java

    r43 r44  
    1111         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(Event, boolean)' 
    1212         */ 
    13         public void testTriggerEventObject() throws Throwable
     13        public void testTriggerEventObject() throws Exception
    1414                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    1515                 
     
    3939         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(String, boolean)' 
    4040         */ 
    41         public void testTriggerEventString() throws Throwable
     41        public void testTriggerEventString() throws Exception
    4242                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    4343                 
     
    6161         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(Event, boolean)' 
    6262         */ 
    63         public void testTriggerEventQueueFlag() throws Throwable
     63        public void testTriggerEventQueueFlag() throws Exception
    6464                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    6565                 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/GetEventListenersTestCase.java

    r43 r44  
    1717         * Test method for 'net.schst.EventDispatcher.EventDispatcher.getEventListeners(String)' 
    1818         */ 
    19         public void testGetEventListeners() throws Throwable
     19        public void testGetEventListeners() throws Exception
    2020                this.dispatcher.addListener("onTest", new CountCaughtEventsListener());          
    2121                TestCase.assertNotNull(this.dispatcher.getEventListeners("onTest")); 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/RemoveListenerTestCase.java

    r43 r44  
    1010         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeEventListener(String, String)' 
    1111         */ 
    12         public void testRemoveEventListenerStringString() throws Throwable
     12        public void testRemoveEventListenerStringString() throws Exception
    1313                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    1414 
     
    2424         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeEventListener(String, EventListener)' 
    2525         */ 
    26         public void testRemoveEventListenerStringEventListener() throws Throwable
     26        public void testRemoveEventListenerStringEventListener() throws Exception
    2727                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    2828 
     
    3838         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeGlobalEventListener(EventListener)' 
    3939         */ 
    40         public void testRemoveGlobalEventListenerEventListener() throws Throwable
     40        public void testRemoveGlobalEventListenerEventListener() throws Exception
    4141                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    4242 
     
    5353         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeGlobalEventListener(String)' 
    5454         */ 
    55         public void testRemoveGlobalEventListenerString() throws Throwable
     55        public void testRemoveGlobalEventListenerString() throws Exception
    5656                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    5757 
     
    6868         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeGlobalEventListener(String)' 
    6969         */ 
    70         public void testRemoveUnknownEventListenerEventListener() throws Throwable
     70        public void testRemoveUnknownEventListenerEventListener() throws Exception
    7171                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    7272 
     
    8282         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeGlobalEventListener(String)' 
    8383         */ 
    84         public void testRemoveUnknownEventListenerString() throws Throwable
     84        public void testRemoveUnknownEventListenerString() throws Exception
    8585                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    8686 
     
    9595         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeGlobalEventListener(EventListener)' 
    9696         */ 
    97         public void testRemoveUnknownGlobalEventListenerEventListener() throws Throwable
     97        public void testRemoveUnknownGlobalEventListenerEventListener() throws Exception
    9898                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    9999 
     
    107107         * Test method for 'net.schst.EventDispatcher.EventDispatcher.removeGlobalEventListener(String)' 
    108108         */ 
    109         public void testRemoveUnknownGlobalEventListenerString() throws Throwable
     109        public void testRemoveUnknownGlobalEventListenerString() throws Exception
    110110                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
    111111 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/ResetTestCase.java

    r43 r44  
    1010         * Test method for 'net.schst.EventDispatcher.EventDispatcher.reset()' 
    1111         */ 
    12         public void testReset() throws Throwable
     12        public void testReset() throws Exception
    1313 
    1414                EventDispatcher dispatcher = EventDispatcher.getDetachedInstance(); 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/TriggerEventTestCase.java

    r43 r44  
    2222         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(Event)' 
    2323         */ 
    24         public void testTriggerEventEvent() throws Throwable
     24        public void testTriggerEventEvent() throws Exception
    2525                String context = new String("context"); 
    2626                String userInfo = new String("userInfo"); 
     
    3333         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(Event, boolean)' 
    3434         */ 
    35         public void testTriggerEventEventBoolean() throws Throwable
     35        public void testTriggerEventEventBoolean() throws Exception
    3636                String context = new String("context"); 
    3737                String userInfo = new String("userInfo"); 
     
    4646         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(String)' 
    4747         */ 
    48         public void testTriggerEventString() throws Throwable
     48        public void testTriggerEventString() throws Exception
    4949                Event returned = this.dispatcher.triggerEvent("onTest"); 
    5050                TestCase.assertEquals("onTest", returned.getName()); 
     
    5454         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(String, boolean)' 
    5555         */ 
    56         public void testTriggerEventStringBoolean() throws Throwable
     56        public void testTriggerEventStringBoolean() throws Exception
    5757                Event returned = this.dispatcher.triggerEvent("onTest", false); 
    5858                TestCase.assertEquals("onTest", returned.getName()); 
     
    6464         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(String, boolean, Object)' 
    6565         */ 
    66         public void testTriggerEventStringBooleanObject() throws Throwable
     66        public void testTriggerEventStringBooleanObject() throws Exception
    6767                String context = new String("context"); 
    6868                Event returned = this.dispatcher.triggerEvent("onTest", false, context); 
     
    7575         * Test method for 'net.schst.EventDispatcher.EventDispatcher.triggerEvent(String, boolean, Object, Object)' 
    7676         */ 
    77         public void testTriggerEventStringBooleanObjectObject() throws Throwable
     77        public void testTriggerEventStringBooleanObjectObject() throws Exception
    7878                String context = new String("context"); 
    7979                String userInfo = new String("userInfo"); 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/helpers/CaptureEventListener.java

    r43 r44  
    1010        private ArrayList<Event> events = new ArrayList<Event>(); 
    1111         
    12         public void handleEvent(Event e) throws Throwable
     12        public void handleEvent(Event e) throws Exception
    1313                this.events.add(e); 
    1414        } 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/helpers/CountCaughtEventsListener.java

    r43 r44  
    88        private int caughtEvents = 0; 
    99         
    10         public void handleEvent(Event e) throws Throwable
     10        public void handleEvent(Event e) throws Exception
    1111                this.caughtEvents++; 
    1212        } 
  • trunk/src/test/java/net/schst/EventDispatcher/tests/helpers/DummyEventListener.java

    r43 r44  
    66public class DummyEventListener implements EventListener { 
    77 
    8         public void handleEvent(Event e) throws Throwable
     8        public void handleEvent(Event e) throws Exception
    99        } 
    1010}