Fix bug in SerializableListDataModel
This is a follow-up on an earlier commit:
97cc86b7c1
Issue: SWF-1510
This commit is contained in:
@@ -24,9 +24,10 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A {@link DataModel} implementation that tracks the currently selected row, allowing only one selection at a time.
|
||||
*
|
||||
*
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class OneSelectionTrackingListDataModel<T> extends SerializableListDataModel<T> implements SelectionAware<T> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.faces.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -29,8 +32,10 @@ import org.springframework.util.Assert;
|
||||
* @author Jeremy Grelle
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SerializableListDataModel<T> extends ListDataModel<T> implements Serializable {
|
||||
|
||||
|
||||
public SerializableListDataModel() {
|
||||
this(new ArrayList<T>());
|
||||
}
|
||||
@@ -59,6 +64,16 @@ public class SerializableListDataModel<T> extends ListDataModel<T> implements Se
|
||||
super.setWrappedData(data);
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||
oos.writeObject(getWrappedData());
|
||||
oos.write(getRowIndex());
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
|
||||
setWrappedData(ois.readObject());
|
||||
setRowIndex(ois.read());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getWrappedData().toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user