|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
ch.randelshofer.gui.table.DefaultMutableTableModel
public class DefaultMutableTableModel
Default implementation of a MutableTableModel. FIXME: Should override more methods of the superclass.
| Field Summary | |
|---|---|
protected java.util.ArrayList |
columnClasses
The ArrayList of column classes. |
protected java.util.ArrayList |
columnIdentifiers
The ArrayList of column identifiers. |
protected java.util.ArrayList |
dataList
The ArrayList of ArrayList of
Object values. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
DefaultMutableTableModel()
Constructs a DefaultMutableTableModel which has a table of zero columns and zero rows. |
|
DefaultMutableTableModel(int rowCount,
int columnCount)
Constructs a DefaultMutableTableModel with numRows and numColumns of null object values. |
|
DefaultMutableTableModel(java.util.List columnNames,
int rowCount)
Constructs a DefaultMutableTableModel with as many columns as there are elements in columNames and numRows of null object values. |
|
DefaultMutableTableModel(java.util.List dataList,
java.util.List columnNames)
Constructs a DefaultMutableTableModel and initializes the table by passing dataList and columnNames to the setDataVector() method. |
|
DefaultMutableTableModel(java.lang.Object[][] dataList,
java.lang.Object[] columnNames)
Constructs a DefaultMutableTableModel and initializes the table by passing dataList and columnNames to the setDataList() method. |
|
DefaultMutableTableModel(java.lang.Object[][] dataList,
java.lang.Object[] columnNames,
java.lang.Class[] columnClasses)
Constructs a DefaultMutableTableModel and initializes the table by passing dataList and columnNames to the setDataList() method. |
|
DefaultMutableTableModel(java.lang.Object[] columnNames,
int rowCount)
Constructs a DefaultMutableTableModel wit as many columns as there are elements in columnNames and numRows of null object values. |
|
| Method Summary | |
|---|---|
void |
addRow(int row,
java.lang.Object element)
Inserts an element at the specified index in the model. |
void |
createRow(int row,
java.lang.Object type)
Invoke this to insert a new row into the table. |
java.awt.datatransfer.Transferable |
exportRowTransferable(int[] rows)
Creates a Transferable to use as the source for a dataList transfer of the specified elements. |
java.lang.Class |
getColumnClass(int column)
|
int |
getColumnCount()
Returns the number of columns in this data table. |
java.lang.String |
getColumnName(int column)
Returns the column name. |
java.lang.Object |
getCreatableRowType(int row)
Returns the default type of elements that can be created at the specified index of the list. |
java.lang.Object[] |
getCreatableRowTypes(int row)
Returns the types of elements that can be created at the specified index of the list. |
javax.swing.Action[] |
getRowActions(int[] rows)
Returns an array of compound actions for the indicated rows. |
int |
getRowCount()
|
java.lang.Object |
getValueAt(int row,
int column)
Returns an attribute value for the cell at row
and column. |
int |
importRowTransferable(java.awt.datatransfer.Transferable t,
int action,
int row,
boolean asChild)
Causes a transfer to the model from a clipboard or a DND drop operation. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and
columnIndex is editable. |
boolean |
isEnabled()
Gets the enabled state of the model. |
boolean |
isRowAddable(int row)
Returns wether a row may be inserted. |
boolean |
isRowDuplicateable(int row)
Returns wether the specified row may be duplicated. |
boolean |
isRowImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
int action,
int row,
boolean asChild)
Indicates whether the model would accept an import of the given set of dataList flavors prior to actually attempting to import it. |
boolean |
isRowRemovable(int row)
Returns wether the specified node may be removed. |
void |
removeRow(int row)
Message this to remove a row from the table. |
void |
setDataVector(java.util.List dataVector,
java.util.List columnIdentifiers)
Replaces the current dataVector instance variable
with the new Vector of rows, dataVector. |
void |
setDataVector(java.lang.Object[][] dataVector,
java.lang.Object[] columnIdentifiers)
Replaces the value in the dataVector instance
variable with the values in the array dataVector. |
void |
setEnabled(boolean b)
Sets the enabled state of the model. |
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
Sets the object value for the cell at column and
row. |
| 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 javax.swing.table.TableModel |
|---|
addTableModelListener, removeTableModelListener |
| Field Detail |
|---|
protected java.util.ArrayList dataList
ArrayList of ArrayList of
Object values.
protected java.util.ArrayList columnIdentifiers
ArrayList of column identifiers.
protected java.util.ArrayList columnClasses
ArrayList of column classes. When
this array list is null, then all columns are reported
as of type Object.class.
| Constructor Detail |
|---|
public DefaultMutableTableModel()
public DefaultMutableTableModel(int rowCount,
int columnCount)
public DefaultMutableTableModel(java.lang.Object[][] dataList,
java.lang.Object[] columnNames)
public DefaultMutableTableModel(java.lang.Object[][] dataList,
java.lang.Object[] columnNames,
java.lang.Class[] columnClasses)
public DefaultMutableTableModel(java.lang.Object[] columnNames,
int rowCount)
public DefaultMutableTableModel(java.util.List columnNames,
int rowCount)
public DefaultMutableTableModel(java.util.List dataList,
java.util.List columnNames)
| Method Detail |
|---|
public void setDataVector(java.util.List dataVector,
java.util.List columnIdentifiers)
dataVector instance variable
with the new Vector of rows, dataVector.
columnIdentifiers are the names of the new
columns. The first name in columnIdentifiers is
mapped to column 0 in dataVector. Each row in
dataVector is adjusted to match the number of
columns in columnIdentifiers
either by truncating the Vector if it is too long,
or adding null values if it is too short.
Note that passing in a null value for
dataVector results in unspecified behavior,
an possibly an exception.
dataVector - the new dataList vectorcolumnIdentifiers - the names of the columns
public void setDataVector(java.lang.Object[][] dataVector,
java.lang.Object[] columnIdentifiers)
dataVector instance
variable with the values in the array dataVector.
The first index in the Object[][]
array is the row index and the second is the column index.
columnIdentifiers are the names of the new columns.
dataVector - the new dataList vectorcolumnIdentifiers - the names of the columns
public void createRow(int row,
java.lang.Object type)
createRow in interface MutableTableModeltype - The type of the new row.row - index at which the specified element is to be inserted.
java.lang.IllegalStateException - if the row may not be inserted.public java.lang.Object[] getCreatableRowTypes(int row)
MutableTableModel
getCreatableRowTypes in interface MutableTableModelrow - The insertion point. 0 <= index <= getRowCount()
public java.lang.Object getCreatableRowType(int row)
MutableTableModel
getCreatableRowType in interface MutableTableModelrow - The insertion point. 0 <= index <= getRowCount()
public boolean isEnabled()
public boolean isRowAddable(int row)
isRowAddable in interface MutableTableModelrow - row of the new row.
public boolean isRowRemovable(int row)
isRowRemovable in interface MutableTableModelrow - row of the row.
MutableTableModel.removeRow(int)public void removeRow(int row)
removeRow in interface MutableTableModelrow - row of the row.
java.lang.IllegalStateException - if the row may not be removed.MutableTableModel.isRowRemovable(int)public boolean isRowDuplicateable(int row)
row - row of the row.
public void setEnabled(boolean b)
public javax.swing.Action[] getRowActions(int[] rows)
getRowActions in interface MutableTableModelrows - The rows.public java.awt.datatransfer.Transferable exportRowTransferable(int[] rows)
exportRowTransferable in interface MutableTableModelrows - Row rows.
public boolean isRowImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
int action,
int row,
boolean asChild)
isRowImportable in interface MutableTableModeltransferFlavors - the dataList formats availableaction - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or
.ACTION_LINK.row - The insertion point. 0 <= index <= getSize()asChild - Indicates that the item is to be imported as a child
of the list item rather than as an individual element
/ of the list.
DnDConstants
public int importRowTransferable(java.awt.datatransfer.Transferable t,
int action,
int row,
boolean asChild)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
importRowTransferable in interface MutableTableModelt - The transfer dataList.action - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or
.ACTION_LINK.row - The insertion point. 0 <= index <= getSize()asChild - Indicates that the item is to be imported as a child
of the list item rather than as an individual element
of the list.
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOExceptionpublic int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelpublic int getRowCount()
getRowCount in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int row,
int column)
row
and column.
getValueAt in interface javax.swing.table.TableModelrow - the row whose value is to be queriedcolumn - the column whose value is to be queried
java.lang.ArrayIndexOutOfBoundsException - if an invalid row or
column was given
public void setValueAt(java.lang.Object aValue,
int row,
int column)
column and
row. aValue is the new value. This method
will generate a tableChanged notification.
setValueAt in interface javax.swing.table.TableModelsetValueAt in class javax.swing.table.AbstractTableModelaValue - the new value; this can be nullrow - the row whose value is to be changedcolumn - the column whose value is to be changed
java.lang.ArrayIndexOutOfBoundsException - if an invalid row or
column was given
public void addRow(int row,
java.lang.Object element)
row - index at which the specified element is to be inserted.element - element to be inserted.
java.lang.ClassCastException - if the element is not compatible with
one of the data flavors type returned by
getInsertableDataFlavors(int)
java.lang.IllegalStateException - if isRowInsertable(int) returns false.
java.lang.IndexOutOfBoundsException - if the index is out of range
(index < 0 || index > size()).public java.lang.Class getColumnClass(int column)
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class javax.swing.table.AbstractTableModelpublic java.lang.String getColumnName(int column)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class javax.swing.table.AbstractTableModelcolumnIdentifiers.
If columnIdentifiers does not have an entry
for this index, returns the default
name provided by the superclass
public boolean isCellEditable(int rowIndex,
int columnIndex)
rowIndex and
columnIndex is editable. Otherwise,
setValueAt on the cell will not change
the value of that cell.
isCellEditable in interface MutableTableModelisCellEditable in interface javax.swing.table.TableModelisCellEditable in class javax.swing.table.AbstractTableModelrowIndex - - the row whose value to be queriedcolumnIndex - - the column whose value to be queried
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||