source: gli/trunk/src/org/greenstone/gatherer/gui/ModalProgressPopup.java@ 20957

Last change on this file since 20957 was 18370, checked in by kjdon, 15 years ago

committed code submitted by Amin Hedjazi for making the GLI right to left. I worked on this code on the rtl-gli branch, then merged the branch back to the trunk at revision 18368. The branch code was slightly different in a couple of places where it shouldn't have been. So don't use the branch code next time. Start a new branch.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
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
27package org.greenstone.gatherer.gui;
28
29
30import java.awt.*;
31import javax.swing.*;
32import org.greenstone.gatherer.Configuration;
33import org.greenstone.gatherer.Dictionary;
34import org.greenstone.gatherer.Gatherer;
35
36
37public class ModalProgressPopup
38 extends ModalDialog
39{
40 /** The size of the popup */
41 final static private Dimension SIZE = new Dimension(300, 75);
42
43 private String message = null;
44
45
46 public ModalProgressPopup(String title, String message)
47 {
48 super(Gatherer.g_man, title);
49 this.message = message;
50 this.setComponentOrientation(Dictionary.getOrientation());
51 }
52
53
54 /** Method to close the popup. */
55 public void close()
56 {
57 setVisible(false);
58 Gatherer.g_man.wait(false);
59 }
60
61
62 /** Method to display the popup on screen. */
63 public void display()
64 {
65 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
66 setSize(SIZE);
67
68 // Create
69 JProgressBar progress_bar = new JProgressBar();
70 progress_bar.setComponentOrientation(Dictionary.getOrientation());
71 progress_bar.setIndeterminate(true);
72
73 // Layout
74 JPanel content_pane = (JPanel) getContentPane();
75 content_pane.setComponentOrientation(Dictionary.getOrientation());
76 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
77 content_pane.setLayout(new BorderLayout());
78
79 JLabel tmp = new JLabel(message);
80 tmp.setComponentOrientation(Dictionary.getOrientation());
81
82 content_pane.add(tmp, BorderLayout.NORTH);
83 content_pane.add(progress_bar, BorderLayout.CENTER);
84
85 Dimension screen_size = Configuration.screen_size;
86 setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
87 setVisible(true);
88
89 // Lock the rest of the GLI interface until close() is called
90 Gatherer.g_man.wait(true);
91 }
92}
Note: See TracBrowser for help on using the repository browser.