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 import de.tuberlin.ivs.owl.matching.ExtendedMatchingResult;
39
40 /***
41 * Shows the results of the plug-in matching.
42 *
43 * @author Stefan Tang (steftang@stanford.edu), Christoph Liebetruth (christophl@voelcker.com)
44 * @version 1.1
45 */
46 public class ShowPlugInResultsDialog extends JDialog {
47
48
49
50
51 JPanel panel1 = new JPanel();
52 JPanel jPanel1 = new JPanel();
53 JPanel jPanel2 = new JPanel();
54 JPanel jPanel3 = new JPanel();
55 BorderLayout borderLayout2 = new BorderLayout();
56 JButton closeButton = new JButton();
57 FlowLayout flowLayout1 = new FlowLayout();
58 JPanel jPanel4 = new JPanel();
59 JPanel jPanel5 = new JPanel();
60 JPanel jPanel6 = new JPanel();
61 JLabel jLabel1 = new JLabel();
62 JScrollPane jScrollPane1 = new JScrollPane();
63 GridLayout gridLayout3 = new GridLayout();
64 JList matchedList = new JList();
65 JPanel jPanel7 = new JPanel();
66 JPanel jPanel8 = new JPanel();
67 GridLayout gridLayout4 = new GridLayout();
68 JLabel jLabel2 = new JLabel();
69 JLabel unmatchedLabel = new JLabel();
70 GridLayout gridLayout6 = new GridLayout();
71 GridLayout gridLayout7 = new GridLayout();
72 BorderLayout borderLayout1 = new BorderLayout();
73 BorderLayout borderLayout3 = new BorderLayout();
74 BorderLayout borderLayout4 = new BorderLayout();
75
76 ExtendedMatchingResult result;
77
78 /***
79 * Constructor.
80 * @param frame The parent frame of this dialog.
81 * @param title The title of this dialog.
82 * @param modal true if the parent frame should be disabled when this dialog
83 * is displayed, false otherwise.
84 * @param result The extended result that contains all the matching results.
85 */
86 public ShowPlugInResultsDialog(Frame frame, String title, boolean modal, ExtendedMatchingResult result) {
87 super(frame, title, modal);
88 try {
89 jbInit();
90 pack();
91 }
92 catch(Exception ex) {
93 ex.printStackTrace();
94 }
95 this.result = result;
96 initFields();
97 }
98
99
100 private void jbInit() throws Exception {
101 panel1.setLayout(borderLayout2);
102 jPanel3.setLayout(flowLayout1);
103 panel1.setMaximumSize(new Dimension(2147483647, 2147483647));
104 closeButton.setText("Close");
105 closeButton.addActionListener(new ShowPlugInResultsDialog_closeButton_actionAdapter(this));
106 jPanel2.setBorder(BorderFactory.createEtchedBorder());
107 jPanel2.setLayout(borderLayout1);
108 jPanel1.setLayout(borderLayout3);
109 jLabel1.setFont(new java.awt.Font("Dialog", 1, 11));
110 jLabel1.setText("Matched Plug-Ins");
111 jLabel1.setVerticalAlignment(SwingConstants.TOP);
112 jPanel6.setLayout(gridLayout3);
113 jPanel8.setLayout(gridLayout4);
114 jPanel4.setLayout(borderLayout4);
115 jLabel2.setFont(new java.awt.Font("Dialog", 1, 11));
116 jLabel2.setText("Unmatched Plug-In");
117 unmatchedLabel.setRequestFocusEnabled(true);
118 unmatchedLabel.setText("myPlugIn");
119 jPanel7.setLayout(gridLayout6);
120 jPanel5.setLayout(gridLayout7);
121 borderLayout3.setHgap(10);
122 borderLayout4.setHgap(10);
123 borderLayout1.setVgap(10);
124 getContentPane().add(panel1);
125 panel1.add(jPanel2, BorderLayout.CENTER);
126 jPanel2.add(jPanel1, BorderLayout.CENTER);
127 jPanel2.add(jPanel4, BorderLayout.SOUTH);
128 panel1.add(jPanel3, BorderLayout.SOUTH);
129 jPanel3.add(closeButton, null);
130 jPanel1.add(jPanel5, BorderLayout.NORTH);
131 jPanel5.add(jLabel1, null);
132 jPanel1.add(jPanel6, BorderLayout.CENTER);
133 jPanel6.add(jScrollPane1, null);
134 jScrollPane1.getViewport().add(matchedList, null);
135 jPanel4.add(jPanel7, BorderLayout.NORTH);
136 jPanel7.add(jLabel2, null);
137 jPanel4.add(jPanel8, BorderLayout.CENTER);
138 jPanel8.add(unmatchedLabel, null);
139 }
140
141 /***
142 * Initializes all the fields with available information.
143 */
144 private void initFields() {
145 if (result==null) {
146 return;
147 }
148 if (result.getUnmatchedPlugIn()==null) {
149 unmatchedLabel.setText("All active plug-ins matched");
150 } else {
151 unmatchedLabel.setText(result.getUnmatchedPlugIn());
152 }
153 if (result.getMatchedPlugIns()!=null) {
154 matchedList.setListData(result.getMatchedPlugIns());
155 }
156 }
157
158
159 void closeButton_actionPerformed(ActionEvent e) {
160 this.hide();
161 }
162 }
163
164
165
166
167 class ShowPlugInResultsDialog_closeButton_actionAdapter implements java.awt.event.ActionListener {
168 ShowPlugInResultsDialog adaptee;
169 ShowPlugInResultsDialog_closeButton_actionAdapter(ShowPlugInResultsDialog adaptee) {
170 this.adaptee = adaptee;
171 }
172 public void actionPerformed(ActionEvent e) {
173 adaptee.closeButton_actionPerformed(e);
174 }
175 }