Rather than use PojoAdapter, use EntityModel [1] (or also EntityCollectionModel). These are basically wrappers around our OIDs, and are serializable.
Looking at our in-built CollectionContentsAsAjaxTablePanel [2] (or isis-wicket-gmap3 or isis-wicket-fullcalendar2) should help. Dan [1] https://github.com/apache/isis/blob/master/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java [2] https://github.com/apache/isis/blob/master/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanelFactory.java On 19 March 2015 at 10:51, Erik de Hair <[email protected]> wrote: > Hi Martin, > >> >> Although I think Dan's solutions would be better for the future I your >> solution of the custom component would help me out for now. >> >> After looking at the Excel and Gmap3 add ons I managed to get the >> collection with items (implementing the RankEditable interface with methods >> moveUp() and moveDown()) rendered. Now I need to add the actions to the >> datatable but have no idea how to create an action that acts on the >> underlying entity. I used Wicket's DataView-class to render the table. >> Could you give me some hints how to do this? >> >> Thanks, >> Erik >> > I shared some code on github [1]. It's not a complete application and it's > not quite generic yet. (Also a lot of experimental code) > > No action (rankUp) is rendered right now and I get some errors about a > PojoAdapter not being serializable. > > Caused by: java.io.NotSerializableException: org.apache.isis.core.runtime. > persistence.adapter.PojoAdapter > at java.io.ObjectOutputStream.writeObject0( > ObjectOutputStream.java:1183) > at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) > at java.util.ArrayList.writeObject(ArrayList.java:742) > at sun.reflect.GeneratedMethodAccessor266.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at java.io.ObjectStreamClass.invokeWriteObject( > ObjectStreamClass.java:988) > at java.io.ObjectOutputStream.writeSerialData( > ObjectOutputStream.java:1495) > at java.io.ObjectOutputStream.writeOrdinaryObject( > ObjectOutputStream.java:1431) > at java.io.ObjectOutputStream.writeObject0( > ObjectOutputStream.java:1177) > at java.io.ObjectOutputStream.defaultWriteFields( > ObjectOutputStream.java:1547) > at java.io.ObjectOutputStream.writeSerialData( > ObjectOutputStream.java:1508) > at java.io.ObjectOutputStream.writeOrdinaryObject( > ObjectOutputStream.java:1431) > at java.io.ObjectOutputStream.writeObject0( > ObjectOutputStream.java:1177) > at java.io.ObjectOutputStream.defaultWriteFields( > ObjectOutputStream.java:1547) > at java.io.ObjectOutputStream.writeSerialData( > ObjectOutputStream.java:1508) > at java.io.ObjectOutputStream.writeOrdinaryObject( > ObjectOutputStream.java:1431) > at java.io.ObjectOutputStream.writeObject0( > ObjectOutputStream.java:1177) > at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1377) > at java.io.ObjectOutputStream.writeObject0( > ObjectOutputStream.java:1173) > at java.io.ObjectOutputStream.defaultWriteFields( > ObjectOutputStream.java:1547) > > > How can I create an action that acts upon the related item? > > Thx, > Erik > > [1] https://github.com/erikdehair/rankeditable-component >
