source: trunk/gli/src/org/greenstone/gatherer/cdm/ParsingProgress.java@ 4364

Last change on this file since 4364 was 4293, checked in by jmt12, 21 years ago

Initial revision

  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37
38
39
40
41
42
43package org.greenstone.gatherer.cdm;
44/**************************************************************************************
45 * Title: Gatherer
46 * Description: The Gatherer: a tool for gathering and enriching a digital collection.
47 * Copyright: Copyright (c) 2001
48 * Company: The University of Waikato
49 * Written: 03/05/02
50 * Revised: 20/05/02
51 * 17/11/02 - Commented
52 **************************************************************************************/
53import java.awt.BorderLayout;
54import java.awt.Dimension;
55import java.awt.Toolkit;
56import javax.swing.BorderFactory;
57import javax.swing.JDialog;
58import javax.swing.JLabel;
59import javax.swing.JPanel;
60import javax.swing.JProgressBar;
61/** This class provides a progress bar to be displayed whenever the module must reload the plugin and classifier information, either automatically or if the user indicates a reload is needed.
62* @author John Thompson, Greenstone Digital Library, University of Waikato
63* @version 2.3
64*/
65public class ParsingProgress
66 extends JDialog {
67 /** The content pane within the dialog box. */
68 private JPanel content_pane = null;
69 /** The progress bar itself. */
70 private JProgressBar progress = null;
71 /** The default size of the progress dialog. */
72 static final Dimension SIZE = new Dimension(400,75);
73 /** Constructor.
74 * @param title The title to show on the dialog, as a <strong>String</strong>.
75 * @param message The message to show on the dialog, as a <strong>String</strong>.
76 * @param max The total number of plugins/classifiers that have to be parsed before the progress bar can be disposed of, as an <i>int</i>.
77 */
78 public ParsingProgress(String title, String message, int max) {
79 super();
80 this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
81 this.setSize(SIZE);
82 this.setTitle(title);
83 // Creation
84 this.content_pane = (JPanel) getContentPane();
85 this.progress = new JProgressBar();
86 this.progress.setMaximum(max);
87 // Layout
88 this.content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
89 this.content_pane.setLayout(new BorderLayout());
90 this.content_pane.add(new JLabel(message), BorderLayout.NORTH);
91 this.content_pane.add(progress, BorderLayout.CENTER);
92 // Center and display
93 Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
94 setLocation((screen_size.width - SIZE.width) / 2,
95 (screen_size.height - SIZE.height) / 2);
96 show();
97 }
98 public void destroy() {
99 }
100 /** Method which increments the progress count by one, which should be called after every successful parsing of a classifier or plugin.
101 */
102 public void inc() {
103 progress.setValue(progress.getValue() + 1);
104 }
105}
Note: See TracBrowser for help on using the repository browser.