You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Henk Vanhoe <he...@kava.be> on 2008/04/03 11:02:39 UTC
[Trinidad] Custom collectionmodel
Hi,
In our tables we need to use our own collection model (a wrapper for
org.apache.myfaces.trinidad.model.CollectionModel with its own
implementation of getRowKey and setRowKey). However the getter in the
backing bean for the value used in the table returns a java.util.List
and the trinidad implementation of CoreTable wraps that in its own
CollectionModel. Is there a way for us to force the trinidad table to
use our own CollectionModel?
Regards,
Henk
Re: [Trinidad] Custom collectionmodel
Posted by Henk Vanhoe <he...@kava.be>.
Max,
I managed to use our own collectionmodel with a solution similar to what
you suggested (have a method in my backing bean itself wrap the list).
It was a bit complicated because we are using nested tables, so we
always have to keep track of the parent table. But in fact that was
relatively easy with the getRowData() method.
Thanks a lot!
Henk
Max Starets wrote:
> Henk,
>
> How about having a simple backing bean used as a table value (for
> example - value="{#mybean.collectionModel}".
> You can execute EL in getCollectionModel() implementation of mybean to
> get the java.util.List, then return an instance
> of your custom collection model that wraps the List.
>
> Max
>
> Henk Vanhoe wrote:
>
>> Hi Max,
>>
>> I cannot use my custom model in the backing bean because it is an EJB3
>> entity with a one-to-many relationship to another entity. The table
>> should be filled with instances of this other entity but they are only
>> available in the first entity as a java.util.List. This List is filled
>> by the application server itself, so I cannot directly make the entity
>> return my own custom collection model.
>>
>> (I tried to directly wrap the list in my custom model in the entity
>> bean itself, but then I had classloader problems as the trinidad
>> libraries had to be included both in my ejb.jar archive and in the war
>> archive).
>>
>> Henk
>>
>> Max Starets wrote:
>>
>>> Henk,
>>>
>>> I must be missing something - why don't you just instantiate your
>>> custom CollectionModel as a backing bean
>>> and EL-bind table's value to it?
>>>
>>> Max
>>>
>>> Henk Vanhoe wrote:
>>>
>>>
>>>> Hi,
>>>> I found one way to force the trinidad table to use our own
>>>> collection model: to extend
>>>> org.apache.myfaces.trinidad.component.core.data.CoreTable and
>>>> override the createCollectionModel method. But I don't like this
>>>> solution because for this to work I have to make this method
>>>> non-final in the trinidad source code itself and recompile it! Is
>>>> there a reason why createCollectionModel is final in the source code
>>>> or could this be removed in the source repository itself (or do I
>>>> have to ask that on the dev mailing list?) Or does anybody have a
>>>> better solution?
>>>> Thanks
>>>> Henk
>>>>
>>>> Does anybody
>>>>
>>>> Henk Vanhoe wrote:
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> In our tables we need to use our own collection model (a wrapper
>>>>> for org.apache.myfaces.trinidad.model.CollectionModel with its own
>>>>> implementation of getRowKey and setRowKey). However the getter in
>>>>> the backing bean for the value used in the table returns a
>>>>> java.util.List and the trinidad implementation of CoreTable wraps
>>>>> that in its own CollectionModel. Is there a way for us to force the
>>>>> trinidad table to use our own CollectionModel?
>>>>>
>>>>> Regards,
>>>>> Henk
>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Re: [Trinidad] Custom collectionmodel
Posted by Max Starets <ma...@oracle.com>.
Henk,
How about having a simple backing bean used as a table value (for
example - value="{#mybean.collectionModel}".
You can execute EL in getCollectionModel() implementation of mybean to
get the java.util.List, then return an instance
of your custom collection model that wraps the List.
Max
Henk Vanhoe wrote:
> Hi Max,
>
> I cannot use my custom model in the backing bean because it is an EJB3
> entity with a one-to-many relationship to another entity. The table
> should be filled with instances of this other entity but they are only
> available in the first entity as a java.util.List. This List is filled
> by the application server itself, so I cannot directly make the entity
> return my own custom collection model.
>
> (I tried to directly wrap the list in my custom model in the entity
> bean itself, but then I had classloader problems as the trinidad
> libraries had to be included both in my ejb.jar archive and in the war
> archive).
>
> Henk
>
> Max Starets wrote:
>> Henk,
>>
>> I must be missing something - why don't you just instantiate your
>> custom CollectionModel as a backing bean
>> and EL-bind table's value to it?
>>
>> Max
>>
>> Henk Vanhoe wrote:
>>
>>> Hi,
>>> I found one way to force the trinidad table to use our own
>>> collection model: to extend
>>> org.apache.myfaces.trinidad.component.core.data.CoreTable and
>>> override the createCollectionModel method. But I don't like this
>>> solution because for this to work I have to make this method
>>> non-final in the trinidad source code itself and recompile it! Is
>>> there a reason why createCollectionModel is final in the source code
>>> or could this be removed in the source repository itself (or do I
>>> have to ask that on the dev mailing list?) Or does anybody have a
>>> better solution?
>>> Thanks
>>> Henk
>>>
>>> Does anybody
>>>
>>> Henk Vanhoe wrote:
>>>
>>>> Hi,
>>>>
>>>> In our tables we need to use our own collection model (a wrapper
>>>> for org.apache.myfaces.trinidad.model.CollectionModel with its own
>>>> implementation of getRowKey and setRowKey). However the getter in
>>>> the backing bean for the value used in the table returns a
>>>> java.util.List and the trinidad implementation of CoreTable wraps
>>>> that in its own CollectionModel. Is there a way for us to force the
>>>> trinidad table to use our own CollectionModel?
>>>>
>>>> Regards,
>>>> Henk
>>>>
>>>>
>>
>>
>
Re: [Trinidad] Custom collectionmodel
Posted by Henk Vanhoe <he...@kava.be>.
Hi Max,
I cannot use my custom model in the backing bean because it is an EJB3
entity with a one-to-many relationship to another entity. The table
should be filled with instances of this other entity but they are only
available in the first entity as a java.util.List. This List is filled
by the application server itself, so I cannot directly make the entity
return my own custom collection model.
(I tried to directly wrap the list in my custom model in the entity bean
itself, but then I had classloader problems as the trinidad libraries
had to be included both in my ejb.jar archive and in the war archive).
Henk
Max Starets wrote:
> Henk,
>
> I must be missing something - why don't you just instantiate your custom
> CollectionModel as a backing bean
> and EL-bind table's value to it?
>
> Max
>
> Henk Vanhoe wrote:
>
>> Hi,
>> I found one way to force the trinidad table to use our own collection
>> model: to extend
>> org.apache.myfaces.trinidad.component.core.data.CoreTable and override
>> the createCollectionModel method. But I don't like this solution
>> because for this to work I have to make this method non-final in the
>> trinidad source code itself and recompile it! Is there a reason why
>> createCollectionModel is final in the source code or could this be
>> removed in the source repository itself (or do I have to ask that on
>> the dev mailing list?) Or does anybody have a better solution?
>> Thanks
>> Henk
>>
>> Does anybody
>>
>> Henk Vanhoe wrote:
>>
>>> Hi,
>>>
>>> In our tables we need to use our own collection model (a wrapper for
>>> org.apache.myfaces.trinidad.model.CollectionModel with its own
>>> implementation of getRowKey and setRowKey). However the getter in the
>>> backing bean for the value used in the table returns a java.util.List
>>> and the trinidad implementation of CoreTable wraps that in its own
>>> CollectionModel. Is there a way for us to force the trinidad table to
>>> use our own CollectionModel?
>>>
>>> Regards,
>>> Henk
>>>
>>>
>>>
>
>
Re: [Trinidad] Custom collectionmodel
Posted by Max Starets <ma...@oracle.com>.
Henk,
I must be missing something - why don't you just instantiate your custom
CollectionModel as a backing bean
and EL-bind table's value to it?
Max
Henk Vanhoe wrote:
> Hi,
> I found one way to force the trinidad table to use our own collection
> model: to extend
> org.apache.myfaces.trinidad.component.core.data.CoreTable and override
> the createCollectionModel method. But I don't like this solution
> because for this to work I have to make this method non-final in the
> trinidad source code itself and recompile it! Is there a reason why
> createCollectionModel is final in the source code or could this be
> removed in the source repository itself (or do I have to ask that on
> the dev mailing list?) Or does anybody have a better solution?
> Thanks
> Henk
>
> Does anybody
>
> Henk Vanhoe wrote:
>> Hi,
>>
>> In our tables we need to use our own collection model (a wrapper for
>> org.apache.myfaces.trinidad.model.CollectionModel with its own
>> implementation of getRowKey and setRowKey). However the getter in the
>> backing bean for the value used in the table returns a java.util.List
>> and the trinidad implementation of CoreTable wraps that in its own
>> CollectionModel. Is there a way for us to force the trinidad table to
>> use our own CollectionModel?
>>
>> Regards,
>> Henk
>>
>>
>
Re: [Trinidad] Custom collectionmodel
Posted by Henk Vanhoe <he...@kava.be>.
Hi,
I found one way to force the trinidad table to use our own collection
model: to extend
org.apache.myfaces.trinidad.component.core.data.CoreTable and override
the createCollectionModel method. But I don't like this solution
because for this to work I have to make this method non-final in the
trinidad source code itself and recompile it! Is there a reason why
createCollectionModel is final in the source code or could this be
removed in the source repository itself (or do I have to ask that on the
dev mailing list?) Or does anybody have a better solution?
Thanks
Henk
Does anybody
Henk Vanhoe wrote:
> Hi,
>
> In our tables we need to use our own collection model (a wrapper for
> org.apache.myfaces.trinidad.model.CollectionModel with its own
> implementation of getRowKey and setRowKey). However the getter in the
> backing bean for the value used in the table returns a java.util.List
> and the trinidad implementation of CoreTable wraps that in its own
> CollectionModel. Is there a way for us to force the trinidad table to
> use our own CollectionModel?
>
> Regards,
> Henk
>
>