|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
org.pentaho.chart.data.ChartTableModel
public class ChartTableModel
Contains the data and metadata using with the charting API.
Field Summary | |
---|---|
static String |
COL_NAME
Column name. |
static String |
ROW_NAME
Row name. |
Constructor Summary | |
---|---|
ChartTableModel()
Creats an empty ChartTableModel |
|
ChartTableModel(boolean rotation)
Creats an empty ChartTableModel |
Method Summary | |
---|---|
int |
findRow(String rowName)
Returns the row number of the 1st row with the specified row name. |
Object |
getCellMetadata(int row,
int col,
Object key)
Retrieves the valid of the metadata for the specified cell and key |
Object |
getColMetadata(int col,
Object key)
Retrieves the metadata for the specified key and column |
int |
getColumnCount()
Returns the number of columns in the table |
String |
getColumnName(int col)
Returns the name of the specified 0-based column number |
int |
getRowCount()
Returns the number of rows in the table |
Object |
getRowMetadata(int row,
Object key)
Retrieves the metadata for the specified row and key. |
String |
getRowName(int row)
Returns the name of the specified 0-based row |
Object |
getValueAt(int row,
int col)
Returns the data at the specified (row, col) |
boolean |
isRotated()
Returns the current rotation |
void |
setCellMetadata(int row,
int col,
Object key,
Object value)
Sets a piece of metadata for a specified cell |
void |
setColMetadata(int col,
Object key,
Object value)
Sets a pieces of metadata for the specified column |
void |
setColumnName(int col,
String name)
Sets the name of the column for the specified 0-based column number |
void |
setData(Object[][] inData)
Sets the data based on the input Object array passed. |
void |
setRotated(boolean rotated)
Sets the rotation. |
void |
setRowMetadata(int row,
Object key,
Object value)
Sets a piece of metadata for the specified row |
void |
setRowName(int row,
String name)
Sets the name of the specified row |
void |
setValueAt(Object value,
int row,
int col)
Sets the data at the specified (row, col) |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.pentaho.chart.ChartData |
---|
findColumn |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, getColumnClass, isCellEditable, removeTableModelListener |
Field Detail |
---|
public static final String ROW_NAME
public static final String COL_NAME
Constructor Detail |
---|
public ChartTableModel()
public ChartTableModel(boolean rotation)
Method Detail |
---|
public boolean isRotated()
public void setRotated(boolean rotated)
true
, then the rows will be accessed as columns
and the columns will be accessed as rows. If the rotation is false
, then the table will be
accessed as normal.
public int getColumnCount()
getColumnCount
in interface TableModel
public int getRowCount()
getRowCount
in interface TableModel
public String getColumnName(int col)
getColumnName
in interface TableModel
Column name is ofcourse column specific, so we use COL as a placeholder to get Column specific data
public void setColumnName(int col, String name)
setColumnName
in interface ChartData
col
- the 0-based column numbername
- the name for the specified columnpublic Object getValueAt(int row, int col)
getValueAt
in interface TableModel
TableModel.getValueAt(int, int)
public void setValueAt(Object value, int row, int col) throws ArrayIndexOutOfBoundsException, IllegalStateException
setValueAt
in interface TableModel
value
- The value to be setrow
- The row number to be usedcol
- The col number to be used
ArrayIndexOutOfBoundsException
- indicates the row or column are invalid
IllegalStateException
- indicates there is no data in the tablepublic void setRowMetadata(int row, Object key, Object value) throws IllegalArgumentException
setRowMetadata
in interface ChartData
row
- the 0-based row number upon which to set the metadatakey
- the key for the metadatavalue
- the value of the metadata
IllegalArgumentException
- indicates an invalid parameter valuepublic Object getRowMetadata(int row, Object key) throws IllegalArgumentException
getRowMetadata
in interface ChartData
row
- the 0-based row number to check for the metadatakey
- the metadata key used to retrieve the metadata value
null
if the metadata
or row do not exist.
IllegalArgumentException
- indicates an invalid row number or keypublic void setColMetadata(int col, Object key, Object value) throws IllegalArgumentException
setColMetadata
in interface ChartData
col
- the 0-based column number upon which the metadata will be setkey
- the metadata keyvalue
- the metadata value
IllegalArgumentException
- indicates an invalid parameter valuepublic Object getColMetadata(int col, Object key) throws IllegalArgumentException
getColMetadata
in interface ChartData
col
- the 0-based column from which the metadata will be retrievedkey
- the key used to retrieve the metadata
null
will be returned
IllegalArgumentException
- indicates an invalid patameterpublic void setCellMetadata(int row, int col, Object key, Object value) throws IllegalArgumentException
setCellMetadata
in interface ChartData
row
- the 0-based row of the cell for which the metadata will be setcol
- the 0-based column of the cell for which the metadata will be setkey
- the key of the metadatavalue
- the value of the metadata
IllegalArgumentException
- indicates an invalid parameterpublic Object getCellMetadata(int row, int col, Object key)
getCellMetadata
in interface ChartData
row
- the 0-based row for the cellcol
- the 0-based column for the cellkey
- the metadata key
public String getRowName(int row)
getRowName
in interface ChartData
row
- the 0-based row number for which the name should be returned
public void setRowName(int row, String name)
setRowName
in interface ChartData
row
- the 0-based row indexname
- the name to assign to the specified rowpublic int findRow(String rowName)
findRow
in interface ChartData
rowName
- the row name
-1
if none found.public void setData(Object[][] inData) throws IllegalStateException
inData
- The input data
IllegalStateException
- if any data element within the array is null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |