* When fetching it is possible to filter the data with this filter object. Null otherwise.
* @param callback
* When this node's data comes from the server, it will be handled by this callback function.
*/
public void fetch(final String filter, final TileFunction<VectorTile> callback) {
final GetVectorTileRequest request = createRequest(filter);
GwtCommand command = new GwtCommand(GetVectorTileRequest.COMMAND);
command.setCommandRequest(request);
final VectorTile self = this;
deferred = GwtCommandDispatcher.getInstance().execute(command, new CommandCallback<GetVectorTileResponse>() {
public void execute(GetVectorTileResponse response) {
if (!(deferred != null && deferred.isCancelled())) {
GetVectorTileResponse tileResponse = (GetVectorTileResponse) response;
org.geomajas.layer.tile.VectorTile tile = tileResponse.getTile();
for (TileCode relatedTile : tile.getCodes()) {
codes.add(relatedTile);
}
code = tile.getCode();
screenWidth = tile.getScreenWidth();
screenHeight = tile.getScreenHeight();
contentType = tile.getContentType();
switch (contentType) {
case STRING_CONTENT:
featureContent.setContent(tile.getFeatureContent());
labelContent.setContent(tile.getLabelContent());
break;
case URL_CONTENT:
if (request.isPaintLabels()) {
if (tile.getLabelContent() == null) {
// feature content may also contain labels !
labelContent.setContent(tile.getFeatureContent());
} else {
labelContent.setContent(tile.getLabelContent());