01: /* ====================================================================
02: * Copyright (c) 1998 - 2003 David F. Glasser. All rights
03: * reserved.
04: *
05: * This file is part of the QueryForm Database Tool.
06: *
07: * The QueryForm Database Tool is free software; you can redistribute it
08: * and/or modify it under the terms of the GNU General Public License as
09: * published by the Free Software Foundation; either version 2 of the
10: * License, or (at your option) any later version.
11: *
12: * The QueryForm Database Tool is distributed in the hope that it will
13: * be useful, but WITHOUT ANY WARRANTY; without even the implied
14: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15: * See the GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with the QueryForm Database Tool; if not, write to:
19: *
20: * The Free Software Foundation, Inc.,
21: * 59 Temple Place, Suite 330
22: * Boston, MA 02111-1307 USA
23: *
24: * or visit http://www.gnu.org.
25: *
26: * ====================================================================
27: *
28: * This product includes software developed by the
29: * Apache Software Foundation (http://www.apache.org/).
30: *
31: * ====================================================================
32: *
33: * $Source: /cvsroot/qform/qform/src/org/glasser/qform/ExportedKeyColumnManager.java,v $
34: * $Revision: 1.1 $
35: * $Author: dglasser $
36: * $Date: 2003/12/22 03:38:26 $
37: *
38: * --------------------------------------------------------------------
39: */
40: package org.glasser.qform;
41:
42: import org.glasser.util.*;
43: import org.glasser.sql.ForeignKeyColumn;
44: import org.glasser.sql.Column;
45: import org.glasser.swing.table.*;
46:
47: /**
48: * This ColumnManager is used for the Exported Key Columns table on an Exported Keys panel.
49: */
50: public class ExportedKeyColumnManager extends AbstractColumnManager {
51:
52: protected final static String[] COLUMN_NAMES = { "Key Seq",
53: "Foreign Column", "Local Column", "Data Type (Local)",
54: "SQL Type (Local)" };
55:
56: protected final static Class[] COLUMN_CLASSES = { Integer.class,
57: String.class, String.class, String.class, Integer.class };
58:
59: public ExportedKeyColumnManager() {
60: super ();
61: setColumnNames(COLUMN_NAMES);
62: setColumnClasses(COLUMN_CLASSES);
63: }
64:
65: public Object getValueAt(int row, int column, Object rowObject) {
66:
67: ForeignKeyColumn fc = (ForeignKeyColumn) rowObject;
68: if (fc == null)
69: return null;
70: Column lc = fc.getLocalColumn();
71: switch (column) {
72: case 0:
73: return new Integer(fc.getKeySeq());
74: case 1:
75: return fc.getLocalColumnName();
76: case 2:
77: return fc.getForeignColumnName();
78: case 3:
79: return lc.getTypeName();
80: case 4:
81: return new Integer(lc.getDataType());
82: default:
83: return null;
84: }
85: }
86: }
|