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/StdGameCalendarPlayoutFinishedEvent.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   *  StdGameCalendarPlayoutFinishedEvent When play() is started it calls the
14   *  leaguePlayoutsFinished() function in the StdLeague.
15   *
16   * @author     Bernhard von Gunten
17   * @created    December 29, 2001
18   */
19  public class StdGameCalendarPlayoutFinishedEvent extends GameCalendarEvent {
20  
21    private StdLeague league = null;
22    private StdLeagueOwner owner = null;
23    private int level;
24  
25  
26    /**
27     *  Constructor for the StdGameCalendarPlayoutFinishedEvent object
28     *
29     * @param  source  The source of this event
30     * @param  day     The day of this event
31     * @param  league  The league of this event
32     */
33    public StdGameCalendarPlayoutFinishedEvent(Object source, Calendar day, StdLeague league) {
34      super(source, day, "StdGameCalendarPlayoutFinishedEvent");
35      this.league = league;
36    }
37  
38  
39    /**
40     *  Returns if online is needed
41     *
42     * @return    Returns true because the whole playouts are finished
43     */
44    public boolean needsOnline() {
45      return true;
46    }
47  
48  
49    /**
50     *  Returns the message (array) shown by the event listener (controller)
51     *
52     * @return    The message value
53     */
54    public String[] getMessage() {
55      Team loser = league.getLeagueLastTeam();
56      String[] result = new String[2];
57      result[0] = Controller.getTranslation("stdleague.leagueLoser") + " " + league.getName();
58      result[1] = loser.getTeamInfo().getTeamName();
59      return result;
60    }
61  
62  
63    /**  Plays the event and calls leaguePlayoutsFinished() on the league*/
64    public void play() {
65      super.play();
66      league.leaguePlayoutsFinished();
67    }
68  
69  }