source: trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/QueryHistoryPanel.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: 2.8 KB
Line 
1/*
2 * QueryHistoryPanel.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
20
21package org.nzdl.gsdl.SimpleGraphicalClient;
22
23import javax.swing.table.AbstractTableModel;
24import javax.swing.table.*;
25import javax.swing.*;
26import javax.swing.border.*;
27import java.awt.*;
28import java.awt.event.*;
29import java.util.*;
30
31
32public class QueryHistoryPanel extends JPanel implements Constants
33{
34
35 QueryHistoryModel personalQueryHistoryModel;
36
37 JTable personalQueryHistoryTable;
38 JTabbedPane tabbedPane;
39 JScrollPane personalScrollQueryPane;
40 TableSorter tableSorter;
41
42 public QueryHistoryPanel(CSModel csModel) {
43 super();
44 setLayout( new BorderLayout() );
45 setBorder(BorderFactory.createTitledBorder("Query History"));
46
47 personalQueryHistoryModel = csModel.getQueryHistoryModel();
48 tableSorter = new TableSorter(personalQueryHistoryModel);
49 personalQueryHistoryTable = new JTable(tableSorter);
50 tableSorter.addMouseListenerToHeaderInTable(personalQueryHistoryTable);
51
52
53 personalQueryHistoryTable.setDefaultRenderer(QueryHistoryModel.CollectionName.class, new CollectionNameRenderer());
54
55 personalQueryHistoryTable.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
56 personalScrollQueryPane = new JScrollPane(personalQueryHistoryTable);
57
58 tabbedPane= new JTabbedPane();
59 tabbedPane.addTab("Personal", personalScrollQueryPane);
60 add(tabbedPane, BorderLayout.CENTER);
61 } // end constructor
62
63
64
65class CollectionNameRenderer extends JLabel implements TableCellRenderer {
66
67 public Component getTableCellRendererComponent(JTable table,
68 Object value,
69 boolean isSelected,
70 boolean hasFocus,
71 int row,
72 int column) {
73 this.setText("**" + value.toString());
74 return this;
75 } // end getTableCellRendererComponent
76
77
78
79
80 } // end CollectionNameRenderer
81
82
83
84
85
86} // QueryHistoryPanel
Note: See TracBrowser for help on using the repository browser.