megamek.common.net
Class ConnectionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by megamek.common.net.ConnectionEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ConnectedEvent, DisconnectedEvent, PacketReceivedEvent

public abstract class ConnectionEvent
extends java.util.EventObject

Instances of descendant classes are sent as a result of changes of the Connection state or packet arrival.

See Also:
ConnectionListener, Serialized Form

Field Summary
static int CONNECTED
           
static int DISCONNECTED
           
static int PACKET_RECEIVED
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
protected ConnectionEvent(java.lang.Object source, int type)
          Constructs connection event
 
Method Summary
 IConnection getConnection()
          Returns the connection on which the Event occured; Equivalent to the getSource()
 int getType()
          Returns the type of the event
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTED

public static final int CONNECTED
See Also:
Constant Field Values

DISCONNECTED

public static final int DISCONNECTED
See Also:
Constant Field Values

PACKET_RECEIVED

public static final int PACKET_RECEIVED
See Also:
Constant Field Values
Constructor Detail

ConnectionEvent

protected ConnectionEvent(java.lang.Object source,
                          int type)
Constructs connection event

Parameters:
source - The object on which the Event initially occurred.
type - event type
Method Detail

getType

public int getType()
Returns the type of the event

Returns:
the type of the event

getConnection

public IConnection getConnection()
Returns the connection on which the Event occured; Equivalent to the getSource()

Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject