Interface DrawableKey

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
DrawingKey

public interface DrawableKey
extends java.lang.Cloneable

The DrawableKey interface is a drawable key, that must implement the method drawKey, fillKey, and settings methods.

The drawing method must be one of the two calls. If the parameters include simply a Graphics2D, then the drawing method redraws the key as previously drawn (using drawKey or fillKey) in the Graphics2D passed to it. If the parameters are a Graphics2D and an AffineTransform, then the drawing method draws using the AffineTransform, starting from (0,0) and assuming the removal of any current AffineTransforms. This indicates, that a scaling of 10 will result in a size of 10 and a transpose of (5,10) results in the drawing at (5,10) and so forth.

The fillKey fills the Graphics2D passed to it with the key. The method also sets the transform so a call to drawKey without a transform will drawn exactly as drawn in fillKey.

The settings methods, setSettings and getSettings, refer to KetSettings generally used to render the key.

All of the methods must be present in a DrawableKey. However not all must act. If the DrawableKey has no need for KeySettings than the setting methods can be left empty.

See Also:
DrawingKey

Method Summary
 java.lang.Object clone()
          Makes public the protected clone method in Object.
 void drawKey(java.awt.Graphics2D g2)
          Draws the actual 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.
 KeySettings getSettings()
          Gets the KeySettings of the key.
 boolean isSettingsSaved()
          Returns true if the KeySettings are currently saved.
 void restoreSettings()
          Restores the settings for the key.
 void saveSettings()
          Saves the settings for the key.
 void setKeySettings(KeySettings s)
          Sets the KeySettings of the DrawableKey.
 void setSettings(KeySettings k)
          Sets the KeySettings of the DrawableKey.
 

Method Detail

drawKey

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

Parameters:
g2 - g2 Graphics2D that the key is painted to.

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.

Parameters:
g2 - g2 Graphics2D that this fills with the key.
a - AffineTransform that transforms the key, using no previous transforms.

fillKey

public void fillKey(java.awt.Graphics2D g2)
Draws the key filling the given Graphics2D. The method completely fills the Graphics2D passed to it, setting the transform as the one necessary to fill and center in the Graphics2D.

Parameters:
g2 - Graphics2D that fills with the key.

clone

public java.lang.Object clone()
Makes public the protected clone method in Object.

Overrides:
clone in class java.lang.Object
Returns:
Object that is cloned.

setSettings

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

Can be left empty

Parameters:
k - 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.

Parameters:
s - KeySettings for use in drawing the key.

getSettings

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

Can be left empty

Returns:
KeySettings for use in drawing the key.

saveSettings

public void saveSettings()
Saves the settings for the key.


restoreSettings

public void restoreSettings()
Restores the settings for the key.


isSettingsSaved

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

Returns:
true if the settings are saved.