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

java.lang.Object
  extended by net.sf.magicproject.clickable.targetable.card.CardFactory

public final class CardFactory
extends java.lang.Object

Since:
0.80
Author:
Fabrice Daugan

Field Summary
static java.awt.Color ACTIVATED_COLOR
          The color identifying the playable activated abilities.
static java.awt.Color borderColor
          The border color of all card
static int cardHeight
          Scaled height of card to display
static int cardWidth
          Scaled width of card to display
static javax.swing.JMenuItem countItem
          The "count card" item of context menu
static javax.swing.JMenuItem expandItem
          The "expand panel" item of context menu
static java.util.Map<java.lang.Integer,java.lang.String> exportedProperties
          The available properties.
static java.lang.String[] exportedTypeNames
          The available type names.
static int[] exportedTypeValues
          The available type values.
static javax.swing.JMenuItem gatherItem
          The "gathered panel" item of context menu
static java.awt.Color powerToughnessColor
          Custom colors of Power/Toughness
static Picture previewCard
          the back image of all Magic card
static java.util.Map<java.lang.Integer,java.awt.Image> propertyPictures
          The available properties pictures as Image.
static java.util.Map<java.lang.Integer,java.lang.String> propertyPicturesHTML
          The available properties pictures as Html.
static double ROTATE_SCALE
          Rotate angle * PI
static java.lang.String STR_EXPAND
          The key identifying the "expand" zone text/action.
static java.lang.String STR_GATHER
          The key identifying the "gathered" zone text/action.
static java.lang.String ttHeader
          The "header" and "cardname" topics string part of tooltip
static javax.swing.Icon WARNING_PICTURE
          The warning Icon.
 
Method Summary
static CardModel getCardModel(java.lang.String cardName)
          Return an instance of CardModel.
static CardModel getCardModel(java.lang.String cardName, java.io.InputStream inputStream)
          Return an instance of CardModel.
static float getScale()
          Returns the scale of images of cards.
static void init(java.io.InputStream inputFile)
          Read from the specified stream the state picture options.
static Picture initPreview()
          Initialize the preview card picture
static void initSettings()
          All settings defined in the properties file and relating cards are managed here.
static void saveSettings()
          Save editable string settings of cards
static void updateAllCardsUI()
          Update the scale, sizes and random angle of all cards of current game.
static void updateColor(java.lang.String colorStr)
          Update the card border's color and other UI colors requiring only a global repaint to update the UI.
static void updateScale()
          Update the scaling transformation for all cards
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STR_GATHER

public static final java.lang.String STR_GATHER
The key identifying the "gathered" zone text/action.

See Also:
Constant Field Values

STR_EXPAND

public static final java.lang.String STR_EXPAND
The key identifying the "expand" zone text/action.

See Also:
Constant Field Values

ROTATE_SCALE

public static final double ROTATE_SCALE
Rotate angle * PI

See Also:
Constant Field Values

ACTIVATED_COLOR

public static final java.awt.Color ACTIVATED_COLOR
The color identifying the playable activated abilities.


powerToughnessColor

public static java.awt.Color powerToughnessColor
Custom colors of Power/Toughness


cardHeight

public static int cardHeight
Scaled height of card to display


cardWidth

public static int cardWidth
Scaled width of card to display


borderColor

public static java.awt.Color borderColor
The border color of all card


ttHeader

public static java.lang.String ttHeader
The "header" and "cardname" topics string part of tooltip


countItem

public static javax.swing.JMenuItem countItem
The "count card" item of context menu


expandItem

public static javax.swing.JMenuItem expandItem
The "expand panel" item of context menu


gatherItem

public static javax.swing.JMenuItem gatherItem
The "gathered panel" item of context menu


exportedTypeNames

public static java.lang.String[] exportedTypeNames
The available type names.


exportedTypeValues

public static int[] exportedTypeValues
The available type values.


exportedProperties

public static java.util.Map<java.lang.Integer,java.lang.String> exportedProperties
The available properties.


propertyPicturesHTML

public static java.util.Map<java.lang.Integer,java.lang.String> propertyPicturesHTML
The available properties pictures as Html.


propertyPictures

public static java.util.Map<java.lang.Integer,java.awt.Image> propertyPictures
The available properties pictures as Image.


WARNING_PICTURE

public static final javax.swing.Icon WARNING_PICTURE
The warning Icon.


previewCard

public static Picture previewCard
the back image of all Magic card

Method Detail

initPreview

public static Picture initPreview()
Initialize the preview card picture

Returns:
the preview card picture

getCardModel

public static CardModel getCardModel(java.lang.String cardName)
Return an instance of CardModel. There is only one instance of CardModel by card having the same name.

Parameters:
cardName - the card name
Returns:
a new instance of CardModel if this card has not yet been loaded, or a shared instance.

getCardModel

public static CardModel getCardModel(java.lang.String cardName,
                                     java.io.InputStream inputStream)
Return an instance of CardModel. There is only one instance of CardModel by card withe the same name.

Parameters:
cardName - the card name
inputStream - the input stream containing the data of this card.
Returns:
a newly created instance of CardModel if this card has not yet been loaded, or a shared instance.

initSettings

public static void initSettings()
All settings defined in the properties file and relating cards are managed here. Also, initialize the tooltip headers and topics to display fastest the tooltip of card.


updateAllCardsUI

public static void updateAllCardsUI()
Update the scale, sizes and random angle of all cards of current game.


updateColor

public static void updateColor(java.lang.String colorStr)
Update the card border's color and other UI colors requiring only a global repaint to update the UI.

Parameters:
colorStr - is the new card border's color

saveSettings

public static void saveSettings()
Save editable string settings of cards


init

public static void init(java.io.InputStream inputFile)
                 throws java.io.IOException
Read from the specified stream the state picture options. The current offset of the stream must pointing on the number of state pictures.
Read from the specified stream the tooltip filters. The current offset of the stream must pointing on the number of tooltip filters.

Parameters:
inputFile - the stream containing settings.
Throws:
java.io.IOException - If some other I/O error occurs

updateScale

public static void updateScale()
Update the scaling transformation for all cards


getScale

public static float getScale()
Returns the scale of images of cards.

Returns:
the scale of images of cards.


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