dflorey     2004/03/15 05:16:48

  Modified:    src/share/org/apache/slide/event EventCollection.java
                        TransientEventCollector.java
  Added:       src/share/org/apache/slide/event GenericEvent.java
                        GenericEventListener.java
  Log:
  Added infrastructure for enabling client side events that are dispatched via slide 
kernel.
  
  Revision  Changes    Path
  1.5       +8 -5      
jakarta-slide/src/share/org/apache/slide/event/EventCollection.java
  
  Index: EventCollection.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/event/EventCollection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EventCollection.java      25 Feb 2004 14:04:36 -0000      1.4
  +++ EventCollection.java      15 Mar 2004 13:16:48 -0000      1.5
  @@ -62,10 +62,13 @@
               if ( event.getEvent() instanceof RemoteInformation ) {
                   StringBuffer infoBuffer = new StringBuffer();
                   String[][] information = 
((RemoteInformation)event.getEvent()).getInformation();
  +                boolean first = true;
                   for ( int j = 0; j < information.length; j++ ) {
  +                    if ( !first ) infoBuffer.append(", ");
  +                    first = false;
                       
infoBuffer.append(information[j][0]).append("=").append(information[j][1]);
                   }
  -                buffer.append("["+event.getClass().getName()+" 
[name="+event.getMethod().getId()+", "+infoBuffer.toString()+"]]");
  +                buffer.append("["+event.getClass().getName()+" 
[name="+event.getMethod().getId()+", information: "+infoBuffer.toString()+"]]");
               } else {
                   buffer.append("["+event.getClass().getName()+" 
[name="+event.getMethod().getId()+"]]");
               }
  
  
  
  1.2       +4 -4      
jakarta-slide/src/share/org/apache/slide/event/TransientEventCollector.java
  
  Index: TransientEventCollector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/event/TransientEventCollector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  
  
  
  1.1                  jakarta-slide/src/share/org/apache/slide/event/GenericEvent.java
  
  Index: GenericEvent.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/event/GenericEvent.java,v 1.1 
2004/03/15 13:16:48 dflorey Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/15 13:16:48 $
   *
   * ====================================================================
   *
   * Copyright 2004 The Apache Software Foundation 
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   */
  
  package org.apache.slide.event;
  
  import java.util.EventListener;
  import java.util.EventObject;
  
  /**
   * The GenericEvent class
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Florey</a>
   */
  public class GenericEvent extends EventObject implements RemoteInformation {
      public final static EventFired EVENT_FIRED = new EventFired();
      public final static VetoableEventFired VETOABLE_EVENT_FIRED = new 
VetoableEventFired();
  
      public final static String GROUP = "generic";
      public final static AbstractEventMethod[] methods = new AbstractEventMethod[] { 
EVENT_FIRED, VETOABLE_EVENT_FIRED };
  
      private String[][] information;
  
      public GenericEvent(Object source, String[][] information) {
          super(source);
          this.information = information;
      }
  
      public String[][] getInformation() {
          return information;
      }
  
      public final static class VetoableEventFired extends VetoableEventMethod {
          public VetoableEventFired() {
              super(GROUP, "vetoableEventFired");
          }
  
          public void fireVetaoableEvent(EventListener listener, EventObject event) 
throws VetoException  {
              if ( listener instanceof GenericEventListener ) 
((GenericEventListener)listener).vetoableEventFired((GenericEvent)event);
          }
      }
  
      public final static class EventFired extends EventMethod {
          public EventFired() {
              super(GROUP, "eventFired");
          }
  
          public void fireEvent(EventListener listener, EventObject event) {
              if ( listener instanceof GenericEventListener ) 
((GenericEventListener)listener).eventFired((GenericEvent)event);
          }
      }
  }
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/event/GenericEventListener.java
  
  Index: GenericEventListener.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/event/GenericEventListener.java,v 
1.1 2004/03/15 13:16:48 dflorey Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/15 13:16:48 $
   *
   * ====================================================================
   *
   * Copyright 2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   */
  
  package org.apache.slide.event;
  
  import java.util.EventListener;
  
  /**
   * Generic event listener interface
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Florey</a>
   * @version $Revision: 1.1 $
   */
  public interface GenericEventListener extends EventListener {
      public void vetoableEventFired(GenericEvent event) throws VetoException;
  
      public void eventFired(GenericEvent event);
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to