View Javadoc

1   /*
2    * Trip Tracker, a real-time position tracking system for the Internet.
3    * Copyright (C) 2006  Team Trip Tracker
4    *
5    * This program is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License as published by the
7    * Free Software Foundation; either version 2 of the License, or (at your
8    * option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful, but
11   * WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13   * General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License along
16   * with this program; if not, write to the Free Software Foundation, Inc.,
17   * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18   */
19  
20  package triptracker.client.net;
21  
22  import java.io.IOException;
23  import java.util.List;
24  
25  import triptracker.core.ConnectionState;
26  import triptracker.core.Coordinate;
27  import triptracker.core.Route;
28  import triptracker.core.User;
29  
30  /***
31   * An abstract adapter class for receiving map socket events. The methods in
32   * this class are empty. This class exists as convenience for creating listener
33   * objects.
34   * <p>
35   * Extend this class to create a MapSocketConnection listener and override the
36   * methods for the events of interest. (If you implement the MapSocketListener
37   * interface, you have to define all of the methods in it. This abstract class
38   * defines null methods for them all, so you only have to define methods for
39   * events you care about.)
40   * <p>
41   * Create a listener object using the extended class and then register it with a
42   * MapSocketConnection using the socket's addListener method. When the socket's
43   * status changes, the relevant method in the listener object is invoked.
44   */
45  public abstract class MapSocketAdapter implements MapSocketListener {
46  
47  	/***
48  	 * {@inheritDoc}
49  	 */
50  	public void connectionUpdate(ConnectionState state) { }
51  
52  	/***
53  	 * {@inheritDoc}
54  	 */
55  	public void invalidMessage(String message) { }
56  
57  	/***
58  	 * {@inheritDoc}
59  	 */
60  	public void socketError(IOException e) { }
61  
62  	/***
63  	 * {@inheritDoc}
64  	 */
65  	public void coordReceived(int routeId, Coordinate coordinate) { }
66  
67  	/***
68  	 * {@inheritDoc}
69  	 */
70  	public void coordsReceived(List<Coordinate> coords) { }
71  	
72  	/***
73  	 * {@inheritDoc}
74  	 */
75  	public void routeList(List<Route> routes) { }
76  
77  	/***
78  	 * {@inheritDoc}
79  	 */
80  	public void routeReceived(int routeId, List<Coordinate> coordinates) { }
81  
82  	/***
83  	 * {@inheritDoc}
84  	 */
85  	public void routeUpdate(int routeId, RouteState state) { }
86  
87  	/***
88  	 * {@inheritDoc}
89  	 */
90  	public void usersReceived(List<User> users) { }
91  
92  	/***
93  	 * {@inheritDoc}
94  	 */
95  	public void userReceived(User user){ }
96  }