The TableView Protocol

 

Last Revision: June 23, 1999

Overview:

Tools in sieve that belong to the Sluice Toolset communicate through the TableView API, following the TableView protocol. The Tabl eView API and the protocol implement a downstream-only flow model; changes propagate from one tool to the tools that are linked to the originator, and then to the tools connected to those, and so on, until reaching a tool that is not the source of any lin k. It is not possible to propagate changes up in the chain; the direction of the changes is always from the source of the link to its destination.

When a tool is selected as destination of a link, it immediately becomes a listener of the tool that is the origin of the link. Note that this behaviour is implemented in the SimpleLink class; is not necessarily the only way of connecti ng tools in sieve, but it is the way it works for the Sluice Toolset.

In order to interact with other tools, any tool in sluice must implement both the sieve.sluice.TableView and the sieve.sluice.TableViewListener interfaces.

 

View and Source Tables:

As its name suggests, the TableView interface defines a view over another table, let’s call it the source table . A view can expose a limited number of fields or records of the source table, but the total set of fields and records of the source table remain constant for a certain tool. A tool will send a TableViewChangedEvent when the view has changed. In any point in time it is possible to get an array with the content o f the view by calling

Object[][] data = view.get(view.getFieldsNames(),0);

On the other hand, if a completely new table is generated by a tool (that is, the tool that provides our tool of data have got a completely new source table), then that tool will first send a SourceRemovedEv ent followed by a SourceAddedEvent to all the tools directly linked to it. Although for most of the tools there is no difference in changing the view and changing the source, this distinction allows those too ls that can take advantage of the difference to recognize both situations. An example of this case would be a tool that implements caching of field information, in order to avoid asking again when a field is again in the view. Most of the tools consider b oth cases (changing the view and changing the source) in the same way, and simply do view.get(view.getFieldsNames(),0) to obtain a the new view.

 

 

The TableView protocol in detail:

 

 

 

 

 

Valid and invalid values for Tables:

 

Conventions