After reading a little bit more the documentation, I can see that the Id of the selected node is set into the DSRequest within a criteria which is called "parentId".
Here is a piece of the GenericGwtRpcDataSource class
Code:
@Override
protected void executeFetch(final String requestId,
final DSRequest request, final DSResponse response) {
//The ResultTree's DSRequests ask for the immediate children of a node only (by specifying parentId in the criteria).
String parentId = request.getCriteria().getAttribute("parentId");
//... take the parentId to pass it to the fetch method...
serviceAsync.fetch(parentId,
new AsyncCallback<List<D>>() {
public void onFailure(Throwable caught) {
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(requestId, response);
}
public void onSuccess(List<D> result) {
List<R> records = new ArrayList<R>();
for (D data : result) {
R newRec = getNewRecordInstance();
copyValues(data, newRec);
records.add(newRec);
}
response.setData(records.toArray(new Record[records.size()]));
processResponse(requestId, response);
}
});
}
Leave a comment: