triptracker.client.net
Class GPSSocketAdapter

java.lang.Object
  extended by triptracker.client.net.GPSSocketAdapter
All Implemented Interfaces:
GPSSocketListener, SocketListener
Direct Known Subclasses:
LoginForm, MainForm, MainFormController, RoutesForm

public class GPSSocketAdapter
extends Object
implements GPSSocketListener

An abstract adapter class for receiving GPS socket events. The methods in this class are empty. This class exists as convenience for creating listener objects.

Extend this class to create a GPSSocketConnection listener and override the methods for the events of interest. (If you implement the GPSSocketListener interface, you have to define all of the methods in it. This abstract class defines null methods for them all, so you only have to define methods for events you care about.)

Create a listener object using the extended class and then register it with a GPSSocketConnection using the socket's addListener method. When the socket's status changes, the relevant method in the listener object is invoked.


Constructor Summary
GPSSocketAdapter()
           
 
Method Summary
 void connectionUpdate(ConnectionState state)
          Invoked when the connection state of the underlying socket has changed.
 void invalidMessage(String message)
          Invoked when an invalid or unsupported message is received from the server.
 void routeCreated(int routeId)
          Invoked when a route creation confirmation is received.
 void routeList(List<Route> routes)
          Invoked when a list of routes is received.
 void socketError(IOException e)
          Invoked when a socket error is encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPSSocketAdapter

public GPSSocketAdapter()
Method Detail

routeList

public void routeList(List<Route> routes)
Invoked when a list of routes is received.

Specified by:
routeList in interface GPSSocketListener
Parameters:
routes - list of routes

invalidMessage

public void invalidMessage(String message)
Invoked when an invalid or unsupported message is received from the server. This happens when the message parser method (often SocketConnection.messageHandler(String)) fails to understand the message, or if it contains invalid data.

Specified by:
invalidMessage in interface SocketListener
Parameters:
message - the message that triggered the event

socketError

public void socketError(IOException e)
Invoked when a socket error is encountered. This generally means that the socket has been closed or at least disconnected from the server.

Specified by:
socketError in interface SocketListener
Parameters:
e - the error that triggered the event

connectionUpdate

public void connectionUpdate(ConnectionState state)
Invoked when the connection state of the underlying socket has changed.

Specified by:
connectionUpdate in interface SocketListener
Parameters:
state - new connection state

routeCreated

public void routeCreated(int routeId)
Invoked when a route creation confirmation is received.

Specified by:
routeCreated in interface GPSSocketListener
Parameters:
routeId - ID of new route


Copyright © 2006 Team Trip Tracker. All Rights Reserved.