registerRpc(DataProviderClientRpc.class, new DataProviderClientRpc() {
@Override
- public void resetSize(long size) {
+ public void reset() {
ds.asList().clear();
// Inform the server-side that all keys are now dropped.
Set<String> keySet = new HashSet<String>(keyToJson.keySet());
public Iterator<T> iterator() {
return backend.iterator();
}
-
- @Override
- public long size() {
- return backend.size();
- }
}
*/
public interface DataSource<T> extends Iterable<T>, Serializable {
- /**
- * Gets the data object count from the back end.
- *
- * @return back end size
- */
- long size();
-
/**
* Saves a data object to the back end. If it's a new object, it should be
* created in the back end. Existing objects with changes should be stored.
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
+ if (reset) {
+ getRpcProxy(DataProviderClientRpc.class).reset();
+ }
+
if (initial || reset) {
- getRpcProxy(DataProviderClientRpc.class).resetSize(
- dataSource.size());
pushData(0, dataSource);
} else if (!updatedData.isEmpty()) {
JsonArray dataArray = Json.createArray();
public interface DataProviderClientRpc extends ClientRpc {
/**
- * Sets the size of the client-side DataSource.
- *
- * @param size
- * the new data set size
+ * Informs the client-side DataSource that all data has been invalidated.
*/
- void resetSize(long size);
+ void reset();
/**
* Sets the data of the client-side DataSource to match the given data