In method where I assign strategy to the VectorLayer:
{
org.gwtopenmaps.openlayers.client.Style style = new org.gwtopenmaps.openlayers.client.Style();
style.setJSObject(getOpenLayersStyle());
}
And where the magic is done:
private native JSObject getOpenLayersStyle() /*-{
var style = new $wnd.OpenLayers.Style({
fontColor: "#FFFFFF",
fontSize: "12px",
label: "${countLabel}"
}, { context: {
countLabel: function(feature) {
var countLabel;
if (feature.cluster) {
var result_count = 0;
for (var i = 0; i < feature.cluster.length; i++) {
result_count += feature.cluster[i].attributes.result_count;
}
countLabel = result_count.toString();
} else {
countLabel = feature.attributes.result_count.toString();
}
feature.attributes.label = countLabel;
return countLabel;
}
}
});
return style;
}-*/;