net.sf.magicproject.clickable.targetable.card
Class AbstractCard

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by net.sf.magicproject.clickable.Clickable
                  extended by net.sf.magicproject.clickable.targetable.Targetable
                      extended by net.sf.magicproject.clickable.targetable.card.AbstractCard
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, MonitorListener
Direct Known Subclasses:
MCard, TriggeredCard

public abstract class AbstractCard
extends Targetable
implements MonitorListener

Since:
0.1
Author:
Fabrice Daugan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 Player controller
          Player controller
 boolean reversed
          tell if this card is reversed or not, that means this card is controlled by opponent or not.
 Visibility visibility
          Indicates if this card is returned or not, that means back image is visible or not.
 
Fields inherited from class net.sf.magicproject.clickable.targetable.Targetable
cachedAbilities, controllerModifier, indirections, registerModifiers, registers
 
Fields inherited from class net.sf.magicproject.clickable.Clickable
highLightColor, isHighLighted
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
abstract  void checkAllCardsOf(Test test, java.util.List<Targetable> list, Ability ability)
          Checks all cards corresponding to this constraints
abstract  int countAllCardsOf(Test test, Ability ability, boolean canBePreempted)
          Checks all cards corresponding to the specified constraints
 java.lang.String getCardName()
          This function return the result of Component#getName().
 Player getController()
          Return the controller of this card
 DatabaseCard getDatabase()
          Return the database configuration of this card : picture, database properties (credits, language,...)
 VirtualCard getMUI()
          Return UI of this card.
 java.awt.Image getPreviewImage()
          Return the card's picture as it would be displayed in the preview panel.
abstract  java.lang.String getTooltipString()
          Return HTML tooltip string of this card.
 java.awt.Image image()
          Return the card's picture
abstract  boolean isACopy()
          Indicates if the current card in the stack is a copy or not
 boolean isCard()
          return true if this targetable is a card
 void mouseEntered(java.awt.event.MouseEvent e)
          is called when mouse is on this card, will disp a preview
 void mouseExited(java.awt.event.MouseEvent e)
           
 void moveCard(int newIdPlace, Player newController, boolean newIsTapped, int idPosition)
          Move this card to a new place tapped or not under the control of a player
 boolean needReverse()
          Is this card need to be reversed to suit to the player view.
 void notifyChange()
          Notify this listener that the listen content has been updated.
 void reverse(boolean reversed)
          Reverse this card if the specified parameter is true
 void reverseAsNeeded()
          Reverse this card if controller is not you
 java.awt.Image scaledImage()
          Return the scaled card's picture
 java.lang.String toString()
          return the card's name
 
Methods inherited from class net.sf.magicproject.clickable.targetable.Targetable
actionPerformed, addModifier, addModifier, addPrivateNamedObject, addTimestampReference, clearDamages, clearPrivateNamedObject, decrementTimestampReference, getCreator, getId, getLastKnownTargetable, getOriginalTargetable, getPrivateNamedObject, getPrivateNamedObjects, getTimestamp, getValue, getValueIndirection, isAbility, isPlayer, isSpell, removeModifier, removeModifier, removePrivateNamedObject, setCreator, targetize, targetize, tokenize
 
Methods inherited from class net.sf.magicproject.clickable.Clickable
disHighLight, disHighlight, highLight, mouseClicked, mousePressed, mouseReleased, sendClickToOpponent
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reversed

public boolean reversed
tell if this card is reversed or not, that means this card is controlled by opponent or not. A card in side, stack or under your control is not reversed.


visibility

public Visibility visibility
Indicates if this card is returned or not, that means back image is visible or not.


controller

public Player controller
Player controller

Method Detail

isCard

public boolean isCard()
return true if this targetable is a card

Specified by:
isCard in class Targetable
Returns:
true if this targetable is a card

countAllCardsOf

public abstract int countAllCardsOf(Test test,
                                    Ability ability,
                                    boolean canBePreempted)
Checks all cards corresponding to the specified constraints

Parameters:
test - applied to count valid cards
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
canBePreempted - true if the valid targets can be derterminated before runtime.
Returns:
amount of card matching with the specified test

checkAllCardsOf

public abstract void checkAllCardsOf(Test test,
                                     java.util.List<Targetable> list,
                                     Ability ability)
Checks all cards corresponding to this constraints

Parameters:
test - applied to count valid cards
list - the list containing the founded cards
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.

moveCard

public void moveCard(int newIdPlace,
                     Player newController,
                     boolean newIsTapped,
                     int idPosition)
Move this card to a new place tapped or not under the control of a player

Parameters:
newIdPlace - the new place for this card
newController - new controler of this card. If null, the controler is the owner.
newIsTapped - dertermines if this card will come tapped or not
idPosition - from IdPositions

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener
Overrides:
mouseExited in class Clickable

getTooltipString

public abstract java.lang.String getTooltipString()
Return HTML tooltip string of this card.

Returns:
HTML tooltip string of this card.

reverseAsNeeded

public void reverseAsNeeded()
Reverse this card if controller is not you


needReverse

public boolean needReverse()
Is this card need to be reversed to suit to the player view.

Returns:
true if this card need to be reversed to suit to the player view.

reverse

public void reverse(boolean reversed)
Reverse this card if the specified parameter is true

Parameters:
reversed - if true the card will be tured as if your controled controls it

image

public java.awt.Image image()
Return the card's picture

Returns:
the card's picture

scaledImage

public java.awt.Image scaledImage()
Return the scaled card's picture

Returns:
the scaled card's picture

notifyChange

public final void notifyChange()
Description copied from interface: MonitorListener
Notify this listener that the listen content has been updated.

Specified by:
notifyChange in interface MonitorListener

getPreviewImage

public final java.awt.Image getPreviewImage()
Return the card's picture as it would be displayed in the preview panel. May be different from the displayed picture.

Returns:
the card's picture as it would be displayed in the preview panel.

toString

public java.lang.String toString()
return the card's name

Specified by:
toString in class Targetable
Returns:
the card's name

isACopy

public abstract boolean isACopy()
Indicates if the current card in the stack is a copy or not

Returns:
true if the current card in the stack is a copy or not

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
is called when mouse is on this card, will disp a preview

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Overrides:
mouseEntered in class Clickable
Parameters:
e - is the mouse event

getController

public Player getController()
Return the controller of this card

Returns:
the controller of this card

getCardName

public final java.lang.String getCardName()
This function return the result of Component#getName(). Return the english name, not the localized one.

Returns:
the result of Component#getName()

getDatabase

public final DatabaseCard getDatabase()
Return the database configuration of this card : picture, database properties (credits, language,...)

Returns:
database configuration of this card

getMUI

public VirtualCard getMUI()
Return UI of this card.

Returns:
UI of this card.


Copyright © 2003-2007 Magic-Project. All Rights Reserved.