1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package net.sf.magicproject.clickable.targetable.card;
19
20 import java.awt.event.ActionEvent;
21
22 import javax.swing.JTabbedPane;
23
24 import net.sf.magicproject.clickable.targetable.Targetable;
25 import net.sf.magicproject.clickable.targetable.TargetableFactory;
26 import net.sf.magicproject.clickable.targetable.player.Player;
27 import net.sf.magicproject.database.DatabaseFactory;
28 import net.sf.magicproject.stack.StackManager;
29 import net.sf.magicproject.token.IdZones;
30 import net.sf.magicproject.ui.MagicUIComponents;
31 import net.sf.magicproject.zone.ExpandableZone;
32 import net.sf.magicproject.zone.MZone;
33
34 /***
35 * MSystemCard.java Created on 5 mars 2004
36 *
37 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
38 * @since 0.60
39 */
40 public final class SystemCard extends MCard {
41
42 /***
43 * The unique instance of this class
44 */
45 public static SystemCard instance = new SystemCard();
46
47 /***
48 * Create a new instance of this class. Private status is there to prevent
49 * user to instanciate this class
50 */
51 private SystemCard() {
52 super();
53 this.database = DatabaseFactory.getDatabase(null, CardFactory
54 .getCardModel("system"), null);
55 idZone = IdZones.PLAY;
56 }
57
58 @Override
59 public Player getController() {
60 return StackManager.activePlayer();
61 }
62
63 @Override
64 public void actionPerformed(ActionEvent evt) {
65 final String action = evt.getActionCommand();
66 final MZone container = TargetableFactory.triggerTargetable.getContainer();
67 if (action == CardFactory.STR_GATHER || action == CardFactory.STR_EXPAND) {
68
69 ((ExpandableZone) container).toggle();
70
71
72 } else if (evt.getSource() == CardFactory.databaseCardInfoItem) {
73 ((JTabbedPane) MagicUIComponents.databasePanel.getParent())
74 .setSelectedComponent(MagicUIComponents.databasePanel);
75 }
76 }
77
78 @Override
79 public void decrementTimestampReference(int timestamp) {
80
81 }
82
83 @Override
84 public void addTimestampReference() {
85
86 }
87
88 @Override
89 public Targetable getLastKnownTargetable(int timeStamp) {
90 return this;
91 }
92
93 @Override
94 public String toString() {
95 return "system";
96 }
97 }