3 The file is used to create, update FrameworkModules of Fpd file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.platform
.ui
;
17 import java
.awt
.BorderLayout
;
19 import javax
.swing
.JFrame
;
20 import javax
.swing
.JOptionPane
;
21 import javax
.swing
.JPanel
;
22 import javax
.swing
.JSplitPane
;
23 import javax
.swing
.JLabel
;
24 import javax
.swing
.JScrollPane
;
25 import javax
.swing
.JTable
;
26 import javax
.swing
.JButton
;
27 import javax
.swing
.ListSelectionModel
;
28 import javax
.swing
.event
.TableModelEvent
;
29 import javax
.swing
.table
.DefaultTableModel
;
30 import javax
.swing
.table
.TableModel
;
32 import org
.tianocore
.PlatformSurfaceAreaDocument
;
33 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
34 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
35 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
36 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
37 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.WorkspaceProfile
;
38 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
40 import java
.awt
.FlowLayout
;
41 import java
.awt
.event
.KeyEvent
;
42 import java
.awt
.event
.MouseEvent
;
43 import java
.util
.ArrayList
;
44 import java
.util
.HashMap
;
45 import java
.util
.Iterator
;
47 import java
.util
.Vector
;
49 public class FpdFrameworkModules
extends IInternalFrame
{
54 private static final long serialVersionUID
= 1L;
56 private static final int timeToWait
= 2000;
58 private long savedMs
= 0;
60 String searchField
= "";
62 public static final int forceDbgColForFpdModTable
= 7;
66 private JSplitPane jSplitPane
= null;
68 private JPanel jPanelTop
= null;
70 private JPanel jPanelBottom
= null;
72 private JLabel jLabel
= null;
74 private JScrollPane jScrollPaneAllModules
= null;
76 private JTable jTableAllModules
= null;
78 private JPanel jPanelTopSouth
= null;
80 private JButton jButtonAddModule
= null;
82 private JLabel jLabelModulesAdded
= null;
84 private JPanel jPanelBottomSouth
= null;
86 private JScrollPane jScrollPaneFpdModules
= null;
88 private JTable jTableFpdModules
= null;
90 private JButton jButtonSettings
= null;
92 private JButton jButtonRemoveModule
= null;
94 private NonEditableTableModel modelAllModules
= null;
96 private FpdModulesTableModel modelFpdModules
= null;
98 private FpdModuleSA settingDlg
= null;
100 private FpdFileContents ffc
= null;
102 private OpeningPlatformType docConsole
= null;
104 private Map
<String
, ArrayList
<String
>> fpdMsa
= null;
106 private ArrayList
<ModuleIdentification
> miList
= null;
109 * Column settings for displaying all modules in workspace
111 private final int modNameColForAllModTable
= 0;
113 private final int pkgNameColForAllModTable
= 1;
115 private final int pathColForAllModTable
= 2;
117 private final int typeColForAllModTable
= 3;
119 private final int pkgVerColForAllModTable
= 5;
121 private final int modVerColForAllModTable
= 4;
124 * Column settings for display modules in the FPD file
126 private final int modNameColForFpdModTable
= 0;
128 private final int pkgNameColForFpdModTable
= 1;
130 private final int pathColForFpdModTable
= 2;
132 private final int archColForFpdModTable
= 3;
134 private final int pkgVerColForFpdModTable
= 6;
136 private final int modVerColForFpdModTable
= 5;
138 private final int typeColForFpdModTable
= 4;
141 * FpdFileContents structure
143 private final int ffcModGuid
= 0;
145 private final int ffcModVer
= 1;
147 private final int ffcPkgGuid
= 2;
149 private final int ffcPkgVer
= 3;
151 private final int ffcModArch
= 4;
154 * Set Column Widths, Only the PATH should not have a max width.
156 private final int modNameMinWidth
= 168;
158 private final int modNamePrefWidth
= 200;
160 private final int modNameMaxWidth
= 350;
162 private final int pkgNameMinWidth
= 100;
164 private final int pkgNamePrefWidth
= 130;
166 private final int pkgNameMaxWidth
= 150;
168 private final int verMinWidth
= 60;
170 private final int verMaxWidth
= 80;
172 private final int verPrefWidth
= 70;
174 private final int pathPrefWidth
= 600;
176 private final int pathMinWidth
= 280;
178 private final int archPrefWidth
= 80;
180 private final int archMinWidth
= 60;
182 private final int archMaxWidth
= 100;
184 private final int typePrefWidth
= 145;
186 private final int typeMinWidth
= 100;
188 private final int typeMaxWidth
= 155;
191 * This method initializes jSplitPane
193 * This is the main edit window
195 * @return javax.swing.JSplitPane jSplitPane
197 private JSplitPane
getJSplitPane() {
198 if (jSplitPane
== null) {
199 jSplitPane
= new JSplitPane();
200 jSplitPane
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
201 jSplitPane
.setDividerLocation(250);
202 jSplitPane
.setBottomComponent(getJPanelBottom());
203 jSplitPane
.setTopComponent(getJPanelTop());
209 * This method initializes jPanelTop
211 * This panel contains the All Modules Table
213 * @return javax.swing.JPanel jPanelTop
215 private JPanel
getJPanelTop() {
216 if (jPanelTop
== null) {
217 jLabel
= new JLabel();
218 jLabel
.setText(" Modules in Workspace");
219 jPanelTop
= new JPanel();
220 jPanelTop
.setLayout(new BorderLayout());
221 jPanelTop
.add(jLabel
, java
.awt
.BorderLayout
.NORTH
);
222 jPanelTop
.add(getJScrollPaneAllModules(), java
.awt
.BorderLayout
.CENTER
);
223 jPanelTop
.add(getJPanelTopSouth(), java
.awt
.BorderLayout
.SOUTH
);
229 * This method initializes jPanelBottom
231 * This panel contains the FPD Modules Table
233 * @return javax.swing.JPanel jPanelBottom
235 private JPanel
getJPanelBottom() {
236 if (jPanelBottom
== null) {
237 jLabelModulesAdded
= new JLabel();
238 jLabelModulesAdded
.setText(" Modules Added into Platform");
239 jPanelBottom
= new JPanel();
240 jPanelBottom
.setLayout(new BorderLayout());
241 jPanelBottom
.add(jLabelModulesAdded
, java
.awt
.BorderLayout
.NORTH
);
242 jPanelBottom
.add(getJPanelBottomSouth(), java
.awt
.BorderLayout
.SOUTH
);
243 jPanelBottom
.add(getJScrollPaneFpdModules(), java
.awt
.BorderLayout
.CENTER
);
249 * This method initializes jScrollPaneAllModules
251 * @return javax.swing.JScrollPane jScrollPaneAllModules
253 private JScrollPane
getJScrollPaneAllModules() {
254 if (jScrollPaneAllModules
== null) {
255 jScrollPaneAllModules
= new JScrollPane();
256 jScrollPaneAllModules
.setPreferredSize(new java
.awt
.Dimension(600, 200));
257 jScrollPaneAllModules
.setViewportView(getJTableAllModules());
259 return jScrollPaneAllModules
;
263 * This method initializes jTableAllModules
265 * @return javax.swing.JTable jTableAllModules
267 private JTable
getJTableAllModules() {
268 if (jTableAllModules
== null) {
269 modelAllModules
= new NonEditableTableModel();
270 TableSorter sorter
= new TableSorter(modelAllModules
);
271 jTableAllModules
= new JTable(sorter
);
272 sorter
.setTableHeader(jTableAllModules
.getTableHeader());
273 jTableAllModules
.setRowHeight(20);
274 modelAllModules
.addColumn("<html>Module<br>Name</html>");
275 modelAllModules
.addColumn("<html>Package<br>Name</html>");
276 modelAllModules
.addColumn("Path");
277 modelAllModules
.addColumn("<html>Module<br>Type</html>");
278 modelAllModules
.addColumn("<html>Module<br>Version</html>");
279 modelAllModules
.addColumn("<html>Package<br>Version</html>");
281 javax
.swing
.table
.TableColumn column
= null;
282 column
= jTableAllModules
.getColumnModel().getColumn(modNameColForAllModTable
);
283 column
.setPreferredWidth(modNamePrefWidth
);
284 column
.setMinWidth(modNameMinWidth
);
285 column
.setMaxWidth(modNameMaxWidth
);
286 column
= jTableAllModules
.getColumnModel().getColumn(modVerColForAllModTable
);
287 column
.setPreferredWidth(verPrefWidth
);
288 column
.setMaxWidth(verMaxWidth
);
289 column
.setMinWidth(verMinWidth
);
290 column
= jTableAllModules
.getColumnModel().getColumn(pkgNameColForAllModTable
);
291 column
.setPreferredWidth(pkgNamePrefWidth
);
292 column
.setMinWidth(pkgNameMinWidth
);
293 column
.setMaxWidth(pkgNameMaxWidth
);
294 column
= jTableAllModules
.getColumnModel().getColumn(pkgVerColForAllModTable
);
295 column
.setPreferredWidth(verPrefWidth
);
296 column
.setMaxWidth(verMaxWidth
);
297 column
.setMinWidth(verMinWidth
);
298 column
= jTableAllModules
.getColumnModel().getColumn(typeColForAllModTable
);
299 column
.setPreferredWidth(typePrefWidth
);
300 column
.setMaxWidth(typeMaxWidth
);
301 column
.setMinWidth(typeMinWidth
);
302 column
= jTableAllModules
.getColumnModel().getColumn(pathColForAllModTable
);
303 column
.setPreferredWidth(pathPrefWidth
);
304 column
.setMinWidth(pathMinWidth
);
306 jTableAllModules
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
307 jTableAllModules
.setAutoResizeMode(JTable
.AUTO_RESIZE_OFF
);
308 jTableAllModules
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
309 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
310 if (e
.getButton() == MouseEvent
.BUTTON1
&& e
.getClickCount() == 2) {
311 java
.awt
.Point p
= e
.getPoint();
312 int rowIndex
= jTableAllModules
.rowAtPoint(p
);
313 TableSorter sorter
= (TableSorter
) jTableAllModules
.getModel();
314 rowIndex
= sorter
.getModelRowIndex(rowIndex
);
315 addModuleIntoPlatform (rowIndex
);
319 jTableAllModules
.addKeyListener(new java
.awt
.event
.KeyAdapter() {
320 public void keyPressed(java
.awt
.event
.KeyEvent e
) {
321 if (e
.getKeyCode() == KeyEvent
.VK_ENTER
) {
322 int selectedRow
= jTableAllModules
.getSelectedRow();
323 if (selectedRow
< 0) {
326 TableSorter sorter
= (TableSorter
) jTableAllModules
.getModel();
327 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
328 addModuleIntoPlatform (selectedRow
);
333 jTableAllModules
.addKeyListener(new java
.awt
.event
.KeyAdapter() {
334 public void keyTyped(java
.awt
.event
.KeyEvent e
) {
336 if (System
.currentTimeMillis() - savedMs
< timeToWait
) {
337 searchField
+= e
.getKeyChar();
340 searchField
= "" + e
.getKeyChar();
343 int viewIndex
= gotoFoundRow (searchField
, jTableAllModules
);
345 jTableAllModules
.changeSelection(viewIndex
, 0, false, false);
347 savedMs
= System
.currentTimeMillis();
353 return jTableAllModules
;
356 private int gotoFoundRow (String s
, JTable model
) {
357 for (int i
= 0; i
< model
.getRowCount(); ++i
) {
358 if (model
.getValueAt(i
, 0) != null && model
.getValueAt(i
, 0).toString().regionMatches(true, 0, s
, 0, s
.length())) {
366 * This method initializes jPanelTopSouth
368 * This panel contains the ADD button
370 * @return javax.swing.JPanel jPanelTopSouth
372 private JPanel
getJPanelTopSouth() {
373 if (jPanelTopSouth
== null) {
374 FlowLayout flowLayout
= new FlowLayout();
375 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
376 jPanelTopSouth
= new JPanel();
377 jPanelTopSouth
.setLayout(flowLayout
);
378 jPanelTopSouth
.add(getJButtonAddModule(), null);
380 return jPanelTopSouth
;
383 private void addModuleIntoPlatform (int selectedRow
) {
384 String path
= modelAllModules
.getValueAt(selectedRow
, pathColForAllModTable
) + "";
385 ModuleIdentification mi
= miList
.get(selectedRow
);
386 Vector
<String
> vArchs
= null;
388 vArchs
= WorkspaceProfile
.getModuleSupArchs(mi
);
390 catch (Exception exp
) {
391 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
394 if (vArchs
== null) {
395 JOptionPane
.showMessageDialog(frame
, "No Supported Architectures specified in MSA file.");
399 String archsAdded
= "";
400 String mg
= mi
.getGuid();
401 String mv
= mi
.getVersion();
402 String pg
= mi
.getPackageId().getGuid();
403 String pv
= mi
.getPackageId().getVersion();
404 String mType
= SurfaceAreaQuery
.getModuleType(mi
);
406 ArrayList
<String
> al
= fpdMsa
.get(mg
+ mv
+ pg
+ pv
);
409 // if existing ModuleSA does not specify version info.
411 al
= fpdMsa
.get(mg
+ "null" + pg
+ "null");
413 al
= fpdMsa
.get(mg
+ "null" + pg
+ pv
);
415 al
= fpdMsa
.get(mg
+ mv
+ pg
+ "null");
417 al
= new ArrayList
<String
>();
418 fpdMsa
.put(mg
+ mv
+ pg
+ pv
, al
);
424 // filter from module SupArchs what archs has been added.
426 for (int i
= 0; i
< al
.size(); ++i
) {
427 vArchs
.remove(al
.get(i
));
430 // check whether archs conform to SupArch of platform.
432 Vector
<Object
> platformSupArch
= new Vector
<Object
>();
433 ffc
.getPlatformDefsSupportedArchs(platformSupArch
);
434 vArchs
.retainAll(platformSupArch
);
436 // Archs this Module supported have already been added.
438 if (vArchs
.size() == 0) {
439 JOptionPane
.showMessageDialog(frame
, "This Module has already been added.");
442 //ToDo put Arch instead of null
443 boolean errorOccurred
= false;
444 for (int i
= 0; i
< vArchs
.size(); ++i
) {
445 String arch
= vArchs
.get(i
);
447 archsAdded
+= arch
+ " ";
448 String
[] row
= { "", "", "", "", "", "", "" };
451 row
[modNameColForFpdModTable
] = mi
.getName();
452 row
[pkgNameColForFpdModTable
] = mi
.getPackageId().getName();
453 row
[pathColForFpdModTable
] = path
;
454 row
[archColForFpdModTable
] = arch
;
455 row
[pkgVerColForFpdModTable
] = pv
;
456 row
[modVerColForFpdModTable
] = mv
;
457 row
[typeColForFpdModTable
] = mType
;
460 modelFpdModules
.addRow(row
);
462 docConsole
.setSaved(false);
464 //ToDo : specify archs need to add.
465 ffc
.addFrameworkModulesPcdBuildDefs(mi
, arch
, null);
466 } catch (Exception exception
) {
467 JOptionPane
.showMessageDialog(frame
, "Adding " + row
[modNameColForFpdModTable
] + " with Supporting Architectures: " + arch
468 + ": " + exception
.getMessage());
469 errorOccurred
= true;
473 String s
= "This Module with Architecture " + archsAdded
;
475 s
+= " was added with Error. Platform may NOT Build.";
477 s
+= " was added Successfully.";
479 JOptionPane
.showMessageDialog(frame
, s
);
480 TableSorter sorterFpdModules
= (TableSorter
)jTableFpdModules
.getModel();
481 int viewIndex
= sorterFpdModules
.getViewIndexArray()[modelFpdModules
.getRowCount() - 1];
482 jTableFpdModules
.changeSelection(viewIndex
, 0, false, false);
487 * This method initializes jButtonAddModule
489 * @return javax.swing.JButton jButtonAddModule
491 private JButton
getJButtonAddModule() {
492 if (jButtonAddModule
== null) {
493 jButtonAddModule
= new JButton();
494 jButtonAddModule
.setPreferredSize(new java
.awt
.Dimension(130, 20));
495 jButtonAddModule
.setText("Add a Module");
496 jButtonAddModule
.addActionListener(new java
.awt
.event
.ActionListener() {
497 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
498 int selectedRow
= jTableAllModules
.getSelectedRow();
499 if (selectedRow
< 0) {
503 TableSorter sorter
= (TableSorter
) jTableAllModules
.getModel();
504 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
505 addModuleIntoPlatform (selectedRow
);
509 return jButtonAddModule
;
513 * This method initializes jPanelBottomSouth
515 * This panel contains the Settings and Remove Buttons
517 * @return javax.swing.JPanel jPanelBottomSouth
519 private JPanel
getJPanelBottomSouth() {
520 if (jPanelBottomSouth
== null) {
521 FlowLayout flowLayout1
= new FlowLayout();
522 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
523 jPanelBottomSouth
= new JPanel();
524 jPanelBottomSouth
.setLayout(flowLayout1
);
525 jPanelBottomSouth
.add(getJButtonSettings(), null);
526 jPanelBottomSouth
.add(getJButtonRemoveModule(), null);
528 return jPanelBottomSouth
;
532 * This method initializes jScrollPaneFpdModules
534 * @return javax.swing.JScrollPane jScrollPaneFpdModules
536 private JScrollPane
getJScrollPaneFpdModules() {
537 if (jScrollPaneFpdModules
== null) {
538 jScrollPaneFpdModules
= new JScrollPane();
539 jScrollPaneFpdModules
.setPreferredSize(new java
.awt
.Dimension(453, 200));
540 jScrollPaneFpdModules
.setViewportView(getJTableFpdModules());
542 return jScrollPaneFpdModules
;
546 * This method initializes jTableFpdModules
548 * @return javax.swing.JTable jTableFpdModules
550 private JTable
getJTableFpdModules() {
551 if (jTableFpdModules
== null) {
552 modelFpdModules
= new FpdModulesTableModel();
553 TableSorter sorter
= new TableSorter(modelFpdModules
);
554 jTableFpdModules
= new JTable(sorter
);
555 sorter
.setTableHeader(jTableFpdModules
.getTableHeader());
556 jTableFpdModules
.setRowHeight(20);
557 modelFpdModules
.addColumn("<html>Module<br>Name</html>");
558 modelFpdModules
.addColumn("<html>Package<br>Name</html>");
559 modelFpdModules
.addColumn("Path");
560 modelFpdModules
.addColumn("<html>Supported<br>Architectures</html>");
561 modelFpdModules
.addColumn("<html>Module<br>Type</html>");
562 modelFpdModules
.addColumn("<html>Module<br>Version</html>");
563 modelFpdModules
.addColumn("<html>Package<br>Version</html>");
564 modelFpdModules
.addColumn("<html>Force<br>Debug</html>");
566 javax
.swing
.table
.TableColumn column
= null;
567 column
= jTableFpdModules
.getColumnModel().getColumn(modNameColForFpdModTable
);
568 column
.setPreferredWidth(modNamePrefWidth
);
569 column
.setMinWidth(modNameMinWidth
);
570 column
.setMaxWidth(modNameMaxWidth
);
571 column
= jTableFpdModules
.getColumnModel().getColumn(modVerColForFpdModTable
);
572 column
.setPreferredWidth(verPrefWidth
);
573 column
.setMaxWidth(verMaxWidth
);
574 column
.setMinWidth(verMinWidth
);
575 column
= jTableFpdModules
.getColumnModel().getColumn(pkgNameColForFpdModTable
);
576 column
.setPreferredWidth(pkgNamePrefWidth
);
577 column
.setMinWidth(pkgNameMinWidth
);
578 column
.setMaxWidth(pkgNameMaxWidth
);
579 column
= jTableFpdModules
.getColumnModel().getColumn(pkgVerColForFpdModTable
);
580 column
.setPreferredWidth(verPrefWidth
);
581 column
.setMaxWidth(verMaxWidth
);
582 column
.setMinWidth(verMinWidth
);
583 column
= jTableFpdModules
.getColumnModel().getColumn(archColForFpdModTable
);
584 column
.setPreferredWidth(archPrefWidth
);
585 column
.setMaxWidth(archMaxWidth
);
586 column
.setMinWidth(archMinWidth
);
587 column
= jTableFpdModules
.getColumnModel().getColumn(pathColForFpdModTable
);
588 column
.setPreferredWidth(pathPrefWidth
);
589 column
.setMinWidth(pathMinWidth
);
590 column
= jTableFpdModules
.getColumnModel().getColumn(typeColForFpdModTable
);
591 column
.setPreferredWidth(typePrefWidth
);
592 column
.setMaxWidth(typeMaxWidth
);
593 column
.setMinWidth(typeMinWidth
);
595 jTableFpdModules
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
596 jTableFpdModules
.setAutoResizeMode(JTable
.AUTO_RESIZE_OFF
);
598 jTableFpdModules
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
599 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
600 if (e
.getButton() == MouseEvent
.BUTTON1
&& e
.getClickCount() == 2) {
601 java
.awt
.Point p
= e
.getPoint();
602 int rowIndex
= jTableFpdModules
.rowAtPoint(p
);
603 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
604 rowIndex
= sorter
.getModelRowIndex(rowIndex
);
605 showSettingsDlg (rowIndex
);
610 jTableFpdModules
.addKeyListener(new java
.awt
.event
.KeyAdapter() {
611 public void keyPressed(java
.awt
.event
.KeyEvent e
) {
612 if (e
.getKeyCode() == KeyEvent
.VK_ENTER
) {
613 int selectedRow
= jTableFpdModules
.getSelectedRow();
614 if (selectedRow
< 0) {
617 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
618 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
619 showSettingsDlg (selectedRow
);
624 jTableFpdModules
.addKeyListener(new java
.awt
.event
.KeyAdapter() {
625 public void keyTyped(java
.awt
.event
.KeyEvent e
) {
627 if (System
.currentTimeMillis() - savedMs
< timeToWait
) {
628 searchField
+= e
.getKeyChar();
631 searchField
= "" + e
.getKeyChar();
634 int viewIndex
= gotoFoundRow (searchField
, jTableFpdModules
);
636 jTableFpdModules
.changeSelection(viewIndex
, 0, false, false);
638 savedMs
= System
.currentTimeMillis();
642 jTableFpdModules
.getModel().addTableModelListener(this);
644 return jTableFpdModules
;
647 public void tableChanged(TableModelEvent arg0
) {
648 if (arg0
.getType() == TableModelEvent
.UPDATE
){
649 int row
= arg0
.getFirstRow();
650 int column
= arg0
.getColumn();
651 TableModel m
= (TableModel
)arg0
.getSource();
653 if (column
!= forceDbgColForFpdModTable
) {
656 String s
= m
.getValueAt(row
, column
)+"";
657 boolean dbgEnable
= new Boolean(s
);
658 ffc
.setModuleSAForceDebug(row
, dbgEnable
);
659 docConsole
.setSaved(false);
663 private void showSettingsDlg (int row
) {
665 if (ffc
.adjustPcd(row
)) {
666 docConsole
.setSaved(false);
669 catch (Exception exp
) {
670 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
674 if (settingDlg
== null) {
675 settingDlg
= new FpdModuleSA(ffc
);
678 String
[] sa
= new String
[5];
679 ffc
.getFrameworkModuleInfo(row
, sa
);
680 String mg
= sa
[ffcModGuid
];
681 String mv
= sa
[ffcModVer
];
682 String pg
= sa
[ffcPkgGuid
];
683 String pv
= sa
[ffcPkgVer
];
684 String arch
= sa
[ffcModArch
];
685 settingDlg
.setKey(mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
, row
, docConsole
);
686 settingDlg
.setVisible(true);
689 * This method initializes jButtonSettings
691 * @return javax.swing.JButton jButtonSettings
693 private JButton
getJButtonSettings() {
694 if (jButtonSettings
== null) {
695 jButtonSettings
= new JButton();
696 jButtonSettings
.setPreferredSize(new java
.awt
.Dimension(130,20));
697 jButtonSettings
.setText("Settings");
698 jButtonSettings
.addActionListener(new java
.awt
.event
.ActionListener() {
699 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
700 int selectedRow
= jTableFpdModules
.getSelectedRow();
701 if (selectedRow
< 0) {
705 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
706 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
707 showSettingsDlg (selectedRow
);
711 return jButtonSettings
;
715 * This method initializes jButtonRemoveModule
717 * @return javax.swing.JButton jButtonRemoveModule
719 private JButton
getJButtonRemoveModule() {
720 if (jButtonRemoveModule
== null) {
721 jButtonRemoveModule
= new JButton();
722 jButtonRemoveModule
.setPreferredSize(new java
.awt
.Dimension(130, 20));
723 jButtonRemoveModule
.setText("Remove Module");
724 jButtonRemoveModule
.addActionListener(new java
.awt
.event
.ActionListener() {
725 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
726 int selectedRow
= jTableFpdModules
.getSelectedRow();
727 if (selectedRow
< 0) {
730 int nextSelection
= selectedRow
;
732 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
733 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
735 String
[] sa
= new String
[5];
736 ffc
.getFrameworkModuleInfo(selectedRow
, sa
);
737 String mg
= sa
[ffcModGuid
];
738 String mv
= sa
[ffcModVer
];
739 String pg
= sa
[ffcPkgGuid
];
740 String pv
= sa
[ffcPkgVer
];
741 String arch
= sa
[ffcModArch
];
743 // sync. module order list in BuildOptions-UserExtensions.
745 String moduleKey
= mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
;
746 String fvBindings
= ffc
.getFvBinding(moduleKey
);
747 if (fvBindings
!= null) {
748 String
[] fvArray
= fvBindings
.split(" ");
749 for (int i
= 0; i
< fvArray
.length
; ++i
) {
750 ffc
.removeModuleInBuildOptionsUserExtensions(fvArray
[i
].trim(), mg
, mv
, pg
, pv
, arch
);
754 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
);
756 mv
= mi
.getVersion();
757 pv
= mi
.getPackageId().getVersion();
761 ffc
.removeModuleSA(selectedRow
);
763 catch (Exception exp
) {
764 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
769 // if no arch specified in ModuleSA
770 fpdMsa
.remove(mg
+ mv
+ pg
+ pv
);
773 ArrayList
<String
> al
= fpdMsa
.get(mg
+ mv
+ pg
+ pv
);
776 if (al
.size() == 0) {
777 fpdMsa
.remove(mg
+ mv
+ pg
+ pv
);
782 modelFpdModules
.removeRow(selectedRow
);
783 if (nextSelection
>= jTableFpdModules
.getRowCount()) {
784 nextSelection
= jTableFpdModules
.getRowCount() - 1;
786 jTableFpdModules
.changeSelection(nextSelection
, 0, false, false);
787 docConsole
.setSaved(false);
791 return jButtonRemoveModule
;
798 public static void main(String
[] args
) {
799 // Set the pane visable
800 new FpdFrameworkModules().setVisible(true);
804 * This is the default constructor
806 public FpdFrameworkModules() {
811 public FpdFrameworkModules(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
817 public FpdFrameworkModules(OpeningPlatformType opt
) {
818 this(opt
.getXmlFpd());
822 private void init(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
825 ffc
= new FpdFileContents(fpd
);
829 if (fpdMsa
== null) {
830 fpdMsa
= new HashMap
<String
, ArrayList
<String
>>();
833 if (ffc
.getFrameworkModulesCount() > 0) {
834 String
[][] saa
= new String
[ffc
.getFrameworkModulesCount()][5];
835 ffc
.getFrameworkModulesInfo(saa
);
836 for (int i
= 0; i
< saa
.length
; ++i
) {
837 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(saa
[i
][ffcModGuid
] + " " + saa
[i
][ffcModVer
] + " "
838 + saa
[i
][ffcPkgGuid
] + " " + saa
[i
][ffcPkgVer
]);
839 Object
[] row
= { "", "", "", "", "", "", "", "" };
841 row
[modNameColForFpdModTable
] = mi
.getName();
842 row
[modVerColForFpdModTable
] = mi
.getVersion();
843 row
[typeColForFpdModTable
] = SurfaceAreaQuery
.getModuleType(mi
);
844 row
[pkgNameColForFpdModTable
] = mi
.getPackageId().getName();
845 row
[pkgVerColForFpdModTable
] = mi
.getPackageId().getVersion();
846 row
[archColForFpdModTable
] = saa
[i
][ffcModArch
];
848 row
[pathColForFpdModTable
] = mi
.getPath().substring(System
.getenv("WORKSPACE").length() + 1);
849 } catch (Exception e
) {
850 JOptionPane
.showMessageDialog(frame
, "Show FPD Modules:" + e
.getMessage());
853 String fpdMsaKey
= saa
[i
][ffcModGuid
] + row
[modVerColForFpdModTable
]
854 + saa
[i
][ffcPkgGuid
] + row
[pkgVerColForFpdModTable
];
855 ArrayList
<String
> al
= fpdMsa
.get(fpdMsaKey
);
857 al
= new ArrayList
<String
>();
858 fpdMsa
.put(fpdMsaKey
, al
);
860 al
.add(saa
[i
][ffcModArch
]);
863 row
[modNameColForFpdModTable
] = saa
[i
][ffcModGuid
];
864 row
[modVerColForFpdModTable
] = saa
[i
][ffcModVer
];
865 row
[pkgNameColForFpdModTable
] = saa
[i
][ffcPkgGuid
];
866 row
[pkgVerColForFpdModTable
] = saa
[i
][ffcPkgVer
];
867 row
[archColForFpdModTable
] = saa
[i
][ffcModArch
];
869 row
[forceDbgColForFpdModTable
] = ffc
.getModuleSAForceDebug(i
);
870 modelFpdModules
.addRow(row
);
873 TableSorter sorter
= (TableSorter
)jTableFpdModules
.getModel();
874 sorter
.setSortState(modNameColForFpdModTable
, TableSorter
.ASCENDING
);
881 private void showAllModules() {
883 if (miList
== null) {
884 miList
= new ArrayList
<ModuleIdentification
>();
887 String
[] s
= { "", "", "", "", "", "" };
889 Iterator ismi
= GlobalData
.vModuleList
.iterator();
890 while (ismi
.hasNext()) {
891 ModuleIdentification mi
= (ModuleIdentification
) ismi
.next();
892 s
[modNameColForAllModTable
] = mi
.getName();
893 s
[modVerColForAllModTable
] = mi
.getVersion();
894 s
[typeColForAllModTable
] = SurfaceAreaQuery
.getModuleType(mi
);
895 s
[pkgNameColForAllModTable
] = mi
.getPackageId().getName();
896 s
[pkgVerColForAllModTable
] = mi
.getPackageId().getVersion();
898 s
[pathColForAllModTable
] = mi
.getPath().substring(System
.getenv("WORKSPACE").length() + 1);
899 } catch (Exception e
) {
900 JOptionPane
.showMessageDialog(frame
, "Show All Modules:" + e
.getMessage());
902 modelAllModules
.addRow(s
);
907 TableSorter sorter
= (TableSorter
)jTableAllModules
.getModel();
908 sorter
.setSortState(modNameColForAllModTable
, TableSorter
.ASCENDING
);
912 * This method initializes this
916 private void initialize() {
917 this.setSize(633, 533);
918 this.setTitle("Framework Modules");
919 this.setContentPane(getJSplitPane());
920 this.setVisible(true);
924 } // @jve:decl-index=0:visual-constraint="10,10"
926 class NonEditableTableModel
extends DefaultTableModel
{
930 private static final long serialVersionUID
= 1L;
932 public boolean isCellEditable(int row
, int col
) {
937 class FpdModulesTableModel
extends DefaultTableModel
{
942 private static final long serialVersionUID
= 1L;
944 public Class
<?
> getColumnClass (int c
) {
945 if (getValueAt(0, c
) != null){
946 return getValueAt(0, c
).getClass();
951 public boolean isCellEditable (int row
, int col
) {
952 if (col
== FpdFrameworkModules
.forceDbgColForFpdModTable
) {