View Full Version : Help with ExampleTableModel from tutorial

09-19-2013, 09:30 AM
Hi, I am working with 'Pentaho Reporting 3.5 for Java Developers (http://techbus.safaribooksonline.com/book/programming/java/9781847193193)' step by step.

Can you please help me with some questions:
for 'Chapter 5: Working with data sources' -
I am trying to implement my own custom ExampleTableModel.

I did all step as it was described, so I got for Chapter2SwingApp is excelent showing report with reflection call to "ch5.ExampleFactory#getAllData()" - method without parameters,

...but for "ch5.ExampleFactory#getLibData(true)" call - I got 'No such method: ch5.ExampleFactory#getLibData'

How to solve it?

PS Sorry, how can I change thread title? After publishing can't find an option for this. Sorry.

for Chapter2SwingApp:

// load report definition
ResourceManager manager = new ResourceManager();

URL url = this.getClass().getResource("/ch2/chapter2_report.prpt");

Resource res = manager.createDirectly(url, MasterReport.class);
MasterReport report = (MasterReport) res.getResource();

NamedStaticDataFactory factory = new NamedStaticDataFactory();

//commented code -
//factory.setQuery("default", "ch5.ExampleFactory#getLibData(true)");

factory.setQuery("default", "ch5.ExampleFactory#getAllData()");

then, for ExampleFactory -

package ch5;

public class ExampleFactory {
public ExampleTableModel getAllData() {
return new ExampleTableModel();

public ExampleTableModel getLibData() {
return new ExampleTableModel(true);

and for ExampleTableModel:

public ExampleTableModel() {
setDataVector(data, columnNames);

public ExampleTableModel(boolean libsOnly) {
if (libsOnly) {
Vector<Vector<Object>> vData = generateData();
vData.remove(vData.size() - 1);
vData.remove(vData.size() - 1);
setDataVector(vData, getColumnNames());
} else {
setDataVector(data, columnNames);