org.jfree.ui

Class SortableTableHeaderListener

public class SortableTableHeaderListener extends Object implements MouseListener, MouseMotionListener

Captures mouse clicks on a table header, with the intention of triggering a sort. Adapted from code by Nabuo Tamemasa posted on http://www.codeguru.com.

Author: Nabuo Tamemasa

Constructor Summary
SortableTableHeaderListener(SortableTableModel model, SortButtonRenderer renderer)
Standard constructor.
Method Summary
voidmouseClicked(MouseEvent e)
This event is ignored (not required).
voidmouseDragged(MouseEvent e)
If the user is dragging or resizing, then we clear the sort column.
voidmouseEntered(MouseEvent e)
This event is ignored (not required).
voidmouseExited(MouseEvent e)
This event is ignored (not required).
voidmouseMoved(MouseEvent e)
This event is ignored (not required).
voidmousePressed(MouseEvent e)
Handle a mouse press event - if the user is NOT resizing a column and NOT dragging a column then give visual feedback that the column header has been pressed.
voidmouseReleased(MouseEvent e)
When the user releases the mouse button, we attempt to sort the table.
voidsetTableModel(SortableTableModel model)
Sets the table model for the listener.

Constructor Detail

SortableTableHeaderListener

public SortableTableHeaderListener(SortableTableModel model, SortButtonRenderer renderer)
Standard constructor.

Parameters: model the model. renderer the renderer.

Method Detail

mouseClicked

public void mouseClicked(MouseEvent e)
This event is ignored (not required).

Parameters: e the mouse event.

mouseDragged

public void mouseDragged(MouseEvent e)
If the user is dragging or resizing, then we clear the sort column.

Parameters: e the mouse event.

mouseEntered

public void mouseEntered(MouseEvent e)
This event is ignored (not required).

Parameters: e the mouse event.

mouseExited

public void mouseExited(MouseEvent e)
This event is ignored (not required).

Parameters: e the mouse event.

mouseMoved

public void mouseMoved(MouseEvent e)
This event is ignored (not required).

Parameters: e the mouse event.

mousePressed

public void mousePressed(MouseEvent e)
Handle a mouse press event - if the user is NOT resizing a column and NOT dragging a column then give visual feedback that the column header has been pressed.

Parameters: e the mouse event.

mouseReleased

public void mouseReleased(MouseEvent e)
When the user releases the mouse button, we attempt to sort the table.

Parameters: e the mouse event.

setTableModel

public void setTableModel(SortableTableModel model)
Sets the table model for the listener.

Parameters: model the model.