1 /***
2 *
3 * The owl-s matcher software is subject to the GNU Lesser General
4 * Public License Version 2.1 (the "License"). You may not copy or use this
5 * file, in either source code or executable form, except in compliance
6 * with the License. You may obtain a copy of the License at
7 * http://www.fsf.org/licenses/lgpl.txt or http://www.opensource.org/.
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied without
11 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the License for the specific language governing rights and
13 * limitations under the License.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this distribution; if not, write to the
17 *
18 * Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330,
20 * Boston, MA 02111-1307 USA
21 *
22 * Copyright (C) 2003-2004
23 * TU Berlin, FG IVS
24 * Stefan Tang,
25 * Christoph Liebetruth,
26 * Michael C. Jaeger,
27 *
28 * More information available at http://ivs.tu-berlin.de/
29 *
30 * $Id$
31 *
32 */
33 package de.tuberlin.ivs.owl.gui;
34
35 import java.awt.*;
36 import javax.swing.*;
37 import java.awt.event.*;
38
39 /***
40 * Dialog that displays the status of the loading/parsing progress when a
41 * file is loaded.
42 *
43 * @author Stefan Tang (steftang@stanford.edu), Christoph Liebetruth (christophl@voelcker.com)
44 * @version 1.1
45 */
46
47 public class LoadingServiceProgressDialog extends JDialog {
48
49
50
51
52 JPanel panel1 = new JPanel();
53 JLabel messageLabel = new JLabel();
54 BorderLayout borderLayout1 = new BorderLayout();
55 JPanel jPanel1 = new JPanel();
56 JButton cancelButton = new JButton();
57 JPanel jPanel3 = new JPanel();
58 JPanel jPanel4 = new JPanel();
59 JPanel jPanel5 = new JPanel();
60 JPanel jPanel6 = new JPanel();
61 BorderLayout borderLayout2 = new BorderLayout();
62 FlowLayout flowLayout1 = new FlowLayout();
63
64 /***
65 * The main frame.
66 */
67 MainFrame mainFrame;
68
69 /***
70 * Constructor.
71 * @param frame The parent frame of this dialog.
72 * @param title The title of this dialog.
73 * @param modal true if the parent frame should be disabled when this dialog
74 * is displayed, false otherwise.
75 */
76 public LoadingServiceProgressDialog(Frame frame, String title, boolean modal,MainFrame parent) {
77 super(frame, title, modal);
78 try {
79 jbInit();
80 pack();
81 }
82 catch(Exception ex) {
83 ex.printStackTrace();
84 }
85 mainFrame = parent;
86 }
87
88
89 private void jbInit() throws Exception {
90 panel1.setLayout(borderLayout1);
91 this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
92 this.setResizable(false);
93 this.setTitle("Loading Service...");
94 messageLabel.setAlignmentX((float) 0.0);
95 messageLabel.setMaximumSize(new Dimension(400, 15));
96 messageLabel.setMinimumSize(new Dimension(400, 15));
97 messageLabel.setPreferredSize(new Dimension(400, 15));
98 messageLabel.setHorizontalAlignment(SwingConstants.LEADING);
99 messageLabel.setText("Please wait while the service is loaded...");
100 messageLabel.setVerticalAlignment(SwingConstants.CENTER);
101 cancelButton.setText("Cancel");
102 cancelButton.addActionListener(new LoadingServiceProgressDialog_cancelButton_actionAdapter(this));
103 jPanel1.setLayout(borderLayout2);
104 panel1.setBorder(null);
105 jPanel6.setLayout(flowLayout1);
106 getContentPane().add(panel1);
107 panel1.add(jPanel1, BorderLayout.CENTER);
108 jPanel1.add(messageLabel, BorderLayout.CENTER);
109 jPanel1.add(jPanel6, BorderLayout.EAST);
110 jPanel6.add(cancelButton, null);
111 jPanel1.add(jPanel5, BorderLayout.WEST);
112 jPanel1.add(jPanel4, BorderLayout.NORTH);
113 jPanel1.add(jPanel3, BorderLayout.SOUTH);
114 }
115
116
117 void cancelButton_actionPerformed(ActionEvent e) {
118 mainFrame.stopLoadThread();
119 mainFrame.stopFrameThread();
120 }
121 }
122
123
124
125
126 class LoadingServiceProgressDialog_cancelButton_actionAdapter implements java.awt.event.ActionListener {
127 LoadingServiceProgressDialog adaptee;
128 LoadingServiceProgressDialog_cancelButton_actionAdapter(LoadingServiceProgressDialog adaptee) {
129 this.adaptee = adaptee;
130 }
131 public void actionPerformed(ActionEvent e) {
132 adaptee.cancelButton_actionPerformed(e);
133 }
134 }