1 | /*
|
---|
2 | * BerryBasketModel.java
|
---|
3 | * Copyright (C) 2001 New Zealand Digital Library Project
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation; either version 2 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
18 | */
|
---|
19 | package org.nzdl.gsdl.SimpleGraphicalClient;
|
---|
20 |
|
---|
21 |
|
---|
22 | import java.util.*;
|
---|
23 | import javax.swing.event.*;
|
---|
24 | import javax.swing.*;
|
---|
25 | import javax.swing.table.*;
|
---|
26 | import java.awt.*;
|
---|
27 |
|
---|
28 |
|
---|
29 | class BerryBasketModel extends AbstractTableModel
|
---|
30 | {
|
---|
31 |
|
---|
32 | String[] content = {"Doc1", "Doc2", "Doc3"};
|
---|
33 | String[] columnTitles = {"Document", "Person", "Date"};
|
---|
34 |
|
---|
35 |
|
---|
36 | public BerryBasketModel()
|
---|
37 | {
|
---|
38 | super();
|
---|
39 | }
|
---|
40 |
|
---|
41 | public void add(Berry berry)
|
---|
42 | {
|
---|
43 | System.out.println("adding to BerryBasketModel: " + berry.toString());
|
---|
44 | //addElement(berry);
|
---|
45 | }
|
---|
46 |
|
---|
47 |
|
---|
48 | public int getColumnCount() { return columnTitles.length; }
|
---|
49 |
|
---|
50 | public int getRowCount() { return content.length;}
|
---|
51 |
|
---|
52 | public Object getValueAt(int row, int col) {
|
---|
53 | // get Berry object
|
---|
54 | // extract document title (say), person, date info from Berry object
|
---|
55 | // depending on column number
|
---|
56 | // column reordering shouldn't matter, all
|
---|
57 | // gets dealt with automatically
|
---|
58 | return Color.black;
|
---|
59 | }
|
---|
60 |
|
---|
61 | public String getColumnName(int col) {
|
---|
62 | return columnTitles[col];
|
---|
63 | }
|
---|
64 |
|
---|
65 | }
|
---|