ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meta...@locus.apache.org
Subject cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/event AntEvent.java BusMember.java EventBus.java
Date Wed, 15 Nov 2000 21:25:58 GMT
metasim     00/11/15 13:25:58

  Modified:    src/antidote/org/apache/tools/ant/gui/event AntEvent.java
                        BusMember.java EventBus.java
  Log:
  Changed mechanism by which BusMembers cancel event propogation so that any type
  of event can be cancelled.
  
  Revision  Changes    Path
  1.2       +1 -17     jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java
  
  Index: AntEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AntEvent.java	2000/11/03 12:04:29	1.1
  +++ AntEvent.java	2000/11/15 21:25:58	1.2
  @@ -59,7 +59,7 @@
   /**
    * Base class for all Ant specific events. Details TBD.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
   public abstract class AntEvent extends EventObject {
  @@ -85,22 +85,6 @@
           return (AppContext) getSource();
       }
   
  -	/** 
  -	 * Determine if the event has been cancelled.
  -	 * 
  -	 * @return True if cancelled, false otherwise.
  -	 */
  -	public boolean isCancelled() {
  -		return _cancelled;
  -	}
  -
  -	/** 
  -	 * Tag the event as being canceled.
  -	 * 
  -	 */
  -	public void cancel() {
  -		_cancelled = true;
  -	}
   
   	/** 
   	 * Create the appropriate default response command to this event.
  
  
  
  1.2       +5 -3      jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/BusMember.java
  
  Index: BusMember.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/BusMember.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BusMember.java	2000/11/03 12:04:30	1.1
  +++ BusMember.java	2000/11/15 21:25:58	1.2
  @@ -58,7 +58,7 @@
   /**
    * Interface for classes that want to be a member of the EventBus.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
   public interface BusMember {
  @@ -74,7 +74,9 @@
   	 * Called when an event is to be posed to the member.
   	 * 
   	 * @param event Event to post.
  -	 */
  -    public void eventPosted(EventObject event);
  +     * @return true if event should be propogated, false if
  +     * it should be cancelled.
  +     */
  +    public boolean eventPosted(EventObject event);
   
   }
  
  
  
  1.3       +7 -6      jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/EventBus.java
  
  Index: EventBus.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/EventBus.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EventBus.java	2000/11/06 12:52:47	1.2
  +++ EventBus.java	2000/11/15 21:25:58	1.3
  @@ -71,7 +71,7 @@
    * NB: This class is overly simple right now, but will eventually
    * be expanded to do better event filtering, interrupt levels, etc. 
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
   */
   public class EventBus {
  @@ -174,6 +174,7 @@
            */
           public void run() {
               synchronized(_memberSet) {
  +              outerLoop:
                   for(int i = 0; i < _memberSet.length; i++) {
                       if(_memberSet[i] == null) continue;
                       
  @@ -182,12 +183,12 @@
                           BusMember next = (BusMember) it.next();
                           BusFilter filter = next.getBusFilter();
                           if(filter == null || filter.accept(_event)) {
  -                            next.eventPosted(_event);
  +                            // If false then callee canceled the event
  +                            // propogation.
  +                            if(!next.eventPosted(_event)) {
  +                                break outerLoop;
  +                            }
                           }
  -                        // Check to see if the member cancelled the event. If so
  -                        // then don't send it on to the other members.
  -                        if(_event instanceof AntEvent &&
  -                           ((AntEvent)_event).isCancelled()) break;
                       }
                   }
               }
  
  
  

Mime
View raw message