]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
Added module type column to the FPD module table, and also removed AUTO_RESIZE_OFF...
[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 al = new ArrayList<String>();
349 fpdMsa.put(mg + mv + pg + pv, al);
350 }
351 for (int i = 0; i < al.size(); ++i) {
352 vArchs.remove(al.get(i));
353 }
354 //
355 // Archs this Module supported have already been added.
356 //
357 if (vArchs.size() == 0) {
358 JOptionPane.showMessageDialog(frame, "This Module has already been added.");
359 return;
360 }
361 //ToDo put Arch instead of null
362 boolean errorOccurred = false;
363 for (int i = 0; i < vArchs.size(); ++i) {
364 String arch = vArchs.get(i);
365 al.add(arch);
366 archsAdded += arch + " ";
367 String[] row = { "", "", "", "", "", "", "" };
368
369 if (mi != null) {
370 row[modNameColForFpdModTable] = mi.getName();
371 row[pkgNameColForFpdModTable] = mi.getPackage().getName();
372 row[pathColForFpdModTable] = path;
373 row[archColForFpdModTable] = arch;
374 row[pkgVerColForFpdModTable] = pv;
375 row[modVerColForFpdModTable] = mv;
376 row[typeColForFpdModTable] = mType;
377
378 }
379 modelFpdModules.addRow(row);
380
381 docConsole.setSaved(false);
382 try {
383 //ToDo : specify archs need to add.
384 ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
385 } catch (Exception exception) {
386 JOptionPane.showMessageDialog(frame, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch
387 + ": " + exception.getMessage());
388 errorOccurred = true;
389 }
390 }
391
392 String s = "This Module with Architecture " + archsAdded;
393 if (errorOccurred) {
394 s += " was added with Error. Platform may NOT Build.";
395 } else {
396 s += " was added Successfully.";
397 }
398 JOptionPane.showMessageDialog(frame, s);
399 jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false);
400 }
401 });
402 }
403 return jButtonAddModule;
404 }
405
406 /**
407 * This method initializes jPanelBottomSouth
408 *
409 * This panel contains the Settings and Remove Buttons
410 *
411 * @return javax.swing.JPanel jPanelBottomSouth
412 */
413 private JPanel getJPanelBottomSouth() {
414 if (jPanelBottomSouth == null) {
415 FlowLayout flowLayout1 = new FlowLayout();
416 flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
417 jPanelBottomSouth = new JPanel();
418 jPanelBottomSouth.setLayout(flowLayout1);
419 jPanelBottomSouth.add(getJButtonSettings(), null);
420 jPanelBottomSouth.add(getJButtonRemoveModule(), null);
421 }
422 return jPanelBottomSouth;
423 }
424
425 /**
426 * This method initializes jScrollPaneFpdModules
427 *
428 * @return javax.swing.JScrollPane jScrollPaneFpdModules
429 */
430 private JScrollPane getJScrollPaneFpdModules() {
431 if (jScrollPaneFpdModules == null) {
432 jScrollPaneFpdModules = new JScrollPane();
433 jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200));
434 jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
435 }
436 return jScrollPaneFpdModules;
437 }
438
439 /**
440 * This method initializes jTableFpdModules
441 *
442 * @return javax.swing.JTable jTableFpdModules
443 */
444 private JTable getJTableFpdModules() {
445 if (jTableFpdModules == null) {
446 modelFpdModules = new NonEditableTableModel();
447 TableSorter sorter = new TableSorter(modelFpdModules);
448 jTableFpdModules = new JTable(sorter);
449 sorter.setTableHeader(jTableFpdModules.getTableHeader());
450 jTableFpdModules.setRowHeight(20);
451 modelFpdModules.addColumn("<html>Module<br>Name</html>");
452 modelFpdModules.addColumn("<html>Package<br>Name</html>");
453 modelFpdModules.addColumn("Path");
454 modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");
455 modelFpdModules.addColumn("<html>Module<br>Type</html>");
456 modelFpdModules.addColumn("<html>Module<br>Version</html>");
457 modelFpdModules.addColumn("<html>Package<br>Version</html>");
458
459
460 javax.swing.table.TableColumn column = null;
461 column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);
462 column.setPreferredWidth(modNamePrefWidth);
463 column.setMinWidth(modNameMinWidth);
464 column.setMaxWidth(modNameMaxWidth);
465 column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable);
466 column.setPreferredWidth(verPrefWidth);
467 column.setMaxWidth(verMaxWidth);
468 column.setMinWidth(verMinWidth);
469 column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable);
470 column.setPreferredWidth(pkgNamePrefWidth);
471 column.setMinWidth(pkgNameMinWidth);
472 column.setMaxWidth(pkgNameMaxWidth);
473 column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable);
474 column.setPreferredWidth(verPrefWidth);
475 column.setMaxWidth(verMaxWidth);
476 column.setMinWidth(verMinWidth);
477 column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable);
478 column.setPreferredWidth(archPrefWidth);
479 column.setMaxWidth(archMaxWidth);
480 column.setMinWidth(archMinWidth);
481 column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable);
482 column.setPreferredWidth(pathPrefWidth);
483 column.setMinWidth(pathMinWidth);
484 column = jTableFpdModules.getColumnModel().getColumn(typeColForFpdModTable);
485 column.setPreferredWidth(typePrefWidth);
486 column.setMaxWidth(typeMaxWidth);
487 column.setMinWidth(typeMinWidth);
488
489 jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
490
491 }
492 return jTableFpdModules;
493 }
494
495 /**
496 * This method initializes jButtonSettings
497 *
498 * @return javax.swing.JButton jButtonSettings
499 */
500 private JButton getJButtonSettings() {
501 if (jButtonSettings == null) {
502 jButtonSettings = new JButton();
503 jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20));
504 jButtonSettings.setText("Settings");
505 jButtonSettings.addActionListener(new java.awt.event.ActionListener() {
506 public void actionPerformed(java.awt.event.ActionEvent e) {
507 int selectedRow = jTableFpdModules.getSelectedRow();
508 if (selectedRow < 0) {
509 return;
510 }
511
512 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
513 selectedRow = sorter.modelIndex(selectedRow);
514 try {
515 if (ffc.adjustPcd(selectedRow)) {
516 docConsole.setSaved(false);
517 }
518 }
519 catch (Exception exp) {
520 JOptionPane.showMessageDialog(frame, exp.getMessage());
521 return;
522 }
523
524 if (settingDlg == null) {
525 settingDlg = new FpdModuleSA(ffc);
526 }
527
528 String[] sa = new String[5];
529 ffc.getFrameworkModuleInfo(selectedRow, sa);
530 String mg = sa[ffcModGuid];
531 String mv = sa[ffcModVer];
532 String pg = sa[ffcPkgGuid];
533 String pv = sa[ffcPkgVer];
534 String arch = sa[ffcModArch];
535 settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole);
536 settingDlg.setVisible(true);
537 }
538 });
539 }
540 return jButtonSettings;
541 }
542
543 /**
544 * This method initializes jButtonRemoveModule
545 *
546 * @return javax.swing.JButton jButtonRemoveModule
547 */
548 private JButton getJButtonRemoveModule() {
549 if (jButtonRemoveModule == null) {
550 jButtonRemoveModule = new JButton();
551 jButtonRemoveModule.setPreferredSize(new java.awt.Dimension(130, 20));
552 jButtonRemoveModule.setText("Remove Module");
553 jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {
554 public void actionPerformed(java.awt.event.ActionEvent e) {
555 int selectedRow = jTableFpdModules.getSelectedRow();
556 if (selectedRow < 0) {
557 return;
558 }
559
560 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
561 selectedRow = sorter.modelIndex(selectedRow);
562
563 String[] sa = new String[5];
564 ffc.getFrameworkModuleInfo(selectedRow, sa);
565 String mg = sa[ffcModGuid];
566 String mv = sa[ffcModVer];
567 String pg = sa[ffcPkgGuid];
568 String pv = sa[ffcPkgVer];
569 String arch = sa[ffcModArch];
570 ModuleIdentification mi = GlobalData.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
571 mv = mi.getVersion();
572 pv = mi.getPackage().getVersion();
573 modelFpdModules.removeRow(selectedRow);
574 if (arch == null) {
575 // if no arch specified in ModuleSA
576 fpdMsa.remove(mg + mv + pg + pv);
577 } else {
578 ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
579 al.remove(arch);
580 if (al.size() == 0) {
581 fpdMsa.remove(mg + mv + pg + pv);
582 }
583 }
584
585 docConsole.setSaved(false);
586 ffc.removeModuleSA(selectedRow);
587 }
588 });
589 }
590 return jButtonRemoveModule;
591 }
592
593 /**
594 *
595 * @param args
596 */
597 public static void main(String[] args) {
598 // Set the pane visable
599 new FpdFrameworkModules().setVisible(true);
600 }
601
602 /**
603 * This is the default constructor
604 */
605 public FpdFrameworkModules() {
606 super();
607 initialize();
608 }
609
610 public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
611 this();
612 init(fpd);
613
614 }
615
616 public FpdFrameworkModules(OpeningPlatformType opt) {
617 this(opt.getXmlFpd());
618 docConsole = opt;
619 }
620
621 private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
622 try {
623 GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));
624 }
625 catch(Exception e){
626 JOptionPane.showMessageDialog(frame, "Error occurred when getting module data.");
627 }
628
629 if (ffc == null) {
630 ffc = new FpdFileContents(fpd);
631 ffc.initDynPcdMap();
632 }
633
634 if (fpdMsa == null) {
635 fpdMsa = new HashMap<String, ArrayList<String>>();
636 }
637
638 if (ffc.getFrameworkModulesCount() > 0) {
639 String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
640 ffc.getFrameworkModulesInfo(saa);
641 for (int i = 0; i < saa.length; ++i) {
642 ModuleIdentification mi = GlobalData.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "
643 + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);
644 String[] row = { "", "", "", "", "", "", "" };
645 if (mi != null) {
646 row[modNameColForFpdModTable] = mi.getName();
647 row[modVerColForFpdModTable] = mi.getVersion();
648 row[typeColForFpdModTable] = mi.getModuleType();
649 row[pkgNameColForFpdModTable] = mi.getPackage().getName();
650 row[pkgVerColForFpdModTable] = mi.getPackage().getVersion();
651 row[archColForFpdModTable] = saa[i][4];
652 try {
653 row[pathColForFpdModTable] = GlobalData.getMsaFile(mi).getPath().substring(
654 System.getenv("WORKSPACE")
655 .length() + 1);
656 } catch (Exception e) {
657 JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());
658 }
659 }
660 modelFpdModules.addRow(row);
661 ArrayList<String> al = fpdMsa.get(saa[i][ffcModGuid] + saa[i][ffcModVer]
662 + saa[i][ffcPkgGuid] + saa[i][ffcPkgVer]);
663 if (al == null) {
664 al = new ArrayList<String>();
665 fpdMsa.put(saa[i][ffcModGuid] + saa[i][ffcModVer] + saa[i][ffcPkgGuid] + saa[i][ffcPkgVer], al);
666 }
667 al.add(saa[i][ffcModArch]);
668
669 }
670 TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
671 sorter.setSortingStatus(modNameColForFpdModTable, TableSorter.ASCENDING);
672 }
673
674 showAllModules();
675
676 }
677
678 private void showAllModules() {
679
680 if (miList == null) {
681 miList = new ArrayList<ModuleIdentification>();
682 }
683 Set<PackageIdentification> spi = GlobalData.getPackageList();
684 Iterator ispi = spi.iterator();
685
686 while (ispi.hasNext()) {
687 PackageIdentification pi = (PackageIdentification) ispi.next();
688 String[] s = { "", "", "", "", "", "" };
689
690 Set<ModuleIdentification> smi = GlobalData.getModules(pi);
691 Iterator ismi = smi.iterator();
692 while (ismi.hasNext()) {
693 ModuleIdentification mi = (ModuleIdentification) ismi.next();
694 s[modNameColForAllModTable] = mi.getName();
695 s[modVerColForAllModTable] = mi.getVersion();
696 s[typeColForAllModTable] = mi.getModuleType();
697 s[pkgNameColForAllModTable] = pi.getName();
698 s[pkgVerColForAllModTable] = pi.getVersion();
699 try {
700 s[pathColForAllModTable] = GlobalData.getMsaFile(mi).getPath()
701 .substring(System.getenv("WORKSPACE").length() + 1);
702 } catch (Exception e) {
703 JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());
704 }
705 modelAllModules.addRow(s);
706 miList.add(mi);
707 }
708 }
709
710 TableSorter sorter = (TableSorter)jTableAllModules.getModel();
711 sorter.setSortingStatus(modNameColForAllModTable, TableSorter.ASCENDING);
712 }
713
714 /**
715 * This method initializes this
716 *
717 * @return void
718 */
719 private void initialize() {
720 this.setSize(633, 533);
721 this.setTitle("Framework Modules");
722 this.setContentPane(getJSplitPane());
723 this.setVisible(true);
724
725 }
726
727 } // @jve:decl-index=0:visual-constraint="10,10"
728
729 class NonEditableTableModel extends DefaultTableModel {
730 /**
731 *
732 */
733 private static final long serialVersionUID = 1L;
734
735 public boolean isCellEditable(int row, int col) {
736 return false;
737 }
738 }