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.map.ui;
21  
22  import java.awt.event.MouseAdapter;
23  import java.awt.event.MouseEvent;
24  //import java.awt.event.MouseWheelEvent;
25  //import java.awt.event.MouseWheelListener;
26  
27  /***
28   * Map client controller for Model View Controller (MVC) separation. 
29   */
30  public class MapController {
31  	private final Map view;
32  	
33  	public MapController(Map view) {
34  		this.view = view;
35  		
36  		view.addMapListener(new mapListener());
37  //		view.addMouseWheelListener(new mouseWheelListener());
38  	}
39  
40  	/*** Events when mouse button is clicked. */
41  	private class mapListener extends MouseAdapter {
42  		@Override
43  		public void mouseClicked(MouseEvent click) {
44  			view.mouseClick(click.getX(), click.getY(), click.getButton());
45  		}
46  	}
47  	
48  //	/*** Events when mouse wheel is moved. */
49  //	private class mouseWheelListener implements MouseWheelListener {
50  //		public void mouseWheelMoved(MouseWheelEvent e) {
51  //			int zoomAmount = e.getWheelRotation();
52  //			if (zoomAmount < 0) {
53  //				view.zoomIn();
54  //			} else { 
55  //				view.zoomOut();
56  //			}
57  //		}		
58  //	}
59  }