net.sf.magicproject.database
Class DatabaseCard

java.lang.Object
  extended by net.sf.magicproject.database.DatabaseCard

public class DatabaseCard
extends java.lang.Object

Since:
0.90
Author:
Fabrice Daugan

Constructor Summary
DatabaseCard(CardModel cardModel, Proxy dataProxy, Proxy... pictureProxies)
          Create new instance of DatabaseCard.
 
Method Summary
 void add(TranslatableData data)
          Add a translatable data to this database.
 DatabaseCard clone()
           
 DatabaseCard clone(CardModel cardModel)
          Return a clone of this object from the given card model.
 DatabaseCard clone(java.lang.String pictureName)
          Create a new instance of DatabaseCard with a picture different form the standard one (relative to card name).
 CardModel getCardModel()
          Return the card model of this card.
 java.lang.String getCardName()
          The card name.
 Proxy getDataProxy()
          Return the proxy used to build this object.
 java.awt.Image getImage(AbstractCard card)
          Return the card's picture as it would be displayed in the board.
 java.awt.Image getImage(MonitorListener listener)
          Return the card's picture as it would be displayed in the board.
 java.lang.String getLocalName()
          Return the localized card's name.
 Proxy[] getPictureProxies()
          Return the proxies used to display picture of this object.
 Proxy getPictureProxy()
          Return the proxy used to display picture of this object.
 java.lang.String getPictureStream()
          Return the stream description used to build the picture by this database object.
 java.lang.String getProperty(java.lang.String property)
          Return the translated data associated to the named property.
 java.lang.String getRulesCredit()
          Return XML rule designer of the card.
 java.awt.Image getScaledImage(AbstractCard card)
          Return the scaled card's picture as it would be displayed in the board.
 java.awt.Image getScaledImage(MonitorListener listener)
          Return the scaled card's picture as it would be displayed in the board.
 boolean isConsistent()
          Return the new score of this database.
 void setConsistent(boolean consistent)
          Set the consistence of this database.
 void setPictureProxies(Proxy... pictureProxies)
          Set the proxy used to display picture of this object.
 java.lang.String toString()
           
 void updateMUI()
          Reset the bufferised data.
 void updatePaintNotification(MCard card, java.awt.Graphics g)
          This method update and paint on the given card, the progressbar of task of the image attached to this model.
 void updatePaintNotification(MonitorListener listener, java.awt.Graphics g)
          This method update and paint on the given listener, the progressbar of task of the image attached to this model.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatabaseCard

public DatabaseCard(CardModel cardModel,
                    Proxy dataProxy,
                    Proxy... pictureProxies)
Create new instance of DatabaseCard.

Parameters:
cardModel - the card model containing card name used as id
dataProxy - the proxy where this data came from. If is null, the picture would be get using the default art URL.
pictureProxies - the proxies used to get image. If is null, dataProxy would be used.
Method Detail

getCardModel

public CardModel getCardModel()
Return the card model of this card.

Returns:
the card model of this card.

getDataProxy

public Proxy getDataProxy()
Return the proxy used to build this object.

Returns:
the proxy used to build this object.

getPictureProxy

public Proxy getPictureProxy()
Return the proxy used to display picture of this object. If is null, dataProxy will be used.

Returns:
the proxy used to display picture of this object. If is null, dataProxy will be used.

getPictureProxies

public Proxy[] getPictureProxies()
Return the proxies used to display picture of this object. If is null, dataProxy will be used.

Returns:
the proxies used to display picture of this object. If is null, dataProxy will be used.

getCardName

public java.lang.String getCardName()
The card name. Is considered as id. Return the english name, not the localized one.

Returns:
the card name. Is considered as id.
See Also:
CardModel.getCardName()

getLocalName

public java.lang.String getLocalName()
Return the localized card's name.

Returns:
the localized card's name.
See Also:
CardModel.getLocalName()

getRulesCredit

public java.lang.String getRulesCredit()
Return XML rule designer of the card.

Returns:
XML rule designer of the card.
See Also:
CardModel.getRulesCredit()

add

public void add(TranslatableData data)
Add a translatable data to this database.

Parameters:
data - translatable data to add.

getImage

public java.awt.Image getImage(AbstractCard card)
Return the card's picture as it would be displayed in the board.

Parameters:
card - the card requesting it's picture.
Returns:
the card's picture as it would be displayed in the board.

getScaledImage

public java.awt.Image getScaledImage(AbstractCard card)
Return the scaled card's picture as it would be displayed in the board.

Parameters:
card - the card requesting it's picture.
Returns:
the scaled card's picture as it would be displayed in the board.

getImage

public java.awt.Image getImage(MonitorListener listener)
Return the card's picture as it would be displayed in the board.

Parameters:
listener - the listener to notify when the picture will be completely loaded.
Returns:
the card's picture as it would be displayed in the board.

getScaledImage

public java.awt.Image getScaledImage(MonitorListener listener)
Return the scaled card's picture as it would be displayed in the board.

Parameters:
listener - the listener to notify when the picture will be completely loaded.
Returns:
the scaled card's picture as it would be displayed in the board.

getPictureStream

public java.lang.String getPictureStream()
Return the stream description used to build the picture by this database object.

Returns:
the stream description used to buid the picture by this database object.

clone

public DatabaseCard clone(java.lang.String pictureName)
Create a new instance of DatabaseCard with a picture different form the standard one (relative to card name). No proxy would be used for this new instance.
The given picture is immediatly loaded.

Parameters:
pictureName - the picture to use with this DatabaseCard
Returns:
a clone of this instance, without proxy and with the specified picture loaded immediatly.

clone

public DatabaseCard clone()
Overrides:
clone in class java.lang.Object

clone

public DatabaseCard clone(CardModel cardModel)
Return a clone of this object from the given card model.

Parameters:
cardModel -
Returns:
a clone of this object from the given card model.

getProperty

public java.lang.String getProperty(java.lang.String property)
Return the translated data associated to the named property.

Parameters:
property - the property name.
Returns:
the translated data associated to the named property.

setPictureProxies

public void setPictureProxies(Proxy... pictureProxies)
Set the proxy used to display picture of this object. If is null, dataProxy will be used.

Parameters:
pictureProxies - the new proxies used for picture. Order corresponds to prefereence.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setConsistent

public void setConsistent(boolean consistent)
Set the consistence of this database.

Parameters:
consistent - the new consistence of this database.

isConsistent

public boolean isConsistent()
Return the new score of this database.

Returns:
true if this database is consistent.

updatePaintNotification

public void updatePaintNotification(MCard card,
                                    java.awt.Graphics g)
This method update and paint on the given card, the progressbar of task of the image attached to this model.

Parameters:
card - the listener to manage.
g - the graphics used to paint the progressbar.

updatePaintNotification

public void updatePaintNotification(MonitorListener listener,
                                    java.awt.Graphics g)
This method update and paint on the given listener, the progressbar of task of the image attached to this model.

Parameters:
listener - the listener to manage.
g - the graphics used to paint the progressbar.

updateMUI

public void updateMUI()
Reset the bufferised data.



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