Examples of TypedTableModel


Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

  }


  private MasterReport createReport()
  {
    final TypedTableModel model = new TypedTableModel();
    model.addColumn("key", String.class);
    model.addColumn("value", Integer.class);
    for (int i = 0; i < 1000; i += 1)
    {
      model.addRow(new Object[]{"K1", Integer.valueOf(1)});
    }

    final PageItemSumFunction itemSumFunction = new PageItemSumFunction();
    itemSumFunction.setField("value");
    itemSumFunction.setName("fn");
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

    ClassicEngineBoot.getInstance().start();
  }

  public void testParameterValidation() throws ReportProcessingException
  {
    final TypedTableModel model = new TypedTableModel();
    model.addColumn("key", String.class);
    model.addColumn("value", String.class);
    model.addRow(new String[]{"K1", "V1"});
    model.addRow(new String[]{"K2", "V2"});
    model.addRow(new String[]{"K3", "V3"});

    final TableDataFactory dataFactory = new TableDataFactory();
    dataFactory.addTable("query", model);

    final DefaultListParameter listParameter =
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

  }


  public void testStrictParameterValidation() throws ReportProcessingException
  {
    final TypedTableModel model = new TypedTableModel();
    model.addColumn("key", String.class);
    model.addColumn("value", String.class);
    model.addRow(new String[]{"K1", "V1"});
    model.addRow(new String[]{"K2", "V2"});
    model.addRow(new String[]{"K3", "V3"});

    final TableDataFactory dataFactory = new TableDataFactory();
    dataFactory.addTable("query", model);

    final DefaultListParameter listParameter =
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

    }
  }

  private TableDataFactory create()
  {
    TypedTableModel model = new TypedTableModel();
    model.addColumn("test-column", String.class);
    model.addRow("table");
    return new TableDataFactory("query", model);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

    final String displayName = getTypedParameter("display-name", String.class, col);
    final Object o = parameters.get(col);
    if (o == null || o.getClass().isArray() == false)
    {
      return new TypedTableModel(new String[]{displayName});
    }

    final TypedTableModel model =
        new TypedTableModel(new String[]{displayName}, new Class[]{o.getClass().getComponentType()});
    final int length = Array.getLength(o);
    for (int i = 0; i < length; i+= 1)
    {
      model.addRow(Array.get(o, i));
    }

    return model;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

  {
    final Boolean trueFirst = getTypedParameter("true-as-first", Boolean.class, Boolean.TRUE);
    final String trueText = getTypedParameter("true-text", String.class, "true");
    final String falseText = getTypedParameter("false-text", String.class, "false");

    final TypedTableModel tableModel = new TypedTableModel();
    tableModel.addColumn("bool", Boolean.class);
    tableModel.addColumn("int", Integer.class);
    tableModel.addColumn("text", String.class);

    if (Boolean.TRUE.equals(trueFirst))
    {
      tableModel.setValueAt(Boolean.TRUE, 0, 0);
      tableModel.setValueAt(1, 0, 1);
      tableModel.setValueAt(trueText, 0, 2);

      tableModel.setValueAt(Boolean.FALSE, 1, 0);
      tableModel.setValueAt(0, 1, 1);
      tableModel.setValueAt(falseText, 1, 2);
    }
    else
    {
      tableModel.setValueAt(Boolean.FALSE, 0, 0);
      tableModel.setValueAt(0, 0, 1);
      tableModel.setValueAt(falseText, 0, 2);

      tableModel.setValueAt(Boolean.TRUE, 1, 0);
      tableModel.setValueAt(1, 1, 1);
      tableModel.setValueAt(trueText, 1, 2);
    }

    return tableModel;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

  }


  private TableModel createData()
  {
    TypedTableModel model = new TypedTableModel();
    model.addColumn("f1", String.class);
    model.addColumn("f2", String.class);
    model.addColumn("f3", String.class);

    model.addRow(null, null, null);
    model.addRow("F1-0", null, null);
    model.addRow("F1-1", "F2-1", null);
    model.addRow(null, "F2-2", "F3-2");
    model.addRow("F2-3", null, "F3-3");
    return model;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

    final Integer limit = getTypedParameter("limit", Integer.class, 100);
    final BigDecimal stepSize = getTypedParameter("step", BigDecimal.class, new BigDecimal(1));
    final BigDecimal start = getTypedParameter("start", BigDecimal.class, new BigDecimal(1));
    final Boolean ascending = getTypedParameter("ascending", Boolean.class, true);
   
    final TypedTableModel tableModel = new TypedTableModel();
    tableModel.addColumn("number", BigDecimal.class);
    BigDecimal value;
    if (Boolean.TRUE.equals(ascending))
    {
      value = start;
    }
    else
    {
      value = start.add(stepSize.multiply(new BigDecimal(limit)));
    }

    for (int i = 0; i < limit; i++)
    {
      tableModel.setValueAt(value, i, 0);
      value = value.add(stepSize);
    }
    return tableModel;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

    final int rowCount = computeRowCount (rowCards, colCards);
    final int colCount = rowDims + colDims + 1;
    final String[] rowPattern = populatePatterns("Row-", rowPatternRaw, rowDims);
    final String[] colPattern = populatePatterns("Col-", colPatternRaw, colDims);

    final TypedTableModel model = new TypedTableModel(rowCount, colCount);
    for (int r = 0; r < rowDims; r+= 1)
    {
      model.addColumn("r" + r, String.class);
    }
    for (int c = 0; c < colDims; c+= 1)
    {
      model.addColumn("c" + c, String.class);
    }
    model.addColumn("value", Double.class);

    final Long seed = getTypedParameter("random-seed", Long.class, System.currentTimeMillis());

    final Random r = new Random(seed);
    final Object[] values = new Object[rowDims + colDims + 1];
    final int[] cards = new int[rowDims + colDims];
    Arrays.fill(cards, -1);
    int pos = 0;
    while (pos >= 0)
    {
      if (pos == cards.length)
      {
        values[pos] = r.nextDouble();
        model.addRow(values);

        pos -= 1;
        continue;
      }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.util.TypedTableModel

    //ModelPrinter.INSTANCE.print(logicalPageBox);
  }

  public void testReport() throws ReportProcessingException, IOException, ContentIOException, BundleWriterException
  {
    final TypedTableModel model = new TypedTableModel();
    model.addColumn("g0", String.class);
    model.addColumn("g1", String.class);
    model.addColumn("value", String.class);
    model.addRow("a", "1", "row-0");
    model.addRow("a", "2", "row-1");
    model.addRow("b", "1", "row-2");
    model.addRow("b", "2", "row-3");
    model.addRow("b", "2", "row-4");
    model.addRow("b", "2", "row-5");
    model.addRow("b", "3", "row-6");
    model.addRow("a", "1", "row-7");
    model.addRow("b", "1", "row-8");
    model.addRow("b", "2", "row-9");

    final MasterReport report = new MasterReport();
    report.setPageDefinition(new SimplePageDefinition(new PageSize(500, 100)));
    report.addGroup(new RelationalGroup());
    report.setDataFactory(new TableDataFactory("query", model));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.