View Javadoc

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 progress when two services are being matched.
41   *
42   * @author Stefan Tang (steftang@stanford.edu), Christoph Liebetruth (christophl@voelcker.com)
43   * @version 1.1
44   */
45  
46  public class MatchingProgressDialog extends JDialog {
47  
48    // --------------------------------------
49    // ------- AUTO-GENERATED FIELDS --------
50    // --------------------------------------
51    JPanel jPanel1 = new JPanel();
52    JPanel jPanel2 = new JPanel();
53    JLabel messageLabel = new JLabel();
54    GridLayout gridLayout1 = new GridLayout();
55    JPanel jPanel3 = new JPanel();
56    JPanel jPanel4 = new JPanel();
57    FlowLayout flowLayout1 = new FlowLayout();
58    FlowLayout flowLayout2 = new FlowLayout();
59    FlowLayout flowLayout3 = new FlowLayout();
60    BorderLayout borderLayout1 = new BorderLayout();
61    JPanel jPanel5 = new JPanel();
62    JButton cancelButton = new JButton();
63  
64    /***
65     * The main frame.
66     */
67    MainFrame mainFrame;
68  
69    /***
70     * Constructor. Initializes this dialog.
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 MatchingProgressDialog(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    // Component initialization
89    private void jbInit() throws Exception {
90      messageLabel.setMaximumSize(new Dimension(400, 15));
91      messageLabel.setMinimumSize(new Dimension(400, 15));
92      messageLabel.setPreferredSize(new Dimension(400, 15));
93      messageLabel.setText("Please wait while the services are being matched...");
94      messageLabel.setVerticalAlignment(SwingConstants.CENTER);
95      jPanel2.setLayout(gridLayout1);
96      this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
97      this.setResizable(false);
98      this.getContentPane().setLayout(borderLayout1);
99      jPanel4.setLayout(flowLayout1);
100     jPanel3.setLayout(flowLayout2);
101     jPanel1.setLayout(flowLayout3);
102     cancelButton.setText("Cancel");
103     cancelButton.addActionListener(new MatchingProgressDialog_cancelButton_actionAdapter(this));
104     this.getContentPane().add(jPanel1, BorderLayout.WEST);
105     this.getContentPane().add(jPanel4, BorderLayout.SOUTH);
106     this.getContentPane().add(jPanel2, BorderLayout.CENTER);
107     this.getContentPane().add(jPanel3, BorderLayout.NORTH);
108     jPanel2.add(messageLabel, null);
109     this.getContentPane().add(jPanel5, BorderLayout.EAST);
110     jPanel5.add(cancelButton, null);
111   }
112 
113   // Is called when the user clicks the cancel button.
114   void cancelButton_actionPerformed(ActionEvent e) {
115     mainFrame.stopMatchThread();
116     mainFrame.stopFrameThread();
117   }
118 }
119 
120 // -----------------------------------------
121 // ------- AUTO GENERATED CLASSES ----------
122 // -----------------------------------------
123 class MatchingProgressDialog_cancelButton_actionAdapter implements java.awt.event.ActionListener {
124   MatchingProgressDialog adaptee;
125   MatchingProgressDialog_cancelButton_actionAdapter(MatchingProgressDialog adaptee) {
126     this.adaptee = adaptee;
127   }
128   public void actionPerformed(ActionEvent e) {
129     adaptee.cancelButton_actionPerformed(e);
130   }
131 }