code: private void buildLegend(VerticalPanel layout) {
  		NamedStyleInfo styleInfo = layer.getLayerInfo().getNamedStyleInfo();
  		int i = 0;
  		for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) {
  			for (RuleInfo rInfo : sfi.getRuleList()) {
  				String url = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
  				ServerLayerStyleWidget.addPath(url, layer.getServerLayerId());
  				ServerLayerStyleWidget.addPath(url, styleInfo.getName());
  				ServerLayerStyleWidget.addPath(url, i + ".png");
  				ServerLayerStyleWidget widget = new ServerLayerStyleWidget(URL.encode(url), rInfo.getName(), rInfo);
  				ruleWidgets.add(widget);
  				layout.add(widget);
  				i++;
  			}
  		}
  	}
docs: ------------------------------------------------------------------------