public class IlvTreeToFlatTableModel extends IlvDefaultFlatTableModel
IlvFlatTableModel
, based on a
Swing TreeModel
.
The table columns are the properties of the tree nodes, plus a synthetic column called "path".
Note: This model does not support adding and removing rows. You should
use the underlying TreeModel
for this purpose (assuming it is
an instance of DefaultTreeModel
and its nodes are instances
of MutableTreeNode
).
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_ROWS_REMOVED_MASK
Constructor and Description |
---|
IlvTreeToFlatTableModel(TreeModel model,
int depth,
IlvPropertyConnector propaccess)
Creates a model backed by a given
TreeModel , with zero columns. |
IlvTreeToFlatTableModel(TreeModel model,
int depth,
IlvPropertyConnector propaccess,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
TreeModel , with the given columns. |
IlvTreeToFlatTableModel(TreeModel model,
int depth,
IlvPropertyConnector propaccess,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
TreeModel , with the given columns. |
IlvTreeToFlatTableModel(TreeModel model,
int depth,
IlvPropertyConnector propaccess,
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 |
fireAllDataChanged()
Notifies the listeners that all data values may have changed
(but the number of rows and columns are not 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 |
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 |
removeRow(int rowIndex)
This method throws an
UnsupportedOperationException . |
void |
removeRows(int rowIndex,
int count)
This method throws an
UnsupportedOperationException . |
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, insertColumn, insertColumn, insertColumn, removeColumn, setColumn, setColumnCount, setColumns, setDoubleAt, setValueAt
addFlatTableModelListener, convertToDouble, endBatch, removeFlatTableModelListener, startBatch
public IlvTreeToFlatTableModel(TreeModel model, int depth, IlvPropertyConnector propaccess)
TreeModel
, with zero columns.model
- A TreeModel
.depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.propaccess
- The way to access the properties of the model nodes.public IlvTreeToFlatTableModel(TreeModel model, int depth, IlvPropertyConnector propaccess, int eventsMaskHint)
TreeModel
, with zero columns.model
- A TreeModel
.depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.propaccess
- The way to access the properties of the model nodes.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 IlvTreeToFlatTableModel(TreeModel model, int depth, IlvPropertyConnector propaccess, IlvDataColumnInfo[] columns)
TreeModel
, with the given columns.model
- A TreeModel
.depth
- A depth limit; use Integer.MAX_VALUE
to use the entire model.propaccess
- The way to access the properties of the model nodes.columns
- The initial list of columns.public IlvTreeToFlatTableModel(TreeModel model, int depth, IlvPropertyConnector propaccess, 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.propaccess
- The way to access the properties of the model nodes.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 fireAllDataChanged()
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 fireAllDataChanged()
whenever
some result of computePathValue
changes.
public String getPathValueProperty()
public void setPathValueProperty(String name)
The argument can be a property 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 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, 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.