Search in sources :

Example 1 with TextReportElement

use of org.activityinfo.shared.report.model.TextReportElement in project activityinfo by bedatadriven.

the class ItextReportRendererTest method htmlImages.

@Test
public void htmlImages() throws IOException {
    DummyPivotTableData data = new DummyPivotTableData();
    PivotChartContent chartContent = new PivotChartContent();
    chartContent.setData(data.table);
    chartContent.setYMin(0);
    chartContent.setYStep(100);
    chartContent.setFilterDescriptions(Collections.EMPTY_LIST);
    PivotChartReportElement chart = new PivotChartReportElement(Type.Pie);
    chart.setTitle("My Pie Chart");
    chart.setCategoryDimensions(data.colDims);
    chart.setSeriesDimensions(data.rowDims);
    chart.setContent(chartContent);
    PivotContent tableContent = new PivotContent();
    tableContent.setFilterDescriptions(Collections.EMPTY_LIST);
    tableContent.setData(data.table);
    PivotTableReportElement table = new PivotTableReportElement();
    table.setColumnDimensions(data.colDims);
    table.setRowDimensions(data.rowDims);
    table.setTitle("My Table");
    table.setContent(tableContent);
    BubbleMapMarker marker1 = new BubbleMapMarker();
    marker1.setLat(-2.45);
    marker1.setLng(28.8);
    marker1.setX(100);
    marker1.setY(100);
    marker1.setRadius(25);
    TileBaseMap baseMap = new TileBaseMap();
    baseMap.setTileUrlPattern("http://mt{s}.aimaps.net/nordkivu.cd/v1/z{z}/{x}x{y}.png");
    MapContent mapContent = new MapContent();
    mapContent.setFilterDescriptions(Collections.EMPTY_LIST);
    mapContent.setBaseMap(baseMap);
    mapContent.setZoomLevel(8);
    mapContent.setCenter(new Extents(-2.2, -2.1, 28.85, 28.9).center());
    mapContent.setMarkers(Arrays.asList((MapMarker) marker1));
    MapReportElement map = new MapReportElement();
    map.setTitle("My Map");
    map.setContent(mapContent);
    ReportContent content = new ReportContent();
    content.setFilterDescriptions(Collections.EMPTY_LIST);
    Report report = new Report();
    report.setContent(content);
    report.addElement(chart);
    report.addElement(table);
    report.addElement(new TextReportElement("Testing 1..2.3.. français"));
    report.addElement(map);
    renderToPdf(report, "piechart.pdf");
    renderToHtml(report, "piechart.html");
    // renderToHtmlUsingWriter(report, "piechart2.html");
    renderToRtf(report, "piechart.rtf");
}
Also used : ReportContent(org.activityinfo.shared.report.content.ReportContent) MapMarker(org.activityinfo.shared.report.content.MapMarker) IconMapMarker(org.activityinfo.shared.report.content.IconMapMarker) BubbleMapMarker(org.activityinfo.shared.report.content.BubbleMapMarker) MapContent(org.activityinfo.shared.report.content.MapContent) Report(org.activityinfo.shared.report.model.Report) DummyPivotTableData(org.activityinfo.server.report.DummyPivotTableData) BubbleMapMarker(org.activityinfo.shared.report.content.BubbleMapMarker) PivotTableReportElement(org.activityinfo.shared.report.model.PivotTableReportElement) Extents(org.activityinfo.shared.util.mapping.Extents) TextReportElement(org.activityinfo.shared.report.model.TextReportElement) MapReportElement(org.activityinfo.shared.report.model.MapReportElement) PivotContent(org.activityinfo.shared.report.content.PivotContent) TileBaseMap(org.activityinfo.shared.map.TileBaseMap) PivotChartReportElement(org.activityinfo.shared.report.model.PivotChartReportElement) PivotChartContent(org.activityinfo.shared.report.content.PivotChartContent) Test(org.junit.Test)

Example 2 with TextReportElement

use of org.activityinfo.shared.report.model.TextReportElement in project activityinfo by bedatadriven.

the class ItextReportRendererTest method pageNumbers.

@Test
public void pageNumbers() throws IOException {
    ReportContent content = new ReportContent();
    content.setFilterDescriptions(Collections.EMPTY_LIST);
    Report report = new Report();
    report.setContent(content);
    for (int i = 0; i != 1000; ++i) {
        TextReportElement element = new TextReportElement();
        element.setText("Quick brown fox, texte français");
        element.setContent(new NullContent());
        report.addElement(element);
    }
    renderToPdf(report, "pagenumbers.pdf");
}
Also used : ReportContent(org.activityinfo.shared.report.content.ReportContent) Report(org.activityinfo.shared.report.model.Report) NullContent(org.activityinfo.shared.report.content.NullContent) TextReportElement(org.activityinfo.shared.report.model.TextReportElement) Test(org.junit.Test)

Example 3 with TextReportElement

use of org.activityinfo.shared.report.model.TextReportElement in project activityinfo by bedatadriven.

the class ElementWidget method loadHtml.

private void loadHtml() {
    contentElement.setInnerHTML("");
    loadingElement.getStyle().setDisplay(Display.BLOCK);
    if (model instanceof TextReportElement) {
        renderStaticHtml();
    } else {
        dispatcher.execute(new RenderReportHtml(model), new AsyncCallback<HtmlResult>() {

            @Override
            public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub
            }

            @Override
            public void onSuccess(HtmlResult result) {
                updateHtml(result.getHtml());
            }
        });
    }
}
Also used : HtmlResult(org.activityinfo.shared.command.result.HtmlResult) RenderReportHtml(org.activityinfo.shared.command.RenderReportHtml) TextReportElement(org.activityinfo.shared.report.model.TextReportElement)

Example 4 with TextReportElement

use of org.activityinfo.shared.report.model.TextReportElement in project activityinfo by bedatadriven.

the class JaxbParseTest method testElements.

@Test
public void testElements() throws JAXBException {
    Report report = parseXml("report-elements.xml");
    dumpXml(report);
    Assert.assertEquals("element count", 7, report.getElements().size());
    Assert.assertTrue("pivotTable", report.getElements().get(0) instanceof PivotTableReportElement);
    Assert.assertTrue("pivotChart", report.getElements().get(1) instanceof PivotChartReportElement);
    Assert.assertTrue("table", report.getElements().get(2) instanceof TableElement);
    Assert.assertTrue("map", report.getElements().get(3) instanceof MapReportElement);
    Assert.assertTrue("static", report.getElements().get(4) instanceof TextReportElement);
    Assert.assertTrue("static", report.getElements().get(5) instanceof TextReportElement);
    Assert.assertTrue("static", report.getElements().get(6) instanceof ImageReportElement);
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) ImageReportElement(org.activityinfo.shared.report.model.ImageReportElement) Report(org.activityinfo.shared.report.model.Report) PivotChartReportElement(org.activityinfo.shared.report.model.PivotChartReportElement) PivotTableReportElement(org.activityinfo.shared.report.model.PivotTableReportElement) TableElement(org.activityinfo.shared.report.model.TableElement) TextReportElement(org.activityinfo.shared.report.model.TextReportElement) Test(org.junit.Test)

Aggregations

TextReportElement (org.activityinfo.shared.report.model.TextReportElement)4 Report (org.activityinfo.shared.report.model.Report)3 Test (org.junit.Test)3 ReportContent (org.activityinfo.shared.report.content.ReportContent)2 MapReportElement (org.activityinfo.shared.report.model.MapReportElement)2 PivotChartReportElement (org.activityinfo.shared.report.model.PivotChartReportElement)2 PivotTableReportElement (org.activityinfo.shared.report.model.PivotTableReportElement)2 DummyPivotTableData (org.activityinfo.server.report.DummyPivotTableData)1 RenderReportHtml (org.activityinfo.shared.command.RenderReportHtml)1 HtmlResult (org.activityinfo.shared.command.result.HtmlResult)1 TileBaseMap (org.activityinfo.shared.map.TileBaseMap)1 BubbleMapMarker (org.activityinfo.shared.report.content.BubbleMapMarker)1 IconMapMarker (org.activityinfo.shared.report.content.IconMapMarker)1 MapContent (org.activityinfo.shared.report.content.MapContent)1 MapMarker (org.activityinfo.shared.report.content.MapMarker)1 NullContent (org.activityinfo.shared.report.content.NullContent)1 PivotChartContent (org.activityinfo.shared.report.content.PivotChartContent)1 PivotContent (org.activityinfo.shared.report.content.PivotContent)1 ImageReportElement (org.activityinfo.shared.report.model.ImageReportElement)1 TableElement (org.activityinfo.shared.report.model.TableElement)1