当前位置: 首页>>代码示例>>Java>>正文


Java MasterReport.getItemBand方法代码示例

本文整理汇总了Java中org.pentaho.reporting.engine.classic.core.MasterReport.getItemBand方法的典型用法代码示例。如果您正苦于以下问题:Java MasterReport.getItemBand方法的具体用法?Java MasterReport.getItemBand怎么用?Java MasterReport.getItemBand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.reporting.engine.classic.core.MasterReport的用法示例。


在下文中一共展示了MasterReport.getItemBand方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading the Table DataFactory.
    DefaultTableModel tableModel = new DefaultTableModel(
      new Object[][] {
        {"Product A", 123},
        {"Product B", 234},
        {"Product C", 345},
        {"Product D", 456}
      },
  	new String[] {"Product", "Cost"});
    TableDataFactory dataFactory = new TableDataFactory();
    dataFactory.addTable("default", tableModel);
    report.setDataFactory(dataFactory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("Product");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("Cost");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:59,代码来源:PentahoServlet.java

示例2: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading OLAP data.
    DriverConnectionProvider provider = new DriverConnectionProvider();
    provider.setDriver("mondrian.olap4j.MondrianOlap4jDriver");
    provider.setUrl("jdbc:mondrian: ");
    provider.setProperty("Catalog", "./resources/steelwheels.mondrian.xml");
    provider.setProperty("JdbcUser", "pentaho_user");
    provider.setProperty("JdbcPassword", "password");
    provider.setProperty("Jdbc", "jdbc:hsqldb:./resources/sampledata/sampledata");
    provider.setProperty("JdbcDrivers", "org.hsqldb.jdbcDriver");

    // Creating the factory.
    BandedMDXDataFactory factory = new BandedMDXDataFactory(provider);
    factory.setQuery("default", "SELECT {[Measures].[Sales]} ON COLUMNS, {Descendants([Time].Children, [Time].[Months])} ON ROWS FROM [SteelWheelsSales]");
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("[Time].[Months]");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("[Measures].[Sales]");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:61,代码来源:PentahoServlet.java

示例3: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Load report xpath data.
    XPathDataFactory factory = new XPathDataFactory();
    factory.setXqueryDataFile("file:./resources/xpathexample.xml");
    factory.setQuery("default", "/ExampleResultSet/Row", false);
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("NAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("SIZE");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:52,代码来源:PentahoServlet.java

示例4: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading MQL data source.
    PmdDataFactory factory = new PmdDataFactory();
    factory.setConnectionProvider(new PmdConnectionProvider());
    factory.setXmiFile("resources/metadata.xmi");
    factory.setDomainId("test");
    factory.setQuery(
      "default",
      "<?xml version='1.0' encoding='UTF-8'?>" + 
      "<mql>" + 
        "<domain_id>test</domain_id>" + 
        "<model_id>BV_ORDERS</model_id>" + 
        "<options>" + 
          "<disable_distinct>false</disable_distinct>" + 
          "<limit>-1</limit>" + 
        "</options>" + 
        "<selections>" + 
          "<selection>" + 
            "<view>CAT_PRODUCTS</view>" + 
            "<column>BC_PRODUCTS_PRODUCTNAME</column>" + 
            "<aggregation>NONE</aggregation>" + 
          "</selection>" + 
          "<selection>" + 
            "<view>CAT_PRODUCTS</view>" + 
            "<column>BC_PRODUCTS_MSRP</column>" + 
            "<aggregation>AVERAGE</aggregation>" + 
          "</selection>" + 
        "</selections>" + 
        "<constraints/>" + 
        "<orders/>" + 
      "</mql>",
      null,
      null);

    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("BC_PRODUCTS_PRODUCTNAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("BC_PRODUCTS_MSRP");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:81,代码来源:PentahoServlet.java

示例5: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Data source provider.
    DriverDataSourceProvider dsProvider = new DriverDataSourceProvider();
    dsProvider.setDriver("org.hsqldb.jdbcDriver");
    dsProvider.setProperty("user", "pentaho_user");
    dsProvider.setProperty("password", "password");
    dsProvider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

    // Mondrian cube provider.
    DefaultCubeFileProvider cubeProvider = new DefaultCubeFileProvider();
    cubeProvider.setMondrianCubeFile("./resources/steelwheels.mondrian.xml");

    // Loading Mondrian data source.
    BandedMDXDataFactory factory = new BandedMDXDataFactory();
    factory.setDataSourceProvider(dsProvider);
    factory.setCubeFileProvider(cubeProvider);
    factory.setQuery("default", "SELECT {[Measures].[Sales]} ON COLUMNS, {Descendants([Time].Children, [Time].[Months])} ON ROWS FROM [SteelWheelsSales]");
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("[Time].[Months]");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("[Measures].[Sales]");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:64,代码来源:PentahoServlet.java

示例6: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading Kettle data source.
    KettleTransFromFileProducer producer = new KettleTransFromFileProducer (
      "resources/CSV Input - Reading customer data.ktr",
      "Dummy (do nothing)",
      new FormulaArgument[0], 
      new FormulaParameter[0]);
    KettleDataFactory factory = new KettleDataFactory();
    factory.setQuery("default", producer);
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("name");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("id");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:56,代码来源:PentahoServlet.java

示例7: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Defining the connection provider.
    DriverConnectionProvider provider = new DriverConnectionProvider();
    provider.setDriver("org.hsqldb.jdbcDriver");
    provider.setProperty("user", "pentaho_user");
    provider.setProperty("password", "password");
    provider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

    // Defining the query.
    SQLReportDataFactory dataFactory = new SQLReportDataFactory(provider);
    String sqlQuery = "SELECT PRODUCTNAME, QUANTITYINSTOCK FROM PRODUCTS";
    dataFactory.setQuery("default", sqlQuery);
    report.setDataFactory(dataFactory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("PRODUCTNAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the quantity in stock of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("QUANTITYINSTOCK");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:59,代码来源:PentahoServlet.java

示例8: doPost

import org.pentaho.reporting.engine.classic.core.MasterReport; //导入方法依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Defining the connection provider.
    Connection connection = DriverManager.getConnection("jdbc:hsqldb:./resources/sampledata/sampledata", "pentaho_user", "password");
    StaticConnectionProvider provider = new StaticConnectionProvider(connection);

    // Defining the query.
    SQLReportDataFactory dataFactory = new SQLReportDataFactory(provider);
    String sqlQuery = "SELECT PRODUCTNAME, QUANTITYINSTOCK FROM PRODUCTS";
    dataFactory.setQuery("default", sqlQuery);
    report.setDataFactory(dataFactory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("PRODUCTNAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("QUANTITYINSTOCK");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:56,代码来源:PentahoServlet.java


注:本文中的org.pentaho.reporting.engine.classic.core.MasterReport.getItemBand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。