public class IlvTreeListToFlatTableModel extends IlvDefaultFlatTableModel
IlvFlatTableModel
, based on an
IlvTreeListModel
.
The table columns are the tree list model columns, plus a synthetic column called "path".
Note: This model does not support adding and removing rows. You should
use the underlying IlvTreeListModel
for this purpose (assuming
it is an instance of IlvDefaultTreeListModel
).
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_ROWS_REMOVED_MASK
Constructor and Description |
---|
IlvTreeListToFlatTableModel(IlvTreeListModel model,
int depth)
Creates a model backed by a given
TreeModel , with zero columns. |
IlvTreeListToFlatTableModel(IlvTreeListModel model,
int depth,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
TreeModel , with the given columns. |
IlvTreeListToFlatTableModel(IlvTreeListModel model,
int depth,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
TreeModel , with the given columns. |
IlvTreeListToFlatTableModel(IlvTreeListModel model,
int depth,
int eventsMaskHint)
Creates a model backed by a given
TreeModel , with zero columns. |
Modifier and Type | Method and Description |
---|---|
void |
addRow()
This method throws an
UnsupportedOperationException . |
void |
addRow(Object[] rowData)
This method throws an
UnsupportedOperationException . |
Object |
clone()
Returns a copy of this object.
|
Object |
computePathValue(TreePath path)
Returns the value of the special property denoting the tree path from
tree root to the given object.
|
protected ilog.views.chart.datax.flat.internal.storage.IlvColumnStorage |
createColumnStorage(IlvDataColumnInfo storage)
Creates the backing storage for column values.
|
void |
disconnect()
Drops references to objects to help garbage collection.
|
void |
dispose()
Cleans up this model and drops references to objects to
help garbage collection.
|
void |
firePathColumnDataChanged()
Notifies the listeners that all values in the path column may have
changed.
|
double |
getDoubleAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex , as a numeric value. |
String |
getPathProperty()
Returns the name of the special property denoting the tree path from
tree root to the given object.
|
String |
getPathValueProperty()
Returns the property used to compute the special property denoting the
tree path.
|
String |
getPathValueSeparator()
Returns the separator used to compute the special property denoting the
tree path.
|
int |
getRowCount()
Returns the number of rows in the model.
|
int |
getSupportedEventsMask()
Returns a bit mask denoting the optional kinds of events that are guaranteed
to be sent by this model to the registered listeners.
|
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column)
Adds a column to the model at a given index.
|
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column,
double[] data)
Adds a column with given data to the model at a given index.
|
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column,
Object[] data)
Adds a column with given data to the model at a given index.
|
void |
insertRow(int rowIndex)
This method throws an
UnsupportedOperationException . |
void |
insertRow(int rowIndex,
Object[] rowData)
This method throws an
UnsupportedOperationException . |
void |
insertRows(int rowIndex,
int count)
This method throws an
UnsupportedOperationException . |
protected boolean |
isColumnComputed(int columnIndex)
Returns
true if setValueAtInternal and setDoubleAtInternal have no effect on a given
column. |
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
void |
removeRow(int rowIndex)
This method throws an
UnsupportedOperationException . |
void |
removeRows(int rowIndex,
int count)
This method throws an
UnsupportedOperationException . |
void |
setColumn(int i,
IlvDataColumnInfo column)
Replaces or adds a column.
|
void |
setColumnCount(int columnCount)
Sets the number of columns in the model.
|
void |
setColumns(List<IlvDataColumnInfo> columns)
Sets the list of columns.
|
protected boolean |
setDoubleAtInternal(double value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setDoubleAt() . |
void |
setPathProperty(String name)
Sets the name of the special property denoting the tree path from
tree root to the given object.
|
void |
setPathValueProperty(String name)
Sets the property used to compute the special property denoting the
tree path.
|
void |
setPathValueSeparator(String separator)
Sets the separator used to compute the special property denoting the
tree path.
|
void |
setRowCount(int rowCount)
This method throws an
UnsupportedOperationException . |
protected boolean |
setValueAtInternal(Object value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
addColumn, addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns, setDoubleAt, setValueAt
addFlatTableModelListener, convertToDouble, endBatch, removeFlatTableModelListener, startBatch
public IlvTreeListToFlatTableModel(IlvTreeListModel model, int depth)
TreeModel
, with zero columns.model
- A TreeModel
.depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.public IlvTreeListToFlatTableModel(IlvTreeListModel model, int depth, int eventsMaskHint)
TreeModel
, with zero columns.model
- A TreeModel
.depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.eventsMaskHint
- Desired events mask. This is just a hint; there is
no guarantee that the event types designated by the
mask are supported by this model.public IlvTreeListToFlatTableModel(IlvTreeListModel model, int depth, IlvDataColumnInfo[] columns)
TreeModel
, with the given columns.model
- A TreeModel
depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.columns
- The initial list of columns.public IlvTreeListToFlatTableModel(IlvTreeListModel model, int depth, IlvDataColumnInfo[] columns, int eventsMaskHint)
TreeModel
, with the given columns.model
- A TreeModel
depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.columns
- The initial list of columns.eventsMaskHint
- Desired events mask. This is just a hint; there is
no guarantee that the event types designated by the
mask are supported by this model.public int getRowCount()
Valid row indices range from 0 to getRowCount()-1
(inclusive).
getRowCount
in interface IlvFlatTableModel
getRowCount
in class IlvDefaultFlatTableModel
public void firePathColumnDataChanged()
public String getPathProperty()
public void setPathProperty(String name)
The default value is "path".
public Object computePathValue(TreePath path)
In the default implementation, this method returns a string constructed
by concatenating the values of the pathValueProperty
of each tree node in the tree path, separated by
pathValueSeparator
.
This method can be overridden in a subclass. The subclass is then
responsible for calling firePathColumnDataChanged()
whenever
some result of computePathValue
changes.
public String getPathValueProperty()
public void setPathValueProperty(String name)
The argument can be a column name, or the special token "%string", denoting the string representation of the tree node, or "%index", denoting the index of the tree node in its parent children list.
The default value is "%string".
public String getPathValueSeparator()
public void setPathValueSeparator(String separator)
The default value is "/".
public Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.getValueAt
in interface IlvFlatTableModel
getValueAt
in class IlvDefaultFlatTableModel
public double getDoubleAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
, as a numeric value.
This method should only be used for columns whose type is
Double. For other types of columns, this method will do a conversion
from the object returned by getValueAt
, which may be
inefficient or inaccurate or raise exceptions.
getDoubleAt
in interface IlvFlatTableModel
getDoubleAt
in class IlvDefaultFlatTableModel
protected boolean setValueAtInternal(Object value, int rowIndex, int columnIndex, boolean forReal)
setValueAt()
. Instead of notifying it simply returns
a boolean
indicating whether notification should be done.
If forReal is false
, the value is not actually set, but the
method still returns the same Boolean, indicating whether the given value is
different from the previous one.
setValueAtInternal
in class IlvDefaultFlatTableModel
protected boolean setDoubleAtInternal(double value, int rowIndex, int columnIndex, boolean forReal)
setDoubleAt()
. Instead of notifying it simply returns
a boolean
indicating whether notification should be done.
If forReal is false
, the value is not actually set, but the
method still returns the same Boolean, indicating whether the given value is
different from the previous one.
setDoubleAtInternal
in class IlvDefaultFlatTableModel
protected boolean isColumnComputed(int columnIndex)
true
if setValueAtInternal
and setDoubleAtInternal
have no effect on a given
column.isColumnComputed
in class IlvBasicFlatTableModel
public int getSupportedEventsMask()
This implementation currently returns
BEFORE_COLUMN_REMOVED_MASK
,
intersected with the eventsMaskHint constructor argument.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatTableModel
getSupportedEventsMask
in class IlvDefaultFlatTableModel
IlvFlatTableModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatTableModel.BEFORE_ROWS_REMOVED_MASK
,
IlvFlatTableModel.BEFORE_COLUMN_REMOVED_MASK
public void setRowCount(int rowCount)
UnsupportedOperationException
.setRowCount
in class IlvDefaultFlatTableModel
rowCount
- The new number of rows.public void addRow()
UnsupportedOperationException
.addRow
in class IlvDefaultFlatTableModel
public void addRow(Object[] rowData)
UnsupportedOperationException
.addRow
in class IlvDefaultFlatTableModel
rowData
- The initial data of this row, must be an array of
getColumnCount()
elements.public void insertRow(int rowIndex)
UnsupportedOperationException
.insertRow
in class IlvDefaultFlatTableModel
rowIndex
- The new row desired index, must be >= 0 and
<= getRowCount()
.public void insertRows(int rowIndex, int count)
UnsupportedOperationException
.insertRows
in class IlvDefaultFlatTableModel
rowIndex
- The first new row desired index, must be >= 0 and
<= getRowCount()
.count
- The number of rows to be inserted.public void insertRow(int rowIndex, Object[] rowData)
UnsupportedOperationException
.insertRow
in class IlvDefaultFlatTableModel
rowIndex
- The new row desired index, must be >= 0 and
<= getRowCount()
.rowData
- The initial data of this row, must be an array of
getColumnCount()
elements.public void removeRow(int rowIndex)
UnsupportedOperationException
.removeRow
in class IlvDefaultFlatTableModel
rowIndex
- The row index, must be >= 0 and
< getRowCount()
.public void removeRows(int rowIndex, int count)
UnsupportedOperationException
.removeRows
in class IlvDefaultFlatTableModel
rowIndex
- The first old row index, must be >= 0 and
<= getRowCount()
- count.count
- The number of rows to be removed.protected ilog.views.chart.datax.flat.internal.storage.IlvColumnStorage createColumnStorage(IlvDataColumnInfo storage)
IlvBasicFlatTableModel
null
if the methods
getValueAt
and getDoubleAt
do not need
backing store.createColumnStorage
in class IlvBasicFlatTableModel
public void setColumnCount(int columnCount)
IlvBasicFlatTableModel
columnCount
and greater are discarded.setColumnCount
in class IlvBasicFlatTableModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
IlvBasicFlatTableModel
insertColumn
in class IlvBasicFlatTableModel
columnIndex
- The new column desired index, must be >= 0 and
<= getColumnCount()
.column
- The metainformation of this column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, Object[] data)
IlvBasicFlatTableModel
insertColumn
in class IlvBasicFlatTableModel
columnIndex
- The new column desired index, must be >= 0 and
<= getColumnCount()
.column
- The metainformation of this column.data
- The initial data of this column. This should be an array
of at least getRowCount()
elements. Unused if
the column is a computed column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, double[] data)
IlvBasicFlatTableModel
insertColumn
in class IlvBasicFlatTableModel
columnIndex
- The new column desired index, must be >= 0 and
<= getColumnCount()
.column
- The metainformation of this column.data
- The initial data of this column. This should be an array
of at least getRowCount()
elements. Unused if
the column is a computed column.public void removeColumn(int columnIndex)
IlvBasicFlatTableModel
removeColumn
in class IlvBasicFlatTableModel
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public void setColumns(List<IlvDataColumnInfo> columns)
IlvBasicFlatTableModel
setColumns
in class IlvBasicFlatTableModel
columns
- A list of IlvDataColumnInfo
.public void setColumn(int i, IlvDataColumnInfo column)
IlvBasicFlatTableModel
removeColumn(i)
followed by
insertColumn(i, column)
.setColumn
in class IlvBasicFlatTableModel
column
- An IlvDataColumnInfo
.public void dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvBasicFlatTableModel
public void disconnect()
Note: After calling this function, and after some changes occurred in the underlying model or columns, this model is no longer functional.
disconnect
in class IlvBasicFlatTableModel
public Object clone()
clone
in class IlvDefaultFlatTableModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.