|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
net.sourceforge.mp3dings.AbstractTableModel
public abstract class AbstractTableModel
Aspects of the implementation of an Mp3dingsTableModel that are shared by all mp3dings tables.
| Nested Class Summary | |
|---|---|
protected class |
AbstractTableModel.UpdateRunnable
Description of the Class |
| Field Summary | |
|---|---|
protected static Aggregator |
aggregator
This aggregator aggregates preference change events and updates this table model on the awt event thread. |
protected FilterCollection |
filters
The filters acting on the fields in this table. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Fields inherited from interface de.mospace.swing.table.SortableTableModel |
|---|
ASCENDING, DESCENDING |
| Constructor Summary | |
|---|---|
AbstractTableModel()
Constructs a new AbstractTableModel. |
|
| Method Summary | |
|---|---|
void |
addDataChangeListener(DataChangeListener l)
Adds a feature to the DataChangeListener attribute of the AbstractTableModel object |
void |
addMessageListener(MessageListener l)
Adds a feature to the MessageListener attribute of the AbstractTableModel object |
void |
addRowsToSorter(int rowCount,
int newSize)
Adds a feature to the RowsToSorter attribute of the AbstractTableModel object |
FilterCollection |
buildFilters()
Loads the filters for this model from the user preferences. |
boolean |
discardChanges(Frame parent)
Description of the Method |
protected void |
fireAllColumnsUpdated()
Notifies listeners that all columns in this model have been updated. |
void |
fireDataChanged()
Description of the Method |
void |
fireDataChanged(int n)
Description of the Method |
protected void |
fireMessageSent(String s)
Description of the Method |
protected void |
fireMessageSent(String s,
int t)
Description of the Method |
Object |
get(int row,
int c)
Gets the value of the specified table cell, converting FullTextString values to strings on the fly. |
int |
getColumn(Field field)
Returns the table column for a field. |
Class |
getColumnClass(int c)
Gets the class of objects in the specified column. |
int |
getColumnCount()
Gets the number of columns in this model. |
String |
getColumnName(int col)
Gets the name of the specified column. |
abstract boolean |
getEditable(Field field)
Returns whether the specified field can be edited in this model. |
int |
getEntries(int row)
Gets the entry represented by the specified row in the current sorting. |
int[] |
getEntries(int[] rows)
Gets the entries represented by the specified rows in the current sorting. |
Field |
getField(int col)
Returns the field for a table column. |
Field[] |
getFields()
Gets the fields that are currently displayed. |
abstract File |
getFile(int row)
Gets the file attribute of the AbstractTableModel object |
JPopupMenu |
getFilterEditPopup(MouseEvent e)
Returns a popup menu that allows to configure the filters acting on a specific column in this model. |
protected JPopupMenu |
getFilterEditPopup(MouseEvent evt,
Field field)
Returns a popup menu that allows to configure the filters acting on a specific field in this model. |
FilterCollection |
getFilters()
Gets the filters attribute of the AbstractTableModel object |
JPopupMenu |
getHeaderPopup(MouseEvent e)
Gets the context menu for the column header of a table displaying this model. |
int[] |
getNextDuplicates(int[] rows,
int startRowIndex,
int[] cols)
Looks for consecutive duplicates in rows, starting at
startRowIndex. |
Preferences |
getPrefs()
Gets the prefs attribute of the AbstractTableModel object |
int |
getRowCount()
Gets the number of rows in this model. |
int |
getRows(int entry)
Gets the current row number of an entry. |
int[] |
getRows(int[] entries)
Gets the current row numbers for a list of entries. |
int |
getSortingColumn()
Gets the column with top sorting precedence. |
int[][] |
getSortOrder()
Gets the columns by which this table is sorted. |
Object |
getValueAt(int row,
int c)
Gets the value of the specified table cell. |
protected void |
init()
new more comprehensive initialization routine |
boolean |
isCellEditable(int row,
int c)
Returns whether the specified table cell can be edited. |
boolean |
isFiltered(int column)
Gets the filtered attribute of the AbstractTableModel object |
boolean |
isSorted()
Gets the sorted attribute of the AbstractTableModel object |
void |
randomize()
Shuffles the entries in this TableModel. |
void |
remAllRowsFromSorter()
Description of the Method |
void |
removeDataChangeListener(DataChangeListener l)
Description of the Method |
void |
removeMessageListener(MessageListener l)
Description of the Method |
void |
remRowFromSorter(int entry)
Description of the Method |
void |
remRowFromSorter(int[] entry)
Description of the Method |
protected abstract List |
reorganizeData(int[] old2new,
int newlength)
Description of the Method |
void |
resetChangeCounter()
Description of the Method |
void |
set(Object v,
int[] rows,
int[] cols)
Updates a range of cells without firing any events. |
void |
set(Object v,
int row,
int c)
Updates the value of the specified table cell without firing any events. |
protected abstract void |
setData(List v)
Sets the data attribute of the AbstractTableModel object |
void |
setSortBy(int col)
Sets the column with top sorting precedence. |
void |
setSortBy(int[] cols)
Sets the columns by which this table is sorted. |
void |
setSortBy(int col,
boolean asc)
Sets the column with top sorting precedence and the way it is to be sorted. |
protected void |
setSorted(boolean b)
Sets the sorted attribute of the AbstractTableModel object |
void |
setValueAt(Object v,
int[] rows,
int[] cols)
Updates a range of cells and notifies tables displaying this model of the change in the data. |
void |
setValueAt(Object v,
int row,
int c)
Updates the value of the specified table cell and notifies tables displaying this model of the change in the data. |
void |
sort()
Sorts the entries in this TableModel according to the criteria set by setSortBy(int). |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sourceforge.mp3dings.Mp3dingsTableModel |
|---|
fireTableDataChanged, getPrefKey |
| Methods inherited from interface net.sourceforge.mp3dings.FieldAssociatedTableModel |
|---|
getAllowedFields, getDefaultFields, getPersistentFields |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, removeTableModelListener |
| Field Detail |
|---|
protected FilterCollection filters
protected static final Aggregator aggregator
| Constructor Detail |
|---|
public AbstractTableModel()
| Method Detail |
|---|
public JPopupMenu getFilterEditPopup(MouseEvent e)
e - a mouse click on the column header of a table
displaying this model
null if e is not the right
kind of event.getHeaderPopup(MouseEvent)
protected JPopupMenu getFilterEditPopup(MouseEvent evt,
Field field)
getFilterEditPopup(MouseEvent) instead.
evt - the mouse event that triggered the popupfield - the field whose filters will be edited
getFilterEditPopup(MouseEvent)public String getColumnName(int col)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcol - a column in this table model
public int getColumnCount()
getColumnCount in interface TableModelpublic Class getColumnClass(int c)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelc - a column
public abstract boolean getEditable(Field field)
getEditable in interface FieldAssociatedTableModelfield - a field that can be displayed by this model
RuntimeException - this method can throw a
runtime exception if field is null.isCellEditable(int, int)
public boolean isCellEditable(int row,
int c)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelrow - the row of the cellc - the column of the cell
RuntimeException - this method can throw a
runtime exception if c is not a valid column number *
public Object getValueAt(int row,
int c)
getValueAt in interface TableModelrow - the row of the cellc - the column of the cell
public Object get(int row,
int c)
get in interface Mp3dingsTableModelrow - the row of the cellc - the column of the cell
public void setValueAt(Object v,
int row,
int c)
This method must only be called from the AWT event dispatching
thread, use set(Object, int, int) if you want to update the
table from another thread.
setValueAt in interface TableModelsetValueAt in class AbstractTableModelrow - the row of the cellc - the column of the cellv - the new value of the cell
public void setValueAt(Object v,
int[] rows,
int[] cols)
setValueAt(Object, int,
int) for each cell.
This method must only be called from the AWT event dispatching
thread, use set(Object, int[], int[]) if you want to update the
table from another thread.
setValueAt in interface Mp3dingsTableModelrows - the rows of the cellscols - the columns of the cellsv - the new value of the cells
public void set(Object v,
int row,
int c)
set in interface Mp3dingsTableModelrow - the row of the cellc - the column of the cellv - the new value of the cellsetValueAt(Object, int, int)
public void set(Object v,
int[] rows,
int[] cols)
set in interface Mp3dingsTableModelrows - the rows of the cellscols - the columns of the cellsv - the new value of the cellssetValueAt(Object, int[], int[])public void sort()
setSortBy(int).
sort in interface SortableTableModelTableSorter.sort(de.mospace.swing.table.SortableTableModel)public void randomize()
randomize in interface SortableTableModelTableSorter.randomize(de.mospace.swing.table.SortableTableModel)public void setSortBy(int col)
col is
already the column with top sorting precedence the sort order will
be reversed, otherwise the entries in this model will be sorted in
ascending order. This implementation remembers previous calls
to this method to determine what to do when two entries have equal fields
in col.
setSortBy in interface SortableTableModelcol - the table columnsetSortBy(int, boolean)public void setSortBy(int[] cols)
setSortBy in interface Mp3dingsTableModelcols - the columns to sort by in order of decreasing precedencesetSortBy(int, boolean)
public int[] getNextDuplicates(int[] rows,
int startRowIndex,
int[] cols)
rows, starting at
startRowIndex.
The returned array contains the index of the first and the last rows
that are identical in all columns specified by cols.
Consider calling setSortBy(int[] cols) and sort()
before calling this method.
getNextDuplicates in interface Mp3dingsTableModelrows - an array of table model rows to search for duplicatesstartRowIndex - the index where the search will begincols - the cols that will be taken into account for comparison, if
null all columns are used.
public void setSortBy(int col,
boolean asc)
col.
setSortBy in interface SortableTableModelcol - the table columnasc - true for ascending orderpublic int getSortingColumn()
getSortingColumn in interface SortableTableModelpublic int[][] getSortOrder()
ASCENDING or DESCENDING.
getSortOrder in interface SortableTableModelpublic int getRows(int entry)
getRows in interface SortableTableModelpublic int[] getRows(int[] entries)
getRows in interface SortableTableModelpublic int getEntries(int row)
getEntries in interface SortableTableModelpublic int[] getEntries(int[] rows)
getEntries in interface SortableTableModelpublic Field getField(int col)
getField in interface FieldAssociatedTableModelcol - the column number for which to retrieve the field
public int getColumn(Field field)
getColumn in interface FieldAssociatedTableModelfield - the field
public Field[] getFields()
getFields in interface FieldAssociatedTableModelgetFields in interface Mp3dingsTableModelpublic int getRowCount()
getRowCount in interface TableModelpublic FilterCollection buildFilters()
protected void fireAllColumnsUpdated()
public boolean isFiltered(int column)
isFiltered in interface Mp3dingsTableModelcolumn - Description of the Parameter
public Preferences getPrefs()
getPrefs in interface Mp3dingsTableModelpublic boolean discardChanges(Frame parent)
discardChanges in interface Mp3dingsTableModelparent - Description of the Parameter
public void resetChangeCounter()
resetChangeCounter in interface Mp3dingsTableModelpublic abstract File getFile(int row)
getFile in interface Mp3dingsTableModelrow - Description of the Parameter
protected abstract List reorganizeData(int[] old2new,
int newlength)
old2new - Description of the Parameternewlength - Description of the Parameter
protected abstract void setData(List v)
v - The new data valueprotected void init()
public FilterCollection getFilters()
getFilters in interface Mp3dingsTableModelpublic boolean isSorted()
isSorted in interface SortableTableModelprotected void setSorted(boolean b)
b - The new sorted valuepublic void remAllRowsFromSorter()
public void remRowFromSorter(int entry)
entry - Description of the Parameterpublic void remRowFromSorter(int[] entry)
entry - Description of the Parameter
public void addRowsToSorter(int rowCount,
int newSize)
rowCount - The feature to be added to the RowsToSorter attributenewSize - The feature to be added to the RowsToSorter attributepublic JPopupMenu getHeaderPopup(MouseEvent e)
getFilterEditPopup(MouseEvent).
getHeaderPopup in interface HeaderPopupTableModele - a mouse click on a column header of a table displaying this
model
getFilterEditPopup(MouseEvent)public void addMessageListener(MessageListener l)
addMessageListener in interface Mp3dingsTableModell - The feature to be added to the MessageListener attributepublic void removeMessageListener(MessageListener l)
l - Description of the Parameter
protected void fireMessageSent(String s,
int t)
s - Description of the Parametert - Description of the Parameterprotected void fireMessageSent(String s)
s - Description of the Parameterpublic void addDataChangeListener(DataChangeListener l)
addDataChangeListener in interface Mp3dingsTableModell - The feature to be added to the DataChangeListener attributepublic void removeDataChangeListener(DataChangeListener l)
l - Description of the Parameterpublic void fireDataChanged(int n)
fireDataChanged in interface Mp3dingsTableModeln - Description of the Parameterpublic void fireDataChanged()
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||