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