You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Greg Brown <gk...@mac.com> on 2010/08/29 16:27:30 UTC

Serializer events

Hi all,

Just a little background on PIVOT-620. The idea occurred to me yesterday and seemed pretty compelling. It allows a caller to hook into the serialization process and be notified as data is read. Using this feature, an application can perform incremental updates as data is loaded to make the UI seem more responsive. For example, rather than simply waiting for a web query to return a large data structure (perhaps a long list read using CSVSerializer), the caller can be notified and populate the UI as data becomes available.

The Large Data demo has been updated to use this approach. If you haven't seen it, this application loads CSV files of up to one million rows and updates a table view a page at a time as the data is loaded. The result is that data begins to appear nearly instantly in the table view (and the caller can cancel the operation at any time by pressing the Cancel button). A similar technique could be used to load JSON or XML data (for example, to populate a TreeView component).

Though events are only supported by the CSV, JSON, and XML serializers at the moment, the concept isn't limited to those types. For example, we could add a listener to BufferedImageSerializer that notifies a caller when the image dimensions are available, or when progressive image frames are available, etc.

Hope you find it useful. I know I will!  :-)

Let me know if you have any questions.

G