com.jgoodies.chart
Interface ChartModel<T>

Type Parameters:
T - the type of the user data
All Known Implementing Classes:
AbstractChartModel, ColoredChartModel, FilteredChartModel

public interface ChartModel<T>

Describes the model required by charts.

Version:
$Revision: 1.3 $
Author:
Karsten Lentzsch

Method Summary
 void addChangeListener(ChangeListener listener)
          Adds the given listener to the list of observers.
 Color getColor(int index)
          Returns the color of the item at the given index.
 T getData(int index)
          Returns the user data at the given index.
 Icon getIcon(int index)
          Returns the icon at the given index.
 int getItemCount()
          Returns the number of items in this model.
 long getSize(int index)
          Returns the mandatory size at the given index.
 String getText(int index)
          Returns the text at the given index.
 void removeChangeListener(ChangeListener listener)
          Removes the given listener fromthe list of observers.
 

Method Detail

getItemCount

int getItemCount()
Returns the number of items in this model.

Returns:
the number of items in this model

getData

T getData(int index)
Returns the user data at the given index.

Parameters:
index - the index to look at
Returns:
the user data object at the given index
Throws:
IndexOutOfBoundsException - if the index is out of bounds

getIcon

Icon getIcon(int index)
Returns the icon at the given index. Charts may display the icon or not.

Parameters:
index - the index to look at
Returns:
the icon at the given index
Throws:
IndexOutOfBoundsException - if the index is out of bounds

getText

String getText(int index)
Returns the text at the given index. Charts may display the text or not.

Parameters:
index - the index to look at
Returns:
the text at the given index
Throws:
IndexOutOfBoundsException - if the index is out of bounds

getSize

long getSize(int index)
Returns the mandatory size at the given index.

Parameters:
index - the index to look at
Returns:
the icon at the given index
Throws:
IndexOutOfBoundsException - if the index is out of bounds

getColor

Color getColor(int index)
Returns the color of the item at the given index. Some chart models may return null and leave it to a wrapper chart model to colorize the data.

Parameters:
index - the index to look at
Returns:
the color at the given index
Throws:
IndexOutOfBoundsException - if the index is out of bounds

addChangeListener

void addChangeListener(ChangeListener listener)
Adds the given listener to the list of observers.

Parameters:
listener - the listener to be added
Throws:
NullPointerException - if the listener is null

removeChangeListener

void removeChangeListener(ChangeListener listener)
Removes the given listener fromthe list of observers. Does nothing if the listener is null.

Parameters:
listener - the listener to be added


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.