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

Quick Search    Search Deep

org.zazof.jteg
Class CardController  view CardController download CardController.java

java.lang.Object
  extended byorg.zazof.jteg.CardController
All Implemented Interfaces:
java.util.EventListener, MessageListener

public class CardController
extends java.lang.Object
implements MessageListener

The CardController is the responsible entitiy of the Cards. It is a varient of the Model-view-controller scheme, but here the CardController is both the controller and the model (CardList). It implements the MessageListener interface, and will notify interested GUI objects when the cardlist is adjusted. (When a card is added or removed from the controller)


Field Summary
private  CardList $cards
           
private  int $numberOfActiveCards
           
private static boolean DEBUG
           
private  java.util.Vector listeners
           
 
Constructor Summary
CardController()
          Constructor of the controller
 
Method Summary
 void addCardControllerListener(CardControllerListener ccl)
          Adds a listener interested in the status of the CardController.
 boolean canExchange()
          Will return true if this player can currenctly exchange cards.
 void createCard(Country country)
          Will 'create' a card by activating one of the available cardobjects and by setting there values
 java.util.Enumeration getCards()
          Returns the cards
 java.lang.String[] getExchangeParams()
          Will return the necessary parameters for later creating a protocoldependent message to the server.
 int getNumberOfActiveCards()
          Returns the number of active cards (the number of cards this player has)
 java.util.Vector getSelectedCards()
          Will return an enumeration containing the cards that are selected
 void messageArrived(Message m)
          method from the MessageListener interface
 void notifyAllListeners()
          Notifies all listeners that the CardController has changed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.Vector listeners

$cards

private CardList $cards

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

$numberOfActiveCards

private int $numberOfActiveCards
Constructor Detail

CardController

public CardController()
Constructor of the controller

Method Detail

addCardControllerListener

public void addCardControllerListener(CardControllerListener ccl)
Adds a listener interested in the status of the CardController. This listener will be notified when the Cardcontroller has changed.


notifyAllListeners

public void notifyAllListeners()
Notifies all listeners that the CardController has changed


messageArrived

public void messageArrived(Message m)
method from the MessageListener interface

Specified by:
messageArrived in interface MessageListener

createCard

public void createCard(Country country)
Will 'create' a card by activating one of the available cardobjects and by setting there values


getCards

public java.util.Enumeration getCards()
Returns the cards


getNumberOfActiveCards

public int getNumberOfActiveCards()
Returns the number of active cards (the number of cards this player has)


getSelectedCards

public java.util.Vector getSelectedCards()
Will return an enumeration containing the cards that are selected


canExchange

public boolean canExchange()
Will return true if this player can currenctly exchange cards. False otherwise


getExchangeParams

public java.lang.String[] getExchangeParams()
                                     throws IllegalExchangeException
Will return the necessary parameters for later creating a protocoldependent message to the server.