source: trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/BerryBasketPanel.java@ 2225

Last change on this file since 2225 was 2225, checked in by daven, 23 years ago

added QueryHistory, tooltips on collectionInfoButton. Altered
CSModel to retain CollectionInfo objects and longCollectionNames
for performance. Added files for a BerryBasket - to be turned on
soon. Added sorting of the QueryHistory via the TableMap and TableSorter
files - from the Java Swing tutorial - not sure about GPL status
of these 2.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1
2/*
3 * BerryBasketPanel.java
4 * Copyright (C) 2001 New Zealand Digital Library Project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20package org.nzdl.gsdl.SimpleGraphicalClient;
21
22
23import javax.swing.*;
24import javax.swing.table.*;
25import javax.swing.border.*;
26import java.awt.*;
27import java.awt.event.*;
28import java.util.*;
29
30
31public class BerryBasketPanel extends JPanel implements Constants
32{
33
34BerryBasketModel berryModel;
35JTable berryTable;
36JList berryList;
37JScrollPane scrollBerryPane;
38
39 public BerryBasketPanel(CSModel csModel)
40 {
41 super();
42 setLayout( new BorderLayout() );
43 setBorder(BorderFactory.createTitledBorder("BerryBasket"));
44 /* TableModel dataModel = new AbstractTableModel() {
45
46
47 public int getColumnCount() { return columnTitles.length; }
48 public int getRowCount() { return 5;}
49 public Object getValueAt(int row, int col) { return new Integer(row*col); }
50 public String getColumnName(int col) {
51 return columnTitles[col];
52 }
53
54 }; */
55 berryModel = new BerryBasketModel();
56 berryTable = new JTable(berryModel);
57
58 //berryTable = new JTable(5,2);
59
60 //berryList = new JList(csModel.getBerryModel()); // must be vector or array
61 //berryList.setFont(berryFont);
62 //berryList.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
63 //scrollBerryPane = new JScrollPane(berryList);
64
65 berryTable.setFont(berryFont);
66 berryTable.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
67
68 berryTable.setDefaultRenderer(Color.class, new BerryCellRenderer());
69 scrollBerryPane = new JScrollPane(berryTable);
70 berryTable.setPreferredScrollableViewportSize(new Dimension(100, 70));
71
72 add(scrollBerryPane, BorderLayout.CENTER);
73 } //end constructor
74
75
76 class BerryCellRenderer extends JLabel implements TableCellRenderer {
77
78 public Component getTableCellRendererComponent(JTable table,
79 Object value,
80 boolean isSelected,
81 boolean hasFocus,
82 int row,
83 int column) {
84 this.setText(value.toString());
85 return this;
86 } // end getTableCellRendererComponent
87
88
89 } // end BerryCellRenderer
90
91} // end BerryBasketPanel
Note: See TracBrowser for help on using the repository browser.