View Javadoc

1   /*
2   @See License.txt@
3    */
4   
5   package spellcast.event;
6   
7   import java.beans.*;
8   import java.io.*;
9   import spellcast.model.*;
10  
11  /***
12   * A Game Update Event contains the details of what has changed in the game.
13   * This is used to update the client's state.
14   * <p>
15   * PropertyChangeEvent's source is transient so we take a copy and store it in the source
16   * member variable.
17   *
18   * @author Barrie Treloar
19   */
20  
21  public class GameUpdateEvent
22      implements GameEvent,
23                 Serializable
24  {
25      private PropertyChangeEvent event;
26      private Id source;
27      
28      /***
29       * Create an GameUpdateEvent for the property that changed on the server.
30       * The source indicates which server object changed and the event is
31       * the details of that change.
32       */
33      public GameUpdateEvent( PropertyChangeEvent event )
34      {
35          this.event = event;
36          this.source = (Id)event.getSource();
37      }
38  
39      /***
40       * Get the value of event.
41       *
42       * @return value of event.
43       */
44      public PropertyChangeEvent getEvent() 
45      {
46          return event;
47      }
48      
49      /***
50       * Set the value of event.
51       *
52       * @param v Value to assign to event.
53       */
54      public void setEvent( PropertyChangeEvent v ) 
55      {
56          event = v;
57      }
58      
59      /***
60       * Get the value of source.
61       *
62       * @return value of source.
63       */
64      public Id getSource() 
65      {
66          return source;
67      }
68      
69      /***
70       * Set the value of source.
71       *
72       * @param v Value to assign to source.
73       */
74      public void setSource( Id v ) 
75      {
76          source = v;
77      }
78  
79  
80  }
81