|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
com.limegroup.gnutella.gui.tables.BasicDataLineModel
com.limegroup.gnutella.gui.tables.HashBasedDataLineModel
This class extends the BasicDataLineModel by storing the 'initializing' object in a HashMap. Tables which need quick access to rows based on the initializing object should use this as the underlying TableModel.
Field Summary | |
protected java.util.HashMap |
_indexes
HashMap for quick access to indexes. |
Fields inherited from class com.limegroup.gnutella.gui.tables.BasicDataLineModel |
_isSorted |
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
HashBasedDataLineModel(java.lang.Class dataLineClass)
Constructor -- this HashBasedDataLineModel supports the the single param constructor of BasicDataLineModel. |
Method Summary | |
int |
add(DataLine dl,
int row)
Override of the add function so we can maintain a HashMap for quick access to the row an object is in. |
void |
clear()
Overrides the default clear to erase the indexes HashMap. |
boolean |
contains(java.lang.Object o)
Overrides the default contains to use the HashMap instead of a linear search. |
protected int |
forceAdd(DataLine dl,
int row)
Utility function that immediately calls super.add(dl, row) without checking if it exists. |
int |
getRow(java.lang.Object o)
Overrides the default getRow to look in the HashMap instead of a linear search. |
void |
initializeObjectChanged(java.lang.Object old,
java.lang.Object now)
Notifies the model that the initialize object of a line has changed. |
void |
remapIndexes(int start)
Remaps the indexes, starting at 'start' and going to the end of the list. |
void |
remove(int row)
Overrides the default remove to remove the index from the hashmap. |
void |
resort()
Overrides the default sort to maintain the indexes HashMap, according to the current sort column and order. |
Methods inherited from class com.limegroup.gnutella.gui.tables.BasicDataLineModel |
add, add, add, addSorted, addSorted, compare, contains, createDataLine, get, get, get, getColumnClass, getColumnCount, getColumnId, getColumnName, getNewDataLine, getRow, getRow, getRowCount, getSortColumn, getSortedPosition, getTableColumn, getToolTipArray, getValueAt, isSortAscending, isSorted, needsResort, refresh, remove, remove, setValueAt, sort, update |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
Methods inherited from interface javax.swing.table.TableModel |
addTableModelListener, isCellEditable, removeTableModelListener |
Field Detail |
protected java.util.HashMap _indexes
Constructor Detail |
public HashBasedDataLineModel(java.lang.Class dataLineClass)
Method Detail |
protected int forceAdd(DataLine dl, int row)
public int add(DataLine dl, int row)
add
in interface DataLineModel
add
in class BasicDataLineModel
public void remove(int row)
remove
in interface DataLineModel
remove
in class BasicDataLineModel
row
- the index of the row to remove.public int getRow(java.lang.Object o)
getRow
in interface DataLineModel
getRow
in class BasicDataLineModel
o
- the object whose index we want.
java.lang.ArrayIndexOutOfBoundsException
- if no dataline was
initialized by o.public void resort()
resort
in interface DataLineModel
resort
in class BasicDataLineModel
public boolean contains(java.lang.Object o)
contains
in interface DataLineModel
contains
in class BasicDataLineModel
o
- The object which initialized a DataLine.
public void clear()
clear
in interface DataLineModel
clear
in class BasicDataLineModel
public void remapIndexes(int start)
public void initializeObjectChanged(java.lang.Object old, java.lang.Object now)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |