source: gli/branches/rtl-gli/src/org/greenstone/gatherer/cdm/ParsingProgress.java@ 18368

Last change on this file since 18368 was 8474, checked in by mdewsnip, 19 years ago

Changed all show() to setVisible(true) and all hide() to setVisible(false) for Java 1.5.0.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 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 */
37package org.greenstone.gatherer.cdm;
38
39/**************************************************************************************
40 * Title: Gatherer
41 * Description: The Gatherer: a tool for gathering and enriching a digital collection.
42 * Copyright: Copyright (c) 2001
43 * Company: The University of Waikato
44 * Written: 03/05/02
45 * Revised: 20/05/02
46 * 17/11/02 - Commented
47 **************************************************************************************/
48import java.awt.*;
49import javax.swing.*;
50
51/** 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.
52 * @author John Thompson, Greenstone Digital Library, University of Waikato
53 * @version 2.3
54 */
55public class ParsingProgress
56 extends JDialog {
57 /** The content pane within the dialog box. */
58 private JPanel content_pane = null;
59 /** The progress bar itself. */
60 private JProgressBar progress = null;
61 /** The default size of the progress dialog. */
62 static final Dimension SIZE = new Dimension(600,75);
63
64 /** Constructor.
65 * @param title The title to show on the dialog, as a <strong>String</strong>.
66 * @param message The message to show on the dialog, as a <strong>String</strong>.
67 * @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>.
68 */
69 public ParsingProgress(String title, String message, int max) {
70 super();
71 this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
72 this.setSize(SIZE);
73 this.setTitle(title);
74
75 // Creation
76 this.content_pane = (JPanel) getContentPane();
77 this.progress = new JProgressBar();
78 this.progress.setMaximum(max);
79
80 // Layout
81 this.content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
82 this.content_pane.setLayout(new BorderLayout());
83 this.content_pane.add(new JLabel(message), BorderLayout.NORTH);
84 this.content_pane.add(progress, BorderLayout.CENTER);
85
86 // Center and display
87 Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
88 setLocation((screen_size.width - SIZE.width) / 2,
89 (screen_size.height - SIZE.height) / 2);
90 setVisible(true);
91 }
92
93 public void destroy() {
94 }
95
96 /** Method which increments the progress count by one, which should be called after every successful parsing of a classifier or plugin.
97 */
98 public void inc() {
99 progress.setValue(progress.getValue() + 1);
100 }
101}
Note: See TracBrowser for help on using the repository browser.