myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamran Kashanian <>
Subject Re: [jira] Created: (TRINIDAD-1938) RowKeyPropertyModel and RowKeyPropertyTreeModel
Date Mon, 11 Oct 2010 21:57:59 GMT
To clarify  ...

The proposal is to add two new model implementations
in org.apache.myfaces.trinidad.model package:

1) org.apache.myfaces.trinidad.model.RowKeyPropertyModel
2) org.apache.myfaces.trinidad.model.RowKeyPropertyTreeModel

RowKeyPropertyModel extends SortableModel and uses row keys (identified by a
property in each row) instead of indexes.
RowKeyPropertyTreeModel extends ChildPropertyTreeModel and wraps each child
model with a RowKeyPropertyModel.

For implementation details for each model please refer to the patch


On Mon, Oct 11, 2010 at 2:15 PM, Kamran Kashanian (JIRA) <> wrote:

> RowKeyPropertyModel and RowKeyPropertyTreeModel
> -----------------------------------------------
>                 Key: TRINIDAD-1938
>                 URL:
>             Project: MyFaces Trinidad
>          Issue Type: Improvement
>          Components: Components
>    Affects Versions:
>         Environment: All
>            Reporter: Kamran Kashanian
> By default,  when Java Lists/Arrays are used as models in Trinidad
> table/tree/treeTable components,  they are wrapped in a SortableModel
> instance.
> The problem with SortableModel is that it uses row indexes as row keys.
>  This makes SortableModel immutable and insert/delete operations in the
> underlying List/array can cause problems.  For example,  indexes shift after
> insert/delete operations and can cause problems if the component is holding
> on to row keys in SelectedRowKey/DisclosedRowKey sets.
> The proposal is to add row key based CollectionModel/TreeModels which avoid
> using indexes as row keys.
> Attaching a patch for a RowKeyPropertyModel and a RowKeyPropertyTreeModel.
>   RowKeyPropertyModel takes a rowKeyProperty name which identifies the
> unique row key in each model row by name.  The setRowKey/getRowKey etc APIs
> use the rowKeyProperty to reference the row key attribute.
> One drawback with the default implementation of setRowKey API in
> RowKeyPropertyModel is that it is inefficient and does a linear search
> through the model to find the row with the given row key.  The search can be
> optimized in subclasses for specific model implementations.
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.

View raw message