View Javadoc

1   /*
2    *   Magic-Project is a turn based strategy simulator
3    *   Copyright (C) 2003-2007 Fabrice Daugan
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 Free 
7    * Software Foundation; either version 2 of the License, or (at your option) any
8    * later version.
9    *
10   *   This program is distributed in the hope that it will be useful, but WITHOUT 
11   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
13   * 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   * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  package net.sf.magicproject.action.handler;
20  
21  import net.sf.magicproject.action.context.ActionContextWrapper;
22  import net.sf.magicproject.clickable.ability.Ability;
23  import net.sf.magicproject.event.context.ContextEventListener;
24  
25  /***
26   * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
27   * @since 0.86
28   */
29  public interface ChoosenAction extends Replayable {
30  
31  	/***
32  	 * No generated event. Let the active player playing this action.
33  	 * 
34  	 * @param actionContext
35  	 *          the context containing data saved by this action during the
36  	 *          'choose" proceess.
37  	 * @param ability
38  	 *          is the ability owning this test. The card component of this
39  	 *          ability should correspond to the card owning this test too.
40  	 * @param context
41  	 *          is the context attached to this action.
42  	 * @return true if the stack can be resolved just after this call.
43  	 */
44  	boolean choose(ActionContextWrapper actionContext,
45  			ContextEventListener context, Ability ability);
46  
47  	/***
48  	 * No generated event. Unset this action as current one.
49  	 * 
50  	 * @param actionContext
51  	 *          the context containing data saved by this action during the
52  	 *          'choose" proceess.
53  	 * @param ability
54  	 *          is the ability owning this test. The card component of this
55  	 *          ability should correspond to the card owning this test too.
56  	 * @param context
57  	 *          is the context attached to this action.
58  	 */
59  	void disactivate(ActionContextWrapper actionContext,
60  			ContextEventListener context, Ability ability);
61  
62  	/***
63  	 * Generate event associated to this action. Only one or several events are
64  	 * generated and may be collected by event listeners. Then play this action
65  	 * 
66  	 * @param actionContext
67  	 *          the context containing data saved by this action during the
68  	 *          'choose" proceess.
69  	 * @param ability
70  	 *          is the ability owning this test. The card component of this
71  	 *          ability should correspond to the card owning this test too.
72  	 * @param context
73  	 *          is the context attached to this action.
74  	 * @return true if the stack can be resolved just after this call.
75  	 */
76  	boolean replay(ActionContextWrapper actionContext,
77  			ContextEventListener context, Ability ability);
78  
79  	/***
80  	 * Return the HTML code representing this action. If this action is named,
81  	 * it's name will be returned. If not, if existing, the picture associated to
82  	 * this action is returned. Otherwise, built-in action's text will be
83  	 * returned.
84  	 * 
85  	 * @param ability
86  	 *          is the ability owning this test. The card component of this
87  	 *          ability should correspond to the card owning this test too.
88  	 * @return the HTML code representing this action. If this action is named,
89  	 *         it's name will be returned. If not, if existing, the picture
90  	 *         associated to this action is returned. Otherwise, built-in action's
91  	 *         text will be returned.
92  	 * @param context
93  	 *          is the context attached to this action.
94  	 * @param actionContext
95  	 *          the context of this action.
96  	 * @since 0.86
97  	 */
98  	String toHtmlString(Ability ability, ContextEventListener context,
99  			ActionContextWrapper actionContext);
100 }