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.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.io.IOException;
25
26 import triptracker.client.net.MapSocket;
27
28
29 public class LoginController implements ActionListener {
30 private final MapSocket model;
31 private final LoginForm view;
32
33 public LoginController(MapSocket model, LoginForm view) {
34
35 this.model = model;
36 this.view = view;
37
38 // Add listeners to the view.
39 view.addLoginBtnListener(this); //new ButtonListener());
40 }
41
42 // private class ButtonListener implements ActionListener {
43 /***
44 * Invoked when an
45 */
46 public void actionPerformed(ActionEvent e) {
47 String username = view.getUsername();
48 String password = view.getPassword();
49 try {
50 model.logon(username, password);
51 } catch (IOException ioe) {
52 view.setMessage("Connection failed: " + ioe.getMessage());
53 return;
54 }
55 view.setMessage("Checking information");
56 }
57 // }
58 }