legend.setFont(style);
legend.setMapId(mapModel.getMapInfo().getId());
legend.setTag("legend");
for (Layer layer : mapModel.getLayers()) {
if (layer instanceof VectorLayer && layer.isShowing()) {
VectorLayer vectorLayer = (VectorLayer) layer;
ClientVectorLayerInfo layerInfo = vectorLayer.getLayerInfo();
String label = layerInfo.getLabel();
FeatureTypeStyleInfo fts = layerInfo.getNamedStyleInfo().getUserStyle().
getFeatureTypeStyleList().get(0);
for (RuleInfo rule : fts.getRuleList()) {
// use title if present, name if not