Hello Mark, thanks for your answer.
I think the code line you mentioned describes the default behaviour of the framework. So the problem with the concurrent access would not be solved, because the framework would still use the integer indices.
Best regards, Simon Kulessa. Am 10.06.2010 08:57, schrieb Mark Millman:
I've done the following to create SortableModel from Lists model = (SortableModel) org.apache.myfaces.trinidad.model.ModelUtils.toCollectionModel((Object)list) ; It's not elegant but it seems to work well enough. Mark -----Original Message----- From: Simon Kulessa [mailto:kule...@flexsecure.de] Sent: Wednesday, June 09, 2010 4:08 AM To: users@myfaces.apache.org Subject: [Trinidad] concurrent access to a sortable table Hello everyone, I am developing a web application for my company based on JSF 1.2.14 and Trinidad 1.2.13. In this application we have different views that are displayed with the help of the<tr:table> tag. We discovered recently that the default data model does not support concurrent access to the data. Source: http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/t rinidad/model/CollectionModel.html -- The only solution to this problem i have discovered so far, is that we have to implement our own CollectionModel to support unique row keys. Question 1: Is there really no other way to support concurrent access? Question 2: Does a tutorial or a discription exist, how the framework uses the CollectionModel? Or a tutorial for implementing your own CollectionModel ? -- I have tried to implement a class that extends the CollectionModel class and implemented the necessary methods. For example: I used the setWrappedData(Object o) method to save the data as an attribute inside the CollectionModel and to generate an index to map the uniqueKey to the specified row. Request 3: It would be helpfull if someone can provide a sample for an efficient implementation of a CollectionModel ? -- To return the CollectionModel to the Framework I changed the return type of the getData method (<tr:table values="someBean.data">) from the previously used List<Data> to CollectionModel, which now wrapps the List<Data>. The bad thing is, that the framework calls this method three times during the render phase. That means I currently need to create/convert the CollectionModel and the index for the mapping three times. Question 4: Is there a way to prevent this? Maybe an additional check can be added to verify in which render state the call is made? -- Another problem is that our data table needs to support sorting. The default CollectionModel does not support sorting and the SortableCollectionMethod does not seem to be expandable (since it uses Integer's as rowKeys). The solution seems to override the "isSortable, getSortingCriteria, setSortingCriteria" methods of the CollectionModel and implement the sorting feature on your own. Question 5: Again, is that really the way you have to do it? Request 6: An efficient sample of an implementation would be nice. -- Any help is appreciated. If necessary I could provide my sample implementation. Best regards, Simon Kulessa.
-- Diplom Informatiker Simon Kulessa FlexSecure GmbH Industriestr. 12 D - 64297 Darmstadt Tel: +49 (0) 6151 501 23-15 Fax: +49 (0) 6151 501 23-19 E-Mail:kule...@flexsecure.de Internet:www.flexsecure.de Geschäftsführer: Erwin Stallenberger, Markus Ruppert Amtsgericht Darmstadt HRB 8036 Umsatzsteuernummer: DE 214745269
smime.p7s
Description: S/MIME Cryptographic Signature