// you dirty hack you...
PrintTemplateInfo template = request.getTemplate();
PageComponent page = (PageComponent) converterService.toInternal(template.getPage());
MapComponentImpl mapComponent = (MapComponentImpl) page.getChild(PrintTemplate.MAP);
if (mapComponent != null) {
LegendComponentImpl legendComponent = (LegendComponentImpl) mapComponent.getChild(PrintTemplate.LEGEND);
if (legendComponent != null) {
LabelComponentImpl lab = (LabelComponentImpl) legendComponent.getChild(PrintTemplate.TITLE);
if (lab != null) {
lab.setText(legendComponent.getTitle());
}
// need to do this before setSizeAndFit
adjustLegendFontSizeForSmallPageSizes(request, legendComponent);
}
}