|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.erichseifert.gral.AbstractDrawable
de.erichseifert.gral.DrawableContainer
de.erichseifert.gral.Legend
public abstract class Legend
Abstract class that serves as a basic for any legend in a plot. It provides an inner Item class which is responsible for displaying a specific DataSource.
The functionality includes:
Field Summary | |
---|---|
static Settings.Key |
BACKGROUND
Key for specifying the Paint instance to be used to
paint the background. |
static Settings.Key |
BORDER
Key for specifying the Stroke instance to be used to
paint the border of the legend. |
static Settings.Key |
COLOR
Key for specifying the Paint instance to be used to
fill the border of the legend. |
static Settings.Key |
GAP
Key for specifying the gap between items. |
static Settings.Key |
ORIENTATION
Key for specifying the orientation of the legend using a DrawableConstants.Orientation value. |
static Settings.Key |
SYMBOL_SIZE
Key for specifying the gap between items. |
Constructor Summary | |
---|---|
Legend()
Creates a new Legend object with default background color, border, orientation and gap between the Items. |
Method Summary | ||
---|---|---|
void |
add(DataSource source)
Adds the specified DataSource in order to display it. |
|
boolean |
contains(DataSource source)
Returns whether the specified DataSource was added to the legend. |
|
void |
draw(DrawingContext context)
Draws the Drawable with the specified
Graphics2D object. |
|
|
getSetting(Settings.Key key)
Returns the setting with the specified key. |
|
void |
remove(DataSource source)
Removes the specified DataSource. |
|
|
removeSetting(Settings.Key key)
Removes the setting with the specified key. |
|
|
removeSettingDefault(Settings.Key key)
Removes the default setting with the specified key. |
|
|
setSetting(Settings.Key key,
T value)
Sets the setting with the specified key to the specified value. |
|
|
setSettingDefault(Settings.Key key,
T value)
Sets a default value for the setting with the specified key. |
|
void |
settingChanged(SettingChangeEvent event)
Invoked if a setting has changed. |
Methods inherited from class de.erichseifert.gral.DrawableContainer |
---|
add, add, getConstraints, getInsets, getLayout, getPreferredSize, iterator, remove, setBounds, setBounds, setInsets, setLayout, size |
Methods inherited from class de.erichseifert.gral.AbstractDrawable |
---|
getBounds, getHeight, getWidth, getX, getY |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.erichseifert.gral.Container |
---|
getBounds |
Field Detail |
---|
public static final Settings.Key BACKGROUND
Paint
instance to be used to
paint the background.
public static final Settings.Key BORDER
Stroke
instance to be used to
paint the border of the legend.
public static final Settings.Key COLOR
Paint
instance to be used to
fill the border of the legend.
public static final Settings.Key ORIENTATION
DrawableConstants.Orientation
value.
public static final Settings.Key GAP
public static final Settings.Key SYMBOL_SIZE
Constructor Detail |
---|
public Legend()
Method Detail |
---|
public void draw(DrawingContext context)
Drawable
Drawable
with the specified
Graphics2D
object.
draw
in interface Drawable
draw
in class DrawableContainer
context
- Environment used for drawingpublic void add(DataSource source)
source
- DataSource to be added.public boolean contains(DataSource source)
source
- Data source
true
if legend contains the data source, otherwise false
public void remove(DataSource source)
source
- DataSource to be removed.public <T> T getSetting(Settings.Key key)
SettingsStorage
getSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.
public <T> void removeSetting(Settings.Key key)
SettingsStorage
removeSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.public <T> void removeSettingDefault(Settings.Key key)
SettingsStorage
removeSettingDefault
in interface SettingsStorage
T
- Type of setting.key
- Key.public <T> void setSetting(Settings.Key key, T value)
SettingsStorage
setSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.value
- Value to be set.public <T> void setSettingDefault(Settings.Key key, T value)
SettingsStorage
setSettingDefault
in interface SettingsStorage
T
- Type of setting.key
- Key.value
- Value to be set.public void settingChanged(SettingChangeEvent event)
SettingsListener
settingChanged
in interface SettingsListener
event
- Event containing information about the changed setting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |