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/ForeignKeyColumnManager.java,v $
34: * $Revision: 1.3 $
35: * $Author: dglasser $
36: * $Date: 2003/12/22 03:39:50 $
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 Foreign Key Columns table on a Foreign Keys panel.
49: */
50: public class ForeignKeyColumnManager extends AbstractColumnManager {
51:
52: protected final static String[] COLUMN_NAMES = { "Key Seq",
53: "Local Column", "Data Type", "SQL Type", "Nullable",
54: "Foreign Column" };
55:
56: protected final static Class[] COLUMN_CLASSES = { Integer.class,
57: String.class, String.class, Integer.class, Boolean.class,
58: String.class };
59:
60: public ForeignKeyColumnManager() {
61: super ();
62: setColumnNames(COLUMN_NAMES);
63: setColumnClasses(COLUMN_CLASSES);
64: }
65:
66: public Object getValueAt(int row, int column, Object rowObject) {
67:
68: ForeignKeyColumn fc = (ForeignKeyColumn) rowObject;
69: if (fc == null)
70: return null;
71: Column lc = fc.getLocalColumn();
72: switch (column) {
73: case 0:
74: return new Integer(fc.getKeySeq());
75: case 1:
76: return fc.getLocalColumnName();
77: case 2:
78: return lc.getTypeName();
79: case 3:
80: return new Integer(lc.getDataType());
81: case 4:
82: if (lc.getNullable())
83: return Boolean.TRUE;
84: else
85: return Boolean.FALSE;
86: case 5:
87: return fc.getForeignColumnName();
88:
89: default:
90: return null;
91: }
92: }
93: }
|