Package org.eclipse.birt.report.model.api

Examples of org.eclipse.birt.report.model.api.ElementFactory


      SessionHandle session = engine.newSessionHandle(ULocale.ENGLISH);

      // create a design or a template. Then create a report element
      // factory
      ReportDesignHandle design = session.createDesign();
      ElementFactory efactory = design.getElementFactory();

      // set my initial properties
      design.setDisplayName("my Test Report");
      design.setDescription("test");
      design.setIconFile("/templates/blank_report.gif");
      design.setFileName("c:/TEMP/sample.rptdesign");
      design.setDefaultUnits("in");
      design.setProperty("comments", "what not and what have you");

      SimpleMasterPageHandle element = efactory
          .newSimpleMasterPage("Page Master");
      DesignElementHandle footerText = efactory.newTextItem("test");
      footerText.setProperty("contentType", "html");
      footerText.setStringProperty("content", "MyTest");

      // Add in a simple page footer to our master page
      element.getPageFooter().add(footerText);

      // try to add the footer to the Master Page
      try {
        design.getMasterPages().add(element);
      } catch (ContentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (NameException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      // create a new grid element, and set the width to 100 percent of
      // the page design
      GridHandle grid = efactory.newGridItem(null, 1, 1);
      grid.setWidth("100%");

      // Add the grid to the report body
      design.getBody().add(grid);

      // create a new row
      RowHandle row = (RowHandle) grid.getRows().get(0);

      // Create a label and add it to the first cell.
      LabelHandle label = efactory.newLabel("Hello, world!");
      label.setText("Hello, World!");
      CellHandle cell = (CellHandle) row.getCells().get(0);
      cell.getContent().add(label);

      // save the report design
View Full Code Here

TOP

Related Classes of org.eclipse.birt.report.model.api.ElementFactory

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.