0 Replies Latest reply on Feb 16, 2007 2:52 PM by pirx

    Question on propagation of events in GraphElement

    pirx

      While looking through the current CVS source, I have a question concerning on propagation of events in GraphElement:

      // event handling ///////////////////////////////////////////////////////////
      
       public void fireEvent(String eventType, ExecutionContext executionContext) {
       Token token = executionContext.getToken();
      
       log.debug( "event '"+eventType+"' on '"+this+"' for '"+token+"'" );
      
       try {
       executionContext.setEventSource(this);
       fireAndPropagateEvent(eventType, executionContext);
       } finally {
       executionContext.setEventSource(null);
       }
       }
      
       public void fireAndPropagateEvent(String eventType, ExecutionContext executionContext) {
       // calculate if the event was fired on this element or if it was a propagated event
       boolean isPropagated = (this.equals(executionContext.getEventSource()));
      
       // execute static actions
       // .....
      }
      
       void executeActions(List actions, ExecutionContext executionContext, boolean isPropagated) {
       if (actions!=null) {
       Iterator iter = actions.iterator();
       while (iter.hasNext()) {
       Action action = (Action) iter.next();
       if ( action.acceptsPropagatedEvents()
       || (!isPropagated)
       ) {
       .....
       }
       }
       }
      


      IMO, the boolean condition

      boolean isPropagated = (this.equals(executionContext.getEventSource()));
      


      should be inverted, since when the executionContext's event source is the
      same as the surrounding graph element, then the event is not
      propagating but originating from this GraphElement. (see the lines above).

      Please correct me, when I'm wrong.

      ...roland