01: /*
02: * JacORB - a free Java ORB
03: *
04: * Copyright (C) 1997-2004 Gerald Brose.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Library General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Library General Public License for more details.
15: *
16: * You should have received a copy of the GNU Library General Public
17: * License along with this library; if not, write to the Free
18: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19: */
20:
21: package org.jacorb.naming.namemanager;
22:
23: import java.util.*;
24:
25: public class NSTableModel extends javax.swing.table.DefaultTableModel {
26: /**
27: * NSTableModel constructor.
28: */
29: public NSTableModel() {
30: super ();
31: String[] colNames = { "Name", "Kind", "Type", "Host", "Port" };
32: super .setColumnIdentifiers(convertToVector(colNames));
33: }
34:
35: /**
36: * getColumnCount method comment.
37: */
38: public int getColumnCount() {
39: return 5;
40: }
41:
42: /**
43: * always returns false to make this table non-editable
44: * @return boolean
45: * @param r int
46: * @param c int
47: */
48: public boolean isCellEditable(int r, int c) {
49: return false;
50: }
51:
52: public void setDataVector(Vector newData) {
53: if (newData == null)
54: throw new IllegalArgumentException(
55: "setDataVector() - Null parameter");
56:
57: // Add the new rows.
58: dataVector = newData;
59:
60: // Make all the new rows the right length and generate a notification.
61: newRowsAdded(new javax.swing.event.TableModelEvent(this , 0,
62: getRowCount() - 1,
63: javax.swing.event.TableModelEvent.ALL_COLUMNS,
64: javax.swing.event.TableModelEvent.INSERT));
65: }
66: }
|