Top Fields Constructors Methods
sun.tools.jconsole.inspector

public Class TableSorter

extends DefaultTableModel
implements MouseListener
Class Inheritance
All Implemented Interfaces
java.awt.event.MouseListener, java.util.EventListener
Annotations
@SuppressWarnings:serial
Imports
java.awt.event.MouseEvent, .MouseListener, java.util.Vector, javax.swing.JTable, javax.swing.event.TableModelEvent, .TableModelListener, javax.swing.table.DefaultTableModel, .JTableHeader, .TableColumnModel, sun.tools.jconsole.JConsole

Field Summary

Modifier and TypeField and Description
private boolean
private TableColumnModel
private Vector<TableModelListener>
private int[]
private int
private JTable
Inherited from javax.swing.table.DefaultTableModel:
columnIdentifiersdataVector

Constructor Summary

AccessConstructor and Description
public
public
TableSorter(Object[] columnNames, int numRows)

Method Summary

Modifier and TypeMethod and Description
public void
public void
addTableModelListener(TableModelListener
the TableModelListener
l
)

Overrides javax.swing.table.AbstractTableModel.addTableModelListener.

Implements javax.swing.table.TableModel.addTableModelListener.

Adds a listener to the list that's notified each time a change to the data model occurs.
private int
private boolean
compareG(Object s1, Object s2, boolean isAscending)

private boolean
compareS(Object s1, Object s2, boolean isAscending)

public int
getIndexOfRow(int row)

private Vector<?>
getRow(int row)

public void
mouseClicked(MouseEvent
the event to be processed
e
)

Implements java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.
public void
mouseEntered(MouseEvent
the event to be processed
e
)

Implements java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.
public void
mouseExited(MouseEvent
the event to be processed
e
)

Implements java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.
public void
mousePressed(MouseEvent
the event to be processed
e
)

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.
public void
mouseReleased(MouseEvent
the event to be processed
e
)

Implements java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.
public void
newDataAvailable(TableModelEvent
the change event
e
)

Overrides javax.swing.table.DefaultTableModel.newDataAvailable.

Equivalent to fireTableChanged.
private void
quickSort(int lo0, int hi0, int key, boolean isAscending)

private void
public void
removeTableModelListener(TableModelListener
the TableModelListener
l
)

Overrides javax.swing.table.AbstractTableModel.removeTableModelListener.

Implements javax.swing.table.TableModel.removeTableModelListener.

Removes a listener from the list that's notified each time a change to the data model occurs.
private void
private void
setRow(Vector<?> data, int row)

private void
sort(int column, boolean isAscending)

public void
sortByColumn(int column)

public void
sortByColumn(int column, boolean ascending)

private void
swap(int i, int j, int column)

Inherited from javax.swing.table.DefaultTableModel:
addColumnaddColumnaddColumnaddRowaddRowconvertToVectorconvertToVectorgetColumnCountgetColumnNamegetDataVectorgetRowCountgetValueAtinsertRowinsertRowisCellEditablemoveRownewRowsAddedremoveRowrowsRemovedsetColumnCountsetColumnIdentifierssetColumnIdentifierssetDataVectorsetDataVectorsetNumRowssetRowCountsetValueAt

Field Detail

ascendingback to summary
private boolean ascending
columnModelback to summary
private TableColumnModel columnModel
evtListenerListback to summary
private Vector<TableModelListener> evtListenerList
invertedIndexback to summary
private int[] invertedIndex
sortColumnback to summary
private int sortColumn
tableViewback to summary
private JTable tableView

Constructor Detail

TableSorterback to summary
public TableSorter()
TableSorterback to summary
public TableSorter(Object[] columnNames, int numRows)

Method Detail

addMouseListenerToHeaderInTableback to summary
public void addMouseListenerToHeaderInTable(JTable table)
addTableModelListenerback to summary
public void addTableModelListener(TableModelListener l)

Overrides javax.swing.table.AbstractTableModel.addTableModelListener.

Implements javax.swing.table.TableModel.addTableModelListener.

Doc from javax.swing.table.AbstractTableModel.addTableModelListener.

Adds a listener to the list that's notified each time a change to the data model occurs.

Parameters
l:TableModelListener

the TableModelListener

Annotations
@Override
compareback to summary
private int compare(Object o1, Object o2)
Annotations
@SuppressWarnings:unchecked
compareGback to summary
private boolean compareG(Object s1, Object s2, boolean isAscending)
compareSback to summary
private boolean compareS(Object s1, Object s2, boolean isAscending)
getIndexOfRowback to summary
public int getIndexOfRow(int row)
getRowback to summary
private Vector<?> getRow(int row)
mouseClickedback to summary
public void mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Doc from java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

Parameters
e:MouseEvent

the event to be processed

mouseEnteredback to summary
public void mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Doc from java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

Parameters
e:MouseEvent

the event to be processed

mouseExitedback to summary
public void mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Doc from java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

Parameters
e:MouseEvent

the event to be processed

mousePressedback to summary
public void mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Doc from java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

Parameters
e:MouseEvent

the event to be processed

mouseReleasedback to summary
public void mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Doc from java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

Parameters
e:MouseEvent

the event to be processed

newDataAvailableback to summary
public void newDataAvailable(TableModelEvent e)

Overrides javax.swing.table.DefaultTableModel.newDataAvailable.

Doc from javax.swing.table.DefaultTableModel.newDataAvailable.

Equivalent to fireTableChanged.

Parameters
e:TableModelEvent

the change event

Annotations
@Override
quickSortback to summary
private void quickSort(int lo0, int hi0, int key, boolean isAscending)
removeListenersback to summary
private void removeListeners()
removeTableModelListenerback to summary
public void removeTableModelListener(TableModelListener l)

Overrides javax.swing.table.AbstractTableModel.removeTableModelListener.

Implements javax.swing.table.TableModel.removeTableModelListener.

Doc from javax.swing.table.AbstractTableModel.removeTableModelListener.

Removes a listener from the list that's notified each time a change to the data model occurs.

Parameters
l:TableModelListener

the TableModelListener

Annotations
@Override
restoreListenersback to summary
private void restoreListeners()
setRowback to summary
private void setRow(Vector<?> data, int row)
Annotations
@SuppressWarnings:unchecked
sortback to summary
private void sort(int column, boolean isAscending)
sortByColumnback to summary
public void sortByColumn(int column)
sortByColumnback to summary
public void sortByColumn(int column, boolean ascending)
swapback to summary
private void swap(int i, int j, int column)