Class DrawingKey

java.lang.Object
  |
  +--DrawingKey
All Implemented Interfaces:
java.lang.Cloneable, DrawableKey

public class DrawingKey
extends java.lang.Object
implements DrawableKey

DrawingKey implements DrawableKey for it is a specific type that draws Object keys. Its constructor needs the Object key it will draw.

See Also:
DrawableKey

Constructor Summary
DrawingKey(java.lang.Object k)
          Constructor that instantiates the DrawingIntegerKey using the given Object k.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this AffineTransform object.
 void drawKey(java.awt.Graphics2D g2)
          Draws the key, first setting all values for the Graphics2D g2.
 void drawKey(java.awt.Graphics2D g2, java.awt.geom.AffineTransform a)
          Draws the key in the given Graphics2D, using the AffineTransform passed to it.
 void fillKey(java.awt.Graphics2D g2)
          Draws the key filling the given Graphics2D.
 java.lang.Object getKey()
          Gets the Object key of the DrawableKey.
 KeySettings getSettings()
          Gets the KeySettings of the key.
 boolean isSettingsSaved()
          Returns true if the KeySettings are currently saved for the DrawingTree.
 void restoreSettings()
          Restores the settings for the tree, decrementing the count of saves by one.
 void saveSettings()
          Saves the settings for the tree, incrementing the count of saves by one and setting the previous settings accordingly.
 void setKey(java.lang.Object k)
          Sets the Object key of the DrawableKey.
 void setKeySettings(KeySettings s)
          Sets the KeySettings of the DrawableKey.
 void setSettings(KeySettings s)
          Sets the KeySettings of the DrawableKey.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawingKey

public DrawingKey(java.lang.Object k)
Constructor that instantiates the DrawingIntegerKey using the given Object k.

Parameters:
k - the Object drawn to the screen.
Method Detail

clone

public java.lang.Object clone()
Returns a copy of this AffineTransform object.

Specified by:
clone in interface DrawableKey
Overrides:
clone in class java.lang.Object
Returns:
an Object that is a copy of this AffineTransform object.

setKey

public void setKey(java.lang.Object k)
Sets the Object key of the DrawableKey.

Parameters:
k - Object key for use in drawing the key.

getKey

public java.lang.Object getKey()
Gets the Object key of the DrawableKey.

Returns:
Object key used for drawing the key.

setSettings

public void setSettings(KeySettings s)
Sets the KeySettings of the DrawableKey. These settings are used for drawing the key in a given Graphics2D.

Specified by:
setSettings in interface DrawableKey
Parameters:
s - KeySettings for use in drawing the key.

setKeySettings

public void setKeySettings(KeySettings s)
Sets the KeySettings of the DrawableKey. These settings are used for drawing the key in a given Graphics2D.

Specified by:
setKeySettings in interface DrawableKey
Parameters:
s - KeySettings for use in drawing the key.

getSettings

public KeySettings getSettings()
Gets the KeySettings of the key.

Specified by:
getSettings in interface DrawableKey
Returns:
KeySettings for use in drawing the key.

isSettingsSaved

public boolean isSettingsSaved()
Returns true if the KeySettings are currently saved for the DrawingTree.

Specified by:
isSettingsSaved in interface DrawableKey
Returns:
true if the settings are saved.

saveSettings

public void saveSettings()
Saves the settings for the tree, incrementing the count of saves by one and setting the previous settings accordingly.

Specified by:
saveSettings in interface DrawableKey

restoreSettings

public void restoreSettings()
Restores the settings for the tree, decrementing the count of saves by one. If the settings have been restored completely, than the KeySettings for the tree are set accordingly.

Specified by:
restoreSettings in interface DrawableKey

fillKey

public void fillKey(java.awt.Graphics2D g2)
Draws the key filling the given Graphics2D. The method completely fills the Graphics2D passed to it, using no AffineTransforms.

Specified by:
fillKey in interface DrawableKey
Parameters:
g2 - Graphics2D that fills with the key.

drawKey

public void drawKey(java.awt.Graphics2D g2,
                    java.awt.geom.AffineTransform a)
Draws the key in the given Graphics2D, using the AffineTransform passed to it. The method uses the AffineTransform using no previous transforms.

Specified by:
drawKey in interface DrawableKey
Parameters:
g2 - Graphics2D that this fills with the key.
a - AffineTransform that transforms the key, assuming no previous transforms occur.

drawKey

public void drawKey(java.awt.Graphics2D g2)
Draws the key, first setting all values for the Graphics2D g2. The drawing is done using the current Shape, defined generally in drawKey or fillKey.

Specified by:
drawKey in interface DrawableKey
Parameters:
g2 - Graphics2D that the key is painted to.