org.grinvin.invariants.details

Class BarChartPanel

Implemented Interfaces:
ListDataListener, ListSelectionListener, MouseListener

public class BarChartPanel
extends JPanel
implements ListSelectionListener, ListDataListener, MouseListener

Panel which displays a list of real numbers in a bar chart.

Data for the bar chart is taken from a list model of real numbers. Selection information comes from a list selection model.

Constructor Summary

BarChartPanel(Number> dataModel)
Create a bar chart panel with given data model.
BarChartPanel(Number> dataModel, ListSelectionModel selectionModel)
Create a bar chart panel with given data model and selection model.
BarChartPanel(Number> dataModel, ListSelectionModel selectionModel, Number referenceValue)
Create a bar chart panel with given data model, selection model and reference value.
BarChartPanel(Number> dataModel, Number referenceValue)
Create a bar chart panel with given data model and reference value.

Method Summary

void
contentsChanged(ListDataEvent e)
Number
getReferenceValue()
Return the reference value which is used to determine the height of the bars.
ListSelectionModel
getSelectionModel()
Return selection model.
String
getToolTipText(MouseEvent event)
void
intervalAdded(ListDataEvent e)
void
intervalRemoved(ListDataEvent e)
Repaint when data model changes.
void
mouseClicked(MouseEvent e)
void
mouseEntered(MouseEvent e)
void
mouseExited(MouseEvent e)
void
mousePressed(MouseEvent e)
void
mouseReleased(MouseEvent e)
protected void
paintComponent(Graphics g)
void
setSelectionModel(ListSelectionModel selectionModel)
Change the reference value which is used to determine the height of the bars.
void
valueChanged(ListSelectionEvent e)
Repaint when selection changes.

Constructor Details

BarChartPanel

public BarChartPanel(Number> dataModel)
Create a bar chart panel with given data model. Creates a new selection model and uses the currently largest absolute value of the data model as reference value.

BarChartPanel

public BarChartPanel(Number> dataModel,
                     ListSelectionModel selectionModel)
Create a bar chart panel with given data model and selection model. Uses the currently largest absolute value of the data model as reference value.

BarChartPanel

public BarChartPanel(Number> dataModel,
                     ListSelectionModel selectionModel,
                     Number referenceValue)
Create a bar chart panel with given data model, selection model and reference value.

BarChartPanel

public BarChartPanel(Number> dataModel,
                     Number referenceValue)
Create a bar chart panel with given data model and reference value. Creates a new selection model.

Method Details

contentsChanged

public void contentsChanged(ListDataEvent e)

getReferenceValue

public Number getReferenceValue()
Return the reference value which is used to determine the height of the bars. This value corresponds to a bar of full height.

getSelectionModel

public ListSelectionModel getSelectionModel()
Return selection model.

getToolTipText

public String getToolTipText(MouseEvent event)

intervalAdded

public void intervalAdded(ListDataEvent e)

intervalRemoved

public void intervalRemoved(ListDataEvent e)
Repaint when data model changes.

mouseClicked

public void mouseClicked(MouseEvent e)

mouseEntered

public void mouseEntered(MouseEvent e)

mouseExited

public void mouseExited(MouseEvent e)

mousePressed

public void mousePressed(MouseEvent e)

mouseReleased

public void mouseReleased(MouseEvent e)

paintComponent

protected void paintComponent(Graphics g)

setSelectionModel

public void setSelectionModel(ListSelectionModel selectionModel)
Change the reference value which is used to determine the height of the bars.

valueChanged

public void valueChanged(ListSelectionEvent e)
Repaint when selection changes.