Package com.haulmont.yarg.structure

Examples of com.haulmont.yarg.structure.BandData


import java.util.List;

public class XlsxIntegrationTest {
    @Test
    public void testXlsx() throws Exception {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);

        BandData band1_1 = new BandData("Band1", root, BandOrientation.HORIZONTAL);
        band1_1.addData("col1", 1);
        band1_1.addData("col2", 2);
        band1_1.addData("col3", 3);
        band1_1.addData("col4", 4);
        band1_1.addData("col5", 5);
        band1_1.addData("col6", 6);

        BandData band12_1 = new BandData("Band12", band1_1, BandOrientation.HORIZONTAL);
        band12_1.addData("col1", 10);
        band12_1.addData("col2", 20);
        band12_1.addData("col3", 30);

        BandData band12_2 = new BandData("Band12", band1_1, BandOrientation.HORIZONTAL);
        band12_2.addData("col1", 100);
        band12_2.addData("col2", 200);
        band12_2.addData("col3", 300);

        BandData band13_1 = new BandData("Band13", band1_1, BandOrientation.VERTICAL);
        band13_1.addData("col1", 190);
        band13_1.addData("col2", 290);

        BandData band13_2 = new BandData("Band13", band1_1, BandOrientation.VERTICAL);
        band13_2.addData("col1", 390);
        band13_2.addData("col2", 490);

        BandData band14_1 = new BandData("Band14", band1_1, BandOrientation.VERTICAL);
        band14_1.addData("col1", "v5");
        band14_1.addData("col2", "v6");

        BandData band14_2 = new BandData("Band14", band1_1, BandOrientation.VERTICAL);
        band14_2.addData("col1", "v7");
        band14_2.addData("col2", "v8");

        BandData band1_2 = new BandData("Band1", root, BandOrientation.HORIZONTAL);
        band1_2.addData("col1", 11);
        band1_2.addData("col2", 22);
        band1_2.addData("col3", 33);
        band1_2.addData("col4", 44);
        band1_2.addData("col5", 55);
        band1_2.addData("col6", 66);

        BandData band12_3 = new BandData("Band12", band1_2, BandOrientation.HORIZONTAL);
        band12_3.addData("col1", 40);
        band12_3.addData("col2", 50);
        band12_3.addData("col3", 60);

        BandData band12_4 = new BandData("Band12", band1_2, BandOrientation.HORIZONTAL);
        band12_4.addData("col1", 400);
        band12_4.addData("col2", 500);
        band12_4.addData("col3", 600);

        band1_1.addChild(band12_1);
        band1_1.addChild(band12_2);
        band1_1.addChild(band13_1);
        band1_1.addChild(band13_2);
View Full Code Here


        compareFiles("./result/integration/result.xlsx", "./modules/core/test/integration/etalon.xlsx");
    }

    @Test
    public void testAlignmentXlsx() throws Exception {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);

        BandData band1_1 = createBand("Band1", 1, root, BandOrientation.HORIZONTAL);
        BandData band1_2 = createBand("Band1", 2, root, BandOrientation.HORIZONTAL);
        BandData band2_1 = createBand("Band2", 1, root, BandOrientation.HORIZONTAL);
        BandData band2_2 = createBand("Band2", 2, root, BandOrientation.HORIZONTAL);
        BandData band3_1 = createBand("Band3", 1, root, BandOrientation.VERTICAL);
        BandData band3_2 = createBand("Band3", 2, root, BandOrientation.VERTICAL);
        BandData band4_1 = createBand("Band4", 1, root, BandOrientation.VERTICAL);
        BandData band4_2 = createBand("Band4", 2, root, BandOrientation.VERTICAL);

        BandData split = new BandData("Split", root, BandOrientation.HORIZONTAL);
        BandData split2 = new BandData("Split2", root, BandOrientation.HORIZONTAL);
        BandData split3 = new BandData("Split3", root, BandOrientation.HORIZONTAL);

        root.addChild(band1_1);
        root.addChild(band1_2);
        root.addChild(split);
        root.addChild(band2_1);
View Full Code Here

        compareFiles("./result/integration/result-align.xlsx", "./modules/core/test/integration/etalon-align.xlsx");
    }

    private BandData createBand(String name, int multiplier, BandData root, BandOrientation childOrient) {
        BandData band1_1 = new BandData(name, root, BandOrientation.HORIZONTAL);
        band1_1.addData("col1", 1 * multiplier);
        band1_1.addData("col2", 2 * multiplier);

        BandData band11_1 = new BandData(name + "1", band1_1, childOrient);
        band11_1.addData("col1", 10 * multiplier);
        band11_1.addData("col2", 20 * multiplier);

        BandData band11_2 = new BandData(name + "1", band1_1, childOrient);
        band11_2.addData("col1", 100 * multiplier);
        band11_2.addData("col2", 200 * multiplier);

        band1_1.addChild(band11_1);
        band1_1.addChild(band11_2);
        return band1_1;
    }
View Full Code Here

public class XlsIntegrationTest {

    @Test
    public void testFormats() throws Exception {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);
        HashMap<String, Object> rootData = new HashMap<String, Object>();
        root.setData(rootData);
        BandData band1 = new BandData("Band1", root, BandOrientation.HORIZONTAL);
        band1.addData("date", new SimpleDateFormat("dd-MM-yyyy").parse("12-04-1961"));
        root.addChild(band1);

        FileOutputStream outputStream = new FileOutputStream("./result/integration/result-formats.xls");

        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("xls", root,
View Full Code Here

    }


    @Test
    public void testFormulas() throws Exception {
        BandData root = createRootBandForFormulas();

        FileOutputStream outputStream = new FileOutputStream("./result/integration/result-with-formulas.xls");

        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("xls", root,
                new ReportTemplateImpl("", "smoketest/test.xls", "./modules/core/test/integration/test-with-formulas.xls", ReportOutputType.xls), outputStream));
View Full Code Here

        compareFiles("./modules/core/test/integration/etalon-with-formulas.xls", "./result/integration/result-with-formulas.xls");
    }

    @Test
    public void testAggregations() throws Exception {
        BandData root = createRootBandForAggregation();

        FileOutputStream outputStream = new FileOutputStream("./result/integration/result-with-aggregation.xls");

        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("xls", root,
                new ReportTemplateImpl("", "smoketest/test.xls", "./modules/core/test/integration/test-with-aggregation.xls", ReportOutputType.xls), outputStream));
View Full Code Here

        compareFiles("./modules/core/test/integration/etalon-with-aggregation.xls", "./result/integration/result-with-aggregation.xls");
    }

    @Test
    public void testAggregationsEmpty() throws Exception {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);
        HashMap<String, Object> rootData = new HashMap<String, Object>();
        root.setData(rootData);

        FileOutputStream outputStream = new FileOutputStream("./result/integration/result-empty.xls");

        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("xls", root,
                new ReportTemplateImpl("", "smoketest/test.xls", "./modules/core/test/integration/test-with-aggregation.xls", ReportOutputType.xls), outputStream));
View Full Code Here

            }
        }
    }

    private BandData createRootBandForFormulas() {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);
        HashMap<String, Object> rootData = new HashMap<String, Object>();
        root.setData(rootData);
        BandData band1_1 = new BandData("Band1", root, BandOrientation.HORIZONTAL);
        BandData band1_2 = new BandData("Band1", root, BandOrientation.HORIZONTAL);
        BandData band1_3 = new BandData("Band1", root, BandOrientation.HORIZONTAL);
        BandData footer = new BandData("Footer", root, BandOrientation.HORIZONTAL);

        Map<String, Object> datamap = new HashMap<String, Object>();
        datamap.put("col1", 1);
        datamap.put("col2", 2);
        datamap.put("col3", 3);
View Full Code Here

        return root;
    }

    private BandData createRootBandForAggregation() {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);
        HashMap<String, Object> rootData = new HashMap<String, Object>();
        root.setData(rootData);

        BandData band1_1 = band(1, 2, BandOrientation.HORIZONTAL, null, "Band1");
        BandData band2_1 = band(11, 22, BandOrientation.HORIZONTAL, null, "Band2");
        BandData band2_2 = band(12, 23, BandOrientation.HORIZONTAL, null, "Band2");
        band1_1.addChildren(Arrays.asList(band2_1, band2_2));

        BandData band1_2 = band(2, 3, BandOrientation.HORIZONTAL, null, "Band1");
        BandData band2_3 = band(13, 24, BandOrientation.HORIZONTAL, null, "Band2");
        BandData band3_1 = band(111, null, BandOrientation.VERTICAL, band2_3, "Band3");
        BandData band3_2 = band(222, null, BandOrientation.VERTICAL, band2_3, "Band3");
        band1_2.addChildren(Arrays.asList(band2_3));
        band2_3.addChildren(Arrays.asList(band3_1, band3_2));

        BandData band1_3 = band(3, 4, BandOrientation.HORIZONTAL, null, "Band1");


        root.addChild(band1_1);
        root.addChild(band1_2);
        root.addChild(band1_3);
View Full Code Here

        return root;
    }

    private BandData band(int col1, Integer col2, BandOrientation orientation, BandData parentBand, String name) {
        BandData band1_1 = new BandData(name, parentBand, orientation);
        Map<String, Object> datamap = new HashMap<String, Object>();
        datamap.put("col1", col1);
        datamap.put("col2", col2);
        band1_1.setData(datamap);
        return band1_1;
    }
View Full Code Here

TOP

Related Classes of com.haulmont.yarg.structure.BandData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.