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 which displays the Text Description of a Web Service.
41 *
42 * @author Stefan Tang (steftang@stanford.edu), Christoph Liebetruth (christophl@voelcker.com)
43 * @version 1.1
44 */
45 public class ShowTextDescriptionDialog extends JDialog {
46
47
48
49
50 JPanel panel1 = new JPanel();
51 BorderLayout borderLayout1 = new BorderLayout();
52 JPanel jPanel1 = new JPanel();
53 JPanel jPanel2 = new JPanel();
54 JScrollPane jScrollPane1 = new JScrollPane();
55 GridLayout gridLayout1 = new GridLayout();
56 JButton closeButton = new JButton();
57 FlowLayout flowLayout1 = new FlowLayout();
58 JTextPane textPane = new JTextPane();
59
60 /***
61 * Constructor.
62 * @param frame The parent frame that shows this dialog.
63 * @param title The title of this dialog.
64 * @param modal true if the parent frame should be disabled when this
65 * dialog is displayed, false otherwise.
66 * @param message The text description that is to be displayed.
67 */
68 public ShowTextDescriptionDialog(Frame frame, String title, boolean modal, String message) {
69 super(frame, title, modal);
70 try {
71 jbInit();
72 pack();
73 }
74 catch(Exception ex) {
75 ex.printStackTrace();
76 }
77 textPane.setText(message);
78 }
79
80 /***
81 * Constructor.
82 * @param message The text description that is to be displayed.
83 */
84 public ShowTextDescriptionDialog(String message) {
85 this(null,"Text Description",true,message);
86 }
87
88 private void jbInit() throws Exception {
89 panel1.setLayout(borderLayout1);
90 jPanel2.setLayout(gridLayout1);
91 closeButton.setText("Close");
92 closeButton.addActionListener(new ShowTextDescriptionDialog_closeButton_actionAdapter(this));
93 jPanel1.setLayout(flowLayout1);
94 textPane.setEditable(false);
95 this.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
96 this.setResizable(false);
97 this.setTitle("Text Desription");
98 getContentPane().add(panel1);
99 panel1.add(jPanel1, BorderLayout.SOUTH);
100 jPanel1.add(closeButton, null);
101 panel1.add(jPanel2, BorderLayout.CENTER);
102 jPanel2.add(jScrollPane1, null);
103 jScrollPane1.getViewport().add(textPane, null);
104 }
105
106
107 void closeButton_actionPerformed(ActionEvent e) {
108 this.hide();
109 }
110 }
111
112
113
114
115 class ShowTextDescriptionDialog_closeButton_actionAdapter implements java.awt.event.ActionListener {
116 ShowTextDescriptionDialog adaptee;
117 ShowTextDescriptionDialog_closeButton_actionAdapter(ShowTextDescriptionDialog adaptee) {
118 this.adaptee = adaptee;
119 }
120 public void actionPerformed(ActionEvent e) {
121 adaptee.closeButton_actionPerformed(e);
122 }
123 }