public class IlvTreeListToFlatListModel extends IlvBasicFlatListModel
IlvFlatListModel
, 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_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvTreeListToFlatListModel(IlvTreeListModel model,
int depth)
Creates a model backed by a given
TreeModel , with zero columns. |
IlvTreeListToFlatListModel(IlvTreeListModel model,
int depth,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
TreeModel , with the given columns. |
IlvTreeListToFlatListModel(IlvTreeListModel model,
int depth,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
TreeModel , with the given columns. |
IlvTreeListToFlatListModel(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.
|
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(Object object,
int columnIndex)
Returns the value for the attribute number
columnIndex
in the given object. |
List |
getObjects()
Returns the objects in this model.
|
TreePath |
getPath(Object object)
Returns the path in the underlying tree model from the root to the
given object.
|
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.
|
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(Object object,
int columnIndex)
Returns the value for the attribute number
columnIndex
in the given object. |
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.
|
void |
setDoubleAt(double value,
Object object,
int columnIndex)
Sets the value for the attribute number
columnIndex
in the given object to the given value . |
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 . |
void |
setValueAt(Object value,
Object object,
int columnIndex)
Sets the value for the attribute number
columnIndex
in the given object to the given value . |
addColumn, addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns
addFlatListModelListener, convertToDouble, endBatch, removeFlatListModelListener, startBatch
public IlvTreeListToFlatListModel(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 IlvTreeListToFlatListModel(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 IlvTreeListToFlatListModel(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 IlvTreeListToFlatListModel(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()
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 List getObjects()
public Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.object
- The object (row) in which the value is to be looked up.columnIndex
- The column denoting the attribute whose value is to be
looked up.public double getDoubleAt(Object object, int columnIndex)
columnIndex
in the given object.
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.
object
- The object (row) in which the value is to be looked up.columnIndex
- The column denoting the attribute whose value is to be
looked up.public void setValueAt(Object value, Object object, int columnIndex)
columnIndex
in the given object to the given value
.value
- The new value.object
- The object (row) in which the value is to be changed.columnIndex
- The column denoting the attribute whose value is to be
changed.public void setDoubleAt(double value, Object object, int columnIndex)
columnIndex
in the given object to the given value
.
This method should only be used for columns whose type is Double. For other types of columns, this method will do a conversion to the column type, which may be inefficient or inaccurate or raise exceptions.
value
- The new value.object
- The object (row) in which the value is to be changed.columnIndex
- The column denoting the attribute whose value is to be
changed.protected boolean isColumnComputed(int columnIndex)
true
if setValueAtInternal
and setDoubleAtInternal
have no effect on a given
column.isColumnComputed
in class IlvBasicFlatListModel
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 IlvFlatListModel
getSupportedEventsMask
in class IlvBasicFlatListModel
IlvFlatListModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatListModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatListModel.BEFORE_COLUMN_REMOVED_MASK
public TreePath getPath(Object object)
public void setRowCount(int rowCount)
UnsupportedOperationException
.public void addRow()
UnsupportedOperationException
.public void addRow(Object[] rowData)
UnsupportedOperationException
.public void insertRow(int rowIndex)
UnsupportedOperationException
.public void insertRows(int rowIndex, int count)
UnsupportedOperationException
.public void insertRow(int rowIndex, Object[] rowData)
UnsupportedOperationException
.public void removeRow(int rowIndex)
UnsupportedOperationException
.public void removeRows(int rowIndex, int count)
UnsupportedOperationException
.public void setColumnCount(int columnCount)
IlvBasicFlatListModel
columnCount
and greater are discarded.setColumnCount
in class IlvBasicFlatListModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
IlvBasicFlatListModel
insertColumn
in class IlvBasicFlatListModel
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)
IlvBasicFlatListModel
insertColumn
in class IlvBasicFlatListModel
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 getObjects().size()
elements. Not used
if the column is a computed column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, double[] data)
IlvBasicFlatListModel
insertColumn
in class IlvBasicFlatListModel
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 getObjects().size()
elements. Not used
if the column is a computed column.public void removeColumn(int columnIndex)
IlvBasicFlatListModel
removeColumn
in class IlvBasicFlatListModel
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public void setColumns(List<IlvDataColumnInfo> columns)
IlvBasicFlatListModel
setColumns
in class IlvBasicFlatListModel
columns
- A list of IlvDataColumnInfo
.public void setColumn(int i, IlvDataColumnInfo column)
IlvBasicFlatListModel
removeColumn(i)
followed by
insertColumn(i, column)
.setColumn
in class IlvBasicFlatListModel
column
- An IlvDataColumnInfo
.public void dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvBasicFlatListModel
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 IlvBasicFlatListModel
public Object clone()
clone
in class IlvBasicFlatListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.