Java 类net.sf.jasperreports.engine.component.ComponentDesignConverter 实例源码

项目:jasperreports    文件:ComponentElementConverter.java   
@Override
public JRPrintElement convert(ReportConverter reportConverter,
        JRElement element)
{
    JRComponentElement componentElement = (JRComponentElement) element;
    JRPrintElement converted = null;
    ComponentKey componentKey = componentElement.getComponentKey();
    if (componentKey != null)
    {
        ComponentManager manager = reportConverter.getComponentsEnvironment().getManager(componentKey);
        if (manager != null)
        {
            ComponentDesignConverter converter = manager.getDesignConverter(reportConverter.getJasperReportsContext());
            if (converter != null)
            {
                // convert using the component converter
                converted = converter.convert(reportConverter, componentElement);
            }
        }
    }

    if (converted == null)
    {
        // fallback to the icon converter
        converted = ICON_CONVERTER.convert(reportConverter, element);
    }

    return converted;
}