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

项目:jasperreports    文件:XYChartCompiler.java   
@Override
public void verify(Component component, JRVerifier verifier)
{
    XYChartComponent chart = (XYChartComponent) component;

    verifyEvaluation(verifier, chart);

    XYDataset dataset = chart.getDataset();
    if (dataset == null)
    {
        verifier.addBrokenRule("No dataset for axis chart", chart);
    }
    else
    {
        verify(verifier, dataset);
    }
}
项目:jasperreports    文件:PieChartCompiler.java   
public void verify(Component component, JRVerifier verifier)
{
    PieChartComponent chart = (PieChartComponent) component;

    verifyEvaluation(verifier, chart);

    verifyTitleExpression(verifier, chart);

    PieDataset dataset = chart.getDataset();
    if (dataset == null)
    {
        verifier.addBrokenRule("No dataset for pie chart", chart);
    }
    else
    {
        verify(verifier, dataset);
    }
}
项目:jasperreports    文件:JRComponentRule.java   
@Override
public void end(String namespace, String name) throws JRException
{
    Object top = getDigester().peek();
    if (!(top instanceof Component))
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_INVALID_INSTANCE,
                new Object[]{top.getClass().getName(), Component.class.getName()});
    }

    Component component = (Component) top;
    JRDesignComponentElement componentElement = (JRDesignComponentElement) getDigester().peek(1);
    String namespacePrefix = ((JRXmlDigester) getDigester()).getLastNamespacePrefix();
    ComponentKey componentKey = new ComponentKey(namespace, namespacePrefix, name);
    componentElement.setComponentKey(componentKey);
    componentElement.setComponent(component);
}
项目:jasperreports    文件:ListComponentCompiler.java   
@Override
public void collectExpressions(Component component,
        JRExpressionCollector collector)
{
    ListComponent listComponent = (ListComponent) component;
    JRDatasetRun datasetRun = listComponent.getDatasetRun();
    collector.collect(datasetRun);

    JRExpressionCollector datasetCollector = collector.getDatasetCollector(
            datasetRun.getDatasetName());
    JRElement[] elements = listComponent.getContents().getElements();
    if (elements != null)
    {
        for (int i = 0; i < elements.length; i++)
        {
            elements[i].collectExpressions(datasetCollector);
        }
    }
}
项目:jasperreports    文件:FillListFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    try
    {
        ListComponent list = (ListComponent) component;
        FillComponent fillList;
        PrintOrderEnum printOrder = list.getPrintOrderValue();
        if (printOrder == null 
                || printOrder == PrintOrderEnum.VERTICAL)
        {
            fillList = new VerticalFillList(list, factory);
        }
        else
        {
            fillList = new HorizontalFillList(list, factory);
        }
        return fillList;
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:dynamicreports-jasper    文件:GeoMapCompiler.java   
@Override
public void verify(Component component, JRVerifier verifier) {
    GeoMapComponent geoMap = (GeoMapComponent) component;

    EvaluationTimeEnum evaluationTime = geoMap.getEvaluationTime();
    if (evaluationTime == EvaluationTimeEnum.AUTO) {
        verifier.addBrokenRule("Auto evaluation time is not supported for geo maps", geoMap);
    } else if (evaluationTime == EvaluationTimeEnum.GROUP) {
        String evaluationGroup = geoMap.getEvaluationGroup();
        if (evaluationGroup == null || evaluationGroup.length() == 0) {
            verifier.addBrokenRule("No evaluation group set for geo map", geoMap);
        } else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup)) {
            verifier.addBrokenRule("Map evalution group \"" + evaluationGroup + " not found", geoMap);
        }
    }

    GeoMapDataset dataset = geoMap.getDataset();
    if (dataset == null) {
        verifier.addBrokenRule("No dataset for geo map", geoMap);
    } else {
        verifier.verifyElementDataset(dataset);
    }
}
项目:jasperreports    文件:TextInputComponentXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    if (component instanceof TextInputComponent) {
        TextInputComponent textInputComponent = (TextInputComponent) component;
        ComponentKey componentKey = componentElement.getComponentKey();
        writeTextInputComponent(textInputComponent, componentKey, reportWriter);
    }
}
项目:jasperreports    文件:TextInputComponentFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    TextInputComponent textInputComponent = (TextInputComponent) component;
    return new TextInputComponentFill(textInputComponent, factory);
}
项目:jasperreports    文件:XYChartCompiler.java   
@Override
public void collectExpressions(Component component, JRExpressionCollector collector)
{
    XYChartComponent chart = (XYChartComponent) component;
    collector.addExpression(chart.getChartTitleExpression());
    collector.addExpression(chart.getXAxisTitleExpression());
    collector.addExpression(chart.getYAxisTitleExpression());
    collectExpressions(chart.getDataset(), collector);
}
项目:jasperreports    文件:XYChartCompiler.java   
@Override
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    XYChartComponent chart = (XYChartComponent) component;
    XYChartComponent compiledChart = new XYChartComponent(chart, baseFactory);
    return compiledChart;
}
项目:jasperreports    文件:PieChartCompiler.java   
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    PieChartComponent chart = (PieChartComponent) component;
    PieChartComponent compiledChart = new PieChartComponent(chart, baseFactory);
    return compiledChart;
}
项目:jasperreports    文件:BarChartCompiler.java   
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    BarChartComponent chart = (BarChartComponent) component;
    BarChartComponent compiledChart = new BarChartComponent(chart, baseFactory);
    return compiledChart;
}
项目:jasperreports    文件:PieChartXmlWriter.java   
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    PieChartComponent chart = (PieChartComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    ComponentKey componentKey = componentElement.getComponentKey();

    String namespaceURI = componentKey.getNamespace();
    String schemaLocation = 
        ComponentsEnvironment.getInstance(jasperReportsContext)
            .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation();
    XmlNamespace namespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(),
            schemaLocation);

    writer.startElement("pieChart", namespace);

    writer.addAttribute("evaluationTime", chart.getEvaluationTime(), EvaluationTimeEnum.NOW);
    if (chart.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        writer.addEncodedAttribute("evaluationGroup", chart.getEvaluationGroup());
    }

    PieDataset dataset = chart.getDataset();
    writer.startElement("pieDataset");

    reportWriter.writeElementDataset(dataset);

    writer.writeExpression("keyExpression", dataset.getKeyExpression());
    writer.writeExpression("valueExpression", dataset.getValueExpression());

    writer.closeElement();//pieDataset

    writer.writeExpression("titleExpression", chart.getTitleExpression());

    writer.closeElement();//pieChart
}
项目:jasperreports    文件:HtmlComponentFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    HtmlComponent htmlComponent = (HtmlComponent) component;
    return new HtmlComponentFill(htmlComponent);
}
项目:jasperreports    文件:HtmlComponentXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    if (component instanceof HtmlComponent) 
    {
        writeHtmlComponent(componentElement, reportWriter);
    }
}
项目:jasperreports    文件:HtmlComponentXmlWriter.java   
protected void writeHtmlComponent(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    HtmlComponent htmlComponent = (HtmlComponent) component;
    ComponentKey componentKey = componentElement.getComponentKey();

    XmlNamespace namespace = new XmlNamespace(
            HtmlComponentExtensionsRegistryFactory.NAMESPACE, 
            componentKey.getNamespacePrefix(),
            HtmlComponentExtensionsRegistryFactory.XSD_LOCATION);

    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();

    writer.startElement("html", namespace);

    writer.addAttribute(HtmlComponent.PROPERTY_SCALE_TYPE, htmlComponent.getScaleType());
    writer.addAttribute(HtmlComponent.PROPERTY_HORIZONTAL_ALIGN, htmlComponent.getHorizontalImageAlign());
    writer.addAttribute(HtmlComponent.PROPERTY_VERTICAL_ALIGN, htmlComponent.getVerticalImageAlign());
    writeExpression(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION, htmlComponent.getHtmlContentExpression(), false, componentElement, reportWriter);

    if (htmlComponent.getEvaluationTime() != EvaluationTimeEnum.NOW) {
        writer.addAttribute(HtmlComponent.PROPERTY_EVALUATION_TIME, htmlComponent.getEvaluationTime());
    }
    writer.addAttribute(HtmlComponent.PROPERTY_EVALUATION_GROUP, htmlComponent.getEvaluationGroup());
    writer.addAttribute(HtmlComponent.PROPERTY_CLIP_ON_OVERFLOW, htmlComponent.getClipOnOverflow());

    writer.closeElement();
}
项目:jasperreports    文件:JRVerifier.java   
protected void verifyComponentElement(JRComponentElement element)
{
    verifyReportElement(element);

    ComponentKey componentKey = element.getComponentKey();
    if (componentKey == null)
    {
        addBrokenRule("No component key set for component element", element);
    }

    Component component = element.getComponent();
    if (component == null)
    {
        addBrokenRule("No component set for component element", element);
    }

    if (componentKey != null && component != null)
    {
        ComponentCompiler compiler = 
            ComponentsEnvironment.getInstance(jasperReportsContext).getManager(componentKey).getComponentCompiler(jasperReportsContext);
        pushCurrentComponentElement(element);
        try
        {
            compiler.verify(component, this);
        }
        finally
        {
            popCurrentComponentElement();
        }
    }
}
项目:jasperreports    文件:JRDesignComponentElement.java   
/**
 * Sets the component instance wrapped by this element.
 * 
 * @param component the component instance
 * @see #getComponent()
 */
public void setComponent(Component component)
{
    Object old = this.component;
    this.component = component;
    setComponentContext();
    getEventSupport().firePropertyChange(PROPERTY_COMPONENT, old, this.component);
}
项目:jasperreports    文件:BarcodeCompiler.java   
@Override
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    BarcodeComponent barcode = (BarcodeComponent) component;
    CompiledBarcodeFactory factory = new CompiledBarcodeFactory(baseFactory);
    return factory.toCompiledComponent(barcode);
}
项目:jasperreports    文件:BarcodeCompiler.java   
@Override
public void verify(Component component, JRVerifier verifier)
{
    BarcodeComponent barcode = (BarcodeComponent) component;
    BarcodeVerifier barcodeVerifier = new BarcodeVerifier(verifier);
    barcode.receive(barcodeVerifier);
}
项目:jasperreports    文件:BarcodeFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    BarcodeComponent barcode = (BarcodeComponent) component;
    return new BarcodeFillComponent(barcode);
}
项目:jasperreports    文件:ComponentsXmlWriter.java   
protected void writeBarbecue(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    BarbecueComponent barcode = (BarbecueComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    ComponentKey componentKey = componentElement.getComponentKey();

    XmlNamespace namespace = new XmlNamespace(
            ComponentsExtensionsRegistryFactory.NAMESPACE, 
            componentKey.getNamespacePrefix(),
            ComponentsExtensionsRegistryFactory.XSD_LOCATION);

    writer.startElement("barbecue", namespace);

    writer.addAttribute("type", barcode.getType());
    writer.addAttribute("drawText", barcode.isDrawText());
    writer.addAttribute("checksumRequired", barcode.isChecksumRequired());
    writer.addAttribute("barWidth", barcode.getBarWidth());
    writer.addAttribute("barHeight", barcode.getBarHeight());
    if (isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_0_0))
    {
        writer.addAttribute("rotation", barcode.getOwnRotation());
    }
    if (barcode.getEvaluationTimeValue() != EvaluationTimeEnum.NOW)
    {
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, 
                barcode.getEvaluationTimeValue());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, 
            barcode.getEvaluationGroup());

    writeExpression("codeExpression", barcode.getCodeExpression(), false, componentElement, reportWriter);
    writeExpression("applicationIdentifierExpression", barcode.getApplicationIdentifierExpression(), false, componentElement, reportWriter);

    writer.closeElement();
}
项目:jasperreports    文件:MapCompiler.java   
@Override
public void collectExpressions(Component component, JRExpressionCollector collector)
{
    MapComponent map = (MapComponent) component;
    collector.addExpression(map.getLatitudeExpression());
    collector.addExpression(map.getLongitudeExpression());
    collector.addExpression(map.getAddressExpression());
    collector.addExpression(map.getZoomExpression());
    collector.addExpression(map.getLanguageExpression());

    List<ItemData> markerDataList = map.getMarkerDataList();
    if(markerDataList != null && markerDataList.size() > 0) {
        for(ItemData markerData : markerDataList){
            ItemCompiler.collectExpressions(markerData, collector);
        }
    }
    List<ItemData> pathStyleList = map.getPathStyleList();
    if(pathStyleList != null && pathStyleList.size() > 0) {
        for(ItemData pathStyle : pathStyleList){
            ItemCompiler.collectExpressions(pathStyle, collector);
        }
    }
    List<ItemData> pathDataList = map.getPathDataList();
    if(pathDataList != null && pathDataList.size() > 0) {
        for(ItemData pathData : pathDataList){
            ItemCompiler.collectExpressions(pathData, collector);
        }
    }
}
项目:jasperreports    文件:MapCompiler.java   
@Override
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    MapComponent map = (MapComponent) component;
    return new StandardMapComponent(map, baseFactory);
}
项目:jasperreports    文件:MapFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    MapComponent map = (MapComponent) component;
    return new MapFillComponent(map, factory);
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException
{
    Component component = componentElement.getComponent();
    SpiderChartComponent spiderChartComponent = (SpiderChartComponent) component;
    JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
    ComponentKey componentKey = componentElement.getComponentKey();

    String namespaceURI = componentKey.getNamespace();
    String schemaLocation = 
        ComponentsEnvironment.getInstance(jasperReportsContext)
            .getBundle(namespaceURI).getXmlParser().getPublicSchemaLocation();
    XmlNamespace componentNamespace = new XmlNamespace(namespaceURI, componentKey.getNamespacePrefix(),
            schemaLocation);


    writer.startElement(ELEMENT_spiderChart, componentNamespace);

    writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, spiderChartComponent.getEvaluationTime(), EvaluationTimeEnum.NOW);

    if (spiderChartComponent.getEvaluationTime() == EvaluationTimeEnum.GROUP)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_evaluationGroup, spiderChartComponent.getEvaluationGroup());
    }

    ChartSettings chartSettings = spiderChartComponent.getChartSettings();
    writeChart(chartSettings, writer, reportWriter, componentNamespace);

    SpiderDataset dataset = (SpiderDataset)spiderChartComponent.getDataset();
    writeSpiderDataSet(dataset, writer, reportWriter, componentNamespace);

    SpiderPlot spiderPlot = (SpiderPlot)spiderChartComponent.getPlot();
    writeSpiderPlot(spiderPlot, chartSettings, writer, componentNamespace);

    writer.closeElement();//spiderChart
}
项目:jasperreports    文件:SpiderChartCompiler.java   
@Override
public void collectExpressions(Component component, JRExpressionCollector collector)
{
    SpiderChartComponent chart = (SpiderChartComponent) component;
    collectExpressions(chart.getChartSettings(), collector);
    collectExpressions((SpiderDataset)chart.getDataset(), collector);
    collectExpressions((SpiderPlot)chart.getPlot(), collector);
}
项目:jasperreports    文件:SpiderChartCompiler.java   
@Override
public void verify(Component component, JRVerifier verifier)
{
    SpiderChartComponent chartComponent = (SpiderChartComponent) component;

    verifyEvaluation(verifier, chartComponent);

    ChartSettings chartSettings = chartComponent.getChartSettings();
    if (chartSettings == null)
    {
        verifier.addBrokenRule("No chart settings for spider chart", chartComponent);
    }

    SpiderDataset dataset = (SpiderDataset)chartComponent.getDataset();
    if (dataset == null)
    {
        verifier.addBrokenRule("No dataset for spider chart", chartComponent);
    }
    else
    {
        verify(verifier, dataset);
    }

    SpiderPlot spiderPlot = (SpiderPlot)chartComponent.getPlot();

    if (dataset == null)
    {
        verifier.addBrokenRule("No plot set for spider chart", chartComponent);
    }
    else
    {
        verify(verifier, spiderPlot);
    }


}
项目:jasperreports    文件:SpiderChartCompiler.java   
@Override
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    SpiderChartComponent chart = (SpiderChartComponent) component;
    SpiderChartComponent compiledChart = new SpiderChartComponent(chart, baseFactory);
    return compiledChart;
}
项目:jasperreports    文件:ListComponentCompiler.java   
@Override
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    ListComponent listComponent = (ListComponent) component;
    StandardListComponent compiledComponent = new StandardListComponent(
            listComponent, baseFactory);
    return compiledComponent;
}
项目:jasperreports    文件:BarbecueCompiler.java   
@Override
public void collectExpressions(Component component, JRExpressionCollector collector)
{
    BarbecueComponent barcode = (BarbecueComponent) component;
    collector.addExpression(barcode.getCodeExpression());
    collector.addExpression(barcode.getApplicationIdentifierExpression());
}
项目:jasperreports    文件:BarbecueCompiler.java   
@Override
public Component toCompiledComponent(Component component,
        JRBaseObjectFactory baseFactory)
{
    BarbecueComponent barcode = (BarbecueComponent) component;
    return new StandardBarbecueComponent(barcode, baseFactory);
}
项目:jasperreports    文件:BarbecueCompiler.java   
@Override
public void verify(Component component, JRVerifier verifier)
{
    BarbecueComponent barcode = (BarbecueComponent) component;

    String type = barcode.getType();
    if (type == null)
    {
        verifier.addBrokenRule("No barcode type set", barcode);
    }

    JRExpression codeExpression = barcode.getCodeExpression();
    if (codeExpression == null)
    {
        verifier.addBrokenRule("Barcode expression is null", barcode);
    }

    EvaluationTimeEnum evaluationTime = barcode.getEvaluationTimeValue();
    if (evaluationTime == EvaluationTimeEnum.AUTO)
    {
        verifier.addBrokenRule("Auto evaluation time is not supported for barcodes", barcode);
    }
    else if (evaluationTime == EvaluationTimeEnum.GROUP)
    {
        String evaluationGroup = barcode.getEvaluationGroup();
        if (evaluationGroup == null || evaluationGroup.length() == 0)
        {
            verifier.addBrokenRule("No evaluation group set for barcode", barcode);
        }
        else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup))
        {
            verifier.addBrokenRule("Barcode evaluation group \"" 
                    + evaluationGroup + " not found", barcode);
        }
    }
}
项目:jasperreports    文件:BarbecueFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    BarbecueComponent barcode = (BarbecueComponent) component;
    return new BarbecueFillComponent(barcode);
}
项目:jasperreports    文件:SortComponentFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    SortComponent sortComponent = (SortComponent) component;
    return new SortComponentFill(sortComponent);
}
项目:jasperreports    文件:SortComponentXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    if (component instanceof SortComponent) 
    {
        writeSortComponent(componentElement, reportWriter);
    }
}
项目:jasperreports    文件:IconLabelComponentCompiler.java   
@Override
public void collectExpressions(Component component, JRExpressionCollector collector) 
{
    IconLabelComponent iconLabelComponent = (IconLabelComponent) component;
    collector.collect(iconLabelComponent.getLabelTextField());
    collector.collect(iconLabelComponent.getIconTextField());
}
项目:jasperreports    文件:IconLabelComponentXmlWriter.java   
@Override
public void writeToXml(JRComponentElement componentElement, JRXmlWriter reportWriter) throws IOException 
{
    Component component = componentElement.getComponent();
    if (component instanceof IconLabelComponent) {
        IconLabelComponent iconLabelComponent = (IconLabelComponent) component;
        ComponentKey componentKey = componentElement.getComponentKey();
        writeIconLabelComponent(iconLabelComponent, componentKey, reportWriter);
    }
}
项目:jasperreports    文件:IconLabelComponentFillFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    IconLabelComponent iconLabelComponent = (IconLabelComponent) component;
    return new IconLabelComponentFill(iconLabelComponent, factory);
}
项目:jasperreports    文件:FillTableFactory.java   
@Override
public FillComponent toFillComponent(Component component,
        JRFillObjectFactory factory)
{
    TableComponent table = (TableComponent) component;
    return new FillTable(table, factory);
}