Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/dma/ihm/game/league/std/events/StdGameCalendarPlayoffFinishedEvent.java


1   package org.dma.ihm.game.league.std.events;
2   
3   import java.util.*;
4   
5   import org.dma.ihm.controller.*;
6   import org.dma.ihm.game.*;
7   import org.dma.ihm.game.calendar.events.*;
8   import org.dma.ihm.game.league.*;
9   import org.dma.ihm.game.league.std.*;
10  import org.dma.ihm.game.team.*;
11  
12  /**
13   *  StdGameCalendarPlayoffFinishedEvent When play() is started it calls the
14   *  leaguePlayoffsFinished() function in the StdLeague.
15   *
16   * @author     Bernhard von Gunten
17   * @created    December 29, 2001
18   */
19  public class StdGameCalendarPlayoffFinishedEvent extends GameCalendarEvent {
20  
21    private StdLeague league = null;
22    private int level;
23  
24  
25    /**
26     *  Constructor for the StdGameCalendarPlayoffFinishedEvent object
27     *
28     * @param  source  The source of this event
29     * @param  day     The day of this event
30     * @param  league  The league of this event
31     */
32    public StdGameCalendarPlayoffFinishedEvent(Object source, Calendar day, StdLeague league) {
33      super(source, day, "StdGameCalendarPlayoffFinishedEvent");
34      this.league = league;
35    }
36  
37  
38    /**
39     *  Returns if online is needed.
40     *
41     * @return    Returns true, because the whole playoffs are finished
42     */
43    public boolean needsOnline() {
44      return true;
45    }
46  
47  
48    /**
49     *  Returns the message (array) shown by the event listener (controller)
50     *
51     * @return    The message value
52     */
53    public String[] getMessage() {
54      Team winner = league.getLeagueFirstTeam();
55      String[] result = new String[2];
56      result[0] = Controller.getTranslation("stdleague.leagueWinner") + " " + league.getName();
57      result[1] = winner.getTeamInfo().getTeamName();
58      return result;
59    }
60  
61  
62    /**  Plays the event and calls leaguePlayoffsFinished() in the league */
63    public void play() {
64      super.play();
65      league.leaguePlayoffsFinished();
66    }
67  
68  }