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.datasetplugin;
15:
16: import org.jetbrains.annotations.NotNull;
17: import org.jetbrains.annotations.Nullable;
18: import org.pentaho.reportdesigner.crm.report.connection.ColumnInfo;
19: import org.pentaho.reportdesigner.lib.client.i18n.TranslationManager;
20:
21: import javax.swing.table.AbstractTableModel;
22: import java.util.ArrayList;
23:
24: /**
25: * User: Martin
26: * Date: 29.07.2006
27: * Time: 16:02:55
28: */
29: public class ColumnInfoTableModel extends AbstractTableModel {
30: @NotNull
31: private ArrayList<ColumnInfo> columnInfos;
32:
33: public ColumnInfoTableModel(@NotNull
34: ArrayList<ColumnInfo> columnInfos) {
35: this .columnInfos = columnInfos;
36: }
37:
38: public int getRowCount() {
39: return columnInfos.size();
40: }
41:
42: public int getColumnCount() {
43: return 2;
44: }
45:
46: @NotNull
47: public String getColumnName(int column) {
48: if (column == 0) {
49: return TranslationManager.getInstance().getTranslation("R",
50: "JDBCDataSetReportElement.ColumnName");
51: } else {
52: return TranslationManager.getInstance().getTranslation("R",
53: "JDBCDataSetReportElement.ColumnType");
54: }
55: }
56:
57: @Nullable
58: public Object getValueAt(int rowIndex, int columnIndex) {
59: if (columnIndex == 0) {
60: return columnInfos.get(rowIndex).getColumnName();
61: } else if (columnIndex == 1) {
62: return columnInfos.get(rowIndex).getColumnClass()
63: .getSimpleName();
64: }
65: return null;
66: }
67: }
|