如何在Eclipse BIRT中将Java对象用作数据集?

时间:2017-07-12 16:05:07

标签: java reporting birt

我基本上遵循了本教程:http://www.vogella.com/tutorials/EclipseBIRT/article.html

现在我有两个Java类const parentPathname = '/animals/edit'; const currentPathname = router.getCurrentLocation().pathname; const isActive = currentPathname.indexOf(parentPathname) !== -1; Mock,如下所示:

MockContainer

...

package reports;

public class Mock {

    private int x;
    private double y;

    public Mock(int x, double y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

}

此外,我有一个脚本数据源 package reports; import java.util.ArrayList; import java.util.List; public class MockContainer { public MockContainer() { } public List<Mock> getMockList() { List<Mock> mocks = new ArrayList<Mock>(); mocks.add(new Mock(1000, +2.5)); mocks.add(new Mock(2000, +1.5)); mocks.add(new Mock(3000, +0.5)); mocks.add(new Mock(3000, -0.5)); mocks.add(new Mock(2000, -1.5)); mocks.add(new Mock(1000, -2.5)); return mocks; } } 和一个数据集 data_source,其中包含两列data_set(整数)和x(十进制)。

但是我在编写JavaScripts时遇到了问题。 y中的我的JavaScripts openfetch如下所示:

data_set

...

count = 0;

mockContainer = new Packages.reports.MockContainer();

mockList = mockContainer.getMockList();

预览结果保持空白......

1 个答案:

答案 0 :(得分:0)

我不知道为什么结果没有显示在预览中,但最后它可以工作......