Package com.im.df.api.support
Interface ViewDataConsumer
-
public interface ViewDataConsumer
ViewDataConsumer
consumes data distributed byViewDataProvider
.ViewDataProvider
interacts with its consumer via several methods using following protocol.Data are distributed sequentially in rounds where each round consists of the following sequence of methods calls:
startingViewDataRequest()
prepareRequest(com.chemaxon.ijc.commons.datarequest.api.RelationalDataRequest)
updateData(com.chemaxon.ijc.commons.datarequest.api.EntityDataResponse)
viewDataRequestFinished()
ViewDataProvider
.- Since:
- 5.12
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<DFDataTree.Vertex>
getVertices()
void
idsChanged(DFResultSet.VertexState vs, java.util.List<? extends java.lang.Comparable<?>> oldIDs, java.util.List<? extends java.lang.Comparable<?>> newIDs)
Notification about change in theVertexState
IDs.boolean
prepareRequest(com.chemaxon.ijc.commons.datarequest.api.RelationalDataRequest request)
Consumer is supposed to fill in a given request if it's missing some data.boolean
selectionChanged(DFResultSet.VertexState vs, SelectionDescription from, SelectionDescription to)
Notifies about change in selection fromfrom
selection toto
selection in a givenVertexState
.void
setQueryIsRunning(boolean queryIsRunning)
Notifies that query in the underlayingDFResultSet
has just been run or that its application has just finished.void
sortDirectiveChanged(DFResultSet.VertexState vs, SortDirective oldSort, SortDirective newSort)
Notification that sort directive of aVertexState
has changed.void
startingViewDataRequest()
Notifies consumer that new data distribution round starts.void
updateData(com.chemaxon.ijc.commons.datarequest.api.EntityDataResponse response)
New entity response arrived.void
viewDataRequestFinished()
This method is called always at the end of the data distribution round (seeViewDataConsumer
's Javadoc).
-
-
-
Method Detail
-
selectionChanged
boolean selectionChanged(DFResultSet.VertexState vs, SelectionDescription from, SelectionDescription to)
Notifies about change in selection fromfrom
selection toto
selection in a givenVertexState
. Consumer should consider whether this selection change implies a need for a new data and report so within return value. If new data are needed consumer will be soon asked withprepareRequest(RelationalDataRequest)
The method might be called from any thread.
- Parameters:
vs
-VertexState
in which the selection has changedfrom
- old selectionto
- new selection- Returns:
true
if new data are needed;false
otherwise.
-
startingViewDataRequest
void startingViewDataRequest()
Notifies consumer that new data distribution round starts.
-
prepareRequest
boolean prepareRequest(com.chemaxon.ijc.commons.datarequest.api.RelationalDataRequest request)
Consumer is supposed to fill in a given request if it's missing some data. If it does not need any data it is supposed to say so by returningfalse
and ignoring the request. Note that consumer which did not manifest interest in the request will not be bothered with any response, i.e.updateData(com.chemaxon.ijc.commons.datarequest.api.EntityDataResponse)
method will not be called within this round.- Parameters:
request
- request to be filed- Returns:
- whether consumer has the interest in request or not
-
updateData
void updateData(com.chemaxon.ijc.commons.datarequest.api.EntityDataResponse response)
New entity response arrived. It's up to consumer what it does with it.- Parameters:
response
- entity response
-
viewDataRequestFinished
void viewDataRequestFinished()
This method is called always at the end of the data distribution round (seeViewDataConsumer
's Javadoc). It is ensured thatstartingViewDataRequest()
was called before this method, i.e. this method cannot be called without thestartingViewDataRequest
. It is ensured to be called also in cases when some of the previous methods in the round threw exception.
-
getVertices
java.util.Collection<DFDataTree.Vertex> getVertices()
- Returns:
Vertex
s used by this consumer
-
idsChanged
void idsChanged(DFResultSet.VertexState vs, java.util.List<? extends java.lang.Comparable<?>> oldIDs, java.util.List<? extends java.lang.Comparable<?>> newIDs)
Notification about change in theVertexState
IDs.- Parameters:
vs
-VertexState
whose IDs were changedoldIDs
- old IDsnewIDs
- new IDs
-
setQueryIsRunning
void setQueryIsRunning(boolean queryIsRunning)
Notifies that query in the underlayingDFResultSet
has just been run or that its application has just finished.- Parameters:
queryIsRunning
- whether a query is running- See Also:
DFResultSet.PROP_QUERY_IS_RUNNING
-
sortDirectiveChanged
void sortDirectiveChanged(DFResultSet.VertexState vs, SortDirective oldSort, SortDirective newSort)
Notification that sort directive of aVertexState
has changed.- Parameters:
vs
-VertexState
whose sort directive was changedoldSort
- old sort directivenewSort
- new sort directive
-
-