c8f9afc60c72b522a71226437afa194aa3e42866
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFrameworkModules.java
1 package org.tianocore.frameworkwizard.platform.ui;
2
3 import java.awt.BorderLayout;
4
5 import javax.swing.JFrame;
6 import javax.swing.JOptionPane;
7 import javax.swing.JPanel;
8 import javax.swing.JSplitPane;
9 import javax.swing.JLabel;
10 import javax.swing.JScrollPane;
11 import javax.swing.JTable;
12 import javax.swing.JButton;
13 import javax.swing.ListSelectionModel;
14 import javax.swing.table.DefaultTableModel;
15
16 import org.tianocore.PlatformSurfaceAreaDocument;
17 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
18 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
19 import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;
20 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;
21 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;
22
23 import java.awt.FlowLayout;
24 import java.io.File;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.Iterator;
28 import java.util.Map;
29 import java.util.Set;
30 import java.util.Vector;
31
32 public class FpdFrameworkModules extends IInternalFrame {
33
34 /**
35 * Initialize Globals
36 */
37 private static final long serialVersionUID = 1L;
38
39 static JFrame frame;
40
41 private JSplitPane jSplitPane = null;
42
43 private JPanel jPanelTop = null;
44
45 private JPanel jPanelBottom = null;
46
47 private JLabel jLabel = null;
48
49 private JScrollPane jScrollPaneAllModules = null;
50
51 private JTable jTableAllModules = null;
52
53 private JPanel jPanelTopSouth = null;
54
55 private JButton jButtonAddModule = null;
56
57 private JLabel jLabelModulesAdded = null;
58
59 private JPanel jPanelBottomSouth = null;
60
61 private JScrollPane jScrollPaneFpdModules = null;
62
63 private JTable jTableFpdModules = null;
64
65 private JButton jButtonSettings = null;
66
67 private JButton jButtonRemoveModule = null;
68
69 private NonEditableTableModel modelAllModules = null;
70
71 private NonEditableTableModel modelFpdModules = null;
72
73 private FpdModuleSA settingDlg = null;
74
75 private FpdFileContents ffc = null;
76
77 private OpeningPlatformType docConsole = null;
78
79 private Map<String, ArrayList<String>> fpdMsa = null;
80
81 private ArrayList<ModuleIdentification> miList = null;
82
83 /**
84 * Column settings for displaying all modules in workspace
85 */
86 private final int modNameColForAllModTable = 0;
87
88 private final int pkgNameColForAllModTable = 1;
89
90 private final int pathColForAllModTable = 2;
91
92 private final int typeColForAllModTable = 3;
93
94 private final int pkgVerColForAllModTable = 5;
95
96 private final int modVerColForAllModTable = 4;
97
98 /**
99 * Column settings for display modules in the FPD file
100 */
101 private final int modNameColForFpdModTable = 0;
102
103 private final int pkgNameColForFpdModTable = 1;
104
105 private final int pathColForFpdModTable = 2;
106
107 private final int archColForFpdModTable = 3;
108
109 private final int pkgVerColForFpdModTable = 5;
110
111 private final int modVerColForFpdModTable = 4;
112
113 /**
114 * FpdFileContents structure
115 */
116 private final int ffcModGuid = 0;
117
118 private final int ffcModVer = 1;
119
120 private final int ffcPkgGuid = 2;
121
122 private final int ffcPkgVer = 3;
123
124 private final int ffcModArch = 4;
125
126 /**
127 * Set Column Widths, Only the PATH should not have a max width.
128 */
129 private final int modNameMinWidth = 168;
130
131 private final int modNamePrefWidth = 200;
132
133 private final int modNameMaxWidth = 350;
134
135 private final int pkgNameMinWidth = 100;
136
137 private final int pkgNamePrefWidth = 130;
138
139 private final int pkgNameMaxWidth = 150;
140
141 private final int verMinWidth = 60;
142
143 private final int verMaxWidth = 80;
144
145 private final int verPrefWidth = 70;
146
147 private final int pathPrefWidth = 320;
148
149 private final int pathMinWidth = 280;
150
151 private final int archPrefWidth = 80;
152
153 private final int archMinWidth = 60;
154
155 private final int archMaxWidth = 100;
156
157 private final int typePrefWidth = 145;
158
159 private final int typeMinWidth = 100;
160
161 private final int typeMaxWidth = 155;
162
163 /**
164 * This method initializes jSplitPane
165 *
166 * This is the main edit window
167 *
168 * @return javax.swing.JSplitPane jSplitPane
169 */
170 private JSplitPane getJSplitPane() {
171 if (jSplitPane == null) {
172 jSplitPane = new JSplitPane();
173 jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
174 jSplitPane.setDividerLocation(250);
175 jSplitPane.setBottomComponent(getJPanelBottom());
176 jSplitPane.setTopComponent(getJPanelTop());
177 }
178 return jSplitPane;
179 }
180
181 /**
182 * This method initializes jPanelTop
183 *
184 * This panel contains the All Modules Table
185 *
186 * @return javax.swing.JPanel jPanelTop
187 */
188 private JPanel getJPanelTop() {
189 if (jPanelTop == null) {
190 jLabel = new JLabel();
191 jLabel.setText("Modules in Workspace");
192 jPanelTop = new JPanel();
193 jPanelTop.setLayout(new BorderLayout());
194 jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH);
195 jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER);
196 jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH);
197 }
198 return jPanelTop;
199 }
200
201 /**
202 * This method initializes jPanelBottom
203 *
204 * This panel contains the FPD Modules Table
205 *
206 * @return javax.swing.JPanel jPanelBottom
207 */
208 private JPanel getJPanelBottom() {
209 if (jPanelBottom == null) {
210 jLabelModulesAdded = new JLabel();
211 jLabelModulesAdded.setText("Modules Added");
212 jPanelBottom = new JPanel();
213 jPanelBottom.setLayout(new BorderLayout());
214 jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH);
215 jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH);
216 jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER);
217 }
218 return jPanelBottom;
219 }
220
221 /**
222 * This method initializes jScrollPaneAllModules
223 *
224 * @return javax.swing.JScrollPane jScrollPaneAllModules
225 */
226 private JScrollPane getJScrollPaneAllModules() {
227 if (jScrollPaneAllModules == null) {
228 jScrollPaneAllModules = new JScrollPane();
229 jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200));
230 jScrollPaneAllModules.setViewportView(getJTableAllModules());
231 }
232 return jScrollPaneAllModules;
233 }
234
235 /**
236 * This method initializes jTableAllModules
237 *
238 * @return javax.swing.JTable jTableAllModules
239 */
240 private JTable getJTableAllModules() {
241 if (jTableAllModules == null) {
242 modelAllModules = new NonEditableTableModel();
243 TableSorter sorter = new TableSorter(modelAllModules);
244 jTableAllModules = new JTable(sorter);
245 sorter.setTableHeader(jTableAllModules.getTableHeader());
246 jTableAllModules.setRowHeight(20);
247 modelAllModules.addColumn("<html>Module<br>Name</html>");
248 modelAllModules.addColumn("<html>Package<br>Name</html>");
249 modelAllModules.addColumn("Path");
250 modelAllModules.addColumn("<html>Module<br>Type</html>");
251 modelAllModules.addColumn("<html>Module<br>Version</html>");
252 modelAllModules.addColumn("<html>Package<br>Version</html>");
253
254 javax.swing.table.TableColumn column = null;
255 column = jTableAllModules.getColumnModel().getColumn(modNameColForAllModTable);
256 column.setPreferredWidth(modNamePrefWidth);
257 column.setMinWidth(modNameMinWidth);
258 column.setMaxWidth(modNameMaxWidth);
259 column = jTableAllModules.getColumnModel().getColumn(modVerColForAllModTable);
260 column.setPreferredWidth(verPrefWidth);
261 column.setMaxWidth(verMaxWidth);
262 column.setMinWidth(verMinWidth);
263 column = jTableAllModules.getColumnModel().getColumn(pkgNameColForAllModTable);
264 column.setPreferredWidth(pkgNamePrefWidth);
265 column.setMinWidth(pkgNameMinWidth);
266 column.setMaxWidth(pkgNameMaxWidth);
267 column = jTableAllModules.getColumnModel().getColumn(pkgVerColForAllModTable);
268 column.setPreferredWidth(verPrefWidth);
269 column.setMaxWidth(verMaxWidth);
270 column.setMinWidth(verMinWidth);
271 column = jTableAllModules.getColumnModel().getColumn(typeColForAllModTable);
272 column.setPreferredWidth(typePrefWidth);
273 column.setMaxWidth(typeMaxWidth);
274 column.setMinWidth(typeMinWidth);
275 column = jTableAllModules.getColumnModel().getColumn(pathColForAllModTable);
276 column.setPreferredWidth(pathPrefWidth);
277 column.setMinWidth(pathMinWidth);
278
279 jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
280 // jTableAllModules.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
281 }
282 return jTableAllModules;
283 }
284
285 /**
286 * This method initializes jPanelTopSouth
287 *
288 * This panel contains the ADD button
289 *
290 * @return javax.swing.JPanel jPanelTopSouth
291 */
292 private JPanel getJPanelTopSouth() {
293 if (jPanelTopSouth == null) {
294 FlowLayout flowLayout = new FlowLayout();
295 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
296 jPanelTopSouth = new JPanel();
297 jPanelTopSouth.setLayout(flowLayout);
298 jPanelTopSouth.add(getJButtonAddModule(), null);
299 }
300 return jPanelTopSouth;
301 }
302
303 /**
304 * This method initializes jButtonAddModule
305 *
306 * @return javax.swing.JButton jButtonAddModule
307 */
308 private JButton getJButtonAddModule() {
309 if (jButtonAddModule == null) {
310 jButtonAddModule = new JButton();
311 jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20));
312 jButtonAddModule.setText("Add a Module");
313 jButtonAddModule.addActionListener(new java.awt.event.ActionListener() {
314 public void actionPerformed(java.awt.event.ActionEvent e) {
315 int selectedRow = jTableAllModules.getSelectedRow();
316 if (selectedRow < 0) {
317 return;
318 }
319
320 TableSorter sorter = (TableSorter) jTableAllModules.getModel();
321 selectedRow = sorter.modelIndex(selectedRow);
322 String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";
323 ModuleIdentification mi = miList.get(selectedRow);
324 Vector<String> vArchs = null;
325 try {
326 vArchs = GlobalData.getModuleSupArchs(mi);
327 }
328 catch (Exception exp) {
329 JOptionPane.showMessageDialog(frame, exp.getMessage());
330 }
331
332 if (vArchs == null) {
333 JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file.");
334 return;
335 }
336
337 String archsAdded = "";
338 String mg = mi.getGuid();
339 String mv = mi.getVersion();
340 String pg = mi.getPackage().getGuid();
341 String pv = mi.getPackage().getVersion();
342
343 ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
344 if (al == null) {
345 al = new ArrayList<String>();
346 fpdMsa.put(mg + mv + pg + pv, al);
347 }
348 for (int i = 0; i < al.size(); ++i) {
349 vArchs.remove(al.get(i));
350 }
351 //
352 // Archs this Module supported have already been added.
353 //
354 if (vArchs.size() == 0) {
355 JOptionPane.showMessageDialog(frame, "This Module has already been added.");
356 return;
357 }
358 //ToDo put Arch instead of null
359 boolean errorOccurred = false;
360 for (int i = 0; i < vArchs.size(); ++i) {
361 String arch = vArchs.get(i);
362 al.add(arch);
363 archsAdded += arch + " ";
364 String[] row = { "", "", "", "", "", "" };
365
366 if (mi != null) {
367 row[modNameColForFpdModTable] = mi.getName();
368 row[pkgNameColForFpdModTable] = mi.getPackage().getName();
369 row[pathColForFpdModTable] = path;
370 row[archColForFpdModTable] = arch;
371 row[pkgVerColForFpdModTable] = pv;
372 row[modVerColForFpdModTable] = mv;
373
374 }
375 modelFpdModules.addRow(row);
376
377 docConsole.setSaved(false);
378 try {
379 //ToDo : specify archs need to add.
380 ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
381 } catch (Exception exception) {
382 JOptionPane.showMessageDialog(frame, "Adding " + row[modNameColForFpdModTable] + " with SupArch " + arch
383 + ": " + exception.getMessage());
384 errorOccurred = true;
385 }
386 }
387
388 String s = "This Module with Architecture " + archsAdded;
389 if (errorOccurred) {
390 s += " was added with Error. Platform may NOT Build.";
391 } else {
392 s += " was added Successfully.";
393 }
394 JOptionPane.showMessageDialog(frame, s);
395 jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false);
396 }
397 });
398 }
399 return jButtonAddModule;
400 }
401
402 /**
403 * This method initializes jPanelBottomSouth
404 *
405 * This panel contains the Settings and Remove Buttons
406 *
407 * @return javax.swing.JPanel jPanelBottomSouth
408 */
409 private JPanel getJPanelBottomSouth() {
410 if (jPanelBottomSouth == null) {
411 FlowLayout flowLayout1 = new FlowLayout();
412 flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
413 jPanelBottomSouth = new JPanel();
414 jPanelBottomSouth.setLayout(flowLayout1);
415 jPanelBottomSouth.add(getJButtonSettings(), null);
416 jPanelBottomSouth.add(getJButtonRemoveModule(), null);
417 }
418 return jPanelBottomSouth;
419 }
420
421 /**
422 * This method initializes jScrollPaneFpdModules
423 *
424 * @return javax.swing.JScrollPane jScrollPaneFpdModules
425 */
426 private JScrollPane getJScrollPaneFpdModules() {
427 if (jScrollPaneFpdModules == null) {
428 jScrollPaneFpdModules = new JScrollPane();
429 jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200));
430 jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
431 }
432 return jScrollPaneFpdModules;
433 }
434
435 /**
436 * This method initializes jTableFpdModules
437 *
438 * @return javax.swing.JTable jTableFpdModules
439 */
440 private JTable getJTableFpdModules() {
441 if (jTableFpdModules == null) {
442 modelFpdModules = new NonEditableTableModel();
443 TableSorter sorter = new TableSorter(modelFpdModules);
444 jTableFpdModules = new JTable(sorter);
445 sorter.setTableHeader(jTableFpdModules.getTableHeader());
446 jTableFpdModules.setRowHeight(20);
447 modelFpdModules.addColumn("<html>Module<br>Name</html>");
448 modelFpdModules.addColumn("<html>Package<br>Name</html>");
449 modelFpdModules.addColumn("Path");
450 modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");
451 modelFpdModules.addColumn("<html>Module<br>Version</html>");
452 modelFpdModules.addColumn("<html>Package<br>Version</html>");
453
454 javax.swing.table.TableColumn column = null;
455 column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);
456 column.setPreferredWidth(modNamePrefWidth);
457 column.setMinWidth(modNameMinWidth);
458 column.setMaxWidth(modNameMaxWidth);
459 column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable);
460 column.setPreferredWidth(verPrefWidth);
461 column.setMaxWidth(verMaxWidth);
462 column.setMinWidth(verMinWidth);
463 column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable);
464 column.setPreferredWidth(pkgNamePrefWidth);
465 column.setMinWidth(pkgNameMinWidth);
466 column.setMaxWidth(pkgNameMaxWidth);
467 column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable);
468 column.setPreferredWidth(verPrefWidth);
469 column.setMaxWidth(verMaxWidth);
470 column.setMinWidth(verMinWidth);
471 column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable);
472 column.setPreferredWidth(archPrefWidth);
473 column.setMaxWidth(archMaxWidth);
474 column.setMinWidth(archMinWidth);
475 column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable);
476 column.setPreferredWidth(pathPrefWidth);
477 column.setMinWidth(pathMinWidth);
478
479 jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
480 // jTableFpdModules.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
481 }
482 return jTableFpdModules;
483 }
484
485 /**
486 * This method initializes jButtonSettings
487 *
488 * @return javax.swing.JButton jButtonSettings
489 */
490 private JButton getJButtonSettings() {
491 if (jButtonSettings == null) {
492 jButtonSettings = new JButton();
493 jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20));
494 jButtonSettings.setText("Settings");
495 jButtonSettings.addActionListener(new java.awt.event.ActionListener() {
496 public void actionPerformed(java.awt.event.ActionEvent e) {
497 int selectedRow = jTableFpdModules.getSelectedRow();
498 if (selectedRow < 0) {
499 return;
500 }
501
502 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
503 selectedRow = sorter.modelIndex(selectedRow);
504 try {
505 if (ffc.adjustPcd(selectedRow)) {
506 docConsole.setSaved(false);
507 }
508 }
509 catch (Exception exp) {
510 JOptionPane.showMessageDialog(frame, exp.getMessage());
511 return;
512 }
513
514 if (settingDlg == null) {
515 settingDlg = new FpdModuleSA(ffc);
516 }
517
518 String[] sa = new String[5];
519 ffc.getFrameworkModuleInfo(selectedRow, sa);
520 String mg = sa[ffcModGuid];
521 String mv = sa[ffcModVer];
522 String pg = sa[ffcPkgGuid];
523 String pv = sa[ffcPkgVer];
524 String arch = sa[ffcModArch];
525 settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole);
526 settingDlg.setVisible(true);
527 }
528 });
529 }
530 return jButtonSettings;
531 }
532
533 /**
534 * This method initializes jButtonRemoveModule
535 *
536 * @return javax.swing.JButton jButtonRemoveModule
537 */
538 private JButton getJButtonRemoveModule() {
539 if (jButtonRemoveModule == null) {
540 jButtonRemoveModule = new JButton();
541 jButtonRemoveModule.setPreferredSize(new java.awt.Dimension(130, 20));
542 jButtonRemoveModule.setText("Remove Module");
543 jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {
544 public void actionPerformed(java.awt.event.ActionEvent e) {
545 int selectedRow = jTableFpdModules.getSelectedRow();
546 if (selectedRow < 0) {
547 return;
548 }
549
550 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
551 selectedRow = sorter.modelIndex(selectedRow);
552
553 String[] sa = new String[5];
554 ffc.getFrameworkModuleInfo(selectedRow, sa);
555 String mg = sa[ffcModGuid];
556 String mv = sa[ffcModVer];
557 String pg = sa[ffcPkgGuid];
558 String pv = sa[ffcPkgVer];
559 String arch = sa[ffcModArch];
560 ModuleIdentification mi = GlobalData.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
561 mv = mi.getVersion();
562 pv = mi.getPackage().getVersion();
563 modelFpdModules.removeRow(selectedRow);
564 if (arch == null) {
565 // if no arch specified in ModuleSA
566 fpdMsa.remove(mg + mv + pg + pv);
567 } else {
568 ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
569 al.remove(arch);
570 if (al.size() == 0) {
571 fpdMsa.remove(mg + mv + pg + pv);
572 }
573 }
574
575 docConsole.setSaved(false);
576 ffc.removeModuleSA(selectedRow);
577 }
578 });
579 }
580 return jButtonRemoveModule;
581 }
582
583 /**
584 *
585 * @param args
586 */
587 public static void main(String[] args) {
588 // TODO Auto-generated method stub
589 new FpdFrameworkModules().setVisible(true);
590 }
591
592 /**
593 * This is the default constructor
594 */
595 public FpdFrameworkModules() {
596 super();
597 initialize();
598 }
599
600 public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
601 this();
602 init(fpd);
603
604 }
605
606 public FpdFrameworkModules(OpeningPlatformType opt) {
607 this(opt.getXmlFpd());
608 docConsole = opt;
609 }
610
611 private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
612 try {
613 GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));
614 }
615 catch(Exception e){
616 JOptionPane.showMessageDialog(frame, "Error occurred when getting module data.");
617 }
618
619 if (ffc == null) {
620 ffc = new FpdFileContents(fpd);
621 ffc.initDynPcdMap();
622 }
623
624 if (fpdMsa == null) {
625 fpdMsa = new HashMap<String, ArrayList<String>>();
626 }
627
628 if (ffc.getFrameworkModulesCount() > 0) {
629 String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
630 ffc.getFrameworkModulesInfo(saa);
631 for (int i = 0; i < saa.length; ++i) {
632 ModuleIdentification mi = GlobalData.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "
633 + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);
634 String[] row = { "", "", "", "", "", "" };
635 if (mi != null) {
636 row[modNameColForFpdModTable] = mi.getName();
637 row[modVerColForFpdModTable] = mi.getVersion();
638 row[pkgNameColForFpdModTable] = mi.getPackage().getName();
639 row[pkgVerColForFpdModTable] = mi.getPackage().getVersion();
640 row[archColForFpdModTable] = saa[i][4];
641 try {
642 row[pathColForFpdModTable] = GlobalData.getMsaFile(mi).getPath().substring(
643 System.getenv("WORKSPACE")
644 .length() + 1);
645 } catch (Exception e) {
646 JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());
647 }
648 }
649 modelFpdModules.addRow(row);
650 ArrayList<String> al = fpdMsa.get(saa[i][ffcModGuid] + saa[i][ffcModVer]
651 + saa[i][ffcPkgGuid] + saa[i][ffcPkgVer]);
652 if (al == null) {
653 al = new ArrayList<String>();
654 fpdMsa.put(saa[i][ffcModGuid] + saa[i][ffcModVer] + saa[i][ffcPkgGuid] + saa[i][ffcPkgVer], al);
655 }
656 al.add(saa[i][ffcModArch]);
657
658 }
659 }
660
661 showAllModules();
662
663 }
664
665 private void showAllModules() {
666
667 if (miList == null) {
668 miList = new ArrayList<ModuleIdentification>();
669 }
670 Set<PackageIdentification> spi = GlobalData.getPackageList();
671 Iterator ispi = spi.iterator();
672
673 while (ispi.hasNext()) {
674 PackageIdentification pi = (PackageIdentification) ispi.next();
675 String[] s = { "", "", "", "", "", "" };
676
677 Set<ModuleIdentification> smi = GlobalData.getModules(pi);
678 Iterator ismi = smi.iterator();
679 while (ismi.hasNext()) {
680 ModuleIdentification mi = (ModuleIdentification) ismi.next();
681 s[modNameColForAllModTable] = mi.getName();
682 s[modVerColForAllModTable] = mi.getVersion();
683 s[typeColForAllModTable] = mi.getModuleType();
684 s[pkgNameColForAllModTable] = pi.getName();
685 s[pkgVerColForAllModTable] = pi.getVersion();
686 try {
687 s[pathColForAllModTable] = GlobalData.getMsaFile(mi).getPath()
688 .substring(System.getenv("WORKSPACE").length() + 1);
689 } catch (Exception e) {
690 JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());
691 }
692 modelAllModules.addRow(s);
693 miList.add(mi);
694 }
695 }
696 }
697
698 /**
699 * This method initializes this
700 *
701 * @return void
702 */
703 private void initialize() {
704 this.setSize(633, 533);
705 this.setTitle("Framework Modules");
706 this.setContentPane(getJSplitPane());
707 this.setVisible(true);
708
709 }
710
711 } // @jve:decl-index=0:visual-constraint="10,10"
712
713 class NonEditableTableModel extends DefaultTableModel {
714 /**
715 *
716 */
717 private static final long serialVersionUID = 1L;
718
719 public boolean isCellEditable(int row, int col) {
720 return false;
721 }
722 }