01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.tests.reportdata;
15:
16: import org.jetbrains.annotations.NotNull;
17:
18: import javax.swing.table.AbstractTableModel;
19:
20: /**
21: * User: Martin
22: * Date: 12.01.2006
23: * Time: 09:41:17
24: */
25: @SuppressWarnings({"ALL"})
26: public class ReportTableModel001 extends AbstractTableModel {
27: @NotNull
28: private String[] fields = new String[] { "FIRSTNAME", "LASTNAME",
29: "INCOME" };
30: @NotNull
31: private Class[] fieldTypes = new Class[] { String.class,
32: String.class, Double.class };
33:
34: @NotNull
35: private Object[][] values = new Object[][] {
36: { "Hugo", "Habicht", new Double(120) },
37: { "Hans", "Meier", new Double(230) },
38: { "Reto", "Stirnemann", new Double(150) }, };
39:
40: public ReportTableModel001() {
41: }
42:
43: public int getRowCount() {
44: return values.length;
45: }
46:
47: public int getColumnCount() {
48: return fields.length;
49: }
50:
51: public String getColumnName(int columnIndex) {
52: return fields[columnIndex];
53: }
54:
55: public Class<?> getColumnClass(int columnIndex) {
56: return fieldTypes[columnIndex];
57: }
58:
59: public Object getValueAt(int rowIndex, int columnIndex) {
60: System.out.println("rowIndex = " + rowIndex);
61: System.out.println("columnIndex = " + columnIndex);
62: return values[rowIndex][columnIndex];
63: }
64: }
|