@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception
{
DesignStyleContainer styleContainer = (DesignStyleContainer) digester.peek();
JasperDesign jasperDesign = (JasperDesign) digester.peek(digester.getCount() - 2);
styleContainer.setDefaultStyleProvider(jasperDesign);
String styleName = attributes.getValue(styleAttribute);
if (styleName != null)
{
Map stylesMap = jasperDesign.getStylesMap();
if (stylesMap.containsKey(styleName))
{
JRStyle style = (JRStyle) stylesMap.get(styleName);
styleContainer.setStyle(style);
}
else
{
styleContainer.setStyleNameReference(styleName);
}
}
}