|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JTable | +--com.ultraswing.CTable
An extension of JTable which adds the following functionality.
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
CTable()
Constructs a default CTable that is initialized with a default
data model, a default column model, and a default selection
model. |
|
CTable(int rows,
int cols)
Constructs a CTable with rows
and cols of empty cells using
DefaultTableModel . |
|
CTable(Object[][] rowData,
Object[] columnNames)
Constructs a CTable to display the values in the two dimensional array,
rowData , with column names, columnNames . |
|
CTable(SortableTableModel model)
Constructs a CTable that is initialized with
model as the data model, a default column model,
and a default selection model. |
|
CTable(SortableTableModel dm,
TableColumnModel cm)
Constructs a CTable that is initialized with
dm as the data model, cm
as the column model, and a default selection model. |
|
CTable(SortableTableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
Constructs a CTable that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model. |
|
CTable(String csvFileName,
boolean hasHeadings)
Constructs a CTable that is initialized with
the passed CSV file |
|
CTable(URL csvFileURL,
boolean hasHeadings)
Constructs a CTable that is initialized with
the passed CSV file |
|
CTable(Vector rowData,
Vector columnNames)
Constructs a CTable to display the values in the
Vector of Vectors , rowData ,
with column names, columnNames . |
Method Summary | |
protected void |
configureEnclosingScrollPane()
|
void |
disableAlternate()
Disables alternate row/colum color |
TableCellRenderer |
getCellRenderer(int row,
int column)
|
CTableRowHeader |
getCTableRowHeader()
Return Table row header object. |
int[] |
getHiddenColumns()
Returns the hidden column indice |
int |
getSortedColumnIndex()
Returns the column index of sorted column |
boolean |
isCellEditable(int row,
int column)
Determines whether the cell is editable |
boolean |
isEditable()
Determines whether the whole table is editable |
boolean |
isSortedColumnAscending()
Determines whether the sorted column is ascending |
boolean |
isSortingEnabled()
Determines whether column sorting is enabled |
void |
removeColumns(int[] columns)
Removes passed columns from table |
void |
removeHeader(int mode)
Removes table headers Note: This method take effect only when this table is already visible. |
void |
resetCellColor(int row,
int column)
Undo the setCellColor |
void |
resetColumnColor(int column)
Undo resetRowColor |
void |
resetRowColor(int row)
Undo setRowColor |
void |
setAlternate(Color c1,
Color c2,
boolean isRowAlternate)
Alternates colors for rows or columns. |
void |
setCellColor(int row,
int column,
Color color)
This method takes precedence over setColumnColor, setRowColor, and setAlternate methods |
void |
setColumnColor(int column,
Color c)
This method takes precedence over setAlternate method |
void |
setEditable(boolean b)
Sets the specified boolean to indicate whether or not this whole table should be editable. |
void |
setRowColor(int row,
Color c)
This method takes precedence over setColumnColor and setAlternate methods |
void |
setRowHeaderEnabled(boolean b)
Enables or disables row header |
void |
setRowHeaderValues(List list)
Sets row header values |
void |
setRowHeight(int row,
int rowHeight)
Sets row height |
void |
setSortingEnabled(boolean b)
Controls whether column sorting is enabled or not |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public CTable()
CTable
that is initialized with a default
data model, a default column model, and a default selection
model.
public CTable(int rows, int cols)
CTable
with rows
and cols
of empty cells using
DefaultTableModel
. The columns will have
names of the form "A", "B", "C", etc.
rows
- the number of rows the table holdscols
- the number of columns the table holdspublic CTable(Object[][] rowData, Object[] columnNames)
CTable
to display the values in the two dimensional array,
rowData
, with column names, columnNames
.
rowData
is an array of rows, so the value of the cell at row 1,
column 5 can be obtained with the following code:
rowData[1][5];
All rows must be of the same length as columnNames
.
rowData
- the data for the new tablecolumnNames
- names of each columnpublic CTable(Vector rowData, Vector columnNames)
CTable
to display the values in the
Vector
of Vectors
, rowData
,
with column names, columnNames
. The
Vectors
contained in rowData
should contain the values for that row. In other words,
the value of the cell at row 1, column 5 can be obtained
with the following code:
((Vector)rowData.elementAt(1)).elementAt(5);
Each row must contain a value for each column or an exception will be raised.
rowData
- the data for the new tablecolumnNames
- names of each columnpublic CTable(SortableTableModel model)
CTable
that is initialized with
model
as the data model, a default column model,
and a default selection model.
model
- the data model for the tablepublic CTable(SortableTableModel dm, TableColumnModel cm)
CTable
that is initialized with
dm
as the data model, cm
as the column model, and a default selection model.
dm
- the data model for the tablecm
- the column model for the tablepublic CTable(SortableTableModel dm, TableColumnModel cm, ListSelectionModel sm)
CTable
that is initialized with
dm
as the data model, cm
as the
column model, and sm
as the selection model.
If any of the parameters are null
this method
will initialize the table with the corresponding default model.
The autoCreateColumnsFromModel
flag is set to false
if cm
is non-null, otherwise it is set to true
and the column model is populated with suitable
TableColumns
for the columns in dm
.
dm
- the data model for the tablecm
- the column model for the tablesm
- the row selection model for the tablepublic CTable(URL csvFileURL, boolean hasHeadings) throws IOException
CTable
that is initialized with
the passed CSV file
csvFileURL
- the URL of CSV filehasHeadings
- whehter the CSV has headings or notpublic CTable(String csvFileName, boolean hasHeadings) throws IOException
CTable
that is initialized with
the passed CSV file
csvFileName
- the file name of CSV filehasHeadings
- whehter the CSV has headings or notMethod Detail |
public void setRowHeaderValues(List list)
list
- values of row header. Each element in the list can be a String object, Component object, or other objects.public void setCellColor(int row, int column, Color color)
public void resetCellColor(int row, int column)
setCellColor
setCellColor(int, int, java.awt.Color)
public void setRowColor(int row, Color c)
public void resetRowColor(int row)
setRowColor
setRowColor(int, java.awt.Color)
public void setColumnColor(int column, Color c)
public void resetColumnColor(int column)
resetRowColor
setColumnColor(int, java.awt.Color)
public void setAlternate(Color c1, Color c2, boolean isRowAlternate)
c1
- The color for row/column where row/column number is evenc2
- The color for row/column where row/column number is oddisRowAlternate
- Alternates colors on rows (true) or columns (false)public void disableAlternate()
public TableCellRenderer getCellRenderer(int row, int column)
getCellRenderer
in class JTable
public void removeColumns(int[] columns)
public int[] getHiddenColumns()
public void setSortingEnabled(boolean b)
public boolean isSortingEnabled()
public int getSortedColumnIndex()
public boolean isSortedColumnAscending()
public void removeHeader(int mode)
mode
- 0: all headers; 1: column header; 2: row headerpublic void setEditable(boolean b)
b
- a boolean value, true if the tree is editablepublic boolean isEditable()
public boolean isCellEditable(int row, int column)
isCellEditable
in class JTable
public void setRowHeaderEnabled(boolean b)
public CTableRowHeader getCTableRowHeader()
setRowHeaderEnabled(boolean)
public void setRowHeight(int row, int rowHeight)
setRowHeight
in class JTable
row
- row indexrowHeight
- row height, in pixelsprotected void configureEnclosingScrollPane()
configureEnclosingScrollPane
in class JTable
|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |