]>
Commit | Line | Data |
---|---|---|
55e83b18 | 1 | /** @file\r |
2 | \r | |
3 | The file is used to show a table with all defined PPIs\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.common.find;\r | |
16 | \r | |
17 | import java.awt.Dimension;\r | |
18 | import java.awt.event.ActionEvent;\r | |
19 | import java.awt.event.ComponentEvent;\r | |
419558bb | 20 | import java.awt.event.MouseEvent;\r |
21 | import java.awt.event.MouseListener;\r | |
55e83b18 | 22 | import java.awt.event.WindowEvent;\r |
23 | import java.util.Vector;\r | |
24 | \r | |
25 | import javax.swing.JButton;\r | |
26 | import javax.swing.JFrame;\r | |
27 | import javax.swing.JPanel;\r | |
28 | import javax.swing.JScrollPane;\r | |
29 | import javax.swing.JTable;\r | |
30 | import javax.swing.ListSelectionModel;\r | |
31 | import javax.swing.SwingConstants;\r | |
419558bb | 32 | import javax.swing.event.ListSelectionEvent;\r |
33 | import javax.swing.event.ListSelectionListener;\r | |
55e83b18 | 34 | import javax.swing.event.TableModelEvent;\r |
35 | import javax.swing.event.TableModelListener;\r | |
36 | import javax.swing.table.DefaultTableCellRenderer;\r | |
37 | \r | |
38 | import org.tianocore.frameworkwizard.common.DataType;\r | |
39 | import org.tianocore.frameworkwizard.common.IDefaultTableModel;\r | |
40 | import org.tianocore.frameworkwizard.common.Log;\r | |
41 | import org.tianocore.frameworkwizard.common.Tools;\r | |
42 | import org.tianocore.frameworkwizard.common.ui.IFrame;\r | |
419558bb | 43 | import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r |
44 | import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r | |
d12f87d3 | 45 | import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;\r |
55e83b18 | 46 | \r |
419558bb | 47 | public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {\r |
55e83b18 | 48 | \r |
49 | ///\r | |
50 | /// Define class Serial Version UID\r | |
51 | ///\r | |
52 | private static final long serialVersionUID = -2448484533878401714L;\r | |
53 | \r | |
54 | //\r | |
55 | // Define class members\r | |
56 | //\r | |
57 | private JTable jTable = null;\r | |
58 | \r | |
59 | private JPanel jContentPane = null;\r | |
60 | \r | |
61 | private JScrollPane jScrollPane = null;\r | |
62 | \r | |
63 | private JScrollPane jScrollPaneTable = null;\r | |
64 | \r | |
65 | private JButton jButtonClose = null;\r | |
66 | \r | |
67 | //\r | |
68 | // Not used by UI\r | |
69 | //\r | |
70 | private IDefaultTableModel model = null;\r | |
71 | \r | |
72 | private String method = "";\r | |
73 | \r | |
74 | private static FindResult findPpisResult = null;\r | |
75 | \r | |
76 | private static FindResult findProtocolsResult = null;\r | |
77 | \r | |
78 | private static FindResult findGuidsResult = null;\r | |
79 | \r | |
80 | private static FindResult findPcdsResult = null;\r | |
81 | \r | |
82 | private static FindResult findLibraryClassResult = null;\r | |
83 | \r | |
419558bb | 84 | private int selectedRow = -1;\r |
85 | \r | |
86 | private LibraryClassVector lcv = null;\r | |
87 | \r | |
88 | private Vector<FindResultId> vLibraryClassFindResult = null;\r | |
89 | \r | |
d12f87d3 | 90 | private PcdCodedVector pv = null;\r |
91 | \r | |
92 | private Vector<PcdFindResultId> vPcdFindResult = null;\r | |
93 | \r | |
55e83b18 | 94 | /**\r |
95 | * This is the default constructor\r | |
96 | */\r | |
97 | public FindResult(String method) {\r | |
98 | super();\r | |
99 | init(method);\r | |
100 | }\r | |
101 | \r | |
102 | /**\r | |
103 | * This method initializes this\r | |
104 | * \r | |
105 | * @return void\r | |
106 | */\r | |
107 | private void init(String method) {\r | |
108 | this.setSize(600, 500);\r | |
109 | this.setContentPane(getJScrollPane());\r | |
110 | this.setTitle("Find Result");\r | |
111 | this.setResizable(true);\r | |
112 | this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);\r | |
113 | this.centerWindow();\r | |
114 | \r | |
115 | //\r | |
116 | // max the window\r | |
117 | //\r | |
118 | //this.setExtendedState(JFrame.MAXIMIZED_BOTH);\r | |
119 | this.method = method;\r | |
120 | this.showTable();\r | |
121 | }\r | |
122 | \r | |
123 | /**\r | |
124 | * This method initializes jContentPane\r | |
125 | * \r | |
126 | * @return javax.swing.JPanel\r | |
127 | */\r | |
128 | private JPanel getJContentPane() {\r | |
129 | if (jContentPane == null) {\r | |
130 | jContentPane = new JPanel();\r | |
131 | jContentPane.setLayout(null);\r | |
132 | jContentPane.add(getJScrollPaneTable(), null);\r | |
133 | jContentPane.add(getJButtonClose(), null);\r | |
134 | jContentPane.setPreferredSize(new java.awt.Dimension(585, 445));\r | |
135 | }\r | |
136 | return jContentPane;\r | |
137 | }\r | |
138 | \r | |
139 | /**\r | |
140 | This method initializes jScrollPane \r | |
141 | \r | |
142 | @return javax.swing.JScrollPane \r | |
143 | */\r | |
144 | private JScrollPane getJScrollPane() {\r | |
145 | if (jScrollPane == null) {\r | |
146 | jScrollPane = new JScrollPane();\r | |
147 | jScrollPane.setViewportView(getJContentPane());\r | |
148 | }\r | |
149 | return jScrollPane;\r | |
150 | }\r | |
151 | \r | |
152 | /**\r | |
153 | This method initializes jScrollPaneTable \r | |
154 | \r | |
155 | @return javax.swing.JScrollPane \r | |
156 | **/\r | |
157 | private JScrollPane getJScrollPaneTable() {\r | |
158 | if (jScrollPaneTable == null) {\r | |
159 | jScrollPaneTable = new JScrollPane();\r | |
160 | jScrollPaneTable.setBounds(new java.awt.Rectangle(0, 0, 585, 395));\r | |
161 | jScrollPaneTable.setPreferredSize(new Dimension(585, 395));\r | |
162 | jScrollPaneTable.setViewportView(getJTable());\r | |
163 | }\r | |
164 | return jScrollPaneTable;\r | |
165 | }\r | |
166 | \r | |
167 | /**\r | |
168 | This method initializes jTable \r | |
169 | \r | |
170 | @return javax.swing.JTable \r | |
171 | **/\r | |
172 | private JTable getJTable() {\r | |
173 | if (jTable == null) {\r | |
174 | model = new IDefaultTableModel();\r | |
175 | jTable = new JTable(model);\r | |
350785ff | 176 | jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r |
177 | jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r | |
178 | \r | |
419558bb | 179 | jTable.getSelectionModel().addListSelectionListener(this);\r |
350785ff | 180 | jTable.getModel().addTableModelListener(this);\r |
419558bb | 181 | jTable.addMouseListener(this);\r |
55e83b18 | 182 | \r |
183 | model.addColumn("Name");\r | |
184 | model.addColumn("Type");\r | |
185 | model.addColumn("Produced by");\r | |
186 | model.addColumn("Consumed by");\r | |
187 | model.addColumn("Declared by");\r | |
188 | \r | |
189 | jTable.getColumn("Name").setCellRenderer(new MyTableCellRenderer());\r | |
190 | jTable.getColumn("Type").setCellRenderer(new MyTableCellRenderer());\r | |
191 | jTable.getColumn("Produced by").setCellRenderer(new MyTableCellRenderer());\r | |
192 | jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());\r | |
193 | jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());\r | |
419558bb | 194 | \r |
350785ff | 195 | int columnWidth = (this.getSize().width - 28) / 5;\r |
196 | jTable.getColumn("Name").setPreferredWidth(columnWidth);\r | |
197 | jTable.getColumn("Type").setPreferredWidth(columnWidth);\r | |
198 | jTable.getColumn("Produced by").setPreferredWidth(columnWidth);\r | |
199 | jTable.getColumn("Consumed by").setPreferredWidth(columnWidth);\r | |
200 | jTable.getColumn("Declared by").setPreferredWidth(columnWidth);\r | |
55e83b18 | 201 | }\r |
202 | return jTable;\r | |
203 | }\r | |
204 | \r | |
205 | /**\r | |
206 | This method initializes jButtonAdd \r | |
207 | \r | |
208 | @return javax.swing.JButton jButtonAdd\r | |
209 | \r | |
210 | **/\r | |
211 | private JButton getJButtonClose() {\r | |
212 | if (jButtonClose == null) {\r | |
213 | jButtonClose = new JButton();\r | |
214 | jButtonClose.setText("Close");\r | |
215 | jButtonClose.addActionListener(this);\r | |
216 | jButtonClose.setBounds(new java.awt.Rectangle(255, 415, 80, 20));\r | |
217 | jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));\r | |
218 | }\r | |
219 | return jButtonClose;\r | |
220 | }\r | |
221 | \r | |
222 | public static FindResult getInstance(String method) {\r | |
223 | if (method.equals("PPI")) {\r | |
224 | if (findPpisResult == null) {\r | |
225 | findPpisResult = new FindResult(method);\r | |
226 | }\r | |
227 | findPpisResult.init(method);\r | |
228 | return findPpisResult;\r | |
229 | }\r | |
230 | \r | |
231 | if (method.equals("PROTOCOL")) {\r | |
232 | if (findProtocolsResult == null) {\r | |
233 | findProtocolsResult = new FindResult(method);\r | |
234 | }\r | |
235 | findProtocolsResult.init(method);\r | |
236 | return findProtocolsResult;\r | |
237 | }\r | |
238 | \r | |
239 | if (method.equals("GUID")) {\r | |
240 | if (findGuidsResult == null) {\r | |
241 | findGuidsResult = new FindResult(method);\r | |
242 | }\r | |
243 | findGuidsResult.init(method);\r | |
244 | return findGuidsResult;\r | |
245 | }\r | |
246 | \r | |
247 | if (method.equals("PCD")) {\r | |
248 | if (findPcdsResult == null) {\r | |
249 | findPcdsResult = new FindResult(method);\r | |
250 | }\r | |
251 | findPcdsResult.init(method);\r | |
252 | return findPcdsResult;\r | |
253 | }\r | |
254 | \r | |
255 | if (method.equals("LIBRARY_CLASS")) {\r | |
256 | if (findLibraryClassResult == null) {\r | |
257 | findLibraryClassResult = new FindResult(method);\r | |
258 | }\r | |
259 | findLibraryClassResult.init(method);\r | |
260 | return findLibraryClassResult;\r | |
261 | }\r | |
262 | \r | |
263 | return null;\r | |
264 | }\r | |
265 | \r | |
266 | /**\r | |
267 | Clear all table rows\r | |
268 | \r | |
269 | **/\r | |
270 | private void clearAll() {\r | |
271 | if (model != null) {\r | |
272 | for (int index = model.getRowCount() - 1; index >= 0; index--) {\r | |
273 | model.removeRow(index);\r | |
274 | }\r | |
275 | }\r | |
276 | }\r | |
277 | \r | |
278 | /**\r | |
279 | Read content of vector and put then into table\r | |
280 | \r | |
281 | **/\r | |
282 | private void showTable() {\r | |
283 | clearAll();\r | |
284 | \r | |
285 | if (this.method.equals("PPI")) {\r | |
286 | Vector<PpiId> vPpi = Find.getAllPpisForFind();\r | |
287 | \r | |
288 | if (vPpi.size() > 0) {\r | |
289 | \r | |
290 | for (int index = 0; index < vPpi.size(); index++) {\r | |
291 | Vector<String> v = new Vector<String>();\r | |
292 | v.addElement(vPpi.elementAt(index).getName());\r | |
293 | v.addElement(vPpi.elementAt(index).getType());\r | |
294 | String strProducedModules = vPpi.elementAt(index).getProducedModules();\r | |
295 | if (strProducedModules.indexOf("<br>") == 0) {\r | |
296 | strProducedModules = strProducedModules.substring("<br>".length());\r | |
297 | }\r | |
298 | int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");\r | |
299 | v.addElement("<html>" + strProducedModules + "</html>");\r | |
300 | \r | |
301 | String strConsumedModules = vPpi.elementAt(index).getConsumedModules();\r | |
302 | if (strConsumedModules.indexOf("<br>") == 0) {\r | |
303 | strConsumedModules = strConsumedModules.substring("<br>".length());\r | |
304 | }\r | |
305 | int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");\r | |
306 | v.addElement("<html>" + strConsumedModules + "</html>");\r | |
307 | \r | |
308 | v.addElement(vPpi.elementAt(index).getDeclaredBy());\r | |
309 | \r | |
310 | model.addRow(v);\r | |
311 | jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);\r | |
312 | }\r | |
313 | } else {\r | |
314 | Log.wrn("Find PPIs", "No PPI found!!!");\r | |
315 | }\r | |
316 | }\r | |
317 | \r | |
318 | if (this.method.equals("PROTOCOL")) {\r | |
319 | Vector<ProtocolId> vProtocol = Find.getAllProtocolsForFind();\r | |
320 | \r | |
321 | if (vProtocol.size() > 0) {\r | |
322 | \r | |
323 | for (int index = 0; index < vProtocol.size(); index++) {\r | |
324 | Vector<String> v = new Vector<String>();\r | |
325 | v.addElement(vProtocol.elementAt(index).getName());\r | |
326 | v.addElement(vProtocol.elementAt(index).getType());\r | |
327 | String strProducedModules = vProtocol.elementAt(index).getProducedModules();\r | |
328 | if (strProducedModules.indexOf("<br>") == 0) {\r | |
329 | strProducedModules = strProducedModules.substring("<br>".length());\r | |
330 | }\r | |
331 | int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");\r | |
332 | v.addElement("<html>" + strProducedModules + "</html>");\r | |
333 | \r | |
334 | String strConsumedModules = vProtocol.elementAt(index).getConsumedModules();\r | |
335 | if (strConsumedModules.indexOf("<br>") == 0) {\r | |
336 | strConsumedModules = strConsumedModules.substring("<br>".length());\r | |
337 | }\r | |
338 | int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");\r | |
339 | v.addElement("<html>" + strConsumedModules + "</html>");\r | |
340 | \r | |
341 | v.addElement(vProtocol.elementAt(index).getDeclaredBy());\r | |
342 | \r | |
343 | model.addRow(v);\r | |
344 | jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);\r | |
345 | }\r | |
346 | } else {\r | |
347 | Log.wrn("Find PROTOCOLs", "No PROTOCOL found!!!");\r | |
348 | }\r | |
349 | }\r | |
350 | \r | |
351 | if (this.method.equals("GUID")) {\r | |
352 | Vector<GuidId> vGuid = Find.getAllGuidsForFind();\r | |
353 | \r | |
354 | if (vGuid.size() > 0) {\r | |
355 | \r | |
356 | for (int index = 0; index < vGuid.size(); index++) {\r | |
357 | Vector<String> v = new Vector<String>();\r | |
358 | v.addElement(vGuid.elementAt(index).getName());\r | |
359 | v.addElement("GUID");\r | |
360 | String strProducedModules = vGuid.elementAt(index).getProducedModules();\r | |
361 | if (strProducedModules.indexOf("<br>") == 0) {\r | |
362 | strProducedModules = strProducedModules.substring("<br>".length());\r | |
363 | }\r | |
364 | int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");\r | |
365 | v.addElement("<html>" + strProducedModules + "</html>");\r | |
366 | \r | |
367 | String strConsumedModules = vGuid.elementAt(index).getConsumedModules();\r | |
368 | if (strConsumedModules.indexOf("<br>") == 0) {\r | |
369 | strConsumedModules = strConsumedModules.substring("<br>".length());\r | |
370 | }\r | |
371 | int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");\r | |
372 | v.addElement("<html>" + strConsumedModules + "</html>");\r | |
373 | \r | |
374 | v.addElement(vGuid.elementAt(index).getDeclaredBy());\r | |
375 | \r | |
376 | model.addRow(v);\r | |
377 | jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);\r | |
378 | }\r | |
379 | } else {\r | |
380 | Log.wrn("Find GUIDs", "No GUID found!!!");\r | |
381 | }\r | |
382 | }\r | |
383 | \r | |
384 | if (this.method.equals("PCD")) {\r | |
d12f87d3 | 385 | pv = Find.getAllPcdCodedVector();\r |
386 | vPcdFindResult = Find.getAllPcdCodedForFind(pv);\r | |
55e83b18 | 387 | \r |
d12f87d3 | 388 | if (vPcdFindResult.size() > 0) {\r |
55e83b18 | 389 | \r |
d12f87d3 | 390 | for (int index = 0; index < vPcdFindResult.size(); index++) {\r |
55e83b18 | 391 | Vector<String> v = new Vector<String>();\r |
d12f87d3 | 392 | v.addElement(vPcdFindResult.elementAt(index).getName());\r |
393 | v.addElement(vPcdFindResult.elementAt(index).getType());\r | |
394 | \r | |
395 | //\r | |
396 | // Generate Produced Modules List\r | |
397 | //\r | |
398 | String strProducedModules = "";\r | |
399 | Vector<ModuleIdentification> vModule = vPcdFindResult.elementAt(index).getProducedModules();\r | |
400 | for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {\r | |
401 | strProducedModules = strProducedModules + "<br>"\r | |
402 | + vModule.get(indexOfPM).getPackageId().getName() + "."\r | |
403 | + vModule.get(indexOfPM).getName();\r | |
404 | }\r | |
55e83b18 | 405 | if (strProducedModules.indexOf("<br>") == 0) {\r |
406 | strProducedModules = strProducedModules.substring("<br>".length());\r | |
407 | }\r | |
408 | int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");\r | |
409 | v.addElement("<html>" + strProducedModules + "</html>");\r | |
410 | \r | |
d12f87d3 | 411 | //\r |
412 | // Generate Consumed Modules List\r | |
413 | //\r | |
414 | String strConsumedModules = "";\r | |
415 | vModule = vPcdFindResult.elementAt(index).getConsumedModules();\r | |
416 | for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {\r | |
417 | strConsumedModules = strConsumedModules + "<br>"\r | |
418 | + vModule.get(indexOfCM).getPackageId().getName() + "."\r | |
419 | + vModule.get(indexOfCM).getName();\r | |
420 | }\r | |
55e83b18 | 421 | if (strConsumedModules.indexOf("<br>") == 0) {\r |
422 | strConsumedModules = strConsumedModules.substring("<br>".length());\r | |
423 | }\r | |
424 | int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");\r | |
425 | v.addElement("<html>" + strConsumedModules + "</html>");\r | |
426 | \r | |
d12f87d3 | 427 | //\r |
428 | // Add declare package name\r | |
429 | //\r | |
430 | v.addElement(vPcdFindResult.elementAt(index).getDeclaredBy().getName());\r | |
55e83b18 | 431 | \r |
432 | model.addRow(v);\r | |
433 | jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);\r | |
434 | }\r | |
435 | } else {\r | |
436 | Log.wrn("Find PCDs", "No PCD found!!!");\r | |
437 | }\r | |
438 | }\r | |
439 | \r | |
440 | if (this.method.equals("LIBRARY_CLASS")) {\r | |
419558bb | 441 | lcv = Find.getAllLibraryClassVector();\r |
442 | vLibraryClassFindResult = Find.getAllLibraryClassForFind(lcv);\r | |
55e83b18 | 443 | \r |
419558bb | 444 | if (vLibraryClassFindResult.size() > 0) {\r |
445 | for (int index = 0; index < vLibraryClassFindResult.size(); index++) {\r | |
55e83b18 | 446 | Vector<String> v = new Vector<String>();\r |
419558bb | 447 | v.addElement(vLibraryClassFindResult.elementAt(index).getName());\r |
448 | v.addElement(vLibraryClassFindResult.elementAt(index).getType());\r | |
449 | \r | |
450 | //\r | |
451 | // Generate Produced Modules List\r | |
452 | //\r | |
453 | String strProducedModules = "";\r | |
454 | Vector<ModuleIdentification> vModule = vLibraryClassFindResult.elementAt(index)\r | |
455 | .getProducedModules();\r | |
456 | for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {\r | |
457 | strProducedModules = strProducedModules + "<br>"\r | |
458 | + vModule.get(indexOfPM).getPackageId().getName() + "."\r | |
459 | + vModule.get(indexOfPM).getName();\r | |
460 | }\r | |
55e83b18 | 461 | if (strProducedModules.indexOf("<br>") == 0) {\r |
462 | strProducedModules = strProducedModules.substring("<br>".length());\r | |
463 | }\r | |
464 | int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");\r | |
465 | v.addElement("<html>" + strProducedModules + "</html>");\r | |
466 | \r | |
419558bb | 467 | //\r |
468 | // Generate Consumed Modules List\r | |
469 | //\r | |
470 | String strConsumedModules = "";\r | |
471 | vModule = vLibraryClassFindResult.elementAt(index).getConsumedModules();\r | |
472 | for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {\r | |
473 | strConsumedModules = strConsumedModules + "<br>"\r | |
474 | + vModule.get(indexOfCM).getPackageId().getName() + "."\r | |
475 | + vModule.get(indexOfCM).getName();\r | |
476 | }\r | |
55e83b18 | 477 | if (strConsumedModules.indexOf("<br>") == 0) {\r |
478 | strConsumedModules = strConsumedModules.substring("<br>".length());\r | |
479 | }\r | |
480 | int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");\r | |
481 | v.addElement("<html>" + strConsumedModules + "</html>");\r | |
482 | \r | |
419558bb | 483 | v.addElement(vLibraryClassFindResult.elementAt(index).getDeclaredBy().getName());\r |
55e83b18 | 484 | \r |
485 | model.addRow(v);\r | |
486 | jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);\r | |
487 | }\r | |
488 | } else {\r | |
489 | Log.wrn("Find Library Classes", "No Library Class found!!!");\r | |
490 | }\r | |
491 | }\r | |
492 | \r | |
493 | this.jTable.repaint();\r | |
494 | this.jTable.updateUI();\r | |
495 | }\r | |
496 | \r | |
497 | public void tableChanged(TableModelEvent arg0) {\r | |
498 | // TODO Auto-generated method stub\r | |
499 | \r | |
500 | }\r | |
501 | \r | |
419558bb | 502 | /* (non-Javadoc)\r |
503 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
504 | *\r | |
505 | */\r | |
55e83b18 | 506 | public void actionPerformed(ActionEvent arg0) {\r |
507 | if (arg0.getSource() == this.jButtonClose) {\r | |
55e83b18 | 508 | this.dispose();\r |
509 | }\r | |
510 | }\r | |
511 | \r | |
512 | /* (non-Javadoc)\r | |
513 | * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r | |
514 | * \r | |
515 | * Override componentResized to resize all components when frame's size is changed\r | |
516 | */\r | |
517 | public void componentResized(ComponentEvent arg0) {\r | |
518 | int intCurrentWidth = this.getJContentPane().getWidth();\r | |
519 | int intCurrentHeight = this.getJContentPane().getHeight();\r | |
520 | int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r | |
521 | int intPreferredHeight = this.getJContentPane().getPreferredSize().height;\r | |
522 | \r | |
523 | Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r | |
524 | intPreferredHeight);\r | |
525 | Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,\r | |
526 | DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);\r | |
350785ff | 527 | Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);\r |
55e83b18 | 528 | }\r |
529 | \r | |
419558bb | 530 | /* (non-Javadoc)\r |
531 | * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)\r | |
532 | *\r | |
533 | */\r | |
534 | public void valueChanged(ListSelectionEvent arg0) {\r | |
535 | if (arg0.getValueIsAdjusting()) {\r | |
536 | return;\r | |
537 | }\r | |
538 | ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();\r | |
539 | if (lsm.isSelectionEmpty()) {\r | |
540 | return;\r | |
541 | } else {\r | |
542 | selectedRow = lsm.getMinSelectionIndex();\r | |
543 | }\r | |
544 | }\r | |
545 | \r | |
546 | /* (non-Javadoc)\r | |
547 | * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r | |
548 | *\r | |
549 | */\r | |
550 | public void mouseClicked(MouseEvent arg0) {\r | |
551 | if (arg0.getClickCount() == 2) {\r | |
552 | if (this.selectedRow < 0) {\r | |
553 | return;\r | |
554 | } else {\r | |
555 | if (this.method.equals("LIBRARY_CLASS")) {\r | |
556 | FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));\r | |
557 | frdi.setVisible(true);\r | |
558 | }\r | |
d12f87d3 | 559 | if (this.method.equals("PCD")) {\r |
560 | FindResultDetailInfo frdi = new FindResultDetailInfo(vPcdFindResult.elementAt(selectedRow));\r | |
561 | frdi.setVisible(true);\r | |
562 | }\r | |
419558bb | 563 | }\r |
564 | }\r | |
565 | }\r | |
566 | \r | |
55e83b18 | 567 | /* (non-Javadoc)\r |
568 | * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)\r | |
569 | *\r | |
570 | * Override windowClosing to popup warning message to confirm quit\r | |
571 | * \r | |
572 | */\r | |
573 | public void windowClosing(WindowEvent arg0) {\r | |
574 | this.dispose();\r | |
575 | }\r | |
576 | \r | |
577 | class MyTableCellRenderer extends DefaultTableCellRenderer {\r | |
578 | ///\r | |
419558bb | 579 | /// Define Class Serial Version UID\r |
55e83b18 | 580 | ///\r |
581 | private static final long serialVersionUID = -2082787479305255946L;\r | |
582 | \r | |
583 | public void setValue(Object value) {\r | |
584 | this.setVerticalAlignment(SwingConstants.TOP);\r | |
585 | super.setValue(value);\r | |
586 | }\r | |
587 | }\r | |
588 | \r | |
419558bb | 589 | public void mousePressed(MouseEvent e) {\r |
590 | // TODO Auto-generated method stub\r | |
591 | \r | |
592 | }\r | |
593 | \r | |
594 | public void mouseReleased(MouseEvent e) {\r | |
595 | // TODO Auto-generated method stub\r | |
596 | \r | |
597 | }\r | |
598 | \r | |
599 | public void mouseEntered(MouseEvent e) {\r | |
600 | // TODO Auto-generated method stub\r | |
601 | \r | |
602 | }\r | |
603 | \r | |
604 | public void mouseExited(MouseEvent e) {\r | |
605 | // TODO Auto-generated method stub\r | |
606 | \r | |
607 | }\r | |
55e83b18 | 608 | }\r |