|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object triptracker.client.net.MapSocketAdapter
public abstract class MapSocketAdapter
An abstract adapter class for receiving map socket events. The methods in this class are empty. This class exists as convenience for creating listener objects.
Extend this class to create a MapSocketConnection listener and override the methods for the events of interest. (If you implement the MapSocketListener 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 MapSocketConnection using the socket's addListener method. When the socket's status changes, the relevant method in the listener object is invoked.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface triptracker.client.net.MapSocketListener |
---|
MapSocketListener.RouteState |
Constructor Summary | |
---|---|
MapSocketAdapter()
|
Method Summary | |
---|---|
void |
connectionUpdate(ConnectionState state)
Invoked when the connection state of the underlying socket has changed. |
void |
coordReceived(int routeId,
Coordinate coordinate)
Invoked when a coordinate is received. |
void |
coordsReceived(List<Coordinate> coords)
Invoked when buffered coordinates is received. |
void |
invalidMessage(String message)
Invoked when an invalid or unsupported message is received from the server. |
void |
routeList(List<Route> routes)
Invoked when a list of routes is received. |
void |
routeReceived(int routeId,
List<Coordinate> coordinates)
Invoked when a list of coordinates for a given route is received. |
void |
routeUpdate(int routeId,
MapSocketListener.RouteState state)
Invoked when the state of a route is changed. |
void |
socketError(IOException e)
Invoked when a socket error is encountered. |
void |
userReceived(User user)
Invoked when a rouser is received. |
void |
usersReceived(List<User> users)
Invoked when a list of registered users is received. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapSocketAdapter()
Method Detail |
---|
public void connectionUpdate(ConnectionState state)
connectionUpdate
in interface SocketListener
state
- new connection statepublic void invalidMessage(String message)
SocketConnection.messageHandler(String)
) fails to understand
the message, or if it contains invalid data.
invalidMessage
in interface SocketListener
message
- the message that triggered the eventpublic void socketError(IOException e)
socketError
in interface SocketListener
e
- the error that triggered the eventpublic void coordReceived(int routeId, Coordinate coordinate)
coordReceived
in interface MapSocketListener
routeId
- route the coordinate belongs tocoordinate
- coordinate receivedpublic void coordsReceived(List<Coordinate> coords)
coordsReceived
in interface MapSocketListener
coords
- list of coordinatespublic void routeList(List<Route> routes)
routeList
in interface MapSocketListener
routes
- list of routespublic void routeReceived(int routeId, List<Coordinate> coordinates)
routeReceived
in interface MapSocketListener
routeId
- route the list of coordinates belongs tocoordinates
- list of coordinatespublic void routeUpdate(int routeId, MapSocketListener.RouteState state)
routeUpdate
in interface MapSocketListener
routeId
- route the state change applies tostate
- the new statepublic void usersReceived(List<User> users)
usersReceived
in interface MapSocketListener
users
- list of userspublic void userReceived(User user)
userReceived
in interface MapSocketListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |