Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Help with ExampleTableModel from tutorial

$
0
0
Hi, I am working with 'Pentaho Reporting 3.5 for Java Developers' 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:

Code:

// load report definition
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
           
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()");
report.setDataFactory(factory);

then, for ExampleFactory -

Code:

package ch5;

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

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

and for ExampleTableModel:

Code:


...
  public ExampleTableModel() {
        super();
        setDataVector(data, columnNames);
    }

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


Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>