1
2 package hoplugins.teamAnalyzer.ui.controller;
3
4 import hoplugins.teamAnalyzer.SystemManager;
5 import hoplugins.teamAnalyzer.manager.TeamManager;
6 import hoplugins.teamAnalyzer.vo.Team;
7
8 import java.awt.event.ActionEvent;
9 import java.awt.event.ActionListener;
10
11
12 /***
13 * Action listener for the favourite teams menu item
14 *
15 * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
16 */
17 public class FavoriteItemListener implements ActionListener {
18
19
20 /*** The favourite team */
21 Team team;
22
23
24
25 /***
26 * Creates a new FavoriteItemListener object.
27 *
28 * @param _team the team of the item
29 */
30 public FavoriteItemListener(Team _team) {
31 super();
32 team = _team;
33 }
34
35
36
37 /***
38 * Action performed event listener If item is clicked show the team in the main comboBox
39 *
40 * @param arg0 the event
41 */
42 public void actionPerformed(ActionEvent arg0) {
43 boolean isInList = TeamManager.isTeamInList(team.getTeamId());
44
45 if (!isInList) {
46 TeamManager.addFavouriteTeam(team);
47 }
48
49 Team t = TeamManager.getTeam(team.getTeamId());
50
51 SystemManager.setActiveTeam(t);
52 TeamManager.forceUpdate();
53 SystemManager.refresh();
54 }
55 }