1 | /**
|
---|
2 | *############################################################################
|
---|
3 | * A component of the Greenstone Librarian Interface, part of the Greenstone
|
---|
4 | * digital library suite from the New Zealand Digital Library Project at the
|
---|
5 | * University of Waikato, New Zealand.
|
---|
6 | *
|
---|
7 | * Author: Michael Dewsnip, NZDL Project, University of Waikato, NZ
|
---|
8 | *
|
---|
9 | * Copyright (C) 2005 New Zealand Digital Library Project
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or modify
|
---|
12 | * it under the terms of the GNU General Public License as published by
|
---|
13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
14 | * (at your option) any later version.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
24 | *############################################################################
|
---|
25 | */
|
---|
26 |
|
---|
27 | package org.greenstone.gatherer.gui;
|
---|
28 |
|
---|
29 |
|
---|
30 | import java.awt.*;
|
---|
31 | import javax.swing.*;
|
---|
32 | import org.greenstone.gatherer.Configuration;
|
---|
33 | import org.greenstone.gatherer.Gatherer;
|
---|
34 |
|
---|
35 |
|
---|
36 | public class ModalProgressPopup
|
---|
37 | extends ModalDialog
|
---|
38 | {
|
---|
39 | /** The size of the popup */
|
---|
40 | final static private Dimension SIZE = new Dimension(300, 75);
|
---|
41 |
|
---|
42 | private String message = null;
|
---|
43 | private JProgressBar progress_bar = null;
|
---|
44 |
|
---|
45 |
|
---|
46 | /** Constructor */
|
---|
47 | public ModalProgressPopup(String title, String message)
|
---|
48 | {
|
---|
49 | super(Gatherer.g_man, title);
|
---|
50 |
|
---|
51 | this.message = message;
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 | /** Method to display the popup on screen.
|
---|
56 | */
|
---|
57 | public void display()
|
---|
58 | {
|
---|
59 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
---|
60 | setModal(true);
|
---|
61 | setSize(SIZE);
|
---|
62 |
|
---|
63 | // Create
|
---|
64 | progress_bar = new JProgressBar();
|
---|
65 | progress_bar.setIndeterminate(true);
|
---|
66 |
|
---|
67 | // Layout
|
---|
68 | JPanel content_pane = (JPanel) getContentPane();
|
---|
69 | content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
70 | content_pane.setLayout(new BorderLayout());
|
---|
71 | content_pane.add(new JLabel(message), BorderLayout.NORTH);
|
---|
72 | content_pane.add(progress_bar, BorderLayout.CENTER);
|
---|
73 |
|
---|
74 | Dimension screen_size = Configuration.screen_size;
|
---|
75 | setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
|
---|
76 | setVisible(true);
|
---|
77 | }
|
---|
78 | }
|
---|