Package com.im.df.api.support
Interface ViewDataConsumer
-
public interface ViewDataConsumerViewDataConsumerconsumes data distributed byViewDataProvider.ViewDataProviderinteracts 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()voididsChanged(DFResultSet.VertexState vs, java.util.List<? extends java.lang.Comparable<?>> oldIDs, java.util.List<? extends java.lang.Comparable<?>> newIDs)Notification about change in theVertexStateIDs.booleanprepareRequest(com.chemaxon.ijc.commons.datarequest.api.RelationalDataRequest request)Consumer is supposed to fill in a given request if it's missing some data.booleanselectionChanged(DFResultSet.VertexState vs, SelectionDescription from, SelectionDescription to)Notifies about change in selection fromfromselection totoselection in a givenVertexState.voidsetQueryIsRunning(boolean queryIsRunning)Notifies that query in the underlayingDFResultSethas just been run or that its application has just finished.voidsortDirectiveChanged(DFResultSet.VertexState vs, SortDirective oldSort, SortDirective newSort)Notification that sort directive of aVertexStatehas changed.voidstartingViewDataRequest()Notifies consumer that new data distribution round starts.voidupdateData(com.chemaxon.ijc.commons.datarequest.api.EntityDataResponse response)New entity response arrived.voidviewDataRequestFinished()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 fromfromselection totoselection 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-VertexStatein which the selection has changedfrom- old selectionto- new selection- Returns:
trueif new data are needed;falseotherwise.
-
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 returningfalseand 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:
Vertexs 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 theVertexStateIDs.- Parameters:
vs-VertexStatewhose IDs were changedoldIDs- old IDsnewIDs- new IDs
-
setQueryIsRunning
void setQueryIsRunning(boolean queryIsRunning)
Notifies that query in the underlayingDFResultSethas 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 aVertexStatehas changed.- Parameters:
vs-VertexStatewhose sort directive was changedoldSort- old sort directivenewSort- new sort directive
-
-