diff options
Diffstat (limited to 'Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform')
20 files changed, 0 insertions, 17626 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java deleted file mode 100644 index bc0b3d2bed..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java +++ /dev/null @@ -1,61 +0,0 @@ -/** @file
-
- The file is used to save basic information of platform
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.platform;
-
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class PlatformIdentification extends Identification{
-
- public PlatformIdentification(String name, String guid, String version, String path){
- super(name, guid, version, path);
- }
-
- public PlatformIdentification(Identification id){
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public File getFpdFile(){
- File fpdFile = new File(this.getPath());
- return fpdFile;
- }
-
- public String toString() {
- return getName() + " " + getVersion() + " [" + Tools.getRelativePath(getFpdFile().getPath(), Workspace.getCurrentWorkspace()) + "]";
- }
-
- public boolean equals(String platformGuid, String platformVersion) {
- boolean b = false;
- if (this.getGuid().equals(platformGuid)) {
- b = true;
- //
- // Check Version
- //
- if (platformVersion != null) {
- if (!Tools.isEmpty(platformVersion)) {
- if (!platformVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-}
\ No newline at end of file diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java deleted file mode 100644 index d47352bb3e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - - The file is used to create tree view sections - - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ -package org.tianocore.frameworkwizard.platform.ui; -import java.awt.GridLayout; - -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; - - -public class DynamicTree extends JPanel { - /** - * - */ - private static final long serialVersionUID = 1L; - protected DefaultMutableTreeNode rootNode; - protected DefaultTreeModel treeModel; - protected JTree tree; - - public DynamicTree() { - super(new GridLayout(1,0)); - - - } - - -} - - diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java deleted file mode 100644 index feddaeeb71..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ /dev/null @@ -1,2242 +0,0 @@ -/** @file
-
- The file is used to create, update BuildOptions of Fpd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import java.awt.FlowLayout;
-import javax.swing.AbstractAction;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JComboBox;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.Vector;
-import java.awt.Dimension;
-import javax.swing.JSplitPane;
-import java.awt.GridLayout;
-
-public class FpdBuildOptions extends IInternalFrame {
-
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- private final int sepHeight = 6;
-
- private final int sepWidth = 10;
-
- private final int buttonWidth = 90;
-
- private final int rowOne = 12;
-
- private final int dialogWidth = 600;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + oneRowHeight + sepHeight;
-
- private final int rowFive = rowFour + oneRowHeight + sepHeight;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int rowSeven = rowSix + oneRowHeight + sepHeight;
-
- private final int buttonRow = rowSeven + oneRowHeight + sepHeight + sepHeight;
-
- private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;
-
- private final int lastButtonXLoc = dialogWidth - buttonWidth - sepWidth;
-
- private final int next2LastButtonLoc = lastButtonXLoc - buttonWidth - sepWidth;
-
- private final int firstButtonLoc = next2LastButtonLoc - buttonWidth - sepWidth;
-
- private final int labelColumn = 12;
-
- private final int fieldColumn = 168;
-
- private final int labelWidth = 155;
-
- private final int fieldWidth = 320;
-
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
-
- // private JPanel jPanelContentSouth = null;
-
- // private JPanel jPanelContentNorth = null;
-
- // private JPanel jPanelContentWest = null;
-
- // private JPanel jPanelContentEast = null;
-
- private JTabbedPane jTabbedPane = null;
-
- private JPanel jPanelUserDef = null;
-
- private JPanel jPanelUserDefNorth = null;
-
- private JPanel jPanelUserDefCenter = null;
-
- private JTextField jTextFieldAntTaskFile = null;
-
- private JLabel jLabelAntTaskId = null;
-
- private JTextField jTextFieldAntTaskId = null;
-
- private JButton jButtonAntTaskAdd = null;
-
- private JButton jButtonAntTaskDel = null;
-
- private JTextField jTextFieldAntCmdOpts = null;
-
- private JScrollPane jScrollPaneAntTasks = null;
-
- private JTable jTableAntTasks = null;
-
- private DefaultTableModel ffsTableModel = null;
-
- private DefaultTableModel sectionsTableModel = null;
-
- private DefaultTableModel sectionTableModel = null;
-
- private DefaultTableModel subsectionsTableModel = null;
-
- private DefaultTableModel antTaskTableModel = null;
-
- private DefaultTableModel ffsAttributesTableModel = null;
-
- private DefaultTableModel optionsTableModel = null;
-
- private JPanel jPanelFfsTab = null;
-
- private JPanel jPanelFfsTabCenter = null;
-
- private JPanel jPanelFfsTabCenterN = null;
-
- private JPanel jPanelFfsTabCenterS = null;
-
- private JButton jButtonFfsAdd = null;
-
- private JButton jButtonFfsDel = null;
-
- private JScrollPane jScrollPaneFfsAttribs = null;
-
- private JTable jTableFfsAttribs = null;
-
- private JPanel jPanelOptionsTab = null;
-
- private JLabel jLabelOptionContents = null;
-
- private JTextField jTextFieldOptionContents = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private JLabel jLabelSupArch = null;
-
- private JLabel jLabelToolCmd = null;
-
- private JTextField jTextFieldToolCmd = null;
-
- private JScrollPane jScrollPaneOptions = null;
-
- private JTable jTableOptions = null;
-
- private JButton jButtonOptionsAdd = null;
-
- private JButton jButtonOptionsDel = null;
-
- private JButton jButtonFfsAttribNew = null;
-
- private JButton jButtonFfsAttribRemove = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private JPanel jArchitectureSelections = null;
-
- private JCheckBox jCheckBoxIA32 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxEBC = null;
-
- private JCheckBox jCheckBoxARM = null;
-
- private JCheckBox jCheckBoxPPC = null;
-
- private JLabel jLabelBuildTargets = null;
-
- private JTextField jTextFieldBuildTargets = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelTagName = null;
-
- private int selectedRow = -1;
-
- private JLabel jLabelAntTaskFile = null;
-
- private JLabel jLabelAntCmdOpts = null;
-
- private JScrollPane jScrollPaneFfs = null;
-
- private JTable jTableFfs = null;
-
- private JLabel jLabelFfsSection = null;
-
- private JScrollPane jScrollPaneFfsSection = null;
-
- private JTable jTableFfsSection = null;
-
- private JLabel jLabelFfsSubSections = null;
-
- private JScrollPane jScrollPaneFfsSubSection = null;
-
- private JTable jTableFfsSubSection = null;
-
- private JLabel jLabelEncapType = null;
-
- private JTextField jTextFieldEncapType = null;
-
- private JPanel jPanelFfsAttribButtonGroup = null;
-
- private JLabel jLabelFfsAttribs = null;
-
- private JButton jButtonFfsSectionNew = null;
-
- private JButton jButtonFfsSectionRemove = null;
-
- private JButton jButtonFfsSubSectionNew = null;
-
- private JButton jButtonFfsSubSectionRemove = null;
-
- private JLabel jLabelFfsSections = null;
-
- private JButton jButtonFfsSectionsNew = null;
-
- private JButton jButtonFfsSectionsRemove = null;
-
- private JScrollPane jScrollPaneFfsSections = null;
-
- private JTable jTableFfsSections = null;
-
- private JButton jButtonAntTaskFileBrowse = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private JSplitPane jSplitPaneFfsC = null;
-
- private JPanel jPanelFfsCTop = null;
-
- private JSplitPane jSplitPaneFfsCBottom = null;
-
- private JPanel jPanelFfsCBottomTop = null;
-
- private JPanel jPanelFfsCBottomBottom = null;
-
- private JPanel jPanelSectionN = null;
-
- private JPanel jPanelSectionsN = null;
-
- private JPanel jPanelSubSectionN = null;
-
- private JPanel jPanelOptionsContainer = null;
-
- private JPanel jPanelUserDefCenterN = null;
-
- private JPanel jPanelTableOptionsContainer = null;
-
- private JLabel jLabelTableOptionsTitle = null;
-
- private final int buildTargetWidth = 150;
- private final int toolChainFamilyWidth = 150;
- private final int supportArchWidth = 150;
- private final int toolCmdCodeWidth = 200;
- private final int tagNameWidth = 150;
- private final int argWidth = 400;
-
- private boolean ffsSelection = false;
- private int selectedFfsTableRow = -1;
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentSouth() {
- if (jPanelContentSouth == null) {
- jPanelContentSouth = new JPanel();
- }
- return jPanelContentSouth;
- }
- */
-
- /**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentNorth() {
- if (jPanelContentNorth == null) {
- jPanelContentNorth = new JPanel();
- }
- return jPanelContentNorth;
- }
- */
-
- /**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentWest() {
- if (jPanelContentWest == null) {
- jPanelContentWest = new JPanel();
- }
- return jPanelContentWest;
- }
- */
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- jPanelContentEast = new JPanel();
- }
- return jPanelContentEast;
- }
- */
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
- jTabbedPane.addTab("Customize Tool Chain Configurations", null, getJPanelOptionsTab(), null);
- jTabbedPane.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(722, 577);
- this.setTitle("Platform Build Options");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
- // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
- // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
- // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanelTableOptionsContainer
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelTableOptionsContainer() {
- if (jPanelTableOptionsContainer == null) {
- jLabelTableOptionsTitle = new JLabel();
- jLabelTableOptionsTitle.setText(" Current Argument Lines");
- jPanelTableOptionsContainer = new JPanel();
- jPanelTableOptionsContainer.setLayout(new BorderLayout());
- jPanelTableOptionsContainer.add(jLabelTableOptionsTitle, java.awt.BorderLayout.NORTH);
- jPanelTableOptionsContainer.add(getJScrollPaneOptions(), java.awt.BorderLayout.CENTER);
- }
- return jPanelTableOptionsContainer;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new FpdBuildOptions().setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public FpdBuildOptions() {
- super();
- initialize();
- this.setVisible(true);
- }
-
- public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdBuildOptions(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- private void init(FpdFileContents ffc) {
- initOptionTable();
- initAntTaskTable();
- initFfsTable();
- this.addInternalFrameListener(new InternalFrameAdapter() {
- public void internalFrameDeactivated(InternalFrameEvent e) {
- if (jTableAntTasks.isEditing()) {
- jTableAntTasks.getCellEditor().stopCellEditing();
- }
- if (jTableOptions.isEditing()) {
- jTableOptions.getCellEditor().stopCellEditing();
- }
- stopEditingInTables ();
- }
- });
- }
-
- private void stopEditingInTables () {
- if (jTableFfs.isEditing()) {
- jTableFfs.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSection.isEditing()) {
- jTableFfsSection.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSections.isEditing()) {
- jTableFfsSections.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSubSection.isEditing()) {
- jTableFfsSubSection.getCellEditor().stopCellEditing();
- }
- if (jTableFfsAttribs.isEditing()) {
- jTableFfsAttribs.getCellEditor().stopCellEditing();
- }
- }
-
- /**
- * This method initializes jPanel13
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTab() {
- if (jPanelFfsTab == null) {
- jPanelFfsTab = new JPanel();
- jPanelFfsTab.setLayout(new BorderLayout());
- jPanelFfsTab.add(getJPanelFfsTabCenter(), java.awt.BorderLayout.CENTER);
- jPanelFfsTab.add(getJScrollPaneFfs(), java.awt.BorderLayout.WEST);
- }
- return jPanelFfsTab;
- }
-
- /**
- * This method initializes jPanel18
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenter() {
- if (jPanelFfsTabCenter == null) {
- jPanelFfsTabCenter = new JPanel();
- jPanelFfsTabCenter.setLayout(new BorderLayout());
- jPanelFfsTabCenter.add(getJPanelFfsTabCenterN(), java.awt.BorderLayout.NORTH);
- jPanelFfsTabCenter.add(getJPanelFfsTabCenterS(), java.awt.BorderLayout.SOUTH);
- jPanelFfsTabCenter.add(getJSplitPaneFfsC(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsTabCenter;
- }
-
- /**
- * This method initializes jPanel15
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenterN() {
- if (jPanelFfsTabCenterN == null) {
- jLabelEncapType = new JLabel();
- jLabelEncapType.setText("Encapsulation Type");
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT);
-
- jPanelFfsTabCenterN = new JPanel();
- jPanelFfsTabCenterN.setLayout(flowLayout5);
-
-
- jPanelFfsTabCenterN.add(jLabelEncapType, null);
- jPanelFfsTabCenterN.add(getJTextFieldEncapType(), null);
- jPanelFfsTabCenterN.add(getJButtonFfsAdd(), null);
- jPanelFfsTabCenterN.add(getJButtonFfsDel(), null);
- }
- return jPanelFfsTabCenterN;
- }
-
- /**
- * This method initializes jPanel16
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenterS() {
- if (jPanelFfsTabCenterS == null) {
- jLabelFfsAttribs = new JLabel();
- jLabelFfsAttribs.setText("Attributes");
- jPanelFfsTabCenterS = new JPanel();
- jPanelFfsTabCenterS.setPreferredSize(new java.awt.Dimension(491, 130));
- jPanelFfsTabCenterS.setLayout(new BorderLayout());
- jPanelFfsTabCenterS.add(jLabelFfsAttribs, java.awt.BorderLayout.WEST);
- jPanelFfsTabCenterS.add(getJScrollPaneFfsAttribs(), java.awt.BorderLayout.CENTER);
- jPanelFfsTabCenterS.add(getJPanelFfsAttribButtonGroup(), java.awt.BorderLayout.EAST);
- }
- return jPanelFfsTabCenterS;
- }
-
- /**
- * This method initializes jTextField6
- *
- * @return javax.swing.JTextField
- */
-
-
- /**
- * This method initializes jButton8
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAdd() {
- if (jButtonFfsAdd == null) {
- jButtonFfsAdd = new JButton();
- jButtonFfsAdd.setPreferredSize(new java.awt.Dimension(70, 20));
- jButtonFfsAdd.setText("New");
- jButtonFfsAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = -2923720717273384221L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
-
- String[] row = { "" };
- ffsTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genBuildOptionsFfs("", "");
- jTableFfs.changeSelection(ffsTableModel.getRowCount()-1, 0, false, false);
-
- }
- });
- }
- return jButtonFfsAdd;
- }
-
- /**
- * This method initializes jButton9
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsDel() {
- if (jButtonFfsDel == null) {
- jButtonFfsDel = new JButton();
- jButtonFfsDel.setPreferredSize(new java.awt.Dimension(70, 20));
- jButtonFfsDel.setText("Delete");
- jButtonFfsDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = -4002678939178194476L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow());
- ffsTableModel.removeRow(jTableFfs.getSelectedRow());
- sectionTableModel.setRowCount(0);
- sectionsTableModel.setRowCount(0);
- subsectionsTableModel.setRowCount(0);
- ffsAttributesTableModel.setRowCount(0);
- }
- });
- }
- return jButtonFfsDel;
- }
-
- /**
- * This method initializes jScrollPane5
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsAttribs() {
- if (jScrollPaneFfsAttribs == null) {
- jScrollPaneFfsAttribs = new JScrollPane();
-// jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
- jScrollPaneFfsAttribs.setViewportView(getJTableFfsAttribs());
-
- }
- return jScrollPaneFfsAttribs;
- }
-
- /**
- * This method initializes jTable4
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsAttribs() {
- if (jTableFfsAttribs == null) {
- ffsAttributesTableModel = new DefaultTableModel();
- jTableFfsAttribs = new JTable(ffsAttributesTableModel);
-// jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
- jTableFfsAttribs.setRowHeight(20);
- ffsAttributesTableModel.addColumn("Name");
- ffsAttributesTableModel.addColumn("Value");
-
- jTableFfsAttribs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfsAttribs.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String name = m.getValueAt(row, 0) + "";
- String value = m.getValueAt(row, 1) + "";
-
- if (name.length() == 0) {
- return;
- }
- if (value.length() == 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), row, name, value);
- }
- }
- });
- }
- return jTableFfsAttribs;
- }
-
- private void initFfsTable() {
- int ffsCount = ffc.getBuildOptionsFfsCount();
- if (ffsCount < 0) {
- return;
- }
- String[][] saa = new String[ffsCount][1];
- ffc.getBuildOptionsFfsKey(saa);
- for (int i = 0; i < saa.length; ++i) {
- ffsTableModel.addRow(saa[i]);
- }
- jTableFfs.changeSelection(0, 0, false, false);
- }
-
- /**
- * This method initializes jButton17
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAttribNew() {
- if (jButtonFfsAttribNew == null) {
- jButtonFfsAttribNew = new JButton();
- jButtonFfsAttribNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsAttribNew.setText("New");
- jButtonFfsAttribNew.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- Object[] o = { "", "" };
- ffsAttributesTableModel.addRow(o);
- docConsole.setSaved(false);
- ffc.genBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), "", "");
- }
- });
- }
- return jButtonFfsAttribNew;
- }
-
- /**
- * This method initializes jButton18
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAttribRemove() {
- if (jButtonFfsAttribRemove == null) {
- jButtonFfsAttribRemove = new JButton();
- jButtonFfsAttribRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsAttribRemove.setText("Remove");
- jButtonFfsAttribRemove.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- if (jTableFfsAttribs.getSelectedRow() >= 0) {
- docConsole.setSaved(false);
- ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow());
- ffc.removeBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(),
- jTableFfsAttribs.getSelectedRow());
- }
- }
- });
- }
- return jButtonFfsAttribRemove;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfs() {
- if (jScrollPaneFfs == null) {
- jScrollPaneFfs = new JScrollPane();
- jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(200,419));
- jScrollPaneFfs.setViewportView(getJTableFfs());
- }
- return jScrollPaneFfs;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfs() {
- if (jTableFfs == null) {
- ffsTableModel = new DefaultTableModel();
- ffsTableModel.addColumn("FFS Type");
- jTableFfs = new JTable(ffsTableModel);
- jTableFfs.setShowGrid(false);
- jTableFfs.setRowHeight(20);
-
- jTableFfs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfs.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
-
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- int row = lsm.getMinSelectionIndex();
- sectionTableModel.setRowCount(0);
- sectionsTableModel.setRowCount(0);
- subsectionsTableModel.setRowCount(0);
- ffsAttributesTableModel.setRowCount(0);
- String[] sArray = { "", "" };
- LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
- ArrayList<String> alSections = new ArrayList<String>();
- ArrayList<String> alSection = new ArrayList<String>();
- ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection);
- ffsSelection = true;
- jTextFieldEncapType.setText(sArray[1]);
- ffsSelection = false;
- for (int i = 0; i < alSection.size(); ++i) {
- String[] sectionRow = { alSection.get(i) };
- sectionTableModel.addRow(sectionRow);
- }
- for (int j = 0; j < alSections.size(); ++j) {
- String[] sectionsRow = { alSections.get(j) };
- sectionsTableModel.addRow(sectionsRow);
- }
- if (lhm.size() <= 0) {
- return;
- }
- Set<String> keySet = lhm.keySet();
- Iterator<String> is = keySet.iterator();
- while (is.hasNext()) {
- String key = is.next();
- String[] attribRow = { key, lhm.get(key) };
- ffsAttributesTableModel.addRow(attribRow);
- }
- selectedFfsTableRow = row;
- }
- }
- });
-
- jTableFfs.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
-
- if (id.length() == 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsKey(row, id);
- }
- }
- });
- }
- return jTableFfs;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsSection() {
- if (jScrollPaneFfsSection == null) {
- jScrollPaneFfsSection = new JScrollPane();
-// jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
- jScrollPaneFfsSection.setViewportView(getJTableFfsSection());
- }
- return jScrollPaneFfsSection;
- }
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSection() {
- if (jTableFfsSection == null) {
- sectionTableModel = new DefaultTableModel();
- sectionTableModel.addColumn("SectionType");
-
- jTableFfsSection = new JTable(sectionTableModel);
- jTableFfsSection.setRowHeight(20);
- JComboBox cb = new JComboBox();
- cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
- cb.addItem("EFI_SECTION_VERSION");
- cb.addItem("EFI_SECTION_USER_INTERFACE");
- cb.addItem("EFI_SECTION_DXE_DEPEX");
- cb.addItem("EFI_SECTION_PEI_DEPEX");
- cb.addItem("EFI_SECTION_PE32");
- cb.addItem("EFI_SECTION_PIC");
- cb.addItem("EFI_SECTION_TE");
- cb.addItem("EFI_SECTION_RAW");
- cb.addItem("EFI_SECTION_COMPRESSION");
- cb.addItem("EFI_SECTION_GUID_DEFINED");
- cb.addItem("EFI_SECTION_COMPATIBILITY16");
- cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
- jTableFfsSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
-
- jTableFfsSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableFfsSection.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String type = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row, type);
- }
- }
- });
- }
- return jTableFfsSection;
- }
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsSubSection() {
- if (jScrollPaneFfsSubSection == null) {
- jScrollPaneFfsSubSection = new JScrollPane();
-// jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
- jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection());
- }
- return jScrollPaneFfsSubSection;
- }
-
- /**
- * This method initializes jTable3
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSubSection() {
- if (jTableFfsSubSection == null) {
- subsectionsTableModel = new DefaultTableModel();
- subsectionsTableModel.addColumn("SectionType");
- jTableFfsSubSection = new JTable(subsectionsTableModel);
- jTableFfsSubSection.setRowHeight(20);
- JComboBox cb = new JComboBox();
- cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
- cb.addItem("EFI_SECTION_VERSION");
- cb.addItem("EFI_SECTION_USER_INTERFACE");
- cb.addItem("EFI_SECTION_DXE_DEPEX");
- cb.addItem("EFI_SECTION_PEI_DEPEX");
- cb.addItem("EFI_SECTION_PE32");
- cb.addItem("EFI_SECTION_PIC");
- cb.addItem("EFI_SECTION_TE");
- cb.addItem("EFI_SECTION_RAW");
- cb.addItem("EFI_SECTION_COMPRESSION");
- cb.addItem("EFI_SECTION_GUID_DEFINED");
- cb.addItem("EFI_SECTION_COMPATIBILITY16");
- cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
- jTableFfsSubSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
- jTableFfsSubSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableFfsSubSection.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String type = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow(), row, type);
- }
- }
- });
- }
- return jTableFfsSubSection;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldEncapType() {
- if (jTextFieldEncapType == null) {
- jTextFieldEncapType = new JTextField();
- jTextFieldEncapType.setPreferredSize(new java.awt.Dimension(200,20));
- jTextFieldEncapType.getDocument().addDocumentListener(new DocumentListener() {
-
- public void insertUpdate(DocumentEvent arg0) {
- if (ffsSelection) {
-// ffsSelection = false;
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- public void removeUpdate(DocumentEvent arg0) {
- if (ffsSelection) {
-// ffsSelection = false;
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- });
- jTextFieldEncapType.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- if (selectedFfsTableRow < 0) {
- return;
- }
- ffc.updateBuildOptionsFfsSectionsType(selectedFfsTableRow, jTextFieldEncapType.getText());
-
- }
- });
- }
- return jTextFieldEncapType;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsAttribButtonGroup() {
- if (jPanelFfsAttribButtonGroup == null) {
- jPanelFfsAttribButtonGroup = new JPanel();
- jPanelFfsAttribButtonGroup.setPreferredSize(new java.awt.Dimension(100, 100));
- jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribNew(), null);
- jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribRemove(), null);
- }
- return jPanelFfsAttribButtonGroup;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionNew() {
- if (jButtonFfsSectionNew == null) {
- jButtonFfsSectionNew = new JButton();
- jButtonFfsSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionNew.setText("New");
- jButtonFfsSectionNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "EFI_SECTION_RAW" };
- sectionTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row[0]);
- }
- });
- }
- return jButtonFfsSectionNew;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionRemove() {
- if (jButtonFfsSectionRemove == null) {
- jButtonFfsSectionRemove = new JButton();
- jButtonFfsSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionRemove.setText("Remove");
-
- jButtonFfsSectionRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- sectionTableModel.removeRow(jTableFfsSection.getSelectedRow());
- ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSection.getSelectedRow());
- }
- });
- }
- return jButtonFfsSectionRemove;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSubSectionNew() {
- if (jButtonFfsSubSectionNew == null) {
- jButtonFfsSubSectionNew = new JButton();
- jButtonFfsSubSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSubSectionNew.setText("New");
- jButtonFfsSubSectionNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "EFI_SECTION_RAW" };
- subsectionsTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow(), row[0]);
-
- }
- });
- }
- return jButtonFfsSubSectionNew;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSubSectionRemove() {
- if (jButtonFfsSubSectionRemove == null) {
- jButtonFfsSubSectionRemove = new JButton();
- jButtonFfsSubSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSubSectionRemove.setText("Remove");
- jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedFfsRow = jTableFfs.getSelectedRow();
- int selectedSectionsRow = jTableFfsSections.getSelectedRow();
- int selectedSubSectionRow = jTableFfsSubSection.getSelectedRow();
- if (selectedFfsRow < 0 || selectedSectionsRow < 0
- || selectedSubSectionRow < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- subsectionsTableModel.removeRow(selectedSubSectionRow);
- ffc.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow,
- selectedSectionsRow,
- selectedSubSectionRow);
- if (subsectionsTableModel.getRowCount() == 0) {
- sectionsTableModel.removeRow(selectedSectionsRow);
- }
- }
- });
- }
- return jButtonFfsSubSectionRemove;
- }
-
- /**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionsNew() {
- if (jButtonFfsSectionsNew == null) {
- jButtonFfsSectionsNew = new JButton();
- jButtonFfsSectionsNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionsNew.setText("New");
- jButtonFfsSectionsNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "Compress" };
- sectionsTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), "");
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");
- jTableFfsSections.changeSelection(sectionsTableModel.getRowCount()-1, 0, false, false);
- }
- });
- }
- return jButtonFfsSectionsNew;
- }
-
- /**
- * This method initializes jButton7
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionsRemove() {
- if (jButtonFfsSectionsRemove == null) {
- jButtonFfsSectionsRemove = new JButton();
- jButtonFfsSectionsRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionsRemove.setText("Remove");
- jButtonFfsSectionsRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow());
- ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow());
- subsectionsTableModel.setRowCount(0);
- }
- });
- }
- return jButtonFfsSectionsRemove;
- }
-
- private JScrollPane getJScrollPaneFfsSections() {
- if (jScrollPaneFfsSections == null) {
- jScrollPaneFfsSections = new JScrollPane();
-// jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
- jScrollPaneFfsSections.setViewportView(getJTableFfsSections());
- }
- return jScrollPaneFfsSections;
- }
-
- /**
- * This method initializes jTable6
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSections() {
- if (jTableFfsSections == null) {
- sectionsTableModel = new DefaultTableModel();
- sectionsTableModel.addColumn("EncapsulationType");
- jTableFfsSections = new JTable(sectionsTableModel);
- jTableFfsSections.setRowHeight(20);
- jTableFfsSections.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfsSections.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- int sectionsRow = lsm.getMinSelectionIndex();
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- subsectionsTableModel.setRowCount(0);
- ArrayList<String> al = new ArrayList<String>();
- ffc.getBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), sectionsRow, al);
- for (int i = 0; i < al.size(); ++i) {
- String[] subsectionRow = { al.get(i) };
- subsectionsTableModel.addRow(subsectionRow);
- }
- }
- }
- });
-
- jTableFfsSections.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String encapType = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType);
- }
- }
- });
- }
- return jTableFfsSections;
- }
-
- /**
- * This method initializes jSplitPaneFfsC
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFfsC() {
- if (jSplitPaneFfsC == null) {
- jSplitPaneFfsC = new JSplitPane();
- jSplitPaneFfsC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPaneFfsC.setDividerLocation(130);
- jSplitPaneFfsC.setTopComponent(getJPanelFfsCTop());
- jSplitPaneFfsC.setBottomComponent(getJSplitPaneFfsCBottom());
- jSplitPaneFfsC.setDividerSize(5);
- }
- return jSplitPaneFfsC;
- }
-
- /**
- * This method initializes jPanelFfsCTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCTop() {
- if (jPanelFfsCTop == null) {
- jPanelFfsCTop = new JPanel();
- jPanelFfsCTop.setLayout(new BorderLayout());
- jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCTop.add(getJScrollPaneFfsSection(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCTop;
- }
-
- /**
- * This method initializes jSplitPaneFfsCBottom
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFfsCBottom() {
- if (jSplitPaneFfsCBottom == null) {
- jSplitPaneFfsCBottom = new JSplitPane();
- jSplitPaneFfsCBottom.setDividerSize(5);
- jSplitPaneFfsCBottom.setDividerLocation(130);
- jSplitPaneFfsCBottom.setTopComponent(getJPanelFfsCBottomTop());
- jSplitPaneFfsCBottom.setBottomComponent(getJPanelFfsCBottomBottom());
- jSplitPaneFfsCBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- }
- return jSplitPaneFfsCBottom;
- }
-
- /**
- * This method initializes jPanelFfsCBottomTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCBottomTop() {
- if (jPanelFfsCBottomTop == null) {
- jPanelFfsCBottomTop = new JPanel();
- jPanelFfsCBottomTop.setLayout(new BorderLayout());
- jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCBottomTop.add(getJScrollPaneFfsSections(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCBottomTop;
- }
-
- /**
- * This method initializes jPanelFfsCBottomBottom
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCBottomBottom() {
- if (jPanelFfsCBottomBottom == null) {
- jPanelFfsCBottomBottom = new JPanel();
- jPanelFfsCBottomBottom.setLayout(new BorderLayout());
- jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCBottomBottom.add(getJScrollPaneFfsSubSection(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCBottomBottom;
- }
-
- /**
- * This method initializes jPanelSectionN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSectionN() {
- if (jPanelSectionN == null) {
- jPanelSectionN = new JPanel();
- jLabelFfsSection = new JLabel();
- jLabelFfsSection.setText("Section");
- jPanelSectionN.add(jLabelFfsSection, null);
- jPanelSectionN.add(getJButtonFfsSectionNew(), null);
- jPanelSectionN.add(getJButtonFfsSectionRemove(), null);
- }
- return jPanelSectionN;
- }
-
- /**
- * This method initializes jPanelSectionsN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSectionsN() {
- if (jPanelSectionsN == null) {
- jPanelSectionsN = new JPanel();
- jLabelFfsSections = new JLabel();
- jLabelFfsSections.setText("Sections");
- jPanelSectionsN.add(jLabelFfsSections, null);
- jPanelSectionsN.add(getJButtonFfsSectionsNew(), null);
- jPanelSectionsN.add(getJButtonFfsSectionsRemove(), null);
- }
- return jPanelSectionsN;
- }
-
- /**
- * This method initializes jPanelSubSectionN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSubSectionN() {
- if (jPanelSubSectionN == null) {
- jPanelSubSectionN = new JPanel();
- jLabelFfsSubSections = new JLabel();
- jLabelFfsSubSections.setText("Sub-Sections");
- jPanelSubSectionN.add(jLabelFfsSubSections, null);
- jPanelSubSectionN.add(getJButtonFfsSubSectionNew(), null);
- jPanelSubSectionN.add(getJButtonFfsSubSectionRemove(), null);
- }
- return jPanelSubSectionN;
- }
-
- /**
- * The following section contains all Build Options content
- */
-
- /**
- * This method initializes jPanelOptionsTab
- *
- * This is the main Options screen
- *
- * @return javax.swing.JPanel jPanelOptionsTab
- */
- private JPanel getJPanelOptionsTab() {
- if (jPanelOptionsTab == null) {
- // This container holds the Options Tab content
-
- // FlowLayout flowLayout9 = new FlowLayout();
- // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(2);
- jPanelOptionsTab = new JPanel();
- jPanelOptionsTab.setLayout(gridLayout);
- jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
- jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
- jPanelOptionsTab.setAutoscrolls(true);
- jPanelOptionsTab.setLocation(0, 0);
- jPanelOptionsTab.add(getJPanelOptionsContainer(), null);
-// jPanelOptionsTab.add(getJScrollPaneOptions(), null);
- jPanelOptionsTab.add(getJPanelTableOptionsContainer(), null);
- }
- return jPanelOptionsTab;
- }
-
- /**
- * This method initializes jPanelOptionsContainer
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelOptionsContainer() {
- if (jPanelOptionsContainer == null) {
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jLabelTagName.setLocation(new java.awt.Point(labelColumn, rowOne));
- jLabelTagName.setText("Tag Name");
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelBuildTargets.setLocation(new java.awt.Point(labelColumn, rowTwo));
- jLabelBuildTargets.setText("Build Targets");
- jLabelToolCmd = new JLabel();
- jLabelToolCmd.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelToolCmd.setLocation(new java.awt.Point(labelColumn, rowThree));
- jLabelToolCmd.setText("Tool Command");
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
- jLabelSupArch.setLocation(new java.awt.Point(labelColumn, rowFour));
- jLabelSupArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jLabelToolChainFamily.setLocation(new java.awt.Point(labelColumn, rowFive));
- jLabelToolChainFamily.setText("Tool Chain Family");
-
- jLabelOptionContents = new JLabel();
- jLabelOptionContents.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
- jLabelOptionContents.setLocation(new java.awt.Point(labelColumn, rowSix));
- jLabelOptionContents.setText("Argument Strings");
-
- jPanelOptionsContainer = new JPanel();
-
- jPanelOptionsContainer.setLayout(null);
-
- jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
- /*
- jPanelOptionsContainer
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-*/
- jPanelOptionsContainer.add(jLabelTagName, null);
- jPanelOptionsContainer.add(getJTextFieldTagName(), null);
-
- jPanelOptionsContainer.add(jLabelBuildTargets, null);
- jPanelOptionsContainer.add(getJTextFieldBuildTargets(), null);
-
- jPanelOptionsContainer.add(jLabelToolChainFamily, null);
- jPanelOptionsContainer.add(getJTextFieldToolChainFamily(), null);
-
- jPanelOptionsContainer.add(jLabelToolCmd, null);
- jPanelOptionsContainer.add(getJTextFieldToolCmd(), null);
-
- jPanelOptionsContainer.add(jLabelSupArch, null);
- jPanelOptionsContainer.add(getArchitectureSelections(), null);
-
- jPanelOptionsContainer.add(jLabelOptionContents, null);
- jPanelOptionsContainer.add(getJTextFieldOptionContents(), null);
-
- jPanelOptionsContainer.add(getJButtonOptionsAdd(), null);
- jPanelOptionsContainer.add(getJButtonOptionsDel(), null);
- }
- return jPanelOptionsContainer;
- }
-
- /**
- * This method initializes jTextFieldOptionTagName Row 1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(fieldColumn, rowOne, fieldWidth, oneRowHeight));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldTagName.setLocation(new java.awt.Point(fieldColumn, rowOne));
- }
- return jTextFieldTagName;
- }
-
- /**
- * This method initializes jTextFieldBuildTargets Row 2
- *
- * @return javax.swing.JTextField jTextFieldBuildTargets
- */
- private JTextField getJTextFieldBuildTargets() {
- if (jTextFieldBuildTargets == null) {
- jTextFieldBuildTargets = new JTextField();
- jTextFieldBuildTargets.setBounds(new java.awt.Rectangle(fieldColumn, rowTwo, fieldWidth, oneRowHeight));
- jTextFieldBuildTargets.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldBuildTargets.setLocation(new java.awt.Point(fieldColumn, rowTwo));
- }
- return jTextFieldBuildTargets;
- }
-
- /**
- * This method initializes jTextFieldToolCmd Row 3
- *
- * This should be a dropdown box of command codes from tools_def.txt
- *
- * @return javax.swing.JTextField jTextFieldToolCmd
- */
- private JTextField getJTextFieldToolCmd() {
- if (jTextFieldToolCmd == null) {
- jTextFieldToolCmd = new JTextField();
- jTextFieldToolCmd.setBounds(new java.awt.Rectangle(fieldColumn, rowThree, fieldWidth, oneRowHeight));
- jTextFieldToolCmd.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldToolCmd.setLocation(new java.awt.Point(fieldColumn, rowThree));
- }
- return jTextFieldToolCmd;
- }
-
- /**
- * This method initializes jArchitectureSelections Row 4
- *
- * @return jArchitectureSelections
- */
- private JPanel getArchitectureSelections() {
- if (jArchitectureSelections == null) {
- jArchitectureSelections = new JPanel();
- jArchitectureSelections.setLayout(null);
- jArchitectureSelections.add(getJCheckBoxIA32(), null);
- jArchitectureSelections.add(getJCheckBoxX64(), null);
- jArchitectureSelections.add(getJCheckBoxIpf(), null);
- jArchitectureSelections.add(getJCheckBoxEBC(), null);
- jArchitectureSelections.add(getJCheckBoxARM(), null);
- jArchitectureSelections.add(getJCheckBoxPPC(), null);
- jArchitectureSelections.setBounds(new java.awt.Rectangle(fieldColumn, rowFour, fieldWidth, oneRowHeight));
- jArchitectureSelections.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jArchitectureSelections.setLocation(new java.awt.Point(fieldColumn, rowFour));
- }
- return jArchitectureSelections;
- }
-
- /**
- * This method initializes jCheckBoxIA32
- *
- * @return javax.swing.JCheckBox jCheckBoxIA32
- */
- private JCheckBox getJCheckBoxIA32() {
- if (jCheckBoxIA32 == null) {
- jCheckBoxIA32 = new JCheckBox();
- jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIA32.setText("IA32");
- }
- return jCheckBoxIA32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox jCheckBoxX64
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox jCheckBoxIpf
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.setText("IPF");
- }
- return jCheckBoxIpf;
- }
-
-
- /**
- * This method initializes jCheckBoxEBC
- *
- * @return javax.swing.JCheckBox jCheckBoxEBC
- */
- private JCheckBox getJCheckBoxEBC() {
- if (jCheckBoxEBC == null) {
- jCheckBoxEBC = new JCheckBox();
- jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEBC.setText("EBC");
- }
- return jCheckBoxEBC;
- }
-
- /**
- * This method initializes jCheckBoxARM
- *
- * @return javax.swing.JCheckBox jCheckBoxARM
- */
- private JCheckBox getJCheckBoxARM() {
- if (jCheckBoxARM == null) {
- jCheckBoxARM = new JCheckBox();
- jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxARM.setText("ARM");
- }
- return jCheckBoxARM;
- }
-
- /**
- * This method initializes jCheckBoxPPC
- *
- * @return javax.swing.JCheckBox jCheckBoxPPC
- */
- private JCheckBox getJCheckBoxPPC() {
- if (jCheckBoxPPC == null) {
- jCheckBoxPPC = new JCheckBox();
- jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPPC.setText("PPC");
- }
- return jCheckBoxPPC;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily Row 5
- *
- * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(fieldColumn, rowFive, fieldWidth, oneRowHeight));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldToolChainFamily.setLocation(new java.awt.Point(fieldColumn, rowFive));
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- * This method initializes jTextFieldOptionContents Row 6
- *
- * This is where we should put the checkbox & entry data for the command arguments
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOptionContents() {
- if (jTextFieldOptionContents == null) {
- jTextFieldOptionContents = new JTextField();
- jTextFieldOptionContents.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldOptionContents.setBounds(fieldColumn, rowSix, fieldWidth, oneRowHeight);
- jTextFieldOptionContents.setLocation(new java.awt.Point(fieldColumn, rowSix));
- }
- return jTextFieldOptionContents;
- }
-
- /**
- * This method initializes jButtonOptionsAdd
- *
- * Add entry from the top screen to the table
- *
- * @return javax.swing.JButton jButtonOptionsAdd
- */
- private JButton getJButtonOptionsAdd() {
- if (jButtonOptionsAdd == null) {
- jButtonOptionsAdd = new JButton();
- jButtonOptionsAdd.setText("Add");
-
- jButtonOptionsAdd.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonOptionsAdd.setBounds(new java.awt.Rectangle(firstButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonOptionsAdd.setLocation(new java.awt.Point(firstButtonLoc, buttonRow));
- jButtonOptionsAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- boolean[] boolArray = { jCheckBoxIA32.isSelected(), jCheckBoxIpf.isSelected(),
- jCheckBoxX64.isSelected(), jCheckBoxEBC.isSelected(),
- jCheckBoxARM.isSelected(), jCheckBoxPPC.isSelected() };
- String s = boolToList(boolArray);
- Object[] o = { jTextFieldBuildTargets.getText(), jTextFieldToolChainFamily.getText(), s,
- jTextFieldToolCmd.getText(), jTextFieldTagName.getText(),
- jTextFieldOptionContents.getText() };
- optionsTableModel.addRow(o);
- docConsole.setSaved(false);
- ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText().trim()),
- jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(),
- jTextFieldToolCmd.getText(), stringToVector(s.trim()),
- jTextFieldOptionContents.getText());
- }
- });
- }
- return jButtonOptionsAdd;
- }
-
- /**
- * This method initializes jButtonOptionsDel
- *
- * Remove a line from the table below
- *
- * @return javax.swing.JButton jButtonOptionsDel
- */
- private JButton getJButtonOptionsDel() {
- if (jButtonOptionsDel == null) {
- jButtonOptionsDel = new JButton();
- jButtonOptionsDel.setText("Delete");
- jButtonOptionsDel.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonOptionsDel.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonOptionsDel.setLocation(new java.awt.Point(next2LastButtonLoc, buttonRow));
- jButtonOptionsDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (selectedRow >= 0) {
- optionsTableModel.removeRow(selectedRow);
- docConsole.setSaved(false);
- ffc.removeBuildOptionsOpt(selectedRow);
- }
- }
- });
- }
- return jButtonOptionsDel;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jScrollPaneOptions, this.getWidth(), intPreferredWidth);
-
- }
- /**
- * This method initializes jScrollPaneOptions
- * Contains the Table and is located below the data entry section
- * @return javax.swing.JScrollPane jScrollPaneOptoins
- */
- private JScrollPane getJScrollPaneOptions() {
- if (jScrollPaneOptions == null) {
- jScrollPaneOptions = new JScrollPane();
- jScrollPaneOptions.setViewportView(getJTableOptions());
- }
- return jScrollPaneOptions;
- }
-
- /**
- * This method initializes jTableOptions
- *
- * @return javax.swing.JTable jTableOptions
- */
- private JTable getJTableOptions() {
- if (jTableOptions == null) {
-
- optionsTableModel = new DefaultTableModel();
- jTableOptions = new JTable(optionsTableModel);
- jTableOptions.setRowHeight(20);
- optionsTableModel.addColumn("Build Targets");
- optionsTableModel.addColumn("Tool Chain Family");
- optionsTableModel.addColumn("Supported Architectures");
- optionsTableModel.addColumn("Tool Command Code");
- optionsTableModel.addColumn("TagName");
- optionsTableModel.addColumn("Arguments");
-
- jTableOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
- jTableOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
- jTableOptions.getColumnModel().getColumn(2).setMinWidth(supportArchWidth);
- jTableOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
- jTableOptions.getColumnModel().getColumn(4).setMinWidth(tagNameWidth);
- jTableOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
-
-// javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
-// JComboBox cb = new JComboBox();
-// cb.addItem("MSFT");
-// cb.addItem("GCC");
-// cb.addItem("CYGWIN");
-// cb.addItem("INTEL");
-// cb.addItem("USER_DEFINED");
-// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance()));
-
- jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance()));
-
- jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- selectedRow = -1;
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableOptions.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String targets = m.getValueAt(row, 0) + "";
- Vector<Object> targetName = new Vector<Object>();
- String[] sArray = targets.split("( )+");
- for (int i = 0; i < sArray.length; ++i) {
- targetName.add(sArray[i]);
- }
- String toolChain = m.getValueAt(row, 1) + "";
- String archs = m.getValueAt(row, 2) + "";
- Vector<Object> supArch = null;
- if (archs.length() > 0) {
- supArch = new Vector<Object>();
- String[] sArray1 = archs.split("( )+");
- for (int i = 0; i < sArray1.length; ++i) {
- supArch.add(sArray1[i]);
- }
- }
-
- String toolCmd = m.getValueAt(row, 3) + "";
- String tagName = m.getValueAt(row, 4) + "";
- String contents = m.getValueAt(row, 5) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents);
- }
- }
- });
- }
- return jTableOptions;
- }
-
- private Vector<Object> stringToVector(String s) {
- String[] sArray = s.split(" ");
- Vector<Object> v = null;
- if (s.length() > 0 && !s.trim().equalsIgnoreCase("")) {
- v = new Vector<Object>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- }
- return v;
- }
-
- private String boolToList(boolean[] bool) {
- String s = " ";
- if (bool[0]) {
- s += "IA32 ";
- }
- if (bool[1]) {
- s += "IPF ";
- }
- if (bool[2]) {
- s += "X64 ";
- }
- if (bool[3]) {
- s += "EBC ";
- }
- if (bool[4]) {
- s += "ARM ";
- }
- if (bool[5]) {
- s += "PPC ";
- }
-
- return s.trim();
- }
-
- private void initOptionTable() {
- if (ffc.getBuildOptionsOptCount() == 0) {
- //ToDo get default options from *.txt file
- return;
- }
- String[][] saa = new String[ffc.getBuildOptionsOptCount()][6];
- ffc.getBuildOptionsOpts(saa);
- for (int i = 0; i < saa.length; ++i) {
- optionsTableModel.addRow(saa[i]);
- }
- }
-
-
- /**
- * Everything below should pertain to the ANT Task Tab
- */
-
- /**
- * This method initializes jButton12
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskFileBrowse() {
- if (jButtonAntTaskFileBrowse == null) {
- jButtonAntTaskFileBrowse = new JButton();
- jButtonAntTaskFileBrowse.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonAntTaskFileBrowse.setText("Browse");
- jButtonAntTaskFileBrowse.addActionListener(new AbstractAction() {
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Workspace.getCurrentWorkspace();
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- int retval = chooser.showOpenDialog(FpdBuildOptions.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "You can only select files in current package!");
- return;
- }
- } else {
- return;
- }
-
- headerDest = theFile.getPath();
- jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/'));
-
- }
-
- });
- }
- return jButtonAntTaskFileBrowse;
- }
-
- /**
- * This method initializes jPanelUserDefCenterN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefCenterN() {
- if (jPanelUserDefCenterN == null) {
- jPanelUserDefCenterN = new JPanel();
- jPanelUserDefCenterN.add(jLabelAntCmdOpts, null);
- jPanelUserDefCenterN.add(getJTextFieldAntCmdOpts(), null);
- jPanelUserDefCenterN.add(getJButtonAntTaskAdd(), null);
- jPanelUserDefCenterN.add(getJButtonAntTaskDel(), null);
- }
- return jPanelUserDefCenterN;
- }
-
- /**
- * This method initializes jPanel8
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDef() {
- if (jPanelUserDef == null) {
- jPanelUserDef = new JPanel();
- jPanelUserDef.setLayout(new BorderLayout());
- jPanelUserDef.add(getJPanelUserDefNorth(), java.awt.BorderLayout.NORTH);
- jPanelUserDef.add(getJPanelUserDefCenter(), java.awt.BorderLayout.CENTER);
-
- }
- return jPanelUserDef;
- }
-
- /**
- * This method initializes jPanel9
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefNorth() {
- if (jPanelUserDefNorth == null) {
- jLabelAntTaskFile = new JLabel();
- jLabelAntTaskFile.setText("ANT Task File");
- jLabelAntTaskFile.setPreferredSize(new java.awt.Dimension(80, 20));
- FlowLayout flowLayout8 = new FlowLayout();
- flowLayout8.setAlignment(java.awt.FlowLayout.CENTER);
- jLabelAntTaskId = new JLabel();
- jLabelAntTaskId.setText("ID");
- jPanelUserDefNorth = new JPanel();
- jPanelUserDefNorth.setLayout(flowLayout8);
- jPanelUserDefNorth.add(jLabelAntTaskFile, null);
- jPanelUserDefNorth.add(getJTextFieldAntTaskFile(), null);
- jPanelUserDefNorth.add(getJButtonAntTaskFileBrowse(), null);
- jPanelUserDefNorth.add(jLabelAntTaskId, null);
- jPanelUserDefNorth.add(getJTextFieldAntTaskId(), null);
- }
- return jPanelUserDefNorth;
- }
-
- /**
- * This method initializes jPanel11
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefCenter() {
- if (jPanelUserDefCenter == null) {
- jLabelAntCmdOpts = new JLabel();
- jLabelAntCmdOpts.setText("ANT Command Options");
- jLabelAntCmdOpts.setPreferredSize(new java.awt.Dimension(131, 20));
- jPanelUserDefCenter = new JPanel();
- jPanelUserDefCenter.setLayout(new BorderLayout());
-
- jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH);
- jPanelUserDefCenter.add(getJScrollPaneAntTasks(), java.awt.BorderLayout.CENTER);
- }
- return jPanelUserDefCenter;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntTaskFile() {
- if (jTextFieldAntTaskFile == null) {
- jTextFieldAntTaskFile = new JTextField();
- jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20));
- }
- return jTextFieldAntTaskFile;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntTaskId() {
- if (jTextFieldAntTaskId == null) {
- jTextFieldAntTaskId = new JTextField();
- jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20));
- }
- return jTextFieldAntTaskId;
- }
-
- /**
- * This method initializes jButton4
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskAdd() {
- if (jButtonAntTaskAdd == null) {
- jButtonAntTaskAdd = new JButton();
- jButtonAntTaskAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonAntTaskAdd.setText("Add");
- jButtonAntTaskAdd.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (!DataValidation.isInt(jTextFieldAntTaskId.getText())
- || jTextFieldAntTaskId.getText().length() != 8) {
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "ID must be an 8-digit integer.");
- return;
- }
- Object[] o = { jTextFieldAntTaskId.getText(), null, null };
- o[1] = jTextFieldAntTaskFile.getText();
- o[2] = jTextFieldAntCmdOpts.getText();
- ffc.genBuildOptionsUserDefAntTask(o[0] + "", o[1] + "", o[2] + "");
- antTaskTableModel.addRow(o);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonAntTaskAdd;
- }
-
- /**
- * This method initializes jButton5
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskDel() {
- if (jButtonAntTaskDel == null) {
- jButtonAntTaskDel = new JButton();
- jButtonAntTaskDel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonAntTaskDel.setText("Delete");
- jButtonAntTaskDel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (selectedRow >= 0) {
- docConsole.setSaved(false);
- antTaskTableModel.removeRow(selectedRow);
- ffc.removeBuildOptionsUserDefAntTask(selectedRow);
- }
- }
- });
- }
- return jButtonAntTaskDel;
- }
-
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntCmdOpts() {
- if (jTextFieldAntCmdOpts == null) {
- jTextFieldAntCmdOpts = new JTextField();
- jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20));
- jTextFieldAntCmdOpts.setEnabled(true);
- }
- return jTextFieldAntCmdOpts;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneAntTasks() {
- if (jScrollPaneAntTasks == null) {
- jScrollPaneAntTasks = new JScrollPane();
- jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400));
- jScrollPaneAntTasks.setViewportView(getJTableAntTasks());
- }
- return jScrollPaneAntTasks;
- }
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableAntTasks() {
- if (jTableAntTasks == null) {
- antTaskTableModel = new DefaultTableModel();
- jTableAntTasks = new JTable(antTaskTableModel);
- jTableAntTasks.setRowHeight(20);
- antTaskTableModel.addColumn("ID");
- antTaskTableModel.addColumn("Filename");
- antTaskTableModel.addColumn("ANT Command Options");
-
- jTableAntTasks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableAntTasks.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- selectedRow = -1;
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableAntTasks.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
- String file = m.getValueAt(row, 1) + "";
- String execOrder = m.getValueAt(row, 2) + "";
- if (id.length() == 0) {
- return;
- }
- if (file.length() == 0 && execOrder.length() == 0) {
- return;
- }
- if (file.length() == 0) {
- file = null;
- }
- if (execOrder.length() == 0) {
- execOrder = null;
- }
- ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder);
-
- }
- }
- });
- }
- return jTableAntTasks;
- }
-
- private void initAntTaskTable() {
- if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) {
- return;
- }
- String[][] saa = new String[ffc.getBuildOptionsUserDefAntTaskCount()][3];
- ffc.getBuildOptionsUserDefAntTasks(saa);
- for (int i = 0; i < saa.length; ++i) {
- antTaskTableModel.addRow(saa[i]);
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java deleted file mode 100644 index c7a455ed91..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java +++ /dev/null @@ -1,774 +0,0 @@ -package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import javax.swing.JCheckBox;
-import javax.swing.JRadioButton;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import java.util.ArrayList;
-
-public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JScrollPane jScrollPaneDynPcd = null;
- private JTable jTableDynPcd = null;
- private DynPcdTableModel modelPcd = null;
- private DynPcdTableModel modelSku = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
- private JPanel jPanelSkuInfo = null;
- private JCheckBox jCheckBoxSkuEnable = null;
- private JPanel jPanelDynPcdValue = null;
- private JRadioButton jRadioButtonHii = null;
- private JRadioButton jRadioButtonVpd = null;
- private JScrollPane jScrollPaneSkuInfo = null;
- private JTable jTableSkuInfo = null;
- private JButton jButtonSkuInfoUpdate = null;
- private JLabel jLabelVarName = null;
- private JTextField jTextFieldVarName = null;
- private JLabel jLabelVarGuid = null;
- private JTextField jTextFieldVarGuid = null;
- private JLabel jLabelPad = null;
- private JLabel jLabelVarOffset = null;
- private JTextField jTextFieldVarOffset = null;
- private JLabel jLabelHiiDefaultValue = null;
- private JTextField jTextFieldHiiDefaultValue = null;
- private JTextField jTextFieldVpdOffset = null;
- private JLabel jLabelVpdOffset = null;
- private JTextField jTextFieldDefaultValue = null;
- private JRadioButton jRadioButtonDefaultValue = null;
- private ButtonGroup bg = new ButtonGroup();
- private JLabel jLabelPadd = null;
- private JLabel jLabelPad1 = null;
- private JScrollPane jScrollPane = null;
- /**
- * This is the default constructor
- */
- public FpdDynamicPcdBuildDefinitions() {
- super();
- initialize();
- }
-
- public FpdDynamicPcdBuildDefinitions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
- this();
- init(fpd);
- }
-
- public FpdDynamicPcdBuildDefinitions(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- public void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- if (ffc == null) {
- ffc = new FpdFileContents(fpd);
- ffc.initDynPcdMap();
- }
- String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
- ffc.getDynamicPcdBuildData(saa);
- for (int i = 0; i < saa.length; ++i) {
- modelPcd.addRow(saa[i]);
- }
-
- saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
- ffc.getPlatformDefsSkuInfos(saa);
- for (int i = 0; i < saa.length; ++i) {
- modelSku.addRow(saa[i]);
- }
-
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(661, 558);
- this.setTitle("Dynamic PCD Build Definitions");
- this.setContentPane(getJContentPane());
- this.setVisible(true);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJScrollPaneDynPcd(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJPanelSkuInfo(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneDynPcd() {
- if (jScrollPaneDynPcd == null) {
- jScrollPaneDynPcd = new JScrollPane();
- jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,250));
- jScrollPaneDynPcd.setViewportView(getJTableDynPcd());
- }
- return jScrollPaneDynPcd;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableDynPcd() {
- if (jTableDynPcd == null) {
- modelPcd = new DynPcdTableModel();
- modelPcd.addColumn("CName");
- modelPcd.addColumn("Token");
- modelPcd.addColumn("TokenSpaceGuid");
- modelPcd.addColumn("MaxDatumSize");
- modelPcd.addColumn("DatumType");
- jTableDynPcd = new JTable(modelPcd);
- jTableDynPcd.setRowHeight(20);
- TableColumn tokenColumn = jTableDynPcd.getColumnModel().getColumn(1);
- jTableDynPcd.removeColumn(tokenColumn);
- jTableDynPcd.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableDynPcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableDynPcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- jTextFieldDefaultValue.setText("");
- jTextFieldVpdOffset.setText("");
- jTextFieldVarName.setText("");
- jTextFieldVarGuid.setText("");
- jTextFieldVarOffset.setText("");
- jTextFieldHiiDefaultValue.setText("");
- displayDetails(selectedRow);
- }
- }
- });
- }
- return jTableDynPcd;
- }
- //
- // should display default sku info here, as no selection event of table1 will be triggered when change selection of rows in table.
- //
- private void displayDetails(int i) {
- int defaultSkuRow = getDefaultSkuInfoRow();
- jTableSkuInfo.changeSelection(defaultSkuRow, 0, false, false);
-
- int skuCount = ffc.getDynamicPcdSkuInfoCount(i);
- String defaultVal = ffc.getDynamicPcdBuildDataValue(i);
- if (defaultVal != null) {
- jRadioButtonDefaultValue.setSelected(true);
- jTextFieldDefaultValue.setText(defaultVal);
- if ( skuCount == 1) {
- jCheckBoxSkuEnable.setSelected(false);
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
-
- else if (ffc.getDynamicPcdBuildDataVpdOffset(i) != null) {
- jRadioButtonVpd.setSelected(true);
- jTextFieldVpdOffset.setText(ffc.getDynamicPcdBuildDataVpdOffset(i));
- if (skuCount ==1) {
- jCheckBoxSkuEnable.setSelected(false);
-
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
- else {
- jRadioButtonHii.setSelected(true);
- String[][] saa = new String[ffc.getDynamicPcdSkuInfoCount(i)][7];
- ffc.getDynamicPcdSkuInfos(i, saa);
-
- String varDisplayName = Tools.convertUnicodeHexStringToString(saa[0][1]);
- jTextFieldVarName.setText(varDisplayName);
-
- jTextFieldVarGuid.setText(saa[0][2]);
- jTextFieldVarOffset.setText(saa[0][3]);
- jTextFieldHiiDefaultValue.setText(saa[0][4]);
- if (skuCount ==1) {
- jCheckBoxSkuEnable.setSelected(false);
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
-
- }
-
- private void displaySkuInfoDetails(String id) {
- int pcdSelected = jTableDynPcd.getSelectedRow();
- if (pcdSelected < 0) {
- return;
- }
-
- int skuInfoCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);
- String[][] saa = new String[skuInfoCount][7];
- ffc.getDynamicPcdSkuInfos(pcdSelected, saa);
- int i = 0;
- while (i < skuInfoCount) {
- if (id.equals(saa[i][0])) {
- if (saa[i][5] != null){
- jRadioButtonVpd.setSelected(true);
- jTextFieldVpdOffset.setText(saa[i][5]);
- }
-
- else if (saa[i][1] != null) {
- jRadioButtonHii.setSelected(true);
- String varDisplayName = Tools.convertUnicodeHexStringToString(saa[i][1]);
- jTextFieldVarName.setText(varDisplayName);
- jTextFieldVarGuid.setText(saa[i][2]);
- jTextFieldVarOffset.setText(saa[i][3]);
- jTextFieldHiiDefaultValue.setText(saa[i][4]);
- }
-
- else{
- jRadioButtonDefaultValue.setSelected(true);
- jTextFieldDefaultValue.setText(saa[i][6]);
- }
- return;
- }
- ++i;
- }
- }
-
- private int getDefaultSkuInfoRow () {
- for (int i = 0; i < modelSku.getRowCount(); ++i) {
- if (modelSku.getValueAt(i, 0).equals("0")) {
- return i;
- }
- }
- return 0;
- }
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSkuInfo() {
- if (jPanelSkuInfo == null) {
- jPanelSkuInfo = new JPanel();
- jPanelSkuInfo.setLayout(new BorderLayout());
- jPanelSkuInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
- jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(600,120));
-
-// jPanelSkuInfo.add(getJPanelSkuInfoN(), java.awt.BorderLayout.NORTH);
- jPanelSkuInfo.add(getJScrollPane(), java.awt.BorderLayout.NORTH);
- jPanelSkuInfo.add(getJScrollPaneSkuInfo(), java.awt.BorderLayout.CENTER);
-
-
-// jPanelSkuInfo.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH);
- }
- return jPanelSkuInfo;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxSkuEnable() {
- if (jCheckBoxSkuEnable == null) {
- jCheckBoxSkuEnable = new JCheckBox();
- jCheckBoxSkuEnable.setText("SKU Enable");
- jCheckBoxSkuEnable.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (!jCheckBoxSkuEnable.isSelected()) {
- int defaultSkuRow = getDefaultSkuInfoRow();
- jTableSkuInfo.changeSelection(defaultSkuRow, 0, false, false);
- }
- jTableSkuInfo.setEnabled(jCheckBoxSkuEnable.isSelected());
- }
- });
- }
- return jCheckBoxSkuEnable;
- }
-
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelDynPcdValue() {
- if (jPanelDynPcdValue == null) {
- jLabelPad1 = new JLabel();
- jLabelPad1.setText(" ");
- GridLayout gridLayout = new GridLayout();
- gridLayout.setColumns(5);
- gridLayout.setRows(4);
- gridLayout.setHgap(20);
- gridLayout.setVgap(20);
-
- jLabelVpdOffset = new JLabel();
- jLabelVpdOffset.setPreferredSize(new java.awt.Dimension(80,20));
- jLabelVpdOffset.setText("VPD Offset");
- jLabelHiiDefaultValue = new JLabel();
- jLabelHiiDefaultValue.setPreferredSize(new java.awt.Dimension(100,20));
- jLabelHiiDefaultValue.setText("HII Default Value");
- jLabelVarOffset = new JLabel();
- jLabelVarOffset.setText("Variable Offset");
- jLabelVarOffset.setPreferredSize(new java.awt.Dimension(90,20));
- jLabelPad = new JLabel();
- jLabelPad.setText(" ");
- jLabelVarGuid = new JLabel();
- jLabelVarGuid.setText("Variable GUID");
- jLabelVarGuid.setPreferredSize(new java.awt.Dimension(100,20));
- jLabelVarName = new JLabel();
- jLabelVarName.setText("Variable Name");
- jLabelVarName.setToolTipText("");
- jLabelVarName.setPreferredSize(new java.awt.Dimension(90,20));
- jPanelDynPcdValue = new JPanel();
- jPanelDynPcdValue.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
- jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(1000,150));
- jPanelDynPcdValue.setLayout(gridLayout);
- jPanelDynPcdValue.add(getJRadioButtonHii(), null);
- jPanelDynPcdValue.add(jLabelVarName, null);
- jPanelDynPcdValue.add(getJTextFieldVarName(), null);
- jPanelDynPcdValue.add(jLabelVarGuid, null);
- jPanelDynPcdValue.add(getJTextFieldVarGuid(), null);
- jPanelDynPcdValue.add(jLabelPad, null);
- jPanelDynPcdValue.add(jLabelVarOffset, null);
- jPanelDynPcdValue.add(getJTextFieldVarOffset(), null);
- jPanelDynPcdValue.add(jLabelHiiDefaultValue, null);
- jPanelDynPcdValue.add(getJTextFieldHiiDefaultValue(), null);
- jPanelDynPcdValue.add(getJRadioButtonVpd(), null);
- jPanelDynPcdValue.add(jLabelVpdOffset, null);
- jLabelPadd = new JLabel();
- jLabelPadd.setText(" ");
- jPanelDynPcdValue.add(getJTextFieldVpdOffset(), null);
- jLabelVarName.setEnabled(false);
- jLabelVarGuid.setEnabled(false);
- jLabelHiiDefaultValue.setEnabled(false);
- jLabelVarOffset.setEnabled(false);
- jLabelVpdOffset.setEnabled(false);
- jPanelDynPcdValue.add(jLabelPadd, null);
- jPanelDynPcdValue.add(jLabelPad1, null);
- jPanelDynPcdValue.add(getJRadioButtonDefaultValue(), null);
- jPanelDynPcdValue.add(getJTextFieldDefaultValue(), null);
- jPanelDynPcdValue.add(getJCheckBoxSkuEnable(), null);
- jPanelDynPcdValue.add(getJButtonSkuInfoUpdate(), null);
- bg.add(jRadioButtonHii);
- bg.add(jRadioButtonVpd);
- }
-
- return jPanelDynPcdValue;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonHii() {
- if (jRadioButtonHii == null) {
- jRadioButtonHii = new JRadioButton();
- jRadioButtonHii.setText("HII Enable");
- jRadioButtonHii.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- boolean selected = jRadioButtonHii.isSelected();
- jLabelVarName.setEnabled(selected);
- jLabelVarGuid.setEnabled(selected);
- jLabelPad.setEnabled(selected);
- jLabelVarOffset.setEnabled(selected);
- jLabelHiiDefaultValue.setEnabled(selected);
- jTextFieldVarName.setEnabled(selected);
- jTextFieldVarGuid.setEnabled(selected);
- jTextFieldVarOffset.setEnabled(selected);
- jTextFieldHiiDefaultValue.setEnabled(selected);
- }
- });
- }
- return jRadioButtonHii;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonVpd() {
- if (jRadioButtonVpd == null) {
- jRadioButtonVpd = new JRadioButton();
- jRadioButtonVpd.setText("VPD Enable");
- jRadioButtonVpd.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- boolean selected = jRadioButtonVpd.isSelected();
- jTextFieldVpdOffset.setEnabled(selected);
- jLabelVpdOffset.setEnabled(selected);
- }
- });
- }
- return jRadioButtonVpd;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSkuInfo() {
- if (jScrollPaneSkuInfo == null) {
- jScrollPaneSkuInfo = new JScrollPane();
- jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(300,50));
- jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
- }
- return jScrollPaneSkuInfo;
- }
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSkuInfo() {
- if (jTableSkuInfo == null) {
- modelSku = new DynPcdTableModel();
- jTableSkuInfo = new JTable(modelSku);
- modelSku.addColumn("SKU ID");
- modelSku.addColumn("SKU Name");
- jTableSkuInfo.setEnabled(false);
- jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableSkuInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (jTableDynPcd.getSelectedRow() < 0) {
- return;
- }
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- jTextFieldDefaultValue.setText("");
- jTextFieldVpdOffset.setText("");
- jTextFieldVarName.setText("");
- jTextFieldVarGuid.setText("");
- jTextFieldVarOffset.setText("");
- jTextFieldHiiDefaultValue.setText("");
- int selected = lsm.getMinSelectionIndex();
- String skuId = modelSku.getValueAt(selected, 0)+"";
- displaySkuInfoDetails(skuId);
- }
- }
- });
- }
- return jTableSkuInfo;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuInfoUpdate() {
- if (jButtonSkuInfoUpdate == null) {
- jButtonSkuInfoUpdate = new JButton();
- jButtonSkuInfoUpdate.setPreferredSize(new java.awt.Dimension(180,20));
- jButtonSkuInfoUpdate.setText("Update SKU Value");
- FontMetrics fm = jButtonSkuInfoUpdate.getFontMetrics(jButtonSkuInfoUpdate.getFont());
- jButtonSkuInfoUpdate.setPreferredSize(new Dimension (fm.stringWidth(jButtonSkuInfoUpdate.getText()) + 40, 20));
- jButtonSkuInfoUpdate.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int pcdSelected = jTableDynPcd.getSelectedRow();
- if (pcdSelected < 0) {
- return;
- }
- docConsole.setSaved(false);
- updateSkuInfo(pcdSelected);
-
- }
- });
- }
- return jButtonSkuInfoUpdate;
- }
-
- private void updateSkuInfo (int pcdSelected) {
- int skuCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);
- String cName = modelPcd.getValueAt(pcdSelected, 0)+"";
- String tsGuid = modelPcd.getValueAt(pcdSelected, 2)+"";
-
- String varName = null;
- String varGuid = null;
- String varOffset = null;
- String hiiDefault = null;
- String value = null;
- String vpdOffset = null;
- if (jRadioButtonHii.isSelected()) {
- varName = Tools.convertStringToUnicodeHexString(jTextFieldVarName.getText());
- if (varName.length() == 0) {
- JOptionPane.showMessageDialog(this, "Variable Name is Empty.");
- return;
- }
- varGuid = jTextFieldVarGuid.getText();
- if (varGuid.length() == 0) {
- JOptionPane.showMessageDialog(this, "Variable GUID is Empty.");
- return;
- }
- varOffset = jTextFieldVarOffset.getText();
- if (!DataValidation.isHex64BitDataType(varOffset)) {
- JOptionPane.showMessageDialog(this, "Variable Offset is NOT Hex64BitDataType.");
- return;
- }
- hiiDefault = jTextFieldHiiDefaultValue.getText();
- if (!DataValidation.isDefaultValueType(hiiDefault)) {
- JOptionPane.showMessageDialog(this, "Default Value is NOT DefaultValueType.");
- return;
- }
- }
- if (jRadioButtonVpd.isSelected()) {
- vpdOffset = jTextFieldVpdOffset.getText();
- if (!DataValidation.isHex64BitDataType(vpdOffset)) {
- JOptionPane.showMessageDialog(this, "VPD Offset is NOT Hex64BitDataType.");
- return;
- }
- }
- if (jRadioButtonDefaultValue.isSelected()) {
- value = jTextFieldDefaultValue.getText();
- if (!DataValidation.isDefaultValueType(value)) {
- JOptionPane.showMessageDialog(this, "Value is NOT DefaultValueType.");
- return;
- }
- }
- //
- // SKU disabled. only modify data for default SKU.
- //
- if (!jCheckBoxSkuEnable.isSelected()) {
- if (true) {
- ffc.removeDynamicPcdBuildDataSkuInfo(pcdSelected);
- if (jRadioButtonHii.isSelected()) {
- ffc.genDynamicPcdBuildDataSkuInfo("0", varName, varGuid, varOffset, hiiDefault, null, null, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, hiiDefault);
- }
- }
- else if (jRadioButtonVpd.isSelected()){
- ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, vpdOffset, null, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, vpdOffset);
- }
- }
- else{
- ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, null, value, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, value);
- }
- }
- }
- }
- //
- // SKU Enabled, need add data to all SKUs.
- //
- if (jCheckBoxSkuEnable.isSelected()) {
- if (skuCount == 1) {
-
- for (int i = 1; i < jTableSkuInfo.getRowCount(); ++i) {
- ffc.genDynamicPcdBuildDataSkuInfo(modelSku.getValueAt(i, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);
- }
- }
- else {
- int row = jTableSkuInfo.getSelectedRow();
- if (row < 0) {
- return;
- }
- ffc.updateDynamicPcdBuildDataSkuInfo(modelSku.getValueAt(row, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);
- }
- }
- }
-
- private String moduleInfo (String pcdInfo) {
-
- return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
- }
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarName() {
- if (jTextFieldVarName == null) {
- jTextFieldVarName = new JTextField();
- jTextFieldVarName.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarName.setEnabled(false);
- }
- return jTextFieldVarName;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarGuid() {
- if (jTextFieldVarGuid == null) {
- jTextFieldVarGuid = new JTextField();
- jTextFieldVarGuid.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarGuid.setEnabled(false);
- }
- return jTextFieldVarGuid;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarOffset() {
- if (jTextFieldVarOffset == null) {
- jTextFieldVarOffset = new JTextField();
- jTextFieldVarOffset.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarOffset.setEnabled(false);
- }
- return jTextFieldVarOffset;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHiiDefaultValue() {
- if (jTextFieldHiiDefaultValue == null) {
- jTextFieldHiiDefaultValue = new JTextField();
- jTextFieldHiiDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldHiiDefaultValue.setEnabled(false);
- }
- return jTextFieldHiiDefaultValue;
- }
-
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVpdOffset() {
- if (jTextFieldVpdOffset == null) {
- jTextFieldVpdOffset = new JTextField();
- jTextFieldVpdOffset.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVpdOffset.setEnabled(false);
- }
- return jTextFieldVpdOffset;
- }
-
- /**
- * This method initializes jTextField5
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jRadioButton2
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonDefaultValue() {
- if (jRadioButtonDefaultValue == null) {
- jRadioButtonDefaultValue = new JRadioButton();
- jRadioButtonDefaultValue.setText("Default PCD Value");
- jRadioButtonDefaultValue.setSelected(true);
- jRadioButtonDefaultValue.setPreferredSize(new java.awt.Dimension(175,20));
- jRadioButtonDefaultValue.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- jTextFieldDefaultValue.setEnabled(jRadioButtonDefaultValue.isSelected());
- }
- });
- bg.add(jRadioButtonDefaultValue);
- }
- return jRadioButtonDefaultValue;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(1003,180));
- jScrollPane.setViewportView(getJPanelDynPcdValue());
- }
- return jScrollPane;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class DynPcdTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
-
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java deleted file mode 100644 index c5f854a7e8..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ /dev/null @@ -1,3818 +0,0 @@ -/** @file
- Java class FpdFileContents is used to parse fpd xml file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.AntTaskDocument;
-import org.tianocore.BuildOptionsDocument;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument;
-import org.tianocore.EfiSectionType;
-import org.tianocore.FlashDefinitionFileDocument;
-import org.tianocore.FlashDocument;
-import org.tianocore.FrameworkModulesDocument;
-import org.tianocore.IntermediateOutputType;
-import org.tianocore.LibrariesDocument;
-import org.tianocore.ModuleSADocument;
-import org.tianocore.ModuleSaBuildOptionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.OptionDocument;
-import org.tianocore.OptionsDocument;
-import org.tianocore.PcdBuildDefinitionDocument;
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.PcdDataTypes;
-import org.tianocore.PcdDeclarationsDocument;
-import org.tianocore.PcdItemTypes;
-import org.tianocore.PlatformDefinitionsDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FvImageTypes;
-import org.tianocore.FvImagesDocument;
-import org.tianocore.LicenseDocument;
-import org.tianocore.PlatformHeaderDocument;
-import org.tianocore.SkuInfoDocument;
-import org.tianocore.UserDefinedAntTasksDocument;
-import org.tianocore.UserExtensionsDocument;
-import org.tianocore.LibrariesDocument.Libraries.Instance;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-/**
- This class processes fpd file contents such as add remove xml elements.
- @since PackageEditor 1.0
-**/
-public class FpdFileContents {
-
- static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";
- static final String regExpNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";
-
- private PlatformSurfaceAreaDocument fpdd = null;
-
- private PlatformSurfaceAreaDocument.PlatformSurfaceArea fpdRoot = null;
-
- private PlatformHeaderDocument.PlatformHeader fpdHdr = null;
-
- private PlatformDefinitionsDocument.PlatformDefinitions fpdPlatformDefs = null;
-
- private FlashDocument.Flash fpdFlash = null;
-
- private BuildOptionsDocument.BuildOptions fpdBuildOpts = null;
-
- private FrameworkModulesDocument.FrameworkModules fpdFrameworkModules = null;
-
- private DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions fpdDynPcdBuildDefs = null;
-
- private HashMap<String, ArrayList<String>> dynPcdMap = null;
-
- private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();
-
- private String itemType (String pcdInfo) {
-
- return pcdInfo.substring(pcdInfo.lastIndexOf(" ") + 1);
- }
-
- /**
- * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.
- */
- public void initDynPcdMap() {
- if (dynPcdMap == null) {
- dynPcdMap = new HashMap<String, ArrayList<String>>();
- List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();
- if (l == null) {
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
- ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- if (moduleSa.getPcdBuildDefinition() == null || moduleSa.getPcdBuildDefinition().getPcdDataList() == null) {
- continue;
- }
- String ModuleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion() +
- " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = moduleSa.getPcdBuildDefinition().getPcdDataList();
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lpi = lp.listIterator();
- while (lpi.hasNext()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = lpi.next();
- String pcdKey = pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName();
- if (dynPcdMap.get(pcdKey) == null) {
- ArrayList<String> al = new ArrayList<String>();
- al.add(ModuleInfo + " " + pcdData.getItemType().toString());
- dynPcdMap.put(pcdKey, al);
- }
- else{
- dynPcdMap.get(pcdKey).add(ModuleInfo + " " + pcdData.getItemType().toString());
- }
- }
- }
- }
- }
-
- public ArrayList<String> getDynPcdMapValue(String key) {
- return dynPcdMap.get(key);
- }
- /**
- Constructor to create a new spd file
- **/
- public FpdFileContents() {
-
- fpdd = PlatformSurfaceAreaDocument.Factory.newInstance();
- fpdRoot = fpdd.addNewPlatformSurfaceArea();
-
- }
-
- /**
- Constructor for existing document object
- @param psa
- **/
- public FpdFileContents(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- fpdRoot = fpd;
- fpdHdr = fpdRoot.getPlatformHeader();
- fpdPlatformDefs = fpdRoot.getPlatformDefinitions();
- fpdBuildOpts = fpdRoot.getBuildOptions();
- fpdFrameworkModules = fpdRoot.getFrameworkModules();
- fpdDynPcdBuildDefs = fpdRoot.getDynamicPcdBuildDefinitions();
- fpdFlash = fpdRoot.getFlash();
- }
-
- /**
- Constructor based on an existing spd file
-
- @param f Existing spd file
- **/
- public FpdFileContents(File f) {
- try {
- fpdd = PlatformSurfaceAreaDocument.Factory.parse(f);
- fpdRoot = fpdd.getPlatformSurfaceArea();
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
-
- public DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions getfpdDynPcdBuildDefs() {
- if (fpdDynPcdBuildDefs == null){
- fpdDynPcdBuildDefs = fpdRoot.addNewDynamicPcdBuildDefinitions();
- }
- return fpdDynPcdBuildDefs;
- }
-
- public FrameworkModulesDocument.FrameworkModules getfpdFrameworkModules() {
- if (fpdFrameworkModules == null){
- fpdFrameworkModules = fpdRoot.addNewFrameworkModules();
- }
- return fpdFrameworkModules;
- }
-
- public void getFrameworkModuleSAByFvBinding (String fvName, Vector<String[]> vGuid) {
- if (getFrameworkModulesCount() == 0){
- return;
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- if (moduleSa.getModuleSaBuildOptions() == null) {
- continue;
- }
- String fvBinding = moduleSa.getModuleSaBuildOptions().getFvBinding();
- if (fvBinding == null) {
- continue;
- }
-
- String[] fvNames = fvBinding.split(" ");
- for (int i = 0; i < fvNames.length; ++i) {
- //
- // BugBug : underscore "_" should not be replaced!!!
- // But Fv name FVMAIN from fdf file not consist with FV_MAIN in fpd file.
- //
- if (fvNames[i].equals(fvName) || fvNames[i].replaceAll("_", "").equals(fvName)) {
- String[] sa = new String[] {moduleSa.getModuleGuid(), moduleSa.getModuleVersion(),
- moduleSa.getPackageGuid(), moduleSa.getPackageVersion(),
- listToString(moduleSa.getSupArchList())};
- vGuid.add(sa);
- break;
- }
- }
- }
- }
-
- public int getFrameworkModulesCount() {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return 0;
- }
- return getfpdFrameworkModules().getModuleSAList().size();
- }
-
- public void getFrameworkModulesInfo(String[][] saa) {
- if (getFrameworkModulesCount() == 0){
- return;
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- int i = 0;
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- saa[i][0] = moduleSa.getModuleGuid();
- saa[i][1] = moduleSa.getModuleVersion();
-
- saa[i][2] = moduleSa.getPackageGuid();
- saa[i][3] = moduleSa.getPackageVersion();
- saa[i][4] = listToString(moduleSa.getSupArchList());
- ++i;
- }
- }
-
- public void getFrameworkModuleInfo(int i, String[] sa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(i);
- if (msa == null) {
- return;
- }
- sa[0] = msa.getModuleGuid();
- sa[1] = msa.getModuleVersion();
- sa[2] = msa.getPackageGuid();
- sa[3] = msa.getPackageVersion();
- sa[4] = listToString(msa.getSupArchList());
- }
-
- public ModuleSADocument.ModuleSA getModuleSA(String key) {
-
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return null;
- }
- String[] s = key.split(" ");
- String archsInKey = "";
- if (s.length > 4) {
- for (int i = 4; i < s.length; ++i) {
- archsInKey += s[i];
- archsInKey += " ";
- }
- archsInKey = archsInKey.trim();
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- if (moduleSa.getModuleGuid().equalsIgnoreCase(s[0]) && moduleSa.getPackageGuid().equalsIgnoreCase(s[2])) {
- if (moduleSa.getModuleVersion() != null) {
- if (!moduleSa.getModuleVersion().equals(s[1])) {
- continue;
- }
- }
- if (moduleSa.getPackageVersion() != null) {
- if (!moduleSa.getPackageVersion().equals(s[3])) {
- continue;
- }
- }
- //ToDo add arch check .
- if (moduleSa.getSupArchList() != null) {
- if (listToString(moduleSa.getSupArchList()).equals(archsInKey)) {
- return moduleSa;
- }
- }
- else {
- if (archsInKey.length() == 0) {
- return moduleSa;
- }
- }
- }
- }
- return null;
- }
-
- private ModuleSADocument.ModuleSA getModuleSA(int i) {
- ModuleSADocument.ModuleSA moduleSa = null;
- if (fpdRoot.getFrameworkModules() == null) {
- return null;
- }
- XmlCursor cursor = fpdRoot.getFrameworkModules().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();
- }
- cursor.dispose();
- return moduleSa;
- }
-
- public void removeModuleSA(int i) {
- XmlObject o = fpdRoot.getFrameworkModules();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- //
- // remove pcd from dynPcdMap, if DynamicPcdBuildData exists, remove them too.
- //
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();
- String moduleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() + " " +
- moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- PcdBuildDefinitionDocument.PcdBuildDefinition pcdBuildDef = moduleSa.getPcdBuildDefinition();
- if (pcdBuildDef != null && pcdBuildDef.getPcdDataList() != null) {
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> li = pcdBuildDef.getPcdDataList().listIterator();
- while(li.hasNext()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);
- }
- }
-
- cursor.push();
- while (cursor.hasPrevToken()) {
- cursor.toPrevToken();
- if (!cursor.isText()) {
- break;
- }
- if (cursor.getObject() == null) {
- break;
- }
- String s = cursor.getTextValue();
- if (s.matches(regExpNewLineAndSpaces)) {
- continue;
- }
- }
-
- if (cursor.isComment()) {
- cursor.removeXml();
- }
-
- cursor.pop();
- cursor.removeXml();
- if (getFrameworkModulesCount() == 0) {
- cursor.dispose();
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
- }
- cursor.dispose();
- }
-
- public boolean adjustPcd (String seqModuleSa, Vector<String> vExceptions) throws Exception {
- boolean dataModified = false;
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);
- int pcdCount = getPcdDataCount(seqModuleSa);
- String[][] saaModuleSaPcd = new String[pcdCount][7];
- getPcdData(seqModuleSa, saaModuleSaPcd);
- String mg = moduleSa.getModuleGuid().toLowerCase();
- String mv = moduleSa.getModuleVersion();
- String pg = moduleSa.getPackageGuid().toLowerCase();
- String pv = moduleSa.getPackageVersion();
- String arch = listToString(moduleSa.getSupArchList());
- //
- // delete pcd in ModuleSA but not in MSA files any longer.
- //
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- int libCount = getLibraryInstancesCount(moduleKey);
- String[][] saaLib = new String[libCount][5];
- getLibraryInstances(moduleKey, saaLib);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- if (mi == null) {
- vExceptions.add("Module " + mg + " does NOT exist in workspace.");
- throw new Exception ("Module does NOT exist in workspace.");
- }
- Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
- //
- // create vector for module & library instance MIs.
- //
- vMi.add(mi);
- for (int j = 0; j < saaLib.length; ++j) {
- String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
- if (libMi != null) {
- vMi.add(libMi);
- }
- }
-
- nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {
-
- for (int j = 0; j < vMi.size(); ++j) {
- ModuleIdentification nextMi = vMi.get(j);
- if (nextMi == null) {
- continue;
- }
- if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], arch, nextMi)) {
- continue nextPcd;
- }
- }
- removePcdData(seqModuleSa, saaModuleSaPcd[i][0], saaModuleSaPcd[i][1]);
- dataModified = true;
- }
- //
- // add new Pcd from MSA file to ModuleSA.
- //
- for (int i = 0; i < vMi.size(); ++i) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(vMi
- .get(i));
- if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
- continue;
- }
- ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();
- msaPcdIter:while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- ArrayList<String> al = getDynPcdMapValue(msaPcd.getCName() + " " + msaPcd.getTokenSpaceGuidCName());
- if (al != null) {
- for (int j = 0; j < al.size(); ++j) {
- if (al.get(j).startsWith(moduleKey)) {
- continue msaPcdIter;
- }
- }
- }
- // Check sup arch conformance for the new PCD
- if (msaPcd.getSupArchList() != null) {
- String newPcdArch = msaPcd.getSupArchList().toString();
- if (!newPcdArch.toLowerCase().contains(arch.toLowerCase())) {
- continue;
- }
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null) {
- //
- // ToDo Error
- //
- String errorMessage = "No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "
- + mi.getName();
- if (i != 0) {
- errorMessage += " Library Instance " + vMi.get(i).getName();
- }
- vExceptions.add(errorMessage);
- throw new PcdDeclNotFound(errorMessage);
- }
- //
- // AddItem to ModuleSA PcdBuildDefinitions
- //
- String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue()
- : msaPcd.getDefaultValue();
-
- genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(),
- msaPcd.getPcdItemType().toString(), spdPcd.getDatumType() + "", defaultVal, moduleSa, spdPcd);
- dataModified = true;
- }
-
- }
-
- return dataModified;
- }
-
- private synchronized void maintainDynPcdMap(String pcdKey, String moduleInfo) {
-
- ArrayList<String> al = dynPcdMap.get(pcdKey);
- if (al == null) {
- return;
- }
- String[] s = moduleInfo.split(" ");
- for(int i = 0; i < al.size(); ++i){
- String consumer = al.get(i);
- if (consumer.contains(s[0].toLowerCase()) && consumer.contains(s[2].toLowerCase())){
- String[] consumerPart = consumer.split(" ");
- if (!consumerPart[4].equals(s[4])) {
- continue;
- }
- al.remove(consumer);
- break;
- }
- }
-
- if (al.size() == 0) {
- defaultPcdValue.remove(pcdKey);
- dynPcdMap.remove(pcdKey);
- String[] s1 = pcdKey.split(" ");
- removeDynamicPcdBuildData(s1[0], s1[1]);
- }
-
- }
- //
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
- //
- public int getPcdDataCount (String key){
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
-
- if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
- return 0;
- }
- return msa.getPcdBuildDefinition().getPcdDataList().size();
-
- }
-
- public void getPcdData (String key, String[][] saa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
-
- if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
- return;
- }
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData>li = msa.getPcdBuildDefinition().getPcdDataList().listIterator();
- for (int k = 0; k < saa.length; ++k) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
- saa[k][0] = pcdData.getCName();
- saa[k][1] = pcdData.getTokenSpaceGuidCName();
- saa[k][2] = pcdData.getItemType()+"";
- saa[k][3] = pcdData.getToken().toString();
- saa[k][4] = pcdData.getMaxDatumSize()+"";
- saa[k][5] = pcdData.getDatumType()+"";
- saa[k][6] = pcdData.getValue();
-
- }
- }
-
- public void removePcdData (String key, String cName, String tsGuid) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);
- if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){
- return;
- }
-
- String mg = moduleSa.getModuleGuid();
- String mv = moduleSa.getModuleVersion();
- String pg = moduleSa.getPackageGuid();
- String pv = moduleSa.getPackageVersion();
- String arch = listToString(moduleSa.getSupArchList());
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
-
- XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()){
-
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
- maintainDynPcdMap(cName + " " + tsGuid, moduleKey);
- if (getPcdDataCount(key) == 1) {
- cursor.toParent();
- }
- cursor.removeXml();
- break;
- }
- }
- while(cursor.toNextSibling());
-
- }
- cursor.dispose();
- }
-
- public void updatePcdData (String key, String cName, String tsGuid, String itemType, String maxSize, String value){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);
- if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){
- return;
- }
-
- XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()){
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
- //
- // change item type while not updating dynPcdData????
- //
- if (itemType != null) {
- pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
- }
-
- if(pcdData.getDatumType().equals("VOID*") && maxSize != null) {
- pcdData.setMaxDatumSize(new Integer(maxSize));
- }
- //
- // if value input is null, keep old value untouched.
- //
- if (value != null) {
- pcdData.setValue(value);
- defaultPcdValue.put(cName + " " + tsGuid, value);
- }
-
- break;
- }
- }
- while(cursor.toNextSibling());
- }
- cursor.dispose();
- }
-
- /**Get original Pcd info from MSA & SPD files.
- * @param mi ModuleIdentification from which MSA & SPD come
- * @param cName PCD cName
- * @param sa Results: HelpText, Original item type.
- * @return
- */
- public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa, Vector<String> validPcdTypes) throws Exception{
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null) {
- return false;
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // First look through MSA pcd entries.
- //
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- if (!msaPcd.getCName().equals(cName)) {
- continue;
- }
- if (!msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {
- continue;
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null || spdPcd.getValidUsage() == null) {
- //
- // ToDo Error
- //
- throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());
- }
- //
- // Get Pcd help text and original item type.
- //
- sa[0] = spdPcd.getHelpText() + msaPcd.getHelpText();
- sa[1] = msaPcd.getPcdItemType() + "";
- sa[2] = msa.getModuleDefinitions().getBinaryModule() + "";
- ListIterator iter = spdPcd.getValidUsage().listIterator();
- while (iter.hasNext()) {
- String usage = iter.next().toString();
- validPcdTypes.add(usage);
- }
- return true;
- }
-
- return false;
- }
-
- private boolean multiSourcePcd (String cName, String tsGuidCName, String moduleKey) {
- int libCount = getLibraryInstancesCount(moduleKey);
- String[][] saaLib = new String[libCount][5];
- getLibraryInstances(moduleKey, saaLib);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
- //
- // create vector for module & library instance MIs.
- //
- vMi.add(mi);
- for (int j = 0; j < saaLib.length; ++j) {
- String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
- vMi.add(libMi);
- }
-
- int pcdSourceCount = 0;
- for (int i = 0; i < vMi.size(); ++i) {
- if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, null, vMi.get(i))) {
- pcdSourceCount++;
- }
- }
-
- if (pcdSourceCount < 2) {
- return false;
- }
- else {
- return true;
- }
-
- }
-
- /**Remove PCDBuildDefinition entries from ModuleSA
- * @param moduleKey identifier of ModuleSA.
- * @param consumer where these entries come from.
- */
- public void removePcdData(String moduleKey, ModuleIdentification consumer) {
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);
- if (msa.getPcdCoded() == null) {
- return;
- }
-
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
-
- while(li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
- ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
- if (moduleSA.getPcdBuildDefinition() != null) {
- XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
- cursor.push();
- if (cursor.toFirstChild()) {
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
- .getObject();
- String cName = msaPcd.getCName();
- String tsGuidCName = msaPcd.getTokenSpaceGuidCName();
- if (cName.equals(pcdData.getCName())
- && tsGuidCName.equals(pcdData.getTokenSpaceGuidCName()) && !multiSourcePcd(cName, tsGuidCName, moduleKey)) {
-
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),
- moduleKey);
- cursor.removeXml();
- break;
- }
- } while (cursor.toNextSibling());
- }
-
- cursor.pop();
- if (moduleSA.getPcdBuildDefinition().getPcdDataList().size() == 0) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
- }
-
- }
- //
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
- //
- public int getLibraryInstancesCount(String key) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){
- return 0;
- }
- return msa.getLibraries().getInstanceList().size();
- }
-
- public void getLibraryInstances(String key, String[][] saa){
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){
- return ;
- }
-
- ListIterator<LibrariesDocument.Libraries.Instance> li = msa.getLibraries().getInstanceList().listIterator();
- for (int i = 0; i < saa.length; ++i) {
- LibrariesDocument.Libraries.Instance instance = li.next();
- saa[i][1] = instance.getModuleGuid();
- saa[i][2] = instance.getModuleVersion();
- saa[i][3] = instance.getPackageGuid();
- saa[i][4] = instance.getPackageVersion();
- }
- }
-
- public boolean instanceExistsInModuleSA (String key, String mg, String mv, String pg, String pv) {
- int count = 0;
- if ((count = getLibraryInstancesCount(key)) > 0) {
- String[][] saa = new String[count][5];
- getLibraryInstances (key, saa);
- for (int i = 0; i < count; ++i) {
- if (mg.equalsIgnoreCase(saa[i][1]) && pg.equalsIgnoreCase(saa[i][3])) {
- boolean modVerMatch = false;
- boolean pkgVerMatch = false;
- if ((mv.equals("null") || saa[i][2] == null)) {
- modVerMatch = true;
- }
- if (pv.equals("null") || saa[i][4] == null) {
- pkgVerMatch = true;
- }
- if (modVerMatch && pkgVerMatch) {
- return true;
- }
- else {
- if (mv.equals(saa[i][2]) && pv.equals(saa[i][4])) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- public void removeLibraryInstance(String key, String instanceKey) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null){
- return ;
- }
-
- String[] instanceInfo = instanceKey.split(" ");
- XmlCursor cursor = msa.getLibraries().newCursor();
- if (cursor.toFirstChild()) {
- do {
- Instance libIns = (Instance)cursor.getObject();
- if (libIns.getModuleGuid().equalsIgnoreCase(instanceInfo[0]) && libIns.getPackageGuid().equalsIgnoreCase(instanceInfo[2])) {
- break;
- }
- }while (cursor.toNextSibling());
- cursor.push();
- while (cursor.hasPrevToken()) {
- cursor.toPrevToken();
- if (!cursor.isText()) {
- break;
- }
- String s = cursor.getTextValue();
- if (s.matches(regExpNewLineAndSpaces)) {
- continue;
- }
- }
-
- if (cursor.isComment()) {
- cursor.removeXml();
- }
- cursor.pop();
- cursor.removeXml();
- if (getLibraryInstancesCount(key) == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
-
- cursor.dispose();
- }
-
- public void genLibraryInstance(ModuleIdentification libMi, String key) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null){
- msa = getfpdFrameworkModules().addNewModuleSA();
- }
- LibrariesDocument.Libraries libs = msa.getLibraries();
- if(libs == null){
- libs = msa.addNewLibraries();
- }
-
- String mn = libMi.getName();
- String mg = libMi.getGuid();
- String mv = libMi.getVersion();
- String pn = libMi.getPackageId().getName();
- String pg = libMi.getPackageId().getGuid();
- String pv = libMi.getPackageId().getVersion();
- LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
- XmlCursor cursor = instance.newCursor();
- try{
- String comment = "Pkg: " + pn + " Mod: " + mn
- + " Path: " + libMi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- cursor.insertComment(comment);
- }
- catch (Exception e){
- e.printStackTrace();
- }
- finally {
- cursor.dispose();
- }
-
- instance.setModuleGuid(mg);
- instance.setModuleVersion(mv);
- instance.setPackageGuid(pg);
- instance.setPackageVersion(pv);
-
- }
-
- public String getFvBinding(String moduleKey){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- return getFvBinding (moduleSa);
- }
-
- public String getFvBinding (ModuleSADocument.ModuleSA moduleSa) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return moduleSa.getModuleSaBuildOptions().getFvBinding();
- }
-
- public void setFvBinding(ModuleSADocument.ModuleSA moduleSa, String fvBinding) {
- if (moduleSa == null ) {
- return;
- }
- if (fvBinding == null || fvBinding.length() == 0) {
- if(moduleSa.getModuleSaBuildOptions() != null){
- moduleSa.getModuleSaBuildOptions().unsetFvBinding();
- }
- }
- else {
- if(moduleSa.getModuleSaBuildOptions() == null){
- moduleSa.addNewModuleSaBuildOptions().setFvBinding(fvBinding);
- return;
- }
- moduleSa.getModuleSaBuildOptions().setFvBinding(fvBinding);
- }
- }
-
- public void setFvBinding(String moduleKey, String fvBinding){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- setFvBinding (moduleSa, fvBinding);
- }
-
- private int fvBindingForModuleSA (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- return -1;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String[] fvNamesArray = fvNameList.split(" ");
- int occursAt = -1;
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (fvNamesArray[i].equals(fvName)) {
- occursAt = i;
- break;
- }
- }
- return occursAt;
- }
-
- public void removeFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- return;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String[] fvNamesArray = fvNameList.split(" ");
- int occursAt = -1;
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (fvNamesArray[i].equals(fvName)) {
- occursAt = i;
- break;
- }
- }
- // jump over where the input fvName occurs in the original Fv list.
- if (occursAt != -1) {
- String newFvNameList = " ";
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (i == occursAt) {
- continue;
- }
- newFvNameList += fvNamesArray[i];
- }
- setFvBinding (moduleSa, newFvNameList.trim());
- }
-
- }
-
- /**
- * @param fvName The FV name that to be removed from FvBinding List.
- */
- public void removeFvBindingAll (String fvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- removeFvBinding (moduleSa, fvName);
- }
- }
-
- public void appendFvBindingAll (String fvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- appendFvBinding (moduleSa, fvName);
- }
- }
-
- public void appendFvBindingFor (String oldFvName, String newFvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- String fvBinding = getFvBinding (moduleSa);
- if (fvBinding != null && fvBindingForModuleSA (moduleSa, oldFvName) >= 0) {
- appendFvBinding (moduleSa, newFvName);
- }
- }
- }
-
- public void appendFvBinding (String moduleKey, String fvName) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- appendFvBinding (moduleSa, fvName);
- }
-
- public void appendFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null) {
- return;
- }
-
- if (moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- setFvBinding(moduleSa, fvName);
- return;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String newFvNameList = fvNameList + " " + fvName;
- setFvBinding (moduleSa, newFvNameList.trim());
- }
-
- public void updateFvBindingInModuleSA (String moduleKey, String fvName) {
-
- appendFvBinding (moduleKey, fvName);
- }
-
- public String getFfsFileNameGuid(String moduleKey){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return moduleSa.getModuleSaBuildOptions().getFfsFileNameGuid();
- }
-
- public void setFfsFileNameGuid(String moduleKey, String fileGuid){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null ) {
- return;
- }
- if(msa.getModuleSaBuildOptions() == null){
- msa.addNewModuleSaBuildOptions();
-
- }
- ModuleSaBuildOptionsDocument.ModuleSaBuildOptions msaBuildOpts= msa.getModuleSaBuildOptions();
- if (fileGuid != null) {
- msaBuildOpts.setFfsFileNameGuid(fileGuid);
- }
- else{
- XmlCursor cursor = msaBuildOpts.newCursor();
- if (cursor.toChild(xmlNs, "FfsFileNameGuid")) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- }
-
- public String getFfsFormatKey(String moduleKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return msa.getModuleSaBuildOptions().getFfsFormatKey();
- }
-
- public void setFfsFormatKey(String moduleKey, String ffsKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null ) {
- return;
- }
- if(msa.getModuleSaBuildOptions() == null){
- msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey);
- return;
- }
- msa.getModuleSaBuildOptions().setFfsFormatKey(ffsKey);
- }
-
- public void setModuleSAForceDebug(int i, boolean dbgEnable) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);
- moduleSa.setForceDebug(dbgEnable);
- }
-
- public boolean getModuleSAForceDebug (int i) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);
- if (moduleSa.getForceDebug() == true) {
- return true;
- }
- return false;
- }
-
- public void getModuleSAOptions(String moduleKey, String[][] saa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
- || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
- return ;
- }
-
- List<OptionDocument.Option> lOpt = msa.getModuleSaBuildOptions().getOptions().getOptionList();
- ListIterator li = lOpt.listIterator();
- int i = 0;
- while(li.hasNext()) {
- OptionDocument.Option opt = (OptionDocument.Option)li.next();
- if (opt.getBuildTargets() != null) {
- saa[i][0] = listToString(opt.getBuildTargets());
- }
- saa[i][1] = opt.getToolChainFamily();
- saa[i][2] = opt.getTagName();
- saa[i][3] = opt.getToolCode();
-
- if (opt.getSupArchList() != null){
- saa[i][4] = listToString(opt.getSupArchList());
- }
- else {
- saa[i][4] = "";
- }
-
- saa[i][5] = opt.getStringValue();
-
- ++i;
- }
- }
-
- public int getModuleSAOptionsCount(String moduleKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
- || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
- return 0;
- }
- return msa.getModuleSaBuildOptions().getOptions().getOptionList().size();
- }
-
- public void genModuleSAOptionsOpt(String moduleKey, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null) {
- msa.addNewModuleSaBuildOptions();
- }
- if (msa.getModuleSaBuildOptions().getOptions() == null){
- msa.getModuleSaBuildOptions().addNewOptions();
- }
- OptionDocument.Option opt = msa.getModuleSaBuildOptions().getOptions().addNewOption();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
-
- public void removeModuleSAOptionsOpt(String moduleKey, int i) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {
- return ;
- }
- OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();
- XmlCursor cursor = opts.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j){
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getModuleSAOptionsCount(moduleKey) == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateModuleSAOptionsOpt(String moduleKey, int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {
- return ;
- }
- OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();
- XmlCursor cursor = opts.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j){
- cursor.toNextSibling();
- }
- OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
- cursor.dispose();
- }
-
- /**add pcd information of module mi to a ModuleSA.
- * @param mi
- * @param moduleSa if null, generate a new ModuleSA.
- */
- public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, String arch, ModuleSADocument.ModuleSA moduleSa) throws Exception {
- //ToDo add Arch filter
-
- if (moduleSa == null) {
- moduleSa = genModuleSA(mi, arch);
- }
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null) {
- return;
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // Implementing InitializePlatformPcdBuildDefinitions
- //
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- if (msaPcd.getSupArchList() != null) {
- if (!msaPcd.getSupArchList().toString().toLowerCase().contains(arch.toLowerCase())) {
- continue;
- }
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null) {
- //
- // ToDo Error
- //
- throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + "\n used by Module "
- + mi.getName() + " or its Library Instances.");
- }
- //
- // AddItem to ModuleSA PcdBuildDefinitions
- //
- String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue() : msaPcd.getDefaultValue();
-
- genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(), msaPcd.getPcdItemType()
- .toString(),
- spdPcd.getDatumType() + "", defaultVal, moduleSa, spdPcd);
- }
-
- }
-
- private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {
-
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;
- for (int i = 0; i < depPkgs.length; ++i) {
-
- XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]);
- if (xo == null) {
- continue;
- }
- for (int j = 0; j < xo.length; ++j) {
- spdPcd = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)xo[j];
- if (msaPcd.getTokenSpaceGuidCName() == null) {
- if (spdPcd.getCName().equals(msaPcd.getCName())) {
- return spdPcd;
- }
- }
- else{
- if (spdPcd.getCName().equals(msaPcd.getCName()) && spdPcd.getTokenSpaceGuidCName().equals(msaPcd.getTokenSpaceGuidCName())) {
- return spdPcd;
- }
- }
-
- }
-
- }
- return null;
- }
-
- private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {
- PackageIdentification pi = WorkspaceProfile.getPackageForModule(mi);
- ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
- XmlCursor cursor = msa.newCursor();
- try{
- String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "
- + mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- cursor.insertComment(comment);
- }
- catch(Exception e){
- e.printStackTrace();
- }
- finally {
- cursor.dispose();
- }
- msa.setModuleGuid(mi.getGuid());
- msa.setModuleVersion(mi.getVersion());
- msa.setPackageGuid(pi.getGuid());
- msa.setPackageVersion(pi.getVersion());
- if (arch != null) {
- Vector<String> v = new Vector<String>();
- v.add(arch);
- msa.setSupArchList(v);
- }
-
- return msa;
- }
-
- private String chooseDefaultPcdType (List validPcdTypes) {
- String choosedType = "";
- if (validPcdTypes.contains("FIXED_AT_BUILD")) {
- choosedType = "FIXED_AT_BUILD";
- }
- else if (validPcdTypes.contains("DYNAMIC")) {
- choosedType = "DYNAMIC";
- }
- else if (validPcdTypes.contains("PATCHABLE_IN_MODULE")) {
- choosedType = "PATCHABLE_IN_MODULE";
- }
- else if (validPcdTypes.contains("DYNAMIC_EX")) {
- choosedType = "DYNAMIC_EX";
- }
- return choosedType;
- }
-
- private synchronized void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal,
- ModuleSADocument.ModuleSA moduleSa, PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd)
- throws PcdItemTypeConflictException, PcdValueMalFormed{
- if (moduleSa.getPcdBuildDefinition() == null){
- moduleSa.addNewPcdBuildDefinition();
- }
- //
- // constructe pcd to modulesa mapping first.
- // Attention : for any error condition, remove from map this pcd.
- //
- ArrayList<String> pcdConsumer = LookupPlatformPcdData(cName + " " + tsGuid);
- if (pcdConsumer == null) {
- pcdConsumer = new ArrayList<String>();
- }
- //
- // Check whether this PCD has already added to ModuleSA, if so, just return.
- //
- String moduleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion()
- + " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- for (int i = 0; i < pcdConsumer.size(); ++i) {
- String pcdInfo = pcdConsumer.get(i);
- if (moduleInfo.equals(pcdInfo.substring(0, pcdInfo.lastIndexOf(" ")))){
- return;
- }
- }
- // if pcd type from MSA file is Dynamic
- // we must choose one default type from SPD file for it.
- //
- List validPcdTypes = spdPcd.getValidUsage();
- //
- // Using existing Pcd type, if this pcd already exists in other ModuleSA
- //
- if (pcdConsumer.size() > 0) {
- //
- // platform should only contain one type for each pcd.
- //
- String existingItemType = itemType (pcdConsumer.get(0));
- for (int i = 1; i < pcdConsumer.size(); ++i) {
- if (!existingItemType.equals(itemType(pcdConsumer.get(i)))) {
- throw new PcdItemTypeConflictException (cName, pcdConsumer.get(0), pcdConsumer.get(i));
- }
- }
-
- if (itemType.equals("DYNAMIC")) {
- if (!validPcdTypes.contains(existingItemType)) {
- throw new PcdItemTypeConflictException(cName, pcdConsumer.get(0));
- }
- itemType = existingItemType;
- }
- else {
- if (!itemType.equals(existingItemType)) {
- throw new PcdItemTypeConflictException(cName, pcdConsumer.get(0));
- }
- }
- }
- //
- // if this is the first occurence of this pcd.
- //
- else {
- if (itemType.equals("DYNAMIC")) {
- itemType = chooseDefaultPcdType (validPcdTypes);
- }
- }
- String listValue = moduleInfo + " " + itemType;
- pcdConsumer.add(listValue);
- dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);
-
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();
- fpdPcd.setCName(cName);
- fpdPcd.setToken(token);
- fpdPcd.setTokenSpaceGuidCName(tsGuid);
- fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));
- fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));
-
- if (defaultVal != null && defaultVal.length() > 0){
- fpdPcd.setValue(defaultVal);
- }
- else {
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {
- fpdPcd.setValue("0");
- }
- if (dataType.equals("BOOLEAN")){
- fpdPcd.setValue("FALSE");
- }
- if (dataType.equals("VOID*")) {
- fpdPcd.setValue("L\"\"");
- }
- }
- //
- // Using existing pcd value, if this pcd already exists in other moduleSa.
- //
- if (defaultPcdValue.get(cName + " " + tsGuid) == null) {
- defaultPcdValue.put(cName + " " + tsGuid, fpdPcd.getValue());
- }
- else {
- fpdPcd.setValue(defaultPcdValue.get(cName + " " + tsGuid));
- }
-
- if (dataType.equals("UINT8")){
- fpdPcd.setMaxDatumSize(1);
- }
- if (dataType.equals("UINT16")) {
- fpdPcd.setMaxDatumSize(2);
- }
- if (dataType.equals("UINT32")) {
- fpdPcd.setMaxDatumSize(4);
- }
- if (dataType.equals("UINT64")){
- fpdPcd.setMaxDatumSize(8);
- }
- if (dataType.equals("BOOLEAN")){
- fpdPcd.setMaxDatumSize(1);
- }
- if (dataType.equals("VOID*")) {
- int maxSize = setMaxSizeForPointer(fpdPcd.getValue());
- fpdPcd.setMaxDatumSize(maxSize);
- }
-
-
- if (itemType.equals("DYNAMIC") || itemType.equals("DYNAMIC_EX")) {
- ArrayList<String> al = LookupDynamicPcdBuildDefinition(cName + " " + tsGuid);
- //
- // if only one module mapped to this pcd, then the one is myself. so no other module mapped.
- // so need to add one dyn pcd.
- //
- if (al.size() == 1) {
- addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);
- }
- }
-
- }
-
- public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{
- if (datum == null) {
- return 0;
- }
- char ch = datum.charAt(0);
- int start, end;
- String strValue;
- //
- // For void* type PCD, only three datum is support:
- // 1) Unicode: string with start char is "L"
- // 2) Ansci: String is ""
- // 3) byte array: String start char "{"
- //
- if (ch == 'L') {
- start = datum.indexOf('\"');
- end = datum.lastIndexOf('\"');
- if ((start > end) ||
- (end > datum.length())||
- ((start == end) && (datum.length() > 0))) {
- //ToDo Error handling here
- throw new PcdValueMalFormed (datum);
- }
-
- strValue = datum.substring(start + 1, end);
- return strValue.length() * 2;
- } else if (ch == '\"'){
- start = datum.indexOf('\"');
- end = datum.lastIndexOf('\"');
- if ((start > end) ||
- (end > datum.length())||
- ((start == end) && (datum.length() > 0))) {
- throw new PcdValueMalFormed (datum);
- }
- strValue = datum.substring(start + 1, end);
- return strValue.length();
- } else if (ch =='{') {
- String[] strValueArray;
-
- start = datum.indexOf('{');
- end = datum.lastIndexOf('}');
- strValue = datum.substring(start + 1, end);
- strValue = strValue.trim();
- if (strValue.length() == 0) {
- return 0;
- }
- strValueArray = strValue.split(",");
- for (int index = 0; index < strValueArray.length; index ++) {
- Integer value = Integer.decode(strValueArray[index].trim());
-
- if (value > 0xFF) {
-// "[FPD file error] The datum type of PCD %s in %s is VOID*, "+
-// "it must be a byte array. But the element of %s exceed the byte range",
- throw new PcdValueMalFormed (datum);
- }
- }
- return strValueArray.length;
-
-
- } else {
-// "[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+
-// "1) UNICODE string: like L\"xxxx\";\r\n"+
-// "2) ANSIC string: like \"xxx\";\r\n"+
-// "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+
-// "but the datum in seems does not following above format!",
- throw new PcdValueMalFormed (datum);
-
- }
- }
-
- private ArrayList<String> LookupDynamicPcdBuildDefinition(String dynPcdKey) {
- ArrayList<String> al = dynPcdMap.get(dynPcdKey);
-
- return al;
- }
-
- private ArrayList<String> LookupPlatformPcdData(String pcdKey) {
-
- return dynPcdMap.get(pcdKey);
- }
-
- public int getDynamicPcdBuildDataCount() {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return 0;
- }
- return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();
- }
-
- public void getDynamicPcdBuildData(String[][] saa) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return ;
- }
- List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcd = li.next();
- saa[i][0] = dynPcd.getCName();
- saa[i][1] = dynPcd.getToken().toString();
- saa[i][2] = dynPcd.getTokenSpaceGuidCName();
- saa[i][3] = dynPcd.getMaxDatumSize()+"";
- saa[i][4] = dynPcd.getDatumType()+"";
-
- ++i;
- }
- }
-
- public void addDynamicPcdBuildData(String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal)
- throws PcdValueMalFormed{
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcdData = getfpdDynPcdBuildDefs().addNewPcdBuildData();
- dynPcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
- dynPcdData.setCName(cName);
- dynPcdData.setToken(token);
- dynPcdData.setTokenSpaceGuidCName(tsGuid);
- dynPcdData.setDatumType(PcdDataTypes.Enum.forString(dataType));
-
- BigInteger bigInt = new BigInteger("0");
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = dynPcdData.addNewSkuInfo();
- skuInfo.setSkuId(bigInt);
- if (defaultVal != null){
- skuInfo.setValue(defaultVal);
- }
- else {
- if (dataType.equals("UINT8")){
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT16")) {
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT32")) {
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT64")){
- skuInfo.setValue("0");
- }
- if (dataType.equals("BOOLEAN")){
- skuInfo.setValue("false");
- }
- if (dataType.equals("VOID*")) {
- skuInfo.setValue("");
- }
- }
- if (dataType.equals("UINT8")){
- dynPcdData.setMaxDatumSize(1);
- }
- if (dataType.equals("UINT16")) {
- dynPcdData.setMaxDatumSize(2);
- }
- if (dataType.equals("UINT32")) {
- dynPcdData.setMaxDatumSize(4);
- }
- if (dataType.equals("UINT64")){
- dynPcdData.setMaxDatumSize(8);
- }
- if (dataType.equals("BOOLEAN")){
- dynPcdData.setMaxDatumSize(1);
- }
- if (dataType.equals("VOID*")) {
- int maxSize = setMaxSizeForPointer(defaultVal);
- dynPcdData.setMaxDatumSize(maxSize);
- }
- }
-
- public void removeDynamicPcdBuildData(String cName, String tsGuid) {
- XmlObject o = fpdRoot.getDynamicPcdBuildDefinitions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- do {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData =
- (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {
-
- if (getDynamicPcdBuildDataCount() == 1) {
- cursor.dispose();
- removeElement(o);
- fpdDynPcdBuildDefs = null;
- return;
- }
- cursor.removeXml();
- cursor.dispose();
- return;
- }
- }
- while (cursor.toNextSibling());
- }
- cursor.dispose();
- }
- //
- // Get the Sku Info count of ith dyn pcd element.
- //
- public int getDynamicPcdSkuInfoCount(int i){
- if (fpdRoot.getDynamicPcdBuildDefinitions() == null || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList() == null
- || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return 0;
- }
-
- int skuInfoCount = 0;
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- skuInfoCount = 0;
- }
- else {
- skuInfoCount = pcdData.getSkuInfoList().size();
- }
- }
- cursor.dispose();
- return skuInfoCount;
- }
-
- public void getDynamicPcdSkuInfos(int i, String[][] saa){
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- cursor.dispose();
- return;
- }
- else {
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();
- int k = 0;
- while (li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();
- saa[k][0] = skuInfo.getSkuId()+"";
- saa[k][1] = skuInfo.getVariableName();
- saa[k][2] = skuInfo.getVariableGuid();
- saa[k][3] = skuInfo.getVariableOffset();
- saa[k][4] = skuInfo.getHiiDefaultValue();
- saa[k][5] = skuInfo.getVpdOffset();
- saa[k][6] = skuInfo.getValue();
- ++k;
- }
-
- }
- }
- cursor.dispose();
-
- }
-
- public String getDynamicPcdBuildDataValue(int i){
- String value = null;
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return value;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- value = null;
- }
- else {
- value = pcdData.getSkuInfoArray(0).getValue();
- }
- }
- cursor.dispose();
- return value;
- }
-
- public String getDynamicPcdBuildDataVpdOffset(int i){
- String vpdOffset = null;
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return vpdOffset;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- vpdOffset = null;
- }
- else {
- vpdOffset = pcdData.getSkuInfoArray(0).getVpdOffset();
- }
- }
- cursor.dispose();
- return vpdOffset;
- }
-
- public void removeDynamicPcdBuildDataSkuInfo(int i) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- cursor.dispose();
- return;
- }
- else {
- pcdData.getSkuInfoList().clear();
-// QName qSkuInfo = new QName(xmlNs, "SkuInfo");
-// cursor.toChild(qSkuInfo);
-// cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- //
- // generate sku info for ith dyn pcd build data.
- //
- public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
- String hiiDefault, String vpdOffset, String value, int i) {
-// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
-// return;
-// }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = pcdData.addNewSkuInfo();
- skuInfo.setSkuId(new BigInteger(id));
- if (varName != null){
- skuInfo.setVariableName(varName);
- skuInfo.setVariableGuid(varGuid);
- skuInfo.setVariableOffset(varOffset);
- skuInfo.setHiiDefaultValue(hiiDefault);
- }
- else if (vpdOffset != null){
- skuInfo.setVpdOffset(vpdOffset);
- }
- else{
- skuInfo.setValue(value);
- }
- }
- }
-
- public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
- String hiiDefault, String vpdOffset, String value, int i){
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();
- while (li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();
- if (skuInfo.getSkuId().toString().equals(id)){
- if (varName != null){
- skuInfo.setVariableName(varName);
- skuInfo.setVariableGuid(varGuid);
- skuInfo.setVariableOffset(varOffset);
- skuInfo.setHiiDefaultValue(hiiDefault);
- }
- else if (vpdOffset != null){
- skuInfo.setVpdOffset(vpdOffset);
- }
- else{
- skuInfo.setValue(value);
- }
- break;
- }
- }
- }
- }
-
- public BuildOptionsDocument.BuildOptions getfpdBuildOpts() {
- if (fpdBuildOpts == null) {
- fpdBuildOpts = fpdRoot.addNewBuildOptions();
- }
- return fpdBuildOpts;
- }
-
- public void genBuildOptionsUserExtensions(String fvName, String userId, String id, String outputFileName, Vector<String[]> includeModules) {
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName elementInfFileName = new QName(xmlNs, "InfFileName");
- QName elementModule = new QName(xmlNs, "Module");
-
- UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions();
- userExts.setUserID(userId);
- userExts.setIdentifier(id);
- XmlCursor cursor = userExts.newCursor();
- cursor.toEndToken();
-
- cursor.beginElement(elementFvName);
- cursor.insertChars(fvName);
- cursor.toNextToken();
-
- cursor.beginElement(elementInfFileName);
- cursor.insertChars(outputFileName);
- cursor.toNextToken();
-
- cursor.beginElement(elementIncludeModules);
- for (int i = 0; i < includeModules.size(); ++i) {
- cursor.beginElement(elementModule);
- cursor.insertAttributeWithValue("ModuleGuid", includeModules.get(i)[0]);
- if (!includeModules.get(i)[1].equals("null") && includeModules.get(i)[1].length() != 0) {
- cursor.insertAttributeWithValue("ModuleVersion", includeModules.get(i)[1]);
- }
- cursor.insertAttributeWithValue("PackageGuid", includeModules.get(i)[2]);
- if (!includeModules.get(i)[3].equals("null") && includeModules.get(i)[3].length() != 0) {
- cursor.insertAttributeWithValue("PackageVersion", includeModules.get(i)[3]);
- }
-
- cursor.insertAttributeWithValue("Arch", includeModules.get(i)[4]);
- cursor.toEndToken();
- cursor.toNextToken();
- }
- cursor.dispose();
- }
-
- public int getUserExtsIncModCount (String fvName, String userId, String id) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return -1;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier() == null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
- int i = 1;
- for (i = 1; cursor.toNextSibling(); ++i);
- cursor.dispose();
- return i;
- }
- cursor.dispose();
- return 0;
- }
- cursor.dispose();
- }
- return -1;
- }
-
- public void getUserExtsIncMods(String fvName, String userId, String id, String[][] saa) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
-
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
- int i = 0;
- do {
- saa[i][0] = cursor.getAttributeText(attribModuleGuid);
- saa[i][1] = cursor.getAttributeText(attribModuleVersion);
- saa[i][2] = cursor.getAttributeText(attribPackageGuid);
- saa[i][3] = cursor.getAttributeText(attribPackageVersion);
- saa[i][4] = cursor.getAttributeText(attribArch);
- ++i;
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
-
- }
-
- public void updateBuildOptionsUserExtensions (String oldFvName, String newFvName) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals("IMAGES")) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(oldFvName)) {
- cursor.setTextValue(newFvName);
- }
- cursor.dispose();
- }
-
- }
-
- public void removeBuildOptionsUserExtensions (String fvName, String userId, String id) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier()== null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toParent();
- cursor.removeXml();
- cursor.dispose();
- return;
- }
- cursor.dispose();
- }
-
- }
-
- private boolean versionEqual (String v1, String v2) {
-
- if ((v1 == null || v1.length() == 0 || v1.equalsIgnoreCase("null"))
- && (v2 == null || v2.length() == 0 || v2.equalsIgnoreCase("null"))) {
- return true;
- }
-
- if (v1 != null && v1.equals(v2)) {
- return true;
- }
-
- return false;
- }
-
- public boolean moduleInBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- boolean inList = false;
- if (getUserExtsIncModCount(fvName, userId, id) > 0) {
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
-
- do {
- String mg = cursor.getAttributeText(attribModuleGuid);
- String mv = cursor.getAttributeText(attribModuleVersion);
- String pg = cursor.getAttributeText(attribPackageGuid);
- String pv = cursor.getAttributeText(attribPackageVersion);
- String ar = cursor.getAttributeText(attribArch);
- if (!moduleGuid.equalsIgnoreCase(mg)) {
- continue;
- }
- if (!packageGuid.equalsIgnoreCase(pg)) {
- continue;
- }
- if (!arch.equalsIgnoreCase(ar)) {
- continue;
- }
- if (!versionEqual(moduleVersion, mv)) {
- continue;
- }
- if (!versionEqual(packageVersion, pv)) {
- continue;
- }
- inList = true;
- break;
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
- }
- return inList;
- }
-
- public void removeModuleInBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- //
- // if there is only one module before remove operation, the whole user extension should be removed.
- //
- int moduleAmount = getUserExtsIncModCount(fvName, userId, id);
- if (moduleAmount == 1) {
- removeBuildOptionsUserExtensions(fvName, userId, id);
- return;
- }
-
- if (moduleAmount > 1) {
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
-
- do {
- String mg = cursor.getAttributeText(attribModuleGuid);
- String mv = cursor.getAttributeText(attribModuleVersion);
- String pg = cursor.getAttributeText(attribPackageGuid);
- String pv = cursor.getAttributeText(attribPackageVersion);
- String ar = cursor.getAttributeText(attribArch);
- if (!moduleGuid.equalsIgnoreCase(mg)) {
- continue;
- }
- if (!packageGuid.equalsIgnoreCase(pg)) {
- continue;
- }
- if (!arch.equalsIgnoreCase(ar)) {
- continue;
- }
- if (!versionEqual(moduleVersion, mv)) {
- continue;
- }
- if (!versionEqual(packageVersion, pv)) {
- continue;
- }
- cursor.removeXml();
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
- }
- }
-
- public void addModuleIntoBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- if (moduleInBuildOptionsUserExtensions (fvName, userId, id, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) {
- return;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName elementModule = new QName(xmlNs, "Module");
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier() == null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- cursor.toLastChild();
- cursor.toEndToken();
- cursor.toNextToken();
- cursor.beginElement(elementModule);
- cursor.insertAttributeWithValue("ModuleGuid", moduleGuid);
- if (!moduleVersion.equals("null") && moduleVersion.length() != 0) {
- cursor.insertAttributeWithValue("ModuleVersion", moduleVersion);
- }
- cursor.insertAttributeWithValue("PackageGuid", packageGuid);
- if (!packageVersion.equals("null") && packageVersion.length() != 0) {
- cursor.insertAttributeWithValue("PackageVersion", packageVersion);
- }
-
- cursor.insertAttributeWithValue("Arch", arch);
- cursor.dispose();
- return;
- }
- cursor.dispose();
- }
-
- }
-
- public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null) {
- udats = getfpdBuildOpts().addNewUserDefinedAntTasks();
- }
-
- AntTaskDocument.AntTask at = udats.addNewAntTask();
- setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);
- }
-
- private void setBuildOptionsUserDefAntTask(String id, String fileName, String execOrder, AntTaskDocument.AntTask at) {
- at.setId(new Integer(id));
- XmlCursor cursor = at.newCursor();
- if (fileName != null){
- at.setFilename(fileName);
- }
- else if (cursor.toChild(xmlNs, "Filename")) {
- cursor.removeXml();
- }
- if (execOrder != null) {
- at.setAntCmdOptions(execOrder);
- }
- else if (cursor.toChild(xmlNs, "AntCmdOptions")) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsUserDefAntTask(int i) {
- XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getBuildOptionsUserDefAntTaskCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsUserDefAntTask(int i, String id, String fileName, String execOrder){
- XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)cursor.getObject();
- setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);
- }
- cursor.dispose();
- }
-
- public int getBuildOptionsUserDefAntTaskCount() {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null || udats.getAntTaskList() == null) {
- return 0;
- }
-
- return udats.getAntTaskList().size();
- }
-
- public void getBuildOptionsUserDefAntTasks(String[][] saa) {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null || udats.getAntTaskList() == null) {
- return ;
- }
-
- List<AntTaskDocument.AntTask> l = udats.getAntTaskList();
- ListIterator li = l.listIterator();
- int i = 0;
- while (li.hasNext()) {
- AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)li.next();
- saa[i][0] = at.getId() + "";
- saa[i][1] = saa[i][2] = "";
- if (at.getFilename() != null){
- saa[i][1] = at.getFilename();
- }
- if (at.getAntCmdOptions() != null) {
- saa[i][2] = at.getAntCmdOptions();
- }
- ++i;
- }
- }
- public void genBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- OptionsDocument.Options opts = getfpdBuildOpts().getOptions();
- if (opts == null) {
- opts = getfpdBuildOpts().addNewOptions();
- }
- OptionDocument.Option opt = opts.addNewOption();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
-
- private void setBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents, OptionDocument.Option opt){
- opt.setStringValue(contents);
- if (buildTargets != null) {
- opt.setBuildTargets(buildTargets);
- }
- else {
- if (opt.isSetBuildTargets()) {
- opt.unsetBuildTargets();
- }
- }
-
- if (toolChain != null && toolChain.length() > 0) {
- opt.setToolChainFamily(toolChain);
- }
- else {
- if (opt.isSetToolChainFamily()) {
- opt.unsetToolChainFamily();
- }
- }
-
- if (tagName != null && tagName.length() > 0) {
- opt.setTagName(tagName);
- }
- else {
- if (opt.isSetTagName()) {
- opt.unsetTagName();
- }
- }
-
- if (toolCmd != null && toolCmd.length() > 0) {
- opt.setToolCode(toolCmd);
- }
- else {
- if (opt.isSetToolCode()) {
- opt.unsetToolCode();
- }
- }
-
-
- if (archList != null) {
- opt.setSupArchList(archList);
- }
- else {
- if (opt.isSetSupArchList()) {
- opt.unsetSupArchList();
- }
- }
- }
-
- public void removeBuildOptionsOpt(int i){
-
- XmlObject o = getfpdBuildOpts().getOptions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getBuildOptionsOptCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsOpt(int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- XmlObject o = getfpdBuildOpts().getOptions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
- cursor.dispose();
- }
-
- public int getBuildOptionsOptCount(){
- if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
- return 0;
- }
- return getfpdBuildOpts().getOptions().getOptionList().size();
- }
-
- public void getBuildOptionsOpts(String[][] saa) {
- if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
- return ;
- }
-
- List<OptionDocument.Option> lOpt = getfpdBuildOpts().getOptions().getOptionList();
- ListIterator li = lOpt.listIterator();
- int i = 0;
- while(li.hasNext()) {
- OptionDocument.Option opt = (OptionDocument.Option)li.next();
- if (opt.getBuildTargets() != null) {
- saa[i][0] = listToString(opt.getBuildTargets());
- }
- saa[i][1] = opt.getToolChainFamily();
- if (opt.getSupArchList() != null){
- saa[i][2] = listToString(opt.getSupArchList());
-
- }
- saa[i][3] = opt.getToolCode();
- saa[i][4] = opt.getTagName();
- saa[i][5] = opt.getStringValue();
-
- ++i;
- }
- }
-
- public void genBuildOptionsFfs(String ffsKey, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs();
- ffs.setFfsKey(ffsKey);
- if (type != null) {
- ffs.addNewSections().setEncapsulationType(type);
- }
- }
-
- public void updateBuildOptionsFfsSectionsType(int i, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- ffs.getSections().setEncapsulationType(type);
- }
-
- public void genBuildOptionsFfsAttribute(int i, String name, String value) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = ffs.addNewAttribute();
- attrib.setName(name);
- attrib.setValue(value);
- }
-
- /**update jth attribute of ith ffs.
- * @param i
- * @param j
- */
- public void updateBuildOptionsFfsAttribute(int i, int j, String name, String value){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- XmlCursor cursor = ffs.newCursor();
- QName qAttrib = new QName(xmlNs, "Attribute");
- if (cursor.toChild(qAttrib)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qAttrib);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = (BuildOptionsDocument.BuildOptions.Ffs.Attribute)cursor.getObject();
- attrib.setName(name);
- attrib.setValue(value);
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsFfsAttribute(int i, int j){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- XmlCursor cursor = ffs.newCursor();
- QName qAttrib = new QName(xmlNs, "Attribute");
- if (cursor.toChild(qAttrib)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qAttrib);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSection(int i, String sectionType) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
-
- if (sections == null){
- sections = ffs.addNewSections();
- }
- sections.addNewSection().setSectionType(EfiSectionType.Enum.forString(sectionType));
- }
-
- public void removeBuildOptionsFfsSectionsSection(int i, int j) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSection = new QName(xmlNs, "Section");
- if (cursor.toChild(qSection)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSection);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSection(int i, int j, String type){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSection = new QName(xmlNs, "Section");
- if (cursor.toChild(qSection)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSection);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Section)cursor.getObject();
- section.setSectionType(EfiSectionType.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSections(int i, String encapType) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
-
- if (sections == null){
- sections = ffs.addNewSections();
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = sections.addNewSections();
- sections2.setEncapsulationType(encapType);
- sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString("EFI_SECTION_PE32"));
- }
-
- public void removeBuildOptionsFfsSectionsSections(int i, int j) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSections(int i, int j, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- sections2.setEncapsulationType(type);
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSectionsSection(int i, int j, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)){
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsFfsSectionsSectionsSection(int i, int j, int k) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int l = 0; l < j; ++l) {
- cursor.toNextSibling(qSections);
- }
- if (cursor.toFirstChild()) {
- int m = 0;
- for (; m < k; ++m) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (m == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSectionsSection(int i, int j, int k, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int l = 0; l < j; ++l) {
- cursor.toNextSibling(qSections);
- }
- if (cursor.toFirstChild()) {
- for (int m = 0; m < k; ++m) {
- cursor.toNextSibling();
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section)cursor.getObject();
- section.setSectionType(EfiSectionType.Enum.forString(type));
- }
- }
- cursor.dispose();
- }
-
- public void getBuildOptionsFfsSectionsSectionsSection(int i, int j, ArrayList<String> al) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)){
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- if (sections2.getSectionList() == null){
- cursor.dispose();
- return;
- }
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section> li = sections2.getSectionList().listIterator();
- while(li.hasNext()) {
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next();
-// if (section.isSetSectionType()) {
- al.add(section.getSectionType()+"");
-// }
-
- }
- }
- cursor.dispose();
-
- }
-
- public int getBuildOptionsFfsCount(){
- if (getfpdBuildOpts().getFfsList() == null) {
- return 0;
- }
- return getfpdBuildOpts().getFfsList().size();
- }
-
- public void getBuildOptionsFfsKey(String[][] saa) {
- if (getfpdBuildOpts().getFfsList() == null) {
- return;
- }
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs> li = getfpdBuildOpts().getFfsList().listIterator();
- int i = 0;
- while(li.hasNext()){
- BuildOptionsDocument.BuildOptions.Ffs ffs = li.next();
- saa[i][0] = ffs.getFfsKey();
- ++i;
- }
- }
-
- public void updateBuildOptionsFfsKey(int i, String key) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- ffs.setFfsKey(key);
- }
-
- /**Get ith FFS key and contents.
- * @param saa
- */
- public void getBuildOptionsFfs(int i, String[] sa, LinkedHashMap<String, String> ffsAttribMap, ArrayList<String> firstLevelSections, ArrayList<String> firstLevelSection) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
-
- if (ffs != null) {
-
- sa[0] = ffs.getFfsKey();
- if (ffs.getSections() != null) {
- if(ffs.getSections().getEncapsulationType() != null){
- sa[1] = ffs.getSections().getEncapsulationType();
- }
- if (ffs.getSections().getSectionList() != null){
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Section> li = ffs.getSections().getSectionList().listIterator();
- while (li.hasNext()) {
- firstLevelSection.add(li.next().getSectionType()+"");
- }
- }
- if (ffs.getSections().getSectionsList() != null) {
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2> li = ffs.getSections().getSectionsList().listIterator();
- while(li.hasNext()) {
- firstLevelSections.add(li.next().getEncapsulationType());
- }
- }
- }
- if (ffs.getAttributeList() != null) {
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Attribute> li = ffs.getAttributeList().listIterator();
- while(li.hasNext()) {
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = li.next();
- ffsAttribMap.put(attrib.getName(), attrib.getValue());
- }
-
- }
- }
-
-
- }
-
- private BuildOptionsDocument.BuildOptions.Ffs getFfs(int i) {
- XmlObject o = getfpdBuildOpts();
- BuildOptionsDocument.BuildOptions.Ffs ffs = null;
-
- XmlCursor cursor = o.newCursor();
- QName qFfs = new QName(xmlNs, "Ffs");
- if (cursor.toChild(qFfs)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFfs);
- }
- ffs = (BuildOptionsDocument.BuildOptions.Ffs)cursor.getObject();
- }
- cursor.dispose();
- return ffs;
- }
-
- public void removeBuildOptionsFfs(int i) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null){
- return;
- }
-
- XmlCursor cursor = ffs.newCursor();
- cursor.removeXml();
- cursor.dispose();
- }
-
-
-
- public PlatformDefinitionsDocument.PlatformDefinitions getfpdPlatformDefs(){
- if (fpdPlatformDefs == null){
- fpdPlatformDefs = fpdRoot.addNewPlatformDefinitions();
- }
- return fpdPlatformDefs;
- }
-
- public void getPlatformDefsSupportedArchs(Vector<Object> archs){
- if (getfpdPlatformDefs().getSupportedArchitectures() == null) {
- return;
- }
- ListIterator li = getfpdPlatformDefs().getSupportedArchitectures().listIterator();
- while(li.hasNext()) {
- archs.add(li.next());
- }
- }
-
- public void setPlatformDefsSupportedArchs(Vector<Object> archs) {
- if (archs != null) {
- getfpdPlatformDefs().setSupportedArchitectures(archs);
- }
-// else {
-// XmlCursor cursor = getfpdPlatformDefs().newCursor();
-// if (cursor.toChild(xmlNs, "SupportedArchitectures")) {
-// cursor.removeXml();
-// }
-// cursor.dispose();
-// }
- }
-
- public void getPlatformDefsBuildTargets(Vector<Object> targets) {
- if (getfpdPlatformDefs().getBuildTargets() == null) {
- return;
- }
- ListIterator li = getfpdPlatformDefs().getBuildTargets().listIterator();
- while(li.hasNext()) {
- targets.add(li.next());
- }
- }
-
- public void setPlatformDefsBuildTargets(Vector<Object> targets) {
- getfpdPlatformDefs().setBuildTargets(targets);
- }
-
- public void genPlatformDefsSkuInfo(String id, String name) {
- SkuInfoDocument.SkuInfo skuInfo = null;
- if (getfpdPlatformDefs().getSkuInfo() == null) {
- skuInfo = getfpdPlatformDefs().addNewSkuInfo();
- }
- skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo.getUiSkuNameList() == null || skuInfo.getUiSkuNameList().size() == 0) {
- SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();
- skuName.setSkuID(new BigInteger("0"));
- skuName.setStringValue("DEFAULT");
- }
- if (id.equals("0")) {
- return;
- }
- SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();
- skuName.setSkuID(new BigInteger(id));
- skuName.setStringValue(name);
- }
-
- public int getPlatformDefsSkuInfoCount(){
- if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
- return 0;
- }
- return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size();
- }
-
- public void getPlatformDefsSkuInfos(String[][] saa){
- if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- }
- return ;
- }
-
- List<SkuInfoDocument.SkuInfo.UiSkuName> l = getfpdPlatformDefs().getSkuInfo().getUiSkuNameList();
- ListIterator<SkuInfoDocument.SkuInfo.UiSkuName> li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- SkuInfoDocument.SkuInfo.UiSkuName sku = li.next();
- saa[i][0] = sku.getSkuID()+"";
- saa[i][1] = sku.getStringValue();
- ++i;
- }
- }
-
- public void removePlatformDefsSkuInfo(int i) {
- SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo == null || i == 0) {
- return ;
- }
-
- XmlCursor cursor = skuInfo.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updatePlatformDefsSkuInfo(int i, String id, String name) {
- SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo == null || i == 0) {
- return ;
- }
-
- XmlCursor cursor = skuInfo.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- SkuInfoDocument.SkuInfo.UiSkuName sku = (SkuInfoDocument.SkuInfo.UiSkuName)cursor.getObject();
- sku.setSkuID(new BigInteger(id));
- sku.setStringValue(name);
- }
- cursor.dispose();
- }
-
- public String getPlatformDefsInterDir(){
- if (getfpdPlatformDefs().getIntermediateDirectories() == null) {
- return null;
- }
- return getfpdPlatformDefs().getIntermediateDirectories().toString();
- }
-
- public void setPlatformDefsInterDir(String interDir){
- getfpdPlatformDefs().setIntermediateDirectories(IntermediateOutputType.Enum.forString(interDir));
- }
-
- public String getPlatformDefsOutputDir() {
- return getfpdPlatformDefs().getOutputDirectory();
- }
-
- public void setPlatformDefsOutputDir(String outputDir) {
- if (outputDir != null && outputDir.length() > 0) {
- getfpdPlatformDefs().setOutputDirectory(outputDir);
- }
- else{
- XmlCursor cursor = getfpdPlatformDefs().newCursor();
- if (cursor.toChild(new QName(xmlNs, "OutputDirectory"))) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
- }
-
- public FlashDocument.Flash getfpdFlash() {
- if (fpdFlash == null) {
- fpdFlash = fpdRoot.addNewFlash();
- }
- return fpdFlash;
- }
-
- public void genFlashDefinitionFile(String file) {
- FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();
- if (fdf == null) {
- fdf = getfpdFlash().addNewFlashDefinitionFile();
- }
-
- fdf.setStringValue(file);
- }
-
- public String getFlashDefinitionFile() {
- FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();
- if (fdf == null) {
- return "";
- }
-
- return fdf.getStringValue();
- }
-
- public void genFvImagesNameValue(String name, String value) {
-
- FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();
- if (fi == null) {
- fi = getfpdFlash().addNewFvImages();
- }
-
- FvImagesDocument.FvImages.NameValue nv = fi.addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- }
-
- public void removeFvImagesNameValue(int i){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qNameValue = new QName(xmlNs, "NameValue");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qNameValue)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qNameValue);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateFvImagesNameValue(int i, String name, String value){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qNameValue = new QName(xmlNs, "NameValue");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qNameValue)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qNameValue);
- }
- FvImagesDocument.FvImages.NameValue nv = (FvImagesDocument.FvImages.NameValue)cursor.getObject();
- nv.setName(name);
- nv.setValue(value);
- }
- cursor.dispose();
- }
-
- public int getFvImagesNameValueCount() {
-
- FvImagesDocument.FvImages fi = null;
- if ((fi = getfpdFlash().getFvImages()) == null || fi.getNameValueList() == null) {
- return 0;
- }
- return fi.getNameValueList().size();
- }
-
- public void getFvImagesNameValues(String[][] nv) {
-
- FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();
- if (fi == null){
- return;
- }
- List<FvImagesDocument.FvImages.NameValue> l = fi.getNameValueList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.NameValue e = (FvImagesDocument.FvImages.NameValue) li
- .next();
- nv[i][0] = e.getName();
- nv[i][1] = e.getValue();
-
- i++;
- }
- }
-
- public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {
- FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
- if (fis == null || fis.getFvImageList() == null) {
- return;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- if (fi.getType().toString().equals("ImageName")) {
- vImageNames.addAll(fi.getFvImageNamesList());
- return;
- }
- }
- }
-
- public void addFvImageFvImageNames (String[] fvNames) {
- FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
- if (fis == null || fis.getFvImageList() == null) {
- genFvImagesFvImage (fvNames, "ImageName", null);
- return;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- if (fi.getType().toString().equals("ImageName")) {
- addFvImageNamesInFvImage (fi, fvNames);
- return;
- }
- }
- genFvImagesFvImage (fvNames, "ImageName", null);
- }
-
- public void addFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String[] fvNames) {
-
- for (int i = 0; i < fvNames.length; ++i) {
- fi.addFvImageNames(fvNames[i]);
- }
- }
-
- public void addFvImageNamesInFvImage (int i, String[] fvNames) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- addFvImageNamesInFvImage(fi, fvNames);
- }
- cursor.dispose();
- }
-
- public void genFvImagesFvImage(String[] names, String types, Map<String, String> options) {
-
- FvImagesDocument.FvImages fis = null;
- if ((fis = getfpdFlash().getFvImages()) == null) {
- fis = getfpdFlash().addNewFvImages();
- }
-
- //
- //gen FvImage with FvImageNames array
- //
- FvImagesDocument.FvImages.FvImage fi = fis.addNewFvImage();
- for (int i = 0; i < names.length; ++i) {
- fi.addFvImageNames(names[i]);
- }
- fi.setType(FvImageTypes.Enum.forString(types));
- if (options != null){
- setFvImagesFvImageFvImageOptions(options, fi);
- }
- }
-
- private void setFvImagesFvImageFvImageOptions(Map<String, String> options, FvImagesDocument.FvImages.FvImage fi){
- FvImagesDocument.FvImages.FvImage.FvImageOptions fio = fi.getFvImageOptions();
- if (fio == null){
- fio = fi.addNewFvImageOptions();
- }
-
- Set<String> key = options.keySet();
- Iterator<String> i = key.iterator();
- while (i.hasNext()) {
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fio.addNewNameValue();
- String k = (String)i.next();
-
- nv.setName(k);
- nv.setValue((String)options.get(k));
-
- }
-
- }
-
-
- public void removeFvImagesFvImage(int i) {
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qFvImage = new QName(xmlNs, "FvImage");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- /**
- * @param oldFvName
- * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
- */
- public void updateFvImageNameAll (String oldFvName, String newFvName) {
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return;
- }
- ListIterator<FvImagesDocument.FvImages.FvImage> li = getfpdFlash().getFvImages().getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- updateFvImageNamesInFvImage (fi, oldFvName, newFvName);
- if (fi.getFvImageNamesList().size() == 0) {
- li.remove();
- }
- }
- }
-
- public void updateFvImageNamesInFvImage (int i, String oldFvName, String newFvName) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- updateFvImageNamesInFvImage (fi, oldFvName, newFvName);
- }
- cursor.dispose();
- }
- /**
- * @param fi
- * @param oldFvName The FV Name to be replaced.
- * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
- */
- public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {
- QName qFvImageNames = new QName(xmlNs, "FvImageNames");
- XmlCursor cursor = fi.newCursor();
-
- if (cursor.toChild(qFvImageNames)) {
- do {
- String xmlValue = cursor.getTextValue();
- if (xmlValue.equals(oldFvName)){
- if (newFvName != null) {
- cursor.setTextValue(newFvName);
- }
- else {
- cursor.removeXml();
- }
- }
- }while (cursor.toNextSibling(qFvImageNames));
- }
-
- cursor.dispose();
- }
-
- /**update the Type attribute of ith FvImage with new type.
- * @param i
- * @param type
- */
- public void updateFvImagesFvImageType (int i, String type) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- fi.setType(FvImageTypes.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void updateFvImagesFvImage(int i, String[] names, String types, Map<String, String> options){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- fi.setType(FvImageTypes.Enum.forString(types));
-
- //
- // remove old FvImageNames before adding new ones
- //
- QName qFvImageNames = new QName(xmlNs, "FvImageNames");
- cursor.toChild(qFvImageNames);
- cursor.removeXml();
- while (cursor.toNextSibling(qFvImageNames)) {
- cursor.removeXml();
- }
-
- for (int k = 0; k < names.length; ++k) {
- fi.addFvImageNames(names[k]);
- }
- //
- // remove old FvImageOptions before adding new options
- //
- QName qFvImageOptions = new QName(xmlNs, "FvImageOptions");
- cursor.toNextSibling(qFvImageOptions);
- cursor.removeXml();
-
- setFvImagesFvImageFvImageOptions(options, fi);
- }
- cursor.dispose();
- }
-
- public int getFvImagesFvImageCount(String type) {
-
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return 0;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- ListIterator li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
-
- ++i;
- }
-
- return i;
- }
-
- public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return vFvImage;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- if (fi.getFvImageNamesList().contains(fvName)) {
- vFvImage.add(fi);
- }
- }
-
- return vFvImage;
- }
- /**
- * @param saa
- * @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.
- */
- public void getFvImagesFvImages(String[][] saa, String type) {
-
- if (getfpdFlash().getFvImages() == null) {
- return;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l == null) {
- return;
- }
- ListIterator li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- //
- // get FvImageNames array, space separated
- //
- List<String> lfn = fi.getFvImageNamesList();
- ListIterator lfni = lfn.listIterator();
- saa[i][0] = " ";
- while (lfni.hasNext()) {
- saa[i][0] += (String)lfni.next();
- saa[i][0] += " ";
- }
- saa[i][0] = saa[i][0].trim();
-
- saa[i][1] = fi.getType()+"";
-
- ++i;
- }
- }
-
- public void removeFvImageNameValue (int i, String attributeName) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- removeFvImageNameValue (fi, attributeName);
- }
- cursor.dispose();
- }
- /**Remove from fi the attribute pair with attributeName in FvImageOptions.
- * @param fi
- * @param attributeName
- */
- public void removeFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String attributeName) {
- if (fi.getFvImageOptions() != null && fi.getFvImageOptions().getNameValueList() != null) {
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- if (nv.getName().equals(attributeName)) {
- li.remove();
- }
- }
- }
- }
-
- public void removeTypedNamedFvImageNameValue (String fvName, String type, String optName) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName(fvName, type);
- for (int i = 0; i < vFvImage.size(); ++i) {
- FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
- removeFvImageNameValue (fi, optName);
- }
- }
-
- /**Add name-value pair to FvImage element with type.
- * @param fvName FV name to add name-value pair.
- * @param type FvImage attribute.
- * @param name
- * @param value
- */
- public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value, String newName) {
- boolean fvImageExists = false;
- if (getfpdFlash().getFvImages() != null) {
-
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l != null) {
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage) li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- if (!fi.getFvImageNamesList().contains(fvName)) {
- continue;
- }
- fvImageExists = true;
- setFvImagesFvImageNameValue(fi, name, value, newName);
- }
- }
- }
-
- if (!fvImageExists) {
- HashMap<String, String> map = new HashMap<String, String>();
- map.put(name, value);
- genFvImagesFvImage(new String[] { fvName }, type, map);
- }
- }
-
- /**Add to all FvImage elements with type, the name-value pair.
- * @param type
- * @param name
- * @param value
- */
- public void setTypedFvImageNameValue (String type, String name, String value) {
- if (getfpdFlash().getFvImages() == null) {
- return;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l == null) {
- return;
- }
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- setFvImagesFvImageNameValue (fi, name, value, null);
- }
-
- }
-
- public void setFvImagesFvImageNameValue (int i, String name, String value) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- setFvImagesFvImageNameValue (fi, name, value, null);
- }
- cursor.dispose();
- }
-
- /**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.
- * @param fi
- * @param name
- * @param value
- * @param newName
- */
- public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {
- if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.addNewFvImageOptions().addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- return;
- }
-
- XmlCursor cursor = fi.getFvImageOptions().newCursor();
- if (cursor.toFirstChild()) {
- do {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();
- if (nv.getName().equals(name)) {
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- cursor.dispose();
- return;
- }
- }while (cursor.toNextSibling());
- }
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- cursor.dispose();
- }
-
- public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");
- for (int i = 0; i < vFvImage.size(); ++i) {
- FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
- if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
- continue;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()
- .getNameValueList()
- .listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- m.put(nv.getName(), nv.getValue());
- }
- }
- }
-
- public int getFvImagePosInFvImages (String fvNameList, String type) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return -1;
- }
-
- int pos = -1;
- String[] fvNameArray = fvNameList.trim().split(" ");
- Vector<String> vFvNames = new Vector<String>();
-
-
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- do {
- pos++;
- vFvNames.removeAllElements();
- for (int i = 0; i < fvNameArray.length; ++i) {
- vFvNames.add(fvNameArray[i]);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- if (!fi.getType().toString().equals(type)) {
- continue;
- }
- if (fi.getFvImageNamesList() == null || fi.getFvImageNamesList().size() != vFvNames.size()) {
- continue;
- }
- ListIterator<String> li = fi.getFvImageNamesList().listIterator();
- while (li.hasNext()) {
- String name = li.next();
- vFvNames.remove(name);
- }
- if (vFvNames.size() == 0) {
- cursor.dispose();
- return pos;
- }
-
- }while (cursor.toNextSibling(qFvImage));
-
- }
- cursor.dispose();
- return -1;
- }
- /**Get FvImage Options for FvImage i
- * @param i the ith FvImage
- */
- public void getFvImagesFvImageOptions(int i, Map<String, String> m) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null){
- cursor.dispose();
- return;
- }
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();
- while(li.hasNext()){
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- m.put(nv.getName(), nv.getValue());
- }
- }
- cursor.dispose();
- }
-
- /**
- Get platform header element
- @return PlatformHeaderDocument.PlatformHeader
- **/
- public PlatformHeaderDocument.PlatformHeader getFpdHdr() {
- if (fpdHdr == null) {
- fpdHdr = fpdRoot.addNewPlatformHeader();
- }
-
- return fpdHdr;
- }
-
- public String getFpdHdrPlatformName() {
- return getFpdHdr().getPlatformName();
- }
-
- public String getFpdHdrGuidValue() {
- return getFpdHdr().getGuidValue();
- }
-
- public String getFpdHdrVer() {
- return getFpdHdr().getVersion();
- }
-
- public String getFpdHdrAbs() {
- return getFpdHdr().getAbstract();
- }
-
- public String getFpdHdrDescription() {
- return getFpdHdr().getDescription();
- }
-
- public String getFpdHdrCopyright() {
- return getFpdHdr().getCopyright();
- }
-
- public String getFpdHdrLicense() {
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- return null;
- }
- return l.getStringValue();
- }
-
- public String getFpdHdrUrl() {
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- return null;
- }
- return l.getURL();
- }
-
- public String getFpdHdrSpec() {
-
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-// return getFpdHdr().getSpecification();
- }
-
- public void setFpdHdrPlatformName(String name){
- getFpdHdr().setPlatformName(name);
- }
-
- public void setFpdHdrGuidValue(String guid){
- getFpdHdr().setGuidValue(guid);
- }
-
- public void setFpdHdrVer(String v){
- getFpdHdr().setVersion(v);
- }
-
- public void setFpdHdrAbs(String abs) {
- getFpdHdr().setAbstract(abs);
- }
-
- public void setFpdHdrDescription(String desc){
- getFpdHdr().setDescription(desc);
- }
-
- public void setFpdHdrCopyright(String cr) {
- getFpdHdr().setCopyright(cr);
- }
-
- public void setFpdHdrLicense(String license){
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- getFpdHdr().addNewLicense().setStringValue(license);
- }
- else {
- l.setStringValue(license);
- }
- }
-
- public void setFpdHdrUrl(String url){
- LicenseDocument.License l = getFpdHdr().getLicense();
-
- l.setURL(url);
-
- }
-
- public void setFpdHdrSpec(String s){
- s = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
- getFpdHdr().setSpecification(s);
- }
- /**
- Save the processed xml contents to file
-
- @param fpdFile The file to save xml contents
- @throws IOException Exceptions during file operation
- **/
- public void saveAs(File fpdFile) throws IOException {
-
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- try {
- fpdd.save(fpdFile, options);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- private String listToString(List l) {
- if (l == null) {
- return null;
- }
- String s = " ";
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- s += li.next();
- s += " ";
- }
- return s.trim();
- }
-
- private void removeElement(XmlObject o) {
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- cursor.dispose();
- }
-}
-
-class PcdItemTypeConflictException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdItemTypeConflictException (String pcdName, String info) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(info);
- if (mi != null) {
- details = pcdName + " ItemType Conflicts with " + mi.getName() + "\n in Pkg " + mi.getPackageId().getName();
- }
- else {
- details = pcdName + " ItemType Conflicts with \n" + info;
- }
- }
-
- PcdItemTypeConflictException (String pcdName, String info1, String info2) {
- ModuleIdentification mi1 = WorkspaceProfile.getModuleId(info1);
- ModuleIdentification mi2 = WorkspaceProfile.getModuleId(info2);
- String moduleInfo1 = "";
- String moduleInfo2 = "";
- if (mi1 != null) {
- moduleInfo1 = mi1.getName() + " in Pkg " + mi1.getPackageId().getName();
- }
- else {
- moduleInfo1 = info1;
- }
-
- if (mi2 != null) {
- moduleInfo2 = mi2.getName() + " in Pkg " + mi2.getPackageId().getName();
- }
- else {
- moduleInfo2 = info2;
- }
-
- details = pcdName + " ItemType Conflicts in \n" + moduleInfo1 + "\n and " + moduleInfo2;
- }
-
- public String getMessage() {
- return details;
- }
-}
-
-class PcdDeclNotFound extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdDeclNotFound(String info) {
- details = "PcdDeclNotFound: " + info;
- }
-
- public String getMessage() {
- return details;
- }
-}
-
-class PcdValueMalFormed extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdValueMalFormed(String info) {
- details = "PcdValueMalFormed: " + info;
- }
-
- public String getMessage() {
- return details;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java deleted file mode 100644 index 29a6219e51..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ /dev/null @@ -1,3239 +0,0 @@ -/** @file
- Java class FpdFlash is GUI for Flash element operation in SPD file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JCheckBox;
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JComboBox;
-import java.awt.Dimension;
-import javax.swing.JSplitPane;
-
-public class FpdFlash extends IInternalFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private final int startIndexOfDynamicTab = 2;
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentSouth = null;
- private JPanel jPanelContentWest = null;
- private JPanel jPanelContentNorth = null;
- private JTabbedPane jTabbedPane = null;
- private JPanel jPanelFvImages = null;
- private JPanel jPanelFvImageS = null;
- private JPanel jPanelFvImageN = null;
- private JCheckBox jCheckBoxFvProperty = null;
- private JLabel jLabelFvPropName = null;
- private JTextField jTextFieldFvPropName = null;
- private JLabel jLabelFvPropValue = null;
- private JTextField jTextFieldFvPropValue = null;
- private JButton jButtonFvPropAdd = null;
- private JScrollPane jScrollPaneFvProp = null;
- private JTable jTableFvProp = null;
- private JPanel jPanelFvPropButtonGroup = null;
- private JButton jButtonFvPropDel = null;
- private DefaultTableModel fvPropertyTableModel = null;
- private DefaultTableModel fvImageNameTableModel = null;
- private ImageParaTableModel fvImageParaTableModel = null;
- private DefaultTableModel fvOptionTableModel = null;
- private JPanel jPanelFvImageC = null;
- private JLabel jLabelFvParaType = null;
- private JComboBox jComboBoxFvParaType = null;
- private JLabel jLabelFvImageNames = null;
- private JLabel jLabelFvParaName = null;
- private JTextField jTextFieldFvParaName = null;
- private JButton jButtonFvNameAdd = null;
- private JScrollPane jScrollPaneFvImageNames = null;
- private JTable jTableFvImageNames = null;
- private JButton jButtonFvNameDel = null;
- private JPanel jPanelFvImageOpts = null;
- private JButton jButtonAddFvImage = null;
- private JScrollPane jScrollPaneFvInfo = null;
- private JTable jTableFvInfo = null;
- private JButton jButtonDelFvImage = null;
- private JPanel jPanelFvImagePara = null;
- private OpeningPlatformType docConsole = null;
- private FpdFileContents ffc = null;
- private JPanel jPanelFdf = null;
- private JCheckBox jCheckBoxFdf = null;
- private JTextField jTextFieldFdf = null;
- private JButton jButtonFdfBrowse = null;
- private JLabel jLabelFvImageOptName = null;
- private JTextField jTextFieldFvImageOptName = null;
- private JLabel jLabelFvImageOptValue = null;
- private JTextField jTextFieldFvImageOptValue = null;
- private JPanel jPanelFvImageOptsButtonGroup = null;
- private JButton jButtonFvImageOptAdd = null;
- private JButton jButtonFvImageOptDel = null;
- private JScrollPane jScrollPane = null;
- private JTable jTableFvImageOpts = null;
- private JButton jButtonUpdateFvImage = null;
- private JPanel jPanelFdfN = null;
- private JPanel jPanelFdfS = null;
- private JSplitPane jSplitPaneFdfC = null;
- private JPanel jPanelFdfCTop = null;
- private JPanel jPanelFdfCBottom = null;
- private JPanel jPanelFdfCTopN = null;
- private JPanel jPanelFdfCTopS = null;
-// private JPanel jPanelFdfCTopC = null;
- private JPanel jPanelFdfCBottomN = null;
-// private JPanel jPanelFdfCBottomC = null;
- private JLabel jLabelFvInFdf = null;
- private JLabel jLabelFvAdditional = null;
- private JScrollPane jScrollPaneFvInFdf = null;
- private JTable jTableFvInFdf = null;
- private IDefaultTableModel fvInFdfTableModel = null; // @jve:decl-index=0:visual-constraint=""
- private JButton jButtonFvInFdfOptions = null;
- private JScrollPane jScrollPaneFvAdditional = null;
- private JTable jTableFvAdditional = null;
- private DefaultTableModel fvAdditionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
- private JButton jButtonAddFv = null;
- private JButton jButtonDelFv = null;
- private JButton jButtonAddFvOptions = null;
- private int tabIndexForFv = -1;
- private int selectedRowInFvAdditionalTable = -1;
- private String oldFvName = null;
- private Vector<String> vBlockSize = new Vector<String>();
- private String determinedFvBlockSize = null;
- private final String defaultBlkSize = "0x10000";
- private String erasePolarity = "";
- boolean memModified = false;
- private FvOptsTableModel fvInFdfOptTableModel = null;
- private FvOptsTableModel fvAdditionalOptTableModel = null;
- private boolean sizeFromOptionDlg = false;
- private boolean fileFromOptionDlg = false;
- private JLabel jLabelOptions = null;
- private JPanel jPanelBgFvName = null;
- private JPanel jPanelBgFvImage = null;
- private JPanel jPanelW = null;
- private JPanel jPanelFvImageParaN = null;
- private JPanel jPanelFvImageParaS = null;
-// private JPanel jPanelFvImageParaC = null;
- private JPanel jPanelFvImageOptsN = null;
- private JPanel jPanelFvImageOptsS = null;
-// private JPanel jPanelFvImageOptsC = null;
- private JPanel jPanelFvImageParaE = null;
- private JPanel jPanelFvImageOptsE = null;
- private JPanel jPanelFvImageSN = null;
- private JPanel jPanelFvImageSE = null;
- private JPanel jPanelFvImageSS = null;
-
- public FpdFlash() {
- super();
- // TODO Auto-generated constructor stub
-
- initialize();
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- public FpdFlash(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdFlash(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (memModified) {
- docConsole.setSaved(false);
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Platform Synced with FDF file.");
- memModified = false;
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout7 = new FlowLayout();
- flowLayout7.setVgap(50);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout7);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentSouth() {
- if (jPanelContentSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- flowLayout.setHgap(15);
- jPanelContentSouth = new JPanel();
- jPanelContentSouth.setLayout(flowLayout);
- jPanelContentSouth.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
- }
- return jPanelContentSouth;
- }
-
- /**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentWest() {
- if (jPanelContentWest == null) {
- jPanelContentWest = new JPanel();
- }
- return jPanelContentWest;
- }
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentNorth() {
- if (jPanelContentNorth == null) {
- jPanelContentNorth = new JPanel();
- }
- return jPanelContentNorth;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("General", null, getJPanelFdf(), null);
- jTabbedPane.addTab("Advanced", null, getJPanelFvImages(), null);
-
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes jPanelFvImages
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImages() {
- if (jPanelFvImages == null) {
- jPanelFvImages = new JPanel();
- jPanelFvImages.setLayout(new BorderLayout());
- jPanelFvImages.add(getJPanelFvImageN(), java.awt.BorderLayout.NORTH);
- jPanelFvImages.add(getJPanelFvImageS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImages.add(getJPanelFvImageC(), java.awt.BorderLayout.CENTER);
- jPanelFvImages.add(getJPanelW(), java.awt.BorderLayout.EAST);
- jPanelFvImages.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
-// fvImageParaTableModel.setRowCount(0);
-// fvPropertyTableModel.setRowCount(0);
-
-
- }
- });
-
- }
- return jPanelFvImages;
- }
-
- /**
- * This method initializes jPanelFvImageN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageS() {
- if (jPanelFvImageS == null) {
- jLabelFvPropValue = new JLabel();
- jLabelFvPropValue.setText("Value");
- jLabelFvPropValue.setEnabled(false);
- jLabelFvPropValue.setPreferredSize(new java.awt.Dimension(38,20));
- jLabelFvPropName = new JLabel();
- jLabelFvPropName.setText("Name");
- jLabelFvPropName.setEnabled(false);
- jLabelFvPropName.setPreferredSize(new java.awt.Dimension(38,20));
- jPanelFvImageS = new JPanel();
- jPanelFvImageS.setPreferredSize(new java.awt.Dimension(576,130));
- jPanelFvImageS.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
- jPanelFvImageS.setLayout(new BorderLayout());
- jPanelFvImageS.add(getJPanelFvImageSN(), java.awt.BorderLayout.NORTH);
- jPanelFvImageS.add(getJPanelFvImageSE(), java.awt.BorderLayout.EAST);
- jPanelFvImageS.add(getJPanelFvImageSS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImageS.add(getJScrollPaneFvProp(), java.awt.BorderLayout.CENTER);
-
- }
- return jPanelFvImageS;
- }
-
- /**
- * This method initializes jPanelFvImageS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageN() {
- if (jPanelFvImageN == null) {
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.setRows(1);
- jPanelFvImageN = new JPanel();
- jPanelFvImageN.setPreferredSize(new java.awt.Dimension(480,150));
- jPanelFvImageN.setLayout(gridLayout2);
- jPanelFvImageN.add(getJScrollPaneFvInfo(), null);
- }
- return jPanelFvImageN;
- }
-
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFvProperty() {
- if (jCheckBoxFvProperty == null) {
- jCheckBoxFvProperty = new JCheckBox();
- jCheckBoxFvProperty.setText("Global FV Variables");
- jCheckBoxFvProperty.addItemListener(new ItemListener(){
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
- boolean seleted = jCheckBoxFvProperty.isSelected();
-
- jLabelFvPropName.setEnabled(seleted);
- jTextFieldFvPropName.setEnabled(seleted);
- jLabelFvPropValue.setEnabled(seleted);
- jTextFieldFvPropValue.setEnabled(seleted);
- jTableFvProp.setEnabled(seleted);
- jButtonFvPropAdd.setEnabled(seleted);
- jButtonFvPropDel.setEnabled(seleted);
-
-
- }
-
- });
- }
- return jCheckBoxFvProperty;
- }
-
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvPropName() {
- if (jTextFieldFvPropName == null) {
- jTextFieldFvPropName = new JTextField();
- jTextFieldFvPropName.setPreferredSize(new java.awt.Dimension(100,20));
- jTextFieldFvPropName.setEnabled(false);
- }
- return jTextFieldFvPropName;
- }
-
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvPropValue() {
- if (jTextFieldFvPropValue == null) {
- jTextFieldFvPropValue = new JTextField();
- jTextFieldFvPropValue.setPreferredSize(new java.awt.Dimension(100,20));
- jTextFieldFvPropValue.setEnabled(false);
- }
- return jTextFieldFvPropValue;
- }
-
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvPropAdd() {
- if (jButtonFvPropAdd == null) {
- jButtonFvPropAdd = new JButton();
- jButtonFvPropAdd.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvPropAdd.setEnabled(false);
- jButtonFvPropAdd.setText("Add");
- jButtonFvPropAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTextFieldFvPropName.getText().length() > 0 && jTextFieldFvPropValue.getText().length() > 0){
- String[] row = {jTextFieldFvPropName.getText(), jTextFieldFvPropValue.getText()};
- fvPropertyTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genFvImagesNameValue(row[0], row[1]);
- }
- }
- });
- }
- return jButtonFvPropAdd;
- }
-
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvProp() {
- if (jScrollPaneFvProp == null) {
- jScrollPaneFvProp = new JScrollPane();
- jScrollPaneFvProp.setPreferredSize(new java.awt.Dimension(350,100));
- jScrollPaneFvProp.setViewportView(getJTableFvProp());
- }
- return jScrollPaneFvProp;
- }
-
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvProp() {
- if (jTableFvProp == null) {
- fvPropertyTableModel = new DefaultTableModel();
- jTableFvProp = new JTable(fvPropertyTableModel);
- fvPropertyTableModel.addColumn("Name");
- fvPropertyTableModel.addColumn("Value");
- jTableFvProp.setRowHeight(20);
- jTableFvProp.setEnabled(false);
-
- jTableFvProp.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvProp.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
-// selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableFvProp.getModel().addTableModelListener(new TableModelListener(){
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- String name = m.getValueAt(row, 0) + "";
- String value = m.getValueAt(row, 1) + "";
- docConsole.setSaved(false);
- ffc.updateFvImagesNameValue(row, name, value);
- }
- }
- });
- }
- return jTableFvProp;
- }
-
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvPropButtonGroup() {
- if (jPanelFvPropButtonGroup == null) {
- jPanelFvPropButtonGroup = new JPanel();
- jPanelFvPropButtonGroup.setPreferredSize(new java.awt.Dimension(80,55));
-
- jPanelFvPropButtonGroup.add(getJButtonFvPropAdd(), null);
- jPanelFvPropButtonGroup.add(getJButtonFvPropDel(), null);
- }
- return jPanelFvPropButtonGroup;
- }
-
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvPropDel() {
- if (jButtonFvPropDel == null) {
- jButtonFvPropDel = new JButton();
- jButtonFvPropDel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvPropDel.setEnabled(false);
- jButtonFvPropDel.setText("Delete");
- jButtonFvPropDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTableFvProp.getSelectedRow() >= 0){
- fvPropertyTableModel.removeRow(jTableFvProp.getSelectedRow());
- docConsole.setSaved(false);
- ffc.removeFvImagesNameValue(jTableFvProp.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvPropDel;
- }
-
-
- /**
- * This method initializes jPanelFvImageC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageC() {
- if (jPanelFvImageC == null) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(2);
- jLabelFvParaName = new JLabel();
- jLabelFvParaName.setPreferredSize(new Dimension(38, 20));
- jLabelFvParaName.setText("Name");
- jLabelFvImageNames = new JLabel();
- jLabelFvImageNames.setText("FV Image Names");
- jLabelFvImageNames.setPreferredSize(new java.awt.Dimension(150,20));
- jLabelFvParaType = new JLabel();
- jLabelFvParaType.setText("Type");
- jLabelFvParaType.setPreferredSize(new java.awt.Dimension(70,20));
- jPanelFvImageC = new JPanel();
- jPanelFvImageC.setLayout(gridLayout);
- jPanelFvImageC.add(getJPanelFvImagePara(), null);
- jPanelFvImageC.add(getJPanelFvImageOpts(), null);
-
-
- }
- return jPanelFvImageC;
- }
-
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxFvParaType() {
- if (jComboBoxFvParaType == null) {
- jComboBoxFvParaType = new JComboBox();
- jComboBoxFvParaType.addItem("Attributes");
- jComboBoxFvParaType.addItem("Components");
- jComboBoxFvParaType.setSelectedIndex(0);
- jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));
- jComboBoxFvParaType.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO disable attribute settings when ValidImageNames selected.
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String oldType = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, oldType);
- if (fvImagePos < 0) {
- return;
- }
-
- String type = jComboBoxFvParaType.getSelectedItem()+"";
- ffc.updateFvImagesFvImageType(fvImagePos, type);
- jTableFvInfo.setValueAt(type, selectedRow, 1);
- docConsole.setSaved(false);
- }
-
- });
- }
- return jComboBoxFvParaType;
- }
-
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvParaName() {
- if (jTextFieldFvParaName == null) {
- jTextFieldFvParaName = new JTextField();
- jTextFieldFvParaName.setPreferredSize(new java.awt.Dimension(140,20));
- }
- return jTextFieldFvParaName;
- }
-
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvNameAdd() {
- if (jButtonFvNameAdd == null) {
- jButtonFvNameAdd = new JButton();
- jButtonFvNameAdd.setPreferredSize(new Dimension(80, 20));
- jButtonFvNameAdd.setEnabled(true);
- jButtonFvNameAdd.setText("Add");
- jButtonFvNameAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTextFieldFvParaName.getText().length() > 0){
- String[] row = {jTextFieldFvParaName.getText()};
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
-
- if (fvImagePos < 0) {
- // new FvImage.
- ffc.genFvImagesFvImage(row, jComboBoxFvParaType.getSelectedItem()+"", null);
- }
- else {
- //append Fv name.
- ffc.addFvImageNamesInFvImage(fvImagePos, row);
- }
- docConsole.setSaved(false);
- fvImageNameTableModel.addRow(row);
- fvNameList += " ";
- fvNameList += row[0];
- jTableFvInfo.setValueAt(fvNameList.trim(), selectedRow, 0);
- jTableFvImageNames.changeSelection(jTableFvImageNames.getRowCount() - 1, 0, false, false);
- }
- }
- });
- }
- return jButtonFvNameAdd;
- }
-
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvImageNames() {
- if (jScrollPaneFvImageNames == null) {
- jScrollPaneFvImageNames = new JScrollPane();
- jScrollPaneFvImageNames.setPreferredSize(new java.awt.Dimension(350,80));
- jScrollPaneFvImageNames.setViewportView(getJTableFvImageNames());
- }
- return jScrollPaneFvImageNames;
- }
-
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvImageNames() {
- if (jTableFvImageNames == null) {
- fvImageNameTableModel = new IDefaultTableModel();
- jTableFvImageNames = new JTable(fvImageNameTableModel);
- jTableFvImageNames.setRowHeight(20);
- fvImageNameTableModel.addColumn("FV Image Name");
-
- }
- return jTableFvImageNames;
- }
-
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvNameDel() {
- if (jButtonFvNameDel == null) {
- jButtonFvNameDel = new JButton();
- jButtonFvNameDel.setPreferredSize(new Dimension(80, 20));
- jButtonFvNameDel.setEnabled(true);
- jButtonFvNameDel.setText("Delete");
- jButtonFvNameDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFvImageNames.getSelectedRow() >= 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String selectedFvName = jTableFvImageNames.getValueAt(jTableFvImageNames.getSelectedRow(), 0)+"";
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
-
- if (fvImagePos < 0) {
- return;
- }
- else {
- //delete Fv name.
- ffc.updateFvImageNamesInFvImage(fvImagePos, selectedFvName, null);
- }
- docConsole.setSaved(false);
- String newList = removeFvNameFromList(fvNameList, selectedFvName);
- jTableFvInfo.setValueAt(newList, selectedRow, 0);
- fvImageNameTableModel.removeRow(jTableFvImageNames.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvNameDel;
- }
-
- private String removeFvNameFromList (String list, String name) {
- String[] nameArray = list.split(" ");
- int occursAt = -1;
- for (int i = 0; i < nameArray.length; ++i) {
- if (nameArray[i].equals(name)) {
- occursAt = i;
- break;
- }
- }
-
- if (occursAt == -1) {
- return list;
- }
-
- String newList = " ";
- for (int j = 0; j < nameArray.length; ++j) {
- if (j != occursAt) {
- newList += nameArray[j];
- newList += " ";
- }
- }
-
- return newList.trim();
- }
-
-
- private JPanel getJPanelFvImageOpts() {
-
-
- if (jPanelFvImageOpts == null) {
- //ToDo add ButtonGroup for RadioButtons
- jLabelOptions = new JLabel();
- jLabelOptions.setText("Attribute");
- jLabelFvImageOptValue = new JLabel();
- jLabelFvImageOptValue.setEnabled(true);
- jLabelFvImageOptValue.setText("Value");
- jLabelFvImageOptValue.setPreferredSize(new Dimension(38, 20));
- jLabelFvImageOptName = new JLabel();
- jLabelFvImageOptName.setEnabled(true);
- jLabelFvImageOptName.setText("Name");
- jLabelFvImageOptName.setPreferredSize(new Dimension(38, 20));
- jPanelFvImageOpts = new JPanel();
- jPanelFvImageOpts.setLayout(new BorderLayout());
- jPanelFvImageOpts.setPreferredSize(new java.awt.Dimension(450,130));
-
-
- jPanelFvImageOpts.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
-
- jPanelFvImageOpts.add(getJPanelFvImageOptsN(), java.awt.BorderLayout.NORTH);
- jPanelFvImageOpts.add(getJPanelFvImageOptsS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImageOpts.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
-
- jPanelFvImageOpts.add(getJPanelFvImageOptsE(), java.awt.BorderLayout.EAST);
- }
- return jPanelFvImageOpts;
- }
-
-
- /**
- * This method initializes jButton4
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFvImage() {
- if (jButtonAddFvImage == null) {
- jButtonAddFvImage = new JButton();
- jButtonAddFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonAddFvImage.setText("New FV Attributes");
- jButtonAddFvImage.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
-
-// String imageName = " ";
-// for (int i = 0; i < jTableFvImageNames.getRowCount(); ++i){
-// imageName += (String)jTableFvImageNames.getValueAt(i, 0);
-// imageName += " ";
-// }
-// imageName = imageName.trim();
-
-// LinkedHashMap<String, String> m = null;
-// m = new LinkedHashMap<String, String>();
-// getOptionNameValue(m);
-// ffc.genFvImagesFvImage(imageName.split(" "), jComboBoxFvParaType.getSelectedItem()+"", m);
-// docConsole.setSaved(false);
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- Object[] row = {"", jComboBoxFvParaType.getSelectedItem()};
- fvImageParaTableModel.addRow(row);
- jTableFvInfo.changeSelection(jTableFvInfo.getRowCount() - 1, 0, false, false);
- }
- });
- }
- return jButtonAddFvImage;
- }
-
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvInfo() {
- if (jScrollPaneFvInfo == null) {
- jScrollPaneFvInfo = new JScrollPane();
- jScrollPaneFvInfo.setPreferredSize(new java.awt.Dimension(480,150));
- jScrollPaneFvInfo.setViewportView(getJTableFvInfo());
- }
- return jScrollPaneFvInfo;
- }
-
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvInfo() {
- if (jTableFvInfo == null) {
- fvImageParaTableModel = new ImageParaTableModel();
- jTableFvInfo = new JTable(fvImageParaTableModel);
- fvImageParaTableModel.addColumn("FvImageNames");
- fvImageParaTableModel.addColumn("Type");
-
- jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvInfo.setRowHeight(20);
- jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- String fvNameList = fvImageParaTableModel.getValueAt(selectedRow, 0)+"";
- String type = fvImageParaTableModel.getValueAt(selectedRow, 1)+"";
- jComboBoxFvParaType.setSelectedItem(type);
- String[] fvNames = fvNameList.split(" ");
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- for (int i = 0; i < fvNames.length; ++i) {
- String[] row = { fvNames[i] };
- if (row[0].length() > 0) {
- fvImageNameTableModel.addRow(row);
- }
- }
-
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- if (fvImagePos < 0) {
- return;
- }
- LinkedHashMap<String, String> optionMap = new LinkedHashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvImagePos, optionMap);
- if (optionMap.size() > 0){
- Set<String> key = optionMap.keySet();
- Iterator<String> i = key.iterator();
- while (i.hasNext()) {
- String k = (String)i.next();
- String[] row = {k, optionMap.get(k)};
- fvOptionTableModel.addRow(row);
- }
- }
- }
- }
- });
-
-
- }
- return jTableFvInfo;
- }
-
-
- /**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelFvImage() {
- if (jButtonDelFvImage == null) {
- jButtonDelFvImage = new JButton();
- jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonDelFvImage.setText("Delete FV Attributes");
- jButtonDelFvImage.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFvInfo.getSelectedRow() >= 0 ) {
- String fvNameList = fvImageParaTableModel.getValueAt(jTableFvInfo.getSelectedRow(), 0)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, jComboBoxFvParaType.getSelectedItem()+"");
-
- ffc.removeFvImagesFvImage(fvImagePos);
- fvImageParaTableModel.removeRow(jTableFvInfo.getSelectedRow());
- docConsole.setSaved(false);
-
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- }
- }
-
- });
- }
- return jButtonDelFvImage;
- }
-
-
- /**
- * This method initializes jPanel6
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImagePara() {
- if (jPanelFvImagePara == null) {
- StarLabel starLabel = new StarLabel();
- starLabel.setVisible(false);
- jPanelFvImagePara = new JPanel();
- jPanelFvImagePara.setLayout(new BorderLayout());
- jPanelFvImagePara.setPreferredSize(new java.awt.Dimension(450,140));
- jPanelFvImagePara.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jPanelFvImagePara.add(getJPanelFvImageParaN(), java.awt.BorderLayout.NORTH);
- jPanelFvImagePara.add(getJPanelFvImageParaS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImagePara.add(getJScrollPaneFvImageNames(), java.awt.BorderLayout.CENTER);
-
- jPanelFvImagePara.add(getJPanelFvImageParaE(), java.awt.BorderLayout.EAST);
-//
-//
-//
- }
- return jPanelFvImagePara;
- }
-
- /**
- * This method initializes jPanel7
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdf() {
- if (jPanelFdf == null) {
- jPanelFdf = new JPanel();
- jPanelFdf.setLayout(new BorderLayout());
-
- jPanelFdf.add(getJPanelFdfN(), java.awt.BorderLayout.NORTH);
- jPanelFdf.add(getJPanelFdfS(), java.awt.BorderLayout.SOUTH);
- jPanelFdf.add(getJSplitPaneFdfC(), java.awt.BorderLayout.CENTER);
- jPanelFdf.addComponentListener(new ComponentAdapter(){
- public void componentShown(ComponentEvent e) {
-// if (ffc.getFlashDefinitionFile() != null) {
-// jTextFieldFdf.setText(ffc.getFlashDefinitionFile());
-// initFvInFdfTable(Workspace.getCurrenetWorkspace() + File.separator + jTextFieldFdf.getText());
-//
-// }
- }
- public void componentHidden(ComponentEvent e) {
- if (jCheckBoxFdf.isSelected()) {
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- }
- }
- });
- }
- return jPanelFdf;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFdf() {
- if (jCheckBoxFdf == null) {
- jCheckBoxFdf = new JCheckBox();
- jCheckBoxFdf.setText("Flash Definition File");
- jCheckBoxFdf.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
- if (jCheckBoxFdf.isSelected()){
- jTextFieldFdf.setEnabled(true);
- jButtonFdfBrowse.setEnabled(true);
- }
- else {
- getFvInFdfTableModel().setRowCount(0);
- jTextFieldFdf.setEnabled(false);
- jTextFieldFdf.setText("");
- jButtonFdfBrowse.setEnabled(false);
- ffc.genFlashDefinitionFile("");
- docConsole.setSaved(false);
- int selectedBackup = selectedRowInFvAdditionalTable;
- selectedRowInFvAdditionalTable = -1;
- initFvAdditionalTable();
- selectedRowInFvAdditionalTable = selectedBackup;
- }
- }
- });
- }
- return jCheckBoxFdf;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFdf() {
- if (jTextFieldFdf == null) {
- jTextFieldFdf = new JTextField();
- jTextFieldFdf.setEnabled(false);
- jTextFieldFdf.setEditable(false);
- jTextFieldFdf.setPreferredSize(new Dimension(300, 20));
- jTextFieldFdf.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- }
- });
- }
- return jTextFieldFdf;
- }
-
- /**
- * This method initializes jButton5
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFdfBrowse() {
- if (jButtonFdfBrowse == null) {
- jButtonFdfBrowse = new JButton();
- jButtonFdfBrowse.setEnabled(false);
- jButtonFdfBrowse.setText("Browse");
- jButtonFdfBrowse.setPreferredSize(new Dimension(78, 20));
- jButtonFdfBrowse.addActionListener(new AbstractAction(){
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- String wsDir = Workspace.getCurrentWorkspace();
- JFileChooser chooser = new JFileChooser(wsDir);
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(FpdFlash.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- File theFile = chooser.getSelectedFile();
- String filePath = theFile.getPath();
- if (!filePath.startsWith(wsDir)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "You can only select files in current WORKSPACE.");
- return;
- }
- jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- docConsole.setSaved(false);
- initFvInFdfTable(filePath);
- }
- }
-
- });
- }
- return jButtonFdfBrowse;
- }
-
- private void initFvAttributes () {
- if (ffc.getFvImagesFvImageCount("Attributes") == 0 && ffc.getFvImagesFvImageCount("Components") == 0) {
- return;
- }
- String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];
- ffc.getFvImagesFvImages(saa, "Attributes");
-
- int i = 0;
- while (i < saa.length) {
- fvImageParaTableModel.addRow(saa[i]);
- ++i;
- }
-
- saa = new String[ffc.getFvImagesFvImageCount("Components")][2];
- ffc.getFvImagesFvImages(saa, "Components");
- i = 0;
- while (i < saa.length) {
- fvImageParaTableModel.addRow(saa[i]);
- ++i;
- }
-
- saa = new String[ffc.getFvImagesNameValueCount()][2];
- ffc.getFvImagesNameValues(saa);
- for (int m = 0; m < saa.length; ++m) {
- fvPropertyTableModel.addRow(saa[m]);
- }
- }
-
- private void initFvAdditionalTable() {
- Vector<String> vFvNames = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vFvNames);
- for (int i = 0; i < vFvNames.size(); ++i) {
- String fvName = vFvNames.get(i);
- if (fvNameExists(fvName)) {
- continue;
- }
- fvAdditionalTableModel.addRow(getBasicFvInfo(fvName));
- addTabForFv(new FvInfoFromFdf(fvName, "", ""));
- }
- }
-
- private void initFvInFdfTable(String fdfPath){
- Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
- getFvInfoFromFdf(fdfPath, vFvInfo);
- getFlashInfoFromFdf (fdfPath);
- if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "FDF file does NOT contain valid Erase Polarity.");
- }
- else {
- ffc.setTypedFvImageNameValue("Attributes", "EFI_ERASE_POLARITY", erasePolarity);
- }
-
- // BugBug: assume all blocks have same size;
-
- String blkSize = defaultBlkSize;
- if (vBlockSize.size() > 0) {
- blkSize = vBlockSize.get(0);
- if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");
- blkSize = defaultBlkSize;
- }
- }
- determinedFvBlockSize = blkSize;
-
- getFvInFdfTableModel().setRowCount(0);
- Vector<String> vExistingFvNameInFpd = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vExistingFvNameInFpd);
- for (int j = 0; j < vFvInfo.size(); ++j) {
- FvInfoFromFdf fvInfo = vFvInfo.get(j);
- String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
-
- if (row[0].length() > 0 && !vExistingFvNameInFpd.contains(row[0])) {
- ffc.addFvImageFvImageNames(new String[]{row[0]});
- }
-
- // if FV addtional table contains the same FV from fdf file, remove that row.
- for (int k = 0; k < jTableFvAdditional.getRowCount(); ++k) {
- if (fvAdditionalTableModel.getValueAt(k, 0).equals(row[0])) {
- fvAdditionalTableModel.removeRow(k);
- }
- }
- getFvInFdfTableModel().addRow(row);
- try {
- int blockSize = Integer.decode(blkSize);
- int fvSize = Integer.decode(row[1]);
- int numBlocks = fvSize/blockSize;
- HashMap<String, String> mOptions = new HashMap<String, String>();
- // if no options for this FV before, generate a new options entry for this FV.
- if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {
-
- mOptions.put("EFI_BLOCK_SIZE", blkSize);
- mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");
- mOptions.put("EFI_FILE_NAME", row[2]);
- ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);
- memModified = true;
- }
- else {
- ffc.getFvImagesFvImageOptions(row[0], mOptions);
- if (mOptions.get("EFI_BLOCK_SIZE") == null || !mOptions.get("EFI_BLOCK_SIZE").equalsIgnoreCase(blkSize)) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize, null);
- memModified = true;
- }
- if (mOptions.get("EFI_NUM_BLOCKS") == null || Integer.decode(mOptions.get("EFI_NUM_BLOCKS")) != numBlocks) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "", null);
- memModified = true;
- }
- if (mOptions.get("EFI_FILE_NAME") == null || !mOptions.get("EFI_FILE_NAME").equals(row[2])) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2], null);
- memModified = true;
- }
-
- }
- }
- catch (NumberFormatException e){
- JOptionPane.showMessageDialog(FpdFlash.this, e.getMessage());
- }
- }
-
- for (int k = 0; k < vFvInfo.size(); ++k) {
- FvInfoFromFdf fvInfo = vFvInfo.get(k);
- addTabForFv(fvInfo);
- }
-
- }
-
- private void addTabForFv (FvInfoFromFdf fvInfo) {
- String fvName = fvInfo.getFvName();
- String outputFile = fvInfo.getEfiFileName();
- int index = jTabbedPane.indexOfTab(fvName);
- if (index >= startIndexOfDynamicTab) {
- return;
- }
- ModuleOrderPane pane = new ModuleOrderPane(fvName, outputFile, ffc, this);
- pane.showModulesInFv(fvName);
- pane.showAllModulesInPlatform();
- jTabbedPane.addTab(fvName, null, pane, null);
- }
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvImageOptName() {
- if (jTextFieldFvImageOptName == null) {
- jTextFieldFvImageOptName = new JTextField();
- jTextFieldFvImageOptName.setEnabled(true);
- jTextFieldFvImageOptName.setPreferredSize(new Dimension(100, 20));
- }
- return jTextFieldFvImageOptName;
- }
-
- /**
- * This method initializes jTextField5
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvImageOptValue() {
- if (jTextFieldFvImageOptValue == null) {
- jTextFieldFvImageOptValue = new JTextField();
- jTextFieldFvImageOptValue.setEnabled(true);
- jTextFieldFvImageOptValue.setPreferredSize(new Dimension(100, 20));
- }
- return jTextFieldFvImageOptValue;
- }
-
- /**
- * This method initializes jPanel8
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsButtonGroup() {
- if (jPanelFvImageOptsButtonGroup == null) {
- jPanelFvImageOptsButtonGroup = new JPanel();
- jPanelFvImageOptsButtonGroup.setPreferredSize(new Dimension(80, 55));
- jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptAdd(), null);
- jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptDel(), null);
- }
- return jPanelFvImageOptsButtonGroup;
- }
-
- /**
- * This method initializes jButton7
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvImageOptAdd() {
- if (jButtonFvImageOptAdd == null) {
- jButtonFvImageOptAdd = new JButton();
- jButtonFvImageOptAdd.setEnabled(true);
- jButtonFvImageOptAdd.setText("Add");
- jButtonFvImageOptAdd.setPreferredSize(new Dimension(80, 20));
- jButtonFvImageOptAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTextFieldFvImageOptName.getText().length() > 0 && jTextFieldFvImageOptValue.getText().length() > 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- String[] row = {jTextFieldFvImageOptName.getText(), jTextFieldFvImageOptValue.getText()};
-
- if (fvImagePos < 0) {
- return;
- }
- else {
- //append options to FvImage.
- ffc.setFvImagesFvImageNameValue(fvImagePos, row[0], row[1]);
- }
- docConsole.setSaved(false);
- fvOptionTableModel.addRow(row);
- jTableFvImageOpts.changeSelection(jTableFvImageOpts.getRowCount() - 1, 0, false, false);
- }
- }
- });
- }
- return jButtonFvImageOptAdd;
- }
-
- /**
- * This method initializes jButton8
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvImageOptDel() {
- if (jButtonFvImageOptDel == null) {
- jButtonFvImageOptDel = new JButton();
- jButtonFvImageOptDel.setEnabled(true);
- jButtonFvImageOptDel.setText("Delete");
- jButtonFvImageOptDel.setPreferredSize(new Dimension(80, 20));
- jButtonFvImageOptDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTableFvImageOpts.getSelectedRow() >= 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- if (fvImagePos < 0) {
- return;
- }
-
- String optName = fvOptionTableModel.getValueAt(jTableFvImageOpts.getSelectedRow(), 0)+"";
- ffc.removeFvImageNameValue(fvImagePos, optName);
- docConsole.setSaved(false);
- fvOptionTableModel.removeRow(jTableFvImageOpts.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvImageOptDel;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(350,100));
- jScrollPane.setViewportView(getJTableFvImageOpts());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable3
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvImageOpts() {
- if (jTableFvImageOpts == null) {
- fvOptionTableModel = new IDefaultTableModel();
- fvOptionTableModel.addColumn("Name");
- fvOptionTableModel.addColumn("Value");
- jTableFvImageOpts = new JTable(fvOptionTableModel);
-
- jTableFvImageOpts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvImageOpts.setRowHeight(20);
-
- }
- return jTableFvImageOpts;
- }
-
- /**
- * This method initializes jButton9
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonUpdateFvImage() {
- if (jButtonUpdateFvImage == null) {
- jButtonUpdateFvImage = new JButton();
- jButtonUpdateFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonUpdateFvImage.setActionCommand("Update");
- jButtonUpdateFvImage.setText("Update FV Attributes");
- jButtonUpdateFvImage.setVisible(false);
- jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableFvInfo.getSelectedRow();
- if (jTableFvInfo.isEditing()) {
- jTableFvInfo.getCellEditor().stopCellEditing();
- }
- if (jTableFvImageOpts.isEditing()) {
- jTableFvImageOpts.getCellEditor().stopCellEditing();
- }
-
- //ToDo Check data validity before update
- String name = fvImageParaTableModel.getValueAt(row, 0) + "";
- String type = fvImageParaTableModel.getValueAt(row, 1) + "";
-
- LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
- getOptionNameValue(lhm);
-
- docConsole.setSaved(false);
- ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm);
-
- }
- });
- }
- return jButtonUpdateFvImage;
- }
-
- /**
- * This method initializes jPanelFdfN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfN() {
- if (jPanelFdfN == null) {
- jPanelFdfN = new JPanel();
- jPanelFdfN.add(getJCheckBoxFdf(), null);
- jPanelFdfN.add(getJTextFieldFdf(), null);
- jPanelFdfN.add(getJButtonFdfBrowse(), null);
- }
- return jPanelFdfN;
- }
-
- /**
- * This method initializes jPanelFdfS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfS() {
- if (jPanelFdfS == null) {
- FlowLayout flowLayout4 = new FlowLayout();
- flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelFdfS = new JPanel();
- jPanelFdfS.setLayout(flowLayout4);
- jPanelFdfS.add(getJButtonAddFv(), null);
- jPanelFdfS.add(getJButtonDelFv(), null);
- jPanelFdfS.add(getJButtonAddFvOptions(), null);
- }
- return jPanelFdfS;
- }
-
- /**
- * This method initializes jSplitPaneFdfC
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFdfC() {
- if (jSplitPaneFdfC == null) {
- jSplitPaneFdfC = new JSplitPane();
- jSplitPaneFdfC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPaneFdfC.setDividerSize(5);
- jSplitPaneFdfC.setTopComponent(getJPanelFdfCTop());
- jSplitPaneFdfC.setBottomComponent(getJPanelFdfCBottom());
- jSplitPaneFdfC.setDividerLocation(280);
- }
- return jSplitPaneFdfC;
- }
-
- /**
- * This method initializes jPanelFdfCTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTop() {
- if (jPanelFdfCTop == null) {
- jPanelFdfCTop = new JPanel();
- jPanelFdfCTop.setLayout(new BorderLayout());
- jPanelFdfCTop.add(getJPanelFdfCTopN(), java.awt.BorderLayout.NORTH);
- jPanelFdfCTop.add(getJPanelFdfCTopS(), java.awt.BorderLayout.SOUTH);
- jPanelFdfCTop.add(getJScrollPaneFvInFdf(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFdfCTop;
- }
-
- /**
- * This method initializes jPanelFdfCBottom
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCBottom() {
- if (jPanelFdfCBottom == null) {
- jPanelFdfCBottom = new JPanel();
- jPanelFdfCBottom.setLayout(new BorderLayout());
- jPanelFdfCBottom.add(getJPanelFdfCBottomN(), java.awt.BorderLayout.NORTH);
- jPanelFdfCBottom.add(getJScrollPaneFvAdditional(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFdfCBottom;
- }
-
- /**
- * This method initializes jPanelFdfCTopN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTopN() {
- if (jPanelFdfCTopN == null) {
- jLabelFvInFdf = new JLabel();
- jLabelFvInFdf.setText("FVs in Flash Definition File");
- jPanelFdfCTopN = new JPanel();
- jPanelFdfCTopN.add(jLabelFvInFdf, null);
- }
- return jPanelFdfCTopN;
- }
-
- /**
- * This method initializes jPanelFdfCTopS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTopS() {
- if (jPanelFdfCTopS == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelFdfCTopS = new JPanel();
- jPanelFdfCTopS.setLayout(flowLayout1);
- jPanelFdfCTopS.add(getJButtonFvInFdfOptions(), null);
- }
- return jPanelFdfCTopS;
- }
-
- /**
- * This method initializes jPanelFdfCTopC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFdfCTopC() {
-// if (jPanelFdfCTopC == null) {
-// jPanelFdfCTopC = new JPanel();
-// jPanelFdfCTopC.add(getJScrollPaneFvInFdf(), null);
-// }
-// return jPanelFdfCTopC;
-// }
-
- /**
- * This method initializes jPanelFdfCBottomN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCBottomN() {
- if (jPanelFdfCBottomN == null) {
- jLabelFvAdditional = new JLabel();
- jLabelFvAdditional.setText("Additional FVs");
- jPanelFdfCBottomN = new JPanel();
- jPanelFdfCBottomN.add(jLabelFvAdditional, null);
- }
- return jPanelFdfCBottomN;
- }
-
- /**
- * This method initializes jPanelFdfCBottomC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFdfCBottomC() {
-// if (jPanelFdfCBottomC == null) {
-// jPanelFdfCBottomC = new JPanel();
-// jPanelFdfCBottomC.add(getJScrollPaneFvAdditional(), null);
-// }
-// return jPanelFdfCBottomC;
-// }
-
- /**
- * This method initializes jScrollPaneFvInFdf
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvInFdf() {
- if (jScrollPaneFvInFdf == null) {
- jScrollPaneFvInFdf = new JScrollPane();
- jScrollPaneFvInFdf.setPreferredSize(new java.awt.Dimension(653,200));
- jScrollPaneFvInFdf.setViewportView(getJTableFvInFdf());
- }
- return jScrollPaneFvInFdf;
- }
-
- /**
- * This method initializes jTableFvInFdf
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvInFdf() {
- if (jTableFvInFdf == null) {
- jTableFvInFdf = new JTable();
- jTableFvInFdf.setRowHeight(20);
- jTableFvInFdf.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
- jTableFvInFdf.setModel(getFvInFdfTableModel());
- }
- return jTableFvInFdf;
- }
-
- /**
- * This method initializes fvInFdfTableModel
- *
- * @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel
- */
- private IDefaultTableModel getFvInFdfTableModel() {
- if (fvInFdfTableModel == null) {
- fvInFdfTableModel = new IDefaultTableModel();
- fvInFdfTableModel.addColumn("FV Name");
- fvInFdfTableModel.addColumn("Size");
- fvInFdfTableModel.addColumn("Corresponding File Name");
- }
- return fvInFdfTableModel;
- }
-
- /**
- * This method initializes jButtonFvInFdfOptions
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvInFdfOptions() {
- if (jButtonFvInFdfOptions == null) {
- jButtonFvInFdfOptions = new JButton();
- jButtonFvInFdfOptions.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvInFdfOptions.setEnabled(true);
- jButtonFvInFdfOptions.setText("Options");
- jButtonFvInFdfOptions.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvInFdf.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = jTableFvInFdf.getValueAt(selectedRow, 0)+"";
- if (fvName.length() == 0) {
- return;
- }
- DefaultTableModel dtm = getFvInFdfOptTableModel();
- new FpdFvOptions(fvName, dtm, ffc, docConsole);
- }
- });
- }
- return jButtonFvInFdfOptions;
- }
-
- private DefaultTableModel getFvInFdfOptTableModel() {
- if (fvInFdfOptTableModel == null) {
- fvInFdfOptTableModel = new FvOptsTableModel();
- fvInFdfOptTableModel.addColumn("Name");
- fvInFdfOptTableModel.addColumn("Value");
- Vector<Object> v = new Vector<Object>();
- v.add("EFI_BLOCK_SIZE");
- v.add("EFI_NUM_BLOCKS");
- v.add("EFI_FILE_NAME");
- fvInFdfOptTableModel.setVKeyWords(v);
- fvInFdfOptTableModel.setVNonEditableName(v);
- }
- return fvInFdfOptTableModel;
- }
-
- private DefaultTableModel getFvAdditionalOptTableModel() {
- if (fvAdditionalOptTableModel == null) {
- fvAdditionalOptTableModel = new FvOptsTableModel();
- fvAdditionalOptTableModel.addColumn("Name");
- fvAdditionalOptTableModel.addColumn("Value");
- Vector<Object> v = new Vector<Object>();
- v.add("EFI_BLOCK_SIZE");
- v.add("EFI_NUM_BLOCKS");
- v.add("EFI_FILE_NAME");
- fvAdditionalOptTableModel.setVNonEditableName(v);
- }
- return fvAdditionalOptTableModel;
- }
-
- /**
- * This method initializes jScrollPaneFvAdditional
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvAdditional() {
- if (jScrollPaneFvAdditional == null) {
- jScrollPaneFvAdditional = new JScrollPane();
- jScrollPaneFvAdditional.setPreferredSize(new java.awt.Dimension(653,200));
- jScrollPaneFvAdditional.setViewportView(getJTableFvAdditional());
- }
- return jScrollPaneFvAdditional;
- }
-
- /**
- * This method initializes jTableFvAdditional
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvAdditional() {
- if (jTableFvAdditional == null) {
- jTableFvAdditional = new JTable();
- jTableFvAdditional.setRowHeight(20);
- jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
- jTableFvAdditional.setModel(getFvAdditionalTableModel());
-
- jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRowInFvAdditionalTable = lsm.getMinSelectionIndex();
- oldFvName = jTableFvAdditional.getValueAt(selectedRowInFvAdditionalTable, 0)+"";
- }
- }
- });
-
- jTableFvAdditional.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int col = arg0.getColumn();
- TableModel m = (TableModel) arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE) {
- if (col == 0) {
- String newFvName = m.getValueAt(row, 0) + "";
- if (newFvName.equals(oldFvName)) {
- return;
- }
- if (fvNameExists(newFvName)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "This FV already exists. Please choose another FV name.");
- m.setValueAt(oldFvName, row, 0);
- return;
- }
-
- tabIndexForFv = jTabbedPane.indexOfTab(oldFvName);
- if (tabIndexForFv >= startIndexOfDynamicTab) {
- jTabbedPane.setTitleAt(tabIndexForFv, newFvName);
- // change FvName in UserExtensions
- ffc.updateBuildOptionsUserExtensions(oldFvName, newFvName);
- // change FvBinding in ModuleSA
- ffc.appendFvBindingFor(oldFvName, newFvName);
- ffc.removeFvBindingAll(oldFvName);
- // change FvImageNames in Flash
- ffc.updateFvImageNameAll(oldFvName, newFvName);
-
- } else {
- ModuleOrderPane pane = new ModuleOrderPane(newFvName, "", ffc, FpdFlash.this);
- pane.showModulesInFv(newFvName);
- pane.showAllModulesInPlatform();
- jTabbedPane.addTab(newFvName, pane);
- // Add FvImageNames in Flash
- String[] fvNames = {newFvName};
- ffc.addFvImageFvImageNames(fvNames);
- }
- docConsole.setSaved(false);
- oldFvName = newFvName;
- }
-
- if (col == 1 && !sizeFromOptionDlg) {
- String fvSize = m.getValueAt(row, col) + "";
- if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "FV size should be Integer or Hex format.");
- return;
- }
- HashMap<String, String> mFvOpts = new HashMap<String, String>();
- ffc.getFvImagesFvImageOptions(oldFvName, mFvOpts);
- String blkSize = mFvOpts.get("EFI_BLOCK_SIZE");
- if (blkSize == null) {
- if (determinedFvBlockSize != null) {
- blkSize = determinedFvBlockSize;
- }
- else {
- blkSize = defaultBlkSize;
- }
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", blkSize, null);
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(blkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- }
- else {
- if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
- int retVal = JOptionPane.showConfirmDialog(FpdFlash.this, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION);
- if (retVal == JOptionPane.YES_OPTION) {
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", defaultBlkSize, null);
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(defaultBlkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- return;
- }
- else {
- return;
- }
-
- }
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(blkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- }
- }
-
- if (col == 2 && !fileFromOptionDlg) {
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_FILE_NAME", m.getValueAt(row, col)+"", null);
- docConsole.setSaved(false);
- }
-
- }
- }
- });
- }
- return jTableFvAdditional;
- }
-
- private boolean fvNameExistsInFvInFdfTable (String fvName) {
- for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {
- if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean fvNameExists (String fvName) {
- if (fvNameExistsInFvInFdfTable(fvName)) {
- return true;
- }
-
- for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {
- if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method initializes fvAdditionalTableModel
- *
- * @return javax.swing.table.DefaultTableModel
- */
- private DefaultTableModel getFvAdditionalTableModel() {
- if (fvAdditionalTableModel == null) {
- fvAdditionalTableModel = new DefaultTableModel();
- fvAdditionalTableModel.addColumn("FV Name");
- fvAdditionalTableModel.addColumn("Size");
- fvAdditionalTableModel.addColumn("Corresponding File Name");
- }
- return fvAdditionalTableModel;
- }
-
- /**
- * This method initializes jButtonAddFv
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFv() {
- if (jButtonAddFv == null) {
- jButtonAddFv = new JButton();
- jButtonAddFv.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAddFv.setEnabled(true);
- jButtonAddFv.setText("New");
- jButtonAddFv.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFvAdditional.isEditing()) {
- jTableFvAdditional.getCellEditor().stopCellEditing();
- }
- String[] row = {"", "", ""};
- fvAdditionalTableModel.addRow(row);
- }
- });
- }
- return jButtonAddFv;
- }
-
- /**
- * This method initializes jButtonDelFv
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelFv() {
- if (jButtonDelFv == null) {
- jButtonDelFv = new JButton();
- jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDelFv.setEnabled(true);
- jButtonDelFv.setText("Delete");
- jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- //delete row in FvAdditional table.
- int selectedRow = jTableFvAdditional.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";
- fvAdditionalTableModel.removeRow(selectedRow);
- //
- //delete tab with selected FV name.
- //
- jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));
- //delete FV Name from FvImages element.
- ffc.updateFvImageNameAll(fvName, null);
- //delete FvBinding from ModuleSA.
- ffc.removeFvBindingAll(fvName);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonDelFv;
- }
-
- /**
- * This method initializes jButtonAddFvOptions
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFvOptions() {
- if (jButtonAddFvOptions == null) {
- jButtonAddFvOptions = new JButton();
- jButtonAddFvOptions.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAddFvOptions.setEnabled(true);
- jButtonAddFvOptions.setText("Options");
- jButtonAddFvOptions.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvAdditional.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = jTableFvAdditional.getValueAt(selectedRow, 0)+"";
- String oldFvSize = jTableFvAdditional.getValueAt(selectedRow, 1)+"";
- String oldFileName = jTableFvAdditional.getValueAt(selectedRow, 2)+"";
- if (fvName.length() == 0) {
- return;
- }
- DefaultTableModel dtm = getFvAdditionalOptTableModel();
- new FpdFvOptions(fvName, dtm, ffc, docConsole);
-
- String[] updatedFvInfo = getBasicFvInfo (fvName);
- if (!oldFvSize.equalsIgnoreCase(updatedFvInfo[1])) {
- sizeFromOptionDlg = true;
- jTableFvAdditional.setValueAt(updatedFvInfo[1], selectedRow, 1);
- sizeFromOptionDlg = false;
- }
- if (!oldFileName.equals(updatedFvInfo[2])) {
- fileFromOptionDlg = true;
- jTableFvAdditional.setValueAt(updatedFvInfo[2], selectedRow, 2);
- fileFromOptionDlg = false;
- }
- }
- });
- }
- return jButtonAddFvOptions;
- }
-
- private String[] getBasicFvInfo (String fvName) {
- HashMap<String, String> mFvOpts = new HashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvName, mFvOpts);
- String bSize = "";
- String numBlks = "";
- String fvSize = "";
- String fvFile = "";
- if (mFvOpts.get("EFI_FILE_NAME") != null) {
- fvFile = mFvOpts.get("EFI_FILE_NAME");
- }
- if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {
- bSize = mFvOpts.get("EFI_BLOCK_SIZE");
- numBlks = mFvOpts.get("EFI_NUM_BLOCKS");
- boolean blockSizeWellFormat = true;
- boolean numOfBlockWellFormat = true;
- if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {
- blockSizeWellFormat = false;
- JOptionPane.showMessageDialog(FpdFlash.this, fvName + " block size bad format.");
- }
- if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {
- numOfBlockWellFormat = false;
- JOptionPane.showMessageDialog(FpdFlash.this, fvName + " number of blocks bad format.");
- }
- if (blockSizeWellFormat && numOfBlockWellFormat) {
- int size = Integer.decode(bSize);
- int num = Integer.decode(numBlks);
- fvSize = "0x" + Integer.toHexString(size*num);
- }
- }
-
- return new String[]{fvName, fvSize, fvFile};
-
- }
-
- /**
- * This method initializes jPanelBgFvName
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelBgFvName() {
- if (jPanelBgFvName == null) {
- jPanelBgFvName = new JPanel();
- jPanelBgFvName.setPreferredSize(new java.awt.Dimension(80,55));
- jPanelBgFvName.add(getJButtonFvNameAdd(), null);
- jPanelBgFvName.add(getJButtonFvNameDel(), null);
- }
- return jPanelBgFvName;
- }
-
- /**
- * This method initializes jPanelBgFvImage
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelBgFvImage() {
- if (jPanelBgFvImage == null) {
- jPanelBgFvImage = new JPanel();
- jPanelBgFvImage.setPreferredSize(new java.awt.Dimension(150,100));
- jPanelBgFvImage.add(getJButtonAddFvImage(), null);
- jPanelBgFvImage.add(getJButtonDelFvImage(), null);
- jPanelBgFvImage.add(getJButtonUpdateFvImage(), null);
- }
- return jPanelBgFvImage;
- }
-
- /**
- * This method initializes jPanelW
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelW() {
- if (jPanelW == null) {
- jPanelW = new JPanel();
- jPanelW.add(getJPanelBgFvImage(), null);
- }
- return jPanelW;
- }
-
- /**
- * This method initializes jPanelFvImageParaN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaN() {
- if (jPanelFvImageParaN == null) {
- FlowLayout flowLayout3 = new FlowLayout();
- flowLayout3.setAlignment(java.awt.FlowLayout.CENTER);
- jPanelFvImageParaN = new JPanel();
- jPanelFvImageParaN.setLayout(flowLayout3);
- jPanelFvImageParaN.add(new StarLabel(), null);
- jPanelFvImageParaN.add(jLabelFvImageNames, null);
- jPanelFvImageParaN.add(jLabelFvParaName, null);
- jPanelFvImageParaN.add(getJTextFieldFvParaName(), null);
- }
- return jPanelFvImageParaN;
- }
-
- /**
- * This method initializes jPanelFvImageParaS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaS() {
- if (jPanelFvImageParaS == null) {
- FlowLayout flowLayout6 = new FlowLayout();
- flowLayout6.setAlignment(java.awt.FlowLayout.CENTER);
- jPanelFvImageParaS = new JPanel();
- jPanelFvImageParaS.setLayout(flowLayout6);
- jPanelFvImageParaS.add(jLabelFvParaType, null);
- jPanelFvImageParaS.add(getJComboBoxFvParaType(), null);
- }
- return jPanelFvImageParaS;
- }
-
- /**
- * This method initializes jPanelFvImageParaC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFvImageParaC() {
-// if (jPanelFvImageParaC == null) {
-// jPanelFvImageParaC = new JPanel();
-// jPanelFvImageParaC.add(getJScrollPaneFvImageNames(), null);
-// }
-// return jPanelFvImageParaC;
-// }
-
- /**
- * This method initializes jPanelFvImageOptsN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsN() {
- if (jPanelFvImageOptsN == null) {
- jPanelFvImageOptsN = new JPanel();
- jPanelFvImageOptsN.add(jLabelOptions, null);
- jPanelFvImageOptsN.add(jLabelFvImageOptName, null);
- jPanelFvImageOptsN.add(getJTextFieldFvImageOptName(), null);
- jPanelFvImageOptsN.add(jLabelFvImageOptValue, null);
- jPanelFvImageOptsN.add(getJTextFieldFvImageOptValue(), null);
- }
- return jPanelFvImageOptsN;
- }
-
- /**
- * This method initializes jPanelFvImageOptsS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsS() {
- if (jPanelFvImageOptsS == null) {
- jPanelFvImageOptsS = new JPanel();
- }
- return jPanelFvImageOptsS;
- }
-
- /**
- * This method initializes jPanelFvImageOptsC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFvImageOptsC() {
-// if (jPanelFvImageOptsC == null) {
-// jPanelFvImageOptsC = new JPanel();
-// jPanelFvImageOptsC.add(getJScrollPane(), null);
-// }
-// return jPanelFvImageOptsC;
-// }
-
- /**
- * This method initializes jPanelFvImageParaE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaE() {
- if (jPanelFvImageParaE == null) {
- jPanelFvImageParaE = new JPanel();
- jPanelFvImageParaE.add(getJPanelBgFvName(), null);
- }
- return jPanelFvImageParaE;
- }
-
- /**
- * This method initializes jPanelFvImageOptsE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsE() {
- if (jPanelFvImageOptsE == null) {
- jPanelFvImageOptsE = new JPanel();
- jPanelFvImageOptsE.add(getJPanelFvImageOptsButtonGroup(), null);
- }
- return jPanelFvImageOptsE;
- }
-
- /**
- * This method initializes jPanelFvImageSN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSN() {
- if (jPanelFvImageSN == null) {
- jPanelFvImageSN = new JPanel();
- jPanelFvImageSN.add(getJCheckBoxFvProperty(), null);
- jPanelFvImageSN.add(jLabelFvPropName, null);
- jPanelFvImageSN.add(getJTextFieldFvPropName(), null);
- jPanelFvImageSN.add(jLabelFvPropValue, null);
- jPanelFvImageSN.add(getJTextFieldFvPropValue(), null);
- }
- return jPanelFvImageSN;
- }
-
- /**
- * This method initializes jPanelFvImageSE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSE() {
- if (jPanelFvImageSE == null) {
- jPanelFvImageSE = new JPanel();
- jPanelFvImageSE.add(getJPanelFvPropButtonGroup(), null);
- }
- return jPanelFvImageSE;
- }
-
- /**
- * This method initializes jPanelFvImageSS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSS() {
- if (jPanelFvImageSS == null) {
- jPanelFvImageSS = new JPanel();
- }
- return jPanelFvImageSS;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new FpdFlash().setVisible(true);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(660, 650);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.setTitle("FPD Flash Definitions");
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTableFvProp.isEditing()) {
- jTableFvProp.getCellEditor().stopCellEditing();
- }
- if (jTableFvImageNames.isEditing()) {
- jTableFvImageNames.getCellEditor().stopCellEditing();
- }
- if (jTableFvInfo.isEditing()) {
- jTableFvInfo.getCellEditor().stopCellEditing();
- }
- if (jTableFvAdditional.isEditing()) {
- jTableFvAdditional.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(FpdFileContents ffc) {
- initFvAttributes();
-
- jTextFieldFdf.setText("");
- String fdfFile = ffc.getFlashDefinitionFile();
- if (fdfFile != null && fdfFile.length() > 0) {
- jCheckBoxFdf.setSelected(true);
- jTextFieldFdf.setText(fdfFile);
- String fdfPath = Workspace.getCurrentWorkspace() + File.separator + fdfFile;
- initFvInFdfTable(fdfPath);
- }
-
- initFvAdditionalTable();
- }
-
- private void getOptionNameValue(Map<String, String> m){
- for (int i = 0; i < jTableFvImageOpts.getRowCount(); ++i) {
- m.put(fvOptionTableModel.getValueAt(i, 0)+"", fvOptionTableModel.getValueAt(i, 1)+"");
- }
- }
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
- jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- private void getFlashInfoFromFdf (String fdfPath) {
- File fdf = new File(fdfPath);
- if (!fdf.exists()) {
- return;
- }
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(fdf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
- //
- // ErasePolarity
- //
- if (str.startsWith("ErasePolarity")) {
- erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(",")).trim();
- }
- //
- // dig into Block section.
- //
- if (str.startsWith("Block") && str.endsWith("}")) {
- String[] blockSec = str.split(",");
- String nv = blockSec[1].trim();
- String[] sizeSec = nv.split("=");
- vBlockSize.add(sizeSec[1].trim());
- }
-
- }
-
- reader.close();
- in.close();
- }
- catch (Exception e) {
-
- }
- }
-
- private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
- File fdf = new File(fdfPath);
- if (!fdf.exists()) {
- return;
- }
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(fdf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
- //
- // dig into Region {} section, create FvInfoFromFdf object for it.
- //
- if (str.startsWith("Region") && str.endsWith("{")) {
- FvInfoFromFdf fvInfo = new FvInfoFromFdf();
- boolean nameFound = false;
- boolean sizeFound = false;
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
-
- if (str.startsWith("Name")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fvInfo.setFvName(str.substring(firstQuote + 1, lastQuote));
- nameFound = true;
- }
-
- if (str.startsWith("Size")) {
- int equalIndex = str.indexOf("=");
- int commaIndex = str.indexOf(",");
- fvInfo.setSize(str.substring(equalIndex + 1, commaIndex).trim());
- sizeFound = true;
- }
-
- if (nameFound && sizeFound) {
- break;
- }
- }
-
- vFvInfo.add(fvInfo);
- }
- //
- // dig into File {} section, supply file name information to existing FvInfoFromFdf object.
- //
- if (str.startsWith("File")) {
- boolean fileNameFound = false;
- boolean fvFound = false;
- String fileName = "";
- String fvName = "";
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
-
- if (str.startsWith("Name")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fileName = str.substring(firstQuote + 1, lastQuote);
- fileNameFound = true;
- }
-
- if (str.startsWith("Region")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fvName = str.substring(firstQuote + 1, lastQuote);
- fvFound = true;
- }
-
- if (fileNameFound && fvFound) {
- break;
- }
- }
-
- for (int i = 0; i <vFvInfo.size(); ++i) {
- if (vFvInfo.get(i).getFvName().equals(fvName)) {
- vFvInfo.get(i).setEfiFileName(fileName);
- }
- }
- }
-
- }
-
- reader.close();
- in.close();
- }
- catch (Exception e) {
-
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.tianocore.frameworkwizard.common.ui.IInternalFrame#actionPerformed(java.awt.event.ActionEvent)
- */
- @Override
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- docConsole.setSaved(false);
- jTabbedPane.setSelectedIndex(0);
- }
- else if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
- jTabbedPane.setSelectedIndex(0);
- }
- else {
- return;
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class ModuleOrderPane extends JPanel implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jPanelModOrderN = null;
- private JPanel jPanelModOrderS = null;
- private JPanel jPanelModOrderC = null;
- private JScrollPane jScrollPaneModInFv = null;
- private JTable jTableModInFv = null;
- private JPanel jPanelController = null;
- private JScrollPane jScrollPaneFpdModules = null;
- private JTable jTableFpdModules = null;
- private JButton jButtonUp = null;
- private JButton jButtonInsert = null;
- private JButton jButtonRemove = null;
- private JButton jButtonDown = null;
- private JButton jButtonOk = null;
- private JButton jButtonCancel = null;
- private IDefaultTableModel modInFvTableModel = null;
- private IDefaultTableModel fpdModTableModel = null;
- private FpdFileContents ffc = null;
- private String title = null;
- private String outputFileName = null;
-
- public ModuleOrderPane(String tabTitle, String file, FpdFileContents inputFfc, ActionListener action) {
- super(new BorderLayout());
- title = tabTitle;
- outputFileName = file;
- ffc = inputFfc;
- add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH);
- add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH);
- add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER);
- jButtonOk.addActionListener(action);
- jButtonCancel.addActionListener(action);
-
- }
-
- public void showModulesInFv(String fvName) {
-
- if (modInFvTableModel == null) {
- return;
- }
- int size = ffc.getUserExtsIncModCount(fvName, "IMAGES", "1");
-
- if (size != -1) {
- String[][] saa = new String[size][5];
- ffc.getUserExtsIncMods(fvName, "IMAGES", "1", saa);
-
- for (int i = 0; i < size; ++i) {
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
-
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- modInFvTableModel.addRow(row);
- }
- }
- //
- // From ModuleSAs, get module guids with FvBinding = fvName.
- //
- Vector<String[]> vModuleSA = new Vector<String[]>();
- ffc.getFrameworkModuleSAByFvBinding(fvName, vModuleSA);
- //
- // If BuildOptions->UserExtensions already contain these module info,
- // no need to add them into table again.
- //
- Iterator<String[]> iter = vModuleSA.iterator();
- while (iter.hasNext()){
- String[] sa = iter.next();
- if (!moduleInfoInTable (sa, modInFvTableModel)) {
- String moduleKey = sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
- String[] row = { name, sa[0] , sa[1], sa[2] , sa[3], sa[4] };
- modInFvTableModel.addRow(row);
- }
- }
-
- }
-
- public void showAllModulesInPlatform() {
-
- if (modInFvTableModel == null || fpdModTableModel == null) {
- return;
- }
- int size = ffc.getFrameworkModulesCount();
- String[][] saa = new String[size][5];
- ffc.getFrameworkModulesInfo(saa);
-
- for (int i = 0; i < size; ++i) {
- if (moduleInfoInTable(saa[i], modInFvTableModel) || moduleInfoInTable(saa[i], fpdModTableModel)) {
- continue;
- }
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- fpdModTableModel.addRow(row);
- }
-
- TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
- sorter.setSortState(0, TableSorter.ASCENDING);
- }
-
-
- protected boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) {
- boolean matched = false;
- int size = model.getDataVector().size();
- for (int i = 0; i < size; ++i) {
- Vector rowData = (Vector)model.getDataVector().elementAt(i);
- for (int j = 1; j < rowData.size(); ++j) {
- if (rowData.elementAt(j) == null && moduleInfo[j-1] == null) {
- matched = true;
- }
- else if (rowData.elementAt(j).equals("null") && moduleInfo[j-1] == null) {
- matched = true;
- }
- else if (rowData.elementAt(j) == null && moduleInfo[j-1].equals("null")) {
- matched = true;
- }
- else if (rowData.elementAt(j) != null && rowData.elementAt(j).toString().equalsIgnoreCase(moduleInfo[j-1])) {
- matched = true;
- }
- else {
- matched = false;
- break;
- }
- }
-
- if (matched) {
- return true;
- }
-
- }
- return false;
- }
-
-
-
- /**
- * This method initializes jPanelModOrderN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderN() {
- if (jPanelModOrderN == null) {
- jPanelModOrderN = new JPanel();
- }
- return jPanelModOrderN;
- }
-
- /**
- * This method initializes jPanelModOrderS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderS() {
- if (jPanelModOrderS == null) {
- FlowLayout flowLayout6 = new FlowLayout();
- flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelModOrderS = new JPanel();
- jPanelModOrderS.setLayout(flowLayout6);
- jPanelModOrderS.add(getJButtonOk(), null);
- jPanelModOrderS.add(getJButtonCancel(), null);
- }
- return jPanelModOrderS;
- }
-
- /**
- * This method initializes jPanelModOrderC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderC() {
- if (jPanelModOrderC == null) {
- jPanelModOrderC = new JPanel();
- jPanelModOrderC.add(getJScrollPaneModInFv(), null);
- jPanelModOrderC.add(getJPanelController(), null);
- jPanelModOrderC.add(getJScrollPaneFpdModules(), null);
- }
- return jPanelModOrderC;
- }
-
- /**
- * This method initializes jScrollPaneModInFv
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneModInFv() {
- if (jScrollPaneModInFv == null) {
- jScrollPaneModInFv = new JScrollPane();
- jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(200,500));
- jScrollPaneModInFv.setViewportView(getJTableModInFv());
- }
- return jScrollPaneModInFv;
- }
-
- /**
- * This method initializes jTableModInFv
- *
- * @return javax.swing.JTable
- */
- protected JTable getJTableModInFv() {
- if (jTableModInFv == null) {
- modInFvTableModel = new IDefaultTableModel();
-
- jTableModInFv = new JTable(modInFvTableModel){
- /**
- *
- */
- private static final long serialVersionUID = 4903583933542581721L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- String arch = (String) model.getValueAt(rowIndex, 5);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- if (mi != null) {
- tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";";
- }
- else {
- tip = "No Module Path Information.";
- }
-
- return tip;
- }
-
- };
- modInFvTableModel.addColumn("Module Orders in FV");
- modInFvTableModel.addColumn("mg");
- modInFvTableModel.addColumn("mv");
- modInFvTableModel.addColumn("pg");
- modInFvTableModel.addColumn("pv");
- modInFvTableModel.addColumn("arch");
-
- for (int i = 1; i < 6; ++i) {
- jTableModInFv.removeColumn(jTableModInFv.getColumnModel().getColumn(jTableModInFv.getColumnCount()-1));
- }
-
- jTableModInFv.setRowHeight(20);
- jTableModInFv.setShowGrid(false);
- jTableModInFv.setAutoCreateColumnsFromModel(false);
- jTableModInFv.addMouseListener(new MouseAdapter() {
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
- */
- @Override
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getButton() == MouseEvent.BUTTON3) {
- java.awt.Point p = arg0.getPoint();
- int rowIndex = jTableModInFv.rowAtPoint(p);
- TableModel model = jTableModInFv.getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- if (mi != null) {
- details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- }
- JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
- }
- }
-
- });
- }
- return jTableModInFv;
- }
-
- /**
- * This method initializes jPanelController
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelController() {
- if (jPanelController == null) {
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setVgap(50);
- flowLayout5.setHgap(50);
- jPanelController = new JPanel();
- jPanelController.setLayout(flowLayout5);
- jPanelController.setPreferredSize(new java.awt.Dimension(150,500));
- jPanelController.add(getJButtonUp(), null);
- jPanelController.add(getJButtonInsert(), null);
- jPanelController.add(getJButtonRemove(), null);
- jPanelController.add(getJButtonDown(), null);
- }
- return jPanelController;
- }
-
- /**
- * This method initializes jScrollPaneFpdModules
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFpdModules() {
- if (jScrollPaneFpdModules == null) {
- jScrollPaneFpdModules = new JScrollPane();
- jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(200,500));
- jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
- }
- return jScrollPaneFpdModules;
- }
-
- /**
- * This method initializes jTableFpdModules
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFpdModules() {
- if (jTableFpdModules == null) {
- fpdModTableModel = new IDefaultTableModel();
- TableSorter sorter = new TableSorter(fpdModTableModel);
- jTableFpdModules = new JTable(sorter){
- /**
- *
- */
- private static final long serialVersionUID = -4666296888377637808L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- String arch = (String) model.getValueAt(rowIndex, 5);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- if (mi != null) {
- tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";";
- }
- else {
- tip = "No Module Path Information.";
- }
-
- return tip;
- }
-
- };
-
- fpdModTableModel.addColumn("Modules in Platform");
- fpdModTableModel.addColumn("mg");
- fpdModTableModel.addColumn("mv");
- fpdModTableModel.addColumn("pg");
- fpdModTableModel.addColumn("pv");
- fpdModTableModel.addColumn("arch");
-
- for (int i = 1; i < 6; ++i) {
- jTableFpdModules.removeColumn(jTableFpdModules.getColumnModel().getColumn(jTableFpdModules.getColumnCount()-1));
- }
- jTableFpdModules.setRowHeight(20);
- jTableFpdModules.setShowGrid(false);
- jTableFpdModules.setAutoCreateColumnsFromModel(false);
- jTableFpdModules.addMouseListener(new MouseAdapter() {
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
- */
- @Override
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getButton() == MouseEvent.BUTTON3) {
- java.awt.Point p = arg0.getPoint();
- int rowIndex = jTableFpdModules.rowAtPoint(p);
- TableModel model = jTableFpdModules.getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- if (mi != null) {
- details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- }
- JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
- }
- }
-
- });
-
- }
- return jTableFpdModules;
- }
-
- /**
- * This method initializes jButtonUp
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonUp() {
- if (jButtonUp == null) {
- jButtonUp = new JButton();
- jButtonUp.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
- jButtonUp.setText("^");
- jButtonUp.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableModInFv.getSelectedRow();
- if (selectedRow <= 0) {
- return;
- }
- modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1);
- jTableModInFv.changeSelection(selectedRow - 1, 0, false, false);
- }
- });
- }
- return jButtonUp;
- }
-
- /**
- * This method initializes jButtonInsert
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonInsert() {
- if (jButtonInsert == null) {
- jButtonInsert = new JButton();
- jButtonInsert.setText("<");
- jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonInsert.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRowRight = jTableFpdModules.getSelectedRow();
- if (selectedRowRight < 0) {
- return;
- }
-
- int rowInModel = ((TableSorter)jTableFpdModules.getModel()).getModelRowIndex(selectedRowRight);
- String name = fpdModTableModel.getValueAt(rowInModel, 0)+"";
- String mg = fpdModTableModel.getValueAt(rowInModel, 1)+"";
- String mv = fpdModTableModel.getValueAt(rowInModel, 2)+"";
- String pg = fpdModTableModel.getValueAt(rowInModel, 3)+"";
- String pv = fpdModTableModel.getValueAt(rowInModel, 4)+"";
- String arch = fpdModTableModel.getValueAt(rowInModel, 5)+"";
- String[] row = {name, mg, mv, pg, pv, arch};
- if (name.length() == 0 || name.equals("N/A")) {
- return;
- }
-
- int selectedRowLeft = jTableModInFv.getSelectedRow();
- if (selectedRowLeft < 0) {
- modInFvTableModel.addRow(row);
- jTableModInFv.changeSelection(jTableModInFv.getRowCount() - 1, 0, false, false);
- }
- else {
- modInFvTableModel.insertRow(selectedRowLeft, row);
- jTableModInFv.changeSelection(selectedRowLeft, 0, false, false);
- }
- fpdModTableModel.removeRow(rowInModel);
- }
- });
- }
- return jButtonInsert;
- }
-
- /**
- * This method initializes jButtonRemove
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonRemove.setText(">");
- jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRowLeft = jTableModInFv.getSelectedRow();
- if (selectedRowLeft < 0) {
- return;
- }
-
- String name = modInFvTableModel.getValueAt(selectedRowLeft, 0)+"";
- String mg = modInFvTableModel.getValueAt(selectedRowLeft, 1)+"";
- String mv = modInFvTableModel.getValueAt(selectedRowLeft, 2)+"";
- String pg = modInFvTableModel.getValueAt(selectedRowLeft, 3)+"";
- String pv = modInFvTableModel.getValueAt(selectedRowLeft, 4)+"";
- String arch = modInFvTableModel.getValueAt(selectedRowLeft, 5)+"";
- String[] row = {name, mg, mv, pg, pv, arch};
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (name.length() == 0 || name.equals("N/A") || ffc.getModuleSA(moduleKey) == null) {
- JOptionPane.showMessageDialog(ModuleOrderPane.this, "Module " + name + " not exists in platform. If you want to add back this module, please first add it into current platform. " + moduleKey );
- modInFvTableModel.removeRow(selectedRowLeft);
- return;
- }
-
- fpdModTableModel.addRow(row);
- int viewIndex = ((TableSorter) jTableFpdModules.getModel()).getViewIndexArray()[jTableFpdModules
- .getRowCount() - 1];
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
- modInFvTableModel.removeRow(selectedRowLeft);
- }
- });
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonDown
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDown() {
- if (jButtonDown == null) {
- jButtonDown = new JButton();
- jButtonDown.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
- jButtonDown.setText("v");
- jButtonDown.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableModInFv.getSelectedRow();
- if (selectedRow >= jTableModInFv.getRowCount() - 1) {
- return;
- }
- modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow + 1);
- jTableModInFv.changeSelection(selectedRow + 1, 0, false, false);
- }
- });
- }
- return jButtonDown;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- protected JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("ModuleOrderPaneOk");
- jButtonOk.addActionListener(this);
-
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- protected JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setActionCommand("ModuleOrderPaneCancel");
-
- }
- return jButtonCancel;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- // need reset FvBindings in ModuleSA.
- ffc.removeFvBindingAll(title);
- //
- // collect module order information to store them into <BuildOptions> -> <UserExtensions>.
- // also update the FvBinding info in <ModuleSA>.
- //
- Vector<String[]> vModInFv = new Vector<String[]>();
- for (int i = 0; i < jTableModInFv.getRowCount(); ++i) {
- String moduleName = modInFvTableModel.getValueAt(i, 0)+"";
- if (moduleName.length() == 0 || moduleName.equals("N/A")) {
- continue;
- }
-
- String mg = modInFvTableModel.getValueAt(i, 1)+"";
- String mv = modInFvTableModel.getValueAt(i, 2)+"";
- String pg = modInFvTableModel.getValueAt(i, 3)+"";
- String pv = modInFvTableModel.getValueAt(i, 4)+"";
- String arch = modInFvTableModel.getValueAt(i, 5)+"";
-
- String moduleInfo = mg + " " + mv + " " + pg + " " + pv + " " + arch;
-
- String[] sa = { mg, mv, pg, pv, arch};
- vModInFv.add(sa);
- ffc.updateFvBindingInModuleSA(moduleInfo, title);
-
- }
- ffc.removeBuildOptionsUserExtensions(title, "IMAGES", "1");
- ffc.genBuildOptionsUserExtensions(title, "IMAGES", "1", outputFileName, vModInFv);
-
- }
- }
-
- /**
- * @return Returns the fpdModTableModel.
- */
- protected IDefaultTableModel getFpdModTableModel() {
- return fpdModTableModel;
- }
-
- /**
- * @return Returns the modInFvTableModel.
- */
- protected IDefaultTableModel getModInFvTableModel() {
- return modInFvTableModel;
- }
-}
-
-
-class FvOptsTableModel extends DefaultTableModel {
-
- private static final long serialVersionUID = 1L;
-
- private Vector<Object> vNonEditableName = new Vector<Object>();
- private Vector<Object> vKeyWords = new Vector<Object>();
-
- public boolean isCellEditable(int row, int col) {
-
- if (vNonEditableName.size() > 0 || vKeyWords.size() > 0) {
- if (vKeyWords.contains(getValueAt(row, 0))) {
- return false;
- }
- if (vNonEditableName.contains(getValueAt(row, 0)) && col == 0) {
- return false;
- }
- }
-
- if (col == 0 && getValueAt(row, 0) != null && getValueAt(row, 0).toString().length() > 0) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @return Returns the vKeyWords.
- */
- protected Vector<Object> getVKeyWords() {
- return vKeyWords;
- }
-
- /**
- * @param keyWords The vKeyWords to set.
- */
- protected void setVKeyWords(Vector<Object> keyWords) {
- vKeyWords.removeAllElements();
- vKeyWords.addAll(keyWords);
- }
-
- /**
- * @return Returns the vNonEditableName.
- */
- protected Vector<Object> getVNonEditableName() {
- return vNonEditableName;
- }
-
- /**
- * @param nonEditableName The vNonEditableName to set.
- */
- protected void setVNonEditableName(Vector<Object> nonEditableName) {
- vNonEditableName.removeAllElements();
- vNonEditableName.addAll(nonEditableName);
- }
-
-}
-class ImageParaTableModel extends DefaultTableModel {
-
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
-// if (getValueAt(row, 1).equals("ImageName") && col >=1) {
-// return false;
-// }
-// return true;
- return false;
- }
-}
-
-class FvInfoFromFdf {
- private String fvName;
- private String size;
- private String efiFileName;
-
- public FvInfoFromFdf () {
- fvName = "";
- size = "";
- efiFileName = "";
- }
- public FvInfoFromFdf (String f, String s, String e) {
- this();
- fvName = f;
- size = s;
- efiFileName = e;
- }
- public String getEfiFileName() {
- return efiFileName;
- }
- public void setEfiFileName(String efiFileName) {
- this.efiFileName = efiFileName;
- }
- public String getFvName() {
- return fvName;
- }
- public void setFvName(String fvName) {
- this.fvName = fvName;
- }
- public String getSize() {
- return size;
- }
- public void setSize(String size) {
- this.size = size;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java deleted file mode 100644 index ae5fce8340..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ /dev/null @@ -1,1084 +0,0 @@ -/** @file
-
- The file is used to create, update FrameworkModules of Fpd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-public class FpdFrameworkModules extends IInternalFrame {
-
- /**
- * Initialize Globals
- */
- private static final long serialVersionUID = 1L;
-
- private static final int timeToWait = 2000;
-
- private static final int pcdSyncThreadNumber = 10;
-
- private long savedMs = 0;
-
- String searchField = "";
-
- public static final int forceDbgColForFpdModTable = 7;
-
- private JSplitPane jSplitPane = null;
-
- private JPanel jPanelTop = null;
-
- private JPanel jPanelBottom = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPaneAllModules = null;
-
- private JTable jTableAllModules = null;
-
- private JPanel jPanelTopSouth = null;
-
- private JButton jButtonAddModule = null;
-
- private JLabel jLabelModulesAdded = null;
-
- private JPanel jPanelBottomSouth = null;
-
- private JScrollPane jScrollPaneFpdModules = null;
-
- private JTable jTableFpdModules = null;
-
- private JButton jButtonSettings = null;
-
- private JButton jButtonRemoveModule = null;
-
- private NonEditableTableModel modelAllModules = null;
-
- private FpdModulesTableModel modelFpdModules = null;
-
- private FpdModuleSA settingDlg = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private Map<String, ArrayList<String>> fpdMsa = null;
-
- private ArrayList<ModuleIdentification> miList = null;
-
- /**
- * Column settings for displaying all modules in workspace
- */
- private final int modNameColForAllModTable = 0;
-
- private final int pkgNameColForAllModTable = 1;
-
- private final int pathColForAllModTable = 2;
-
- private final int typeColForAllModTable = 3;
-
- private final int pkgVerColForAllModTable = 5;
-
- private final int modVerColForAllModTable = 4;
-
- /**
- * Column settings for display modules in the FPD file
- */
- private final int modNameColForFpdModTable = 0;
-
- private final int pkgNameColForFpdModTable = 1;
-
- private final int pathColForFpdModTable = 2;
-
- private final int archColForFpdModTable = 3;
-
- private final int pkgVerColForFpdModTable = 6;
-
- private final int modVerColForFpdModTable = 5;
-
- private final int typeColForFpdModTable = 4;
-
- /**
- * FpdFileContents structure
- */
- private final int ffcModGuid = 0;
-
- private final int ffcModVer = 1;
-
- private final int ffcPkgGuid = 2;
-
- private final int ffcPkgVer = 3;
-
- private final int ffcModArch = 4;
-
- /**
- * Set Column Widths, Only the PATH should not have a max width.
- */
- private final int modNameMinWidth = 168;
-
- private final int modNamePrefWidth = 200;
-
- private final int modNameMaxWidth = 350;
-
- private final int pkgNameMinWidth = 100;
-
- private final int pkgNamePrefWidth = 130;
-
- private final int pkgNameMaxWidth = 150;
-
- private final int verMinWidth = 60;
-
- private final int verMaxWidth = 80;
-
- private final int verPrefWidth = 70;
-
- private final int pathPrefWidth = 600;
-
- private final int pathMinWidth = 280;
-
- private final int archPrefWidth = 80;
-
- private final int archMinWidth = 60;
-
- private final int archMaxWidth = 100;
-
- private final int typePrefWidth = 145;
-
- private final int typeMinWidth = 100;
-
- private final int typeMaxWidth = 155;
-
- private JButton jButtonApriori = null;
-
- /**
- * This method initializes jSplitPane
- *
- * This is the main edit window
- *
- * @return javax.swing.JSplitPane jSplitPane
- */
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane();
- jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPane.setDividerLocation(250);
- jSplitPane.setBottomComponent(getJPanelBottom());
- jSplitPane.setTopComponent(getJPanelTop());
- }
- return jSplitPane;
- }
-
- /**
- * This method initializes jPanelTop
- *
- * This panel contains the All Modules Table
- *
- * @return javax.swing.JPanel jPanelTop
- */
- private JPanel getJPanelTop() {
- if (jPanelTop == null) {
- jLabel = new JLabel();
- jLabel.setText(" Modules in Workspace");
- jPanelTop = new JPanel();
- jPanelTop.setLayout(new BorderLayout());
- jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH);
- jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER);
- jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH);
- }
- return jPanelTop;
- }
-
- /**
- * This method initializes jPanelBottom
- *
- * This panel contains the FPD Modules Table
- *
- * @return javax.swing.JPanel jPanelBottom
- */
- private JPanel getJPanelBottom() {
- if (jPanelBottom == null) {
- jLabelModulesAdded = new JLabel();
- jLabelModulesAdded.setText(" Modules Added into Platform");
- jPanelBottom = new JPanel();
- jPanelBottom.setLayout(new BorderLayout());
- jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH);
- jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH);
- jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER);
- }
- return jPanelBottom;
- }
-
- /**
- * This method initializes jScrollPaneAllModules
- *
- * @return javax.swing.JScrollPane jScrollPaneAllModules
- */
- private JScrollPane getJScrollPaneAllModules() {
- if (jScrollPaneAllModules == null) {
- jScrollPaneAllModules = new JScrollPane();
- jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200));
- jScrollPaneAllModules.setViewportView(getJTableAllModules());
- }
- return jScrollPaneAllModules;
- }
-
- /**
- * This method initializes jTableAllModules
- *
- * @return javax.swing.JTable jTableAllModules
- */
- private JTable getJTableAllModules() {
- if (jTableAllModules == null) {
- modelAllModules = new NonEditableTableModel();
- TableSorter sorter = new TableSorter(modelAllModules);
- jTableAllModules = new JTable(sorter);
- sorter.setTableHeader(jTableAllModules.getTableHeader());
- jTableAllModules.setRowHeight(20);
- modelAllModules.addColumn("<html>Module<br>Name</html>");
- modelAllModules.addColumn("<html>Package<br>Name</html>");
- modelAllModules.addColumn("Path");
- modelAllModules.addColumn("<html>Module<br>Type</html>");
- modelAllModules.addColumn("<html>Module<br>Version</html>");
- modelAllModules.addColumn("<html>Package<br>Version</html>");
-
- javax.swing.table.TableColumn column = null;
- column = jTableAllModules.getColumnModel().getColumn(modNameColForAllModTable);
- column.setPreferredWidth(modNamePrefWidth);
- column.setMinWidth(modNameMinWidth);
- column.setMaxWidth(modNameMaxWidth);
- column = jTableAllModules.getColumnModel().getColumn(modVerColForAllModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(pkgNameColForAllModTable);
- column.setPreferredWidth(pkgNamePrefWidth);
- column.setMinWidth(pkgNameMinWidth);
- column.setMaxWidth(pkgNameMaxWidth);
- column = jTableAllModules.getColumnModel().getColumn(pkgVerColForAllModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(typeColForAllModTable);
- column.setPreferredWidth(typePrefWidth);
- column.setMaxWidth(typeMaxWidth);
- column.setMinWidth(typeMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(pathColForAllModTable);
- column.setPreferredWidth(pathPrefWidth);
- column.setMinWidth(pathMinWidth);
-
- jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableAllModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- jTableAllModules.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
- java.awt.Point p = e.getPoint();
- int rowIndex = jTableAllModules.rowAtPoint(p);
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- rowIndex = sorter.getModelRowIndex(rowIndex);
- addModuleIntoPlatform (rowIndex);
- }
- }
- });
- jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- int selectedRow = jTableAllModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- addModuleIntoPlatform (selectedRow);
- }
- }
- });
-
- jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent e) {
-
- if (System.currentTimeMillis() - savedMs < timeToWait) {
- searchField += e.getKeyChar();
- }
- else {
- searchField = "" + e.getKeyChar();
- }
-
- int viewIndex = gotoFoundRow (searchField, jTableAllModules);
- if (viewIndex >= 0){
- jTableAllModules.changeSelection(viewIndex, 0, false, false);
- }
- savedMs = System.currentTimeMillis();
- }
- });
-
-
- }
- return jTableAllModules;
- }
-
- private int gotoFoundRow (String s, JTable model) {
- for (int i = 0; i < model.getRowCount(); ++i) {
- if (model.getValueAt(i, 0) != null && model.getValueAt(i, 0).toString().regionMatches(true, 0, s, 0, s.length())) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * This method initializes jPanelTopSouth
- *
- * This panel contains the ADD button
- *
- * @return javax.swing.JPanel jPanelTopSouth
- */
- private JPanel getJPanelTopSouth() {
- if (jPanelTopSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelTopSouth = new JPanel();
- jPanelTopSouth.setLayout(flowLayout);
- jPanelTopSouth.add(getJButtonAddModule(), null);
- }
- return jPanelTopSouth;
- }
-
- private void addModuleIntoPlatform (int selectedRow) {
- String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";
- ModuleIdentification mi = miList.get(selectedRow);
- Vector<String> vArchs = null;
-
- vArchs = WorkspaceProfile.getModuleSupArchs(mi);
-
- if (vArchs == null) {
- JOptionPane.showMessageDialog(this, "No Supported Architectures specified in MSA file.");
- return;
- }
-
- Vector<Object> platformSupArch = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(platformSupArch);
- platformSupArch.retainAll(vArchs);
- if (platformSupArch.size() == 0) {
- JOptionPane.showMessageDialog(this, "This Module does not support this platform architectures.");
- return;
- }
-
- String archsAdded = "";
- String mg = mi.getGuid();
- String mv = mi.getVersion();
- String pg = mi.getPackageId().getGuid();
- String pv = mi.getPackageId().getVersion();
- String mType = SurfaceAreaQuery.getModuleType(mi);
-
- ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- if (al == null) {
- //
- // if existing ModuleSA does not specify version info.
- //
- al = fpdMsa.get(mg + "null" + pg + "null");
- if (al == null) {
- al = fpdMsa.get(mg + "null" + pg + pv);
- if (al == null){
- al = fpdMsa.get(mg + mv + pg + "null");
- if (al == null) {
- al = new ArrayList<String>();
- fpdMsa.put(mg + mv + pg + pv, al);
- }
- }
- }
- }
- //
- // filter from module SupArchs what archs has been added.
- //
- for (int i = 0; i < al.size(); ++i) {
- vArchs.remove(al.get(i));
- }
- //
- // check whether archs conform to SupArch of platform.
- //
- platformSupArch.removeAllElements();
- ffc.getPlatformDefsSupportedArchs(platformSupArch);
- vArchs.retainAll(platformSupArch);
- //
- // Archs this Module supported have already been added.
- //
- if (vArchs.size() == 0) {
- JOptionPane.showMessageDialog(this, "This Module has already been added.");
- return;
- }
- //ToDo put Arch instead of null
- boolean errorOccurred = false;
- for (int i = 0; i < vArchs.size(); ++i) {
- String arch = vArchs.get(i);
- al.add(arch);
- archsAdded += arch + " ";
- String[] row = { "", "", "", "", "", "", "" };
-
- if (mi != null) {
- row[modNameColForFpdModTable] = mi.getName();
- row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
- row[pathColForFpdModTable] = path;
- row[archColForFpdModTable] = arch;
- row[pkgVerColForFpdModTable] = pv;
- row[modVerColForFpdModTable] = mv;
- row[typeColForFpdModTable] = mType;
-
- }
- modelFpdModules.addRow(row);
-
- docConsole.setSaved(false);
- try {
- //ToDo : specify archs need to add.
- ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
- } catch (Exception exception) {
- JOptionPane.showMessageDialog(this, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch
- + ": " + exception.getMessage());
- errorOccurred = true;
- }
- }
-
- String s = "This Module with Architecture " + archsAdded;
- if (errorOccurred) {
- s += " was added with Error. Platform may NOT Build.";
- } else {
- s += " was added Successfully.";
- }
- JOptionPane.showMessageDialog(this, s);
- TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel();
- int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1];
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
-
- }
-
- /**
- * This method initializes jButtonAddModule
- *
- * @return javax.swing.JButton jButtonAddModule
- */
- private JButton getJButtonAddModule() {
- if (jButtonAddModule == null) {
- jButtonAddModule = new JButton();
- jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20));
- jButtonAddModule.setText("Add a Module");
- jButtonAddModule.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableAllModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- addModuleIntoPlatform (selectedRow);
- }
- });
- }
- return jButtonAddModule;
- }
-
- /**
- * This method initializes jPanelBottomSouth
- *
- * This panel contains the Settings and Remove Buttons
- *
- * @return javax.swing.JPanel jPanelBottomSouth
- */
- private JPanel getJPanelBottomSouth() {
- if (jPanelBottomSouth == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelBottomSouth = new JPanel();
- jPanelBottomSouth.setLayout(flowLayout1);
- jPanelBottomSouth.add(getJButtonSettings(), null);
- jPanelBottomSouth.add(getJButtonRemoveModule(), null);
- jPanelBottomSouth.add(getJButtonApriori(), null);
- }
- return jPanelBottomSouth;
- }
-
- /**
- * This method initializes jScrollPaneFpdModules
- *
- * @return javax.swing.JScrollPane jScrollPaneFpdModules
- */
- private JScrollPane getJScrollPaneFpdModules() {
- if (jScrollPaneFpdModules == null) {
- jScrollPaneFpdModules = new JScrollPane();
- jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200));
- jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
- }
- return jScrollPaneFpdModules;
- }
-
- /**
- * This method initializes jTableFpdModules
- *
- * @return javax.swing.JTable jTableFpdModules
- */
- private JTable getJTableFpdModules() {
- if (jTableFpdModules == null) {
- modelFpdModules = new FpdModulesTableModel();
- TableSorter sorter = new TableSorter(modelFpdModules);
- jTableFpdModules = new JTable(sorter);
- sorter.setTableHeader(jTableFpdModules.getTableHeader());
- jTableFpdModules.setRowHeight(20);
- modelFpdModules.addColumn("<html>Module<br>Name</html>");
- modelFpdModules.addColumn("<html>Package<br>Name</html>");
- modelFpdModules.addColumn("Path");
- modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");
- modelFpdModules.addColumn("<html>Module<br>Type</html>");
- modelFpdModules.addColumn("<html>Module<br>Version</html>");
- modelFpdModules.addColumn("<html>Package<br>Version</html>");
- modelFpdModules.addColumn("<html>Force<br>Debug</html>");
-
- javax.swing.table.TableColumn column = null;
- column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);
- column.setPreferredWidth(modNamePrefWidth);
- column.setMinWidth(modNameMinWidth);
- column.setMaxWidth(modNameMaxWidth);
- column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable);
- column.setPreferredWidth(pkgNamePrefWidth);
- column.setMinWidth(pkgNameMinWidth);
- column.setMaxWidth(pkgNameMaxWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable);
- column.setPreferredWidth(archPrefWidth);
- column.setMaxWidth(archMaxWidth);
- column.setMinWidth(archMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable);
- column.setPreferredWidth(pathPrefWidth);
- column.setMinWidth(pathMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(typeColForFpdModTable);
- column.setPreferredWidth(typePrefWidth);
- column.setMaxWidth(typeMaxWidth);
- column.setMinWidth(typeMinWidth);
-
- jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFpdModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-
- jTableFpdModules.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
- java.awt.Point p = e.getPoint();
- int rowIndex = jTableFpdModules.rowAtPoint(p);
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- rowIndex = sorter.getModelRowIndex(rowIndex);
- showSettingsDlg (rowIndex);
- }
- }
- });
-
- jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- showSettingsDlg (selectedRow);
- }
- }
- });
-
- jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent e) {
-
- if (System.currentTimeMillis() - savedMs < timeToWait) {
- searchField += e.getKeyChar();
- }
- else {
- searchField = "" + e.getKeyChar();
- }
-
- int viewIndex = gotoFoundRow (searchField, jTableFpdModules);
- if (viewIndex >= 0){
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
- }
- savedMs = System.currentTimeMillis();
- }
- });
-
- jTableFpdModules.getModel().addTableModelListener(this);
- }
- return jTableFpdModules;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- if (arg0.getType() == TableModelEvent.UPDATE){
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
-
- if (column != forceDbgColForFpdModTable) {
- return;
- }
- String s = m.getValueAt(row, column)+"";
- boolean dbgEnable = new Boolean(s);
- ffc.setModuleSAForceDebug(row, dbgEnable);
- docConsole.setSaved(false);
- }
- }
-
- private void showSettingsDlg (int row) {
-// As PCD sync. check is full platform range now during opening FrameworkModules editor,
-// the following check is no longer needed.
-// try {
-// Vector<String> vExceptions = new Vector<String>();
-// if (ffc.adjustPcd(row, vExceptions)) {
-// JOptionPane.showMessageDialog(frame, "Pcd entries sync. with those in MSA files.");
-// docConsole.setSaved(false);
-// }
-// }
-// catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
-// }
-
- if (settingDlg == null) {
- settingDlg = new FpdModuleSA(ffc);
- }
-
- String[] sa = new String[5];
- ffc.getFrameworkModuleInfo(row, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, row, docConsole);
- settingDlg.setVisible(true);
- }
- /**
- * This method initializes jButtonSettings
- *
- * @return javax.swing.JButton jButtonSettings
- */
- private JButton getJButtonSettings() {
- if (jButtonSettings == null) {
- jButtonSettings = new JButton();
- jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20));
- jButtonSettings.setText("Settings");
- jButtonSettings.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- showSettingsDlg (selectedRow);
- }
- });
- }
- return jButtonSettings;
- }
-
- /**
- * This method initializes jButtonRemoveModule
- *
- * @return javax.swing.JButton jButtonRemoveModule
- */
- private JButton getJButtonRemoveModule() {
- if (jButtonRemoveModule == null) {
- jButtonRemoveModule = new JButton();
- jButtonRemoveModule.setText("Remove Module");
- FontMetrics fm = jButtonRemoveModule.getFontMetrics(jButtonRemoveModule.getFont());
- jButtonRemoveModule.setPreferredSize(new Dimension (fm.stringWidth(jButtonRemoveModule.getText()) + 40, 20));
- jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- int nextSelection = selectedRow;
-
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
-
- String[] sa = new String[5];
- ffc.getFrameworkModuleInfo(selectedRow, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- //
- // sync. module order list in BuildOptions-UserExtensions.
- //
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- String fvBindings = ffc.getFvBinding(moduleKey);
- if (fvBindings != null) {
- String[] fvArray = fvBindings.split(" ");
- for (int i = 0; i < fvArray.length; ++i) {
- ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", "1", mg, mv, pg, pv, arch);
- }
- }
-
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
- if (mi != null) {
- mv = mi.getVersion();
- pv = mi.getPackageId().getVersion();
- }
-
- try {
- ffc.removeModuleSA(selectedRow);
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdFrameworkModules.this, exp.getMessage());
- return;
- }
-
- if (arch == null) {
- // if no arch specified in ModuleSA
- fpdMsa.remove(mg + mv + pg + pv);
-
- } else {
- ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- if (al != null) {
- al.remove(arch);
- if (al.size() == 0) {
- fpdMsa.remove(mg + mv + pg + pv);
- }
- }
- }
-
- modelFpdModules.removeRow(selectedRow);
- if (nextSelection >= jTableFpdModules.getRowCount()) {
- nextSelection = jTableFpdModules.getRowCount() - 1;
- }
- jTableFpdModules.changeSelection(nextSelection, 0, false, false);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonRemoveModule;
- }
-
- /**
- * This method initializes jButtonApriori
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonApriori() {
- if (jButtonApriori == null) {
- jButtonApriori = new JButton();
- jButtonApriori.setText("Apriori Files");
- FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont());
- int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40;
- if (jButtonRemoveModule.getWidth() > buttonWidth) {
- buttonWidth = jButtonRemoveModule.getWidth();
- }
- jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20));
- jButtonApriori.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- new GenAprioriFileDialog(ffc, docConsole).setVisible(true);
- }});
- }
- return jButtonApriori;
- }
-
- /**
- *
- * @param args
- */
- public static void main(String[] args) {
- // Set the pane visable
- new FpdFrameworkModules().setVisible(true);
- }
-
- private class PcdSyncTask extends Thread {
-
- boolean pcdSynced = false;
- public void run () {
- Vector<String> vExceptions = new Vector<String>();
- pcdSync(vExceptions);
- if (pcdSynced) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files.");
- docConsole.setSaved(false);
- }
- if (vExceptions.size() > 0) {
- String errorMsg = "";
- for (int i = 0; i < vExceptions.size(); ++i) {
- errorMsg += " " + vExceptions.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);
- }
- }
-
- private void pcdSync(Vector<String> v) {
-
- Vector<PcdSyncSubTask> vThreads = new Vector<PcdSyncSubTask> ();
- int moduleCount = jTableFpdModules.getRowCount();
- int start = 0;
- for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {
- int end = start + moduleCount/FpdFrameworkModules.pcdSyncThreadNumber + 1;
- if (end > moduleCount) {
- end = moduleCount;
- }
- vThreads.add(new PcdSyncSubTask (start, end, v));
- start = end;
- }
-
- for (int i = 0; i < vThreads.size(); ++i) {
- vThreads.get(i).start();
- }
-
- try {
- for (int i = 0; i < vThreads.size(); ++i) {
- vThreads.get(i).join();
- }
- }
- catch (InterruptedException e) {
-
- }
-
- }
-
- private class PcdSyncSubTask extends Thread {
-
- private int startModule = 0;
- private int endModulePlusOne = 1;
- private Vector<String> v = null;
-
- PcdSyncSubTask (int start, int endPlusOne, Vector<String> vErr) {
- startModule = start;
- endModulePlusOne = endPlusOne;
- v = vErr;
- }
-
- public void run () {
- String[] sa = new String[5];
- for (int i = startModule; i < endModulePlusOne; ++i) {
- try {
- ffc.getFrameworkModuleInfo(i, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (ffc.adjustPcd(key, v)) {
- pcdSynced = true;
- }
- }
- catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
- continue;
- }
- }
- }
- }
- }
-
- /**
- * This is the default constructor
- */
- public FpdFrameworkModules() {
- super();
- initialize();
- }
-
- public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- init(fpd);
-
- }
-
- private PcdSyncTask pst = null;
- public FpdFrameworkModules(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (pst == null) {
- pst = new PcdSyncTask();
- }
- pst.start();
- }
-
- private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
-
- if (ffc == null) {
- ffc = new FpdFileContents(fpd);
- ffc.initDynPcdMap();
- }
-
- if (fpdMsa == null) {
- fpdMsa = new HashMap<String, ArrayList<String>>();
- }
-
- if (ffc.getFrameworkModulesCount() > 0) {
- String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
- ffc.getFrameworkModulesInfo(saa);
- for (int i = 0; i < saa.length; ++i) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "
- + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);
- Object[] row = { "", "", "", "", "", "", "", "" };
- if (mi != null) {
- row[modNameColForFpdModTable] = mi.getName();
- row[modVerColForFpdModTable] = mi.getVersion();
- row[typeColForFpdModTable] = SurfaceAreaQuery.getModuleType(mi);
- row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
- row[pkgVerColForFpdModTable] = mi.getPackageId().getVersion();
- row[archColForFpdModTable] = saa[i][ffcModArch];
- try {
- row[pathColForFpdModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show FPD Modules:" + e.getMessage());
- }
-
- String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable]
- + saa[i][ffcPkgGuid] + row[pkgVerColForFpdModTable];
- ArrayList<String> al = fpdMsa.get(fpdMsaKey);
- if (al == null) {
- al = new ArrayList<String>();
- fpdMsa.put(fpdMsaKey, al);
- }
- al.add(saa[i][ffcModArch]);
- }
- else {
- row[modNameColForFpdModTable] = saa[i][ffcModGuid];
- row[modVerColForFpdModTable] = saa[i][ffcModVer];
- row[pkgNameColForFpdModTable] = saa[i][ffcPkgGuid];
- row[pkgVerColForFpdModTable] = saa[i][ffcPkgVer];
- row[archColForFpdModTable] = saa[i][ffcModArch];
- }
- row[forceDbgColForFpdModTable] = ffc.getModuleSAForceDebug(i);
- modelFpdModules.addRow(row);
-
- }
- TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
- sorter.setSortState(modNameColForFpdModTable, TableSorter.ASCENDING);
- }
-
- showAllModules();
-
- }
-
- private void showAllModules() {
-
- if (miList == null) {
- miList = new ArrayList<ModuleIdentification>();
- }
-
- String[] s = { "", "", "", "", "", "" };
-
- Iterator ismi = GlobalData.vModuleList.iterator();
- while (ismi.hasNext()) {
- ModuleIdentification mi = (ModuleIdentification) ismi.next();
- s[modNameColForAllModTable] = mi.getName();
- s[modVerColForAllModTable] = mi.getVersion();
- s[typeColForAllModTable] = SurfaceAreaQuery.getModuleType(mi);
- s[pkgNameColForAllModTable] = mi.getPackageId().getName();
- s[pkgVerColForAllModTable] = mi.getPackageId().getVersion();
- try {
- s[pathColForAllModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show All Modules:" + e.getMessage());
- }
- modelAllModules.addRow(s);
- miList.add(mi);
- }
-
-
- TableSorter sorter = (TableSorter)jTableAllModules.getModel();
- sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(633, 533);
- this.setTitle("Framework Modules");
- this.setContentPane(getJSplitPane());
- this.setVisible(true);
-
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class NonEditableTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- return false;
- }
-}
-
-class FpdModulesTableModel extends DefaultTableModel {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public Class<?> getColumnClass (int c) {
- if (getValueAt(0, c) != null){
- return getValueAt(0, c).getClass();
- }
- return String.class;
- }
-
- public boolean isCellEditable (int row, int col) {
- if (col == FpdFrameworkModules.forceDbgColForFpdModTable) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java deleted file mode 100644 index b91f0c8f03..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java +++ /dev/null @@ -1,368 +0,0 @@ -/** @file
- Java class FpdFvOptions is GUI for FV options in FPD file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowEvent;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JButton;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-
-/**
- *
- *
- */
-public class FpdFvOptions extends JDialog {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private static JFrame frame;
- private JPanel jContentPane = null;
- private JPanel jPanelN = null;
- private JPanel jPanelS = null;
- private JPanel jPanelC = null;
- private JScrollPane jScrollPaneFvOptions = null;
- private JTable jTableFvOptions = null;
- private DefaultTableModel tableModel = null;
- private String fvName = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
- private JButton jButtonNew = null;
- private JButton jButtonDelete = null;
- private String oldOptionName = "";
- private int selectedRow = -1;
- private TableModelListener tableModelListener = null;
-
- /**
- * This is the default constructor
- */
- public FpdFvOptions(String name, DefaultTableModel tm, FpdFileContents ffc, OpeningPlatformType dc) {
- super(FrameworkWizardUI.getInstance());
- fvName = name;
- this.ffc = ffc;
- this.docConsole = dc;
- setTableModel(tm);
- initOptions();
- initialize();
-
- }
-
- protected void processWindowEvent (WindowEvent e) {
- if (e.getID() == WindowEvent.WINDOW_CLOSING) {
- if (jTableFvOptions.isEditing()) {
- jTableFvOptions.getCellEditor().stopCellEditing();
- }
- tableModel.removeTableModelListener(tableModelListener);
- this.dispose();
- }
- }
-
- private void initOptions() {
- tableModel.setRowCount(0);
- LinkedHashMap<String, String> mOpts = new LinkedHashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvName, mOpts);
- Set<String> sKey = mOpts.keySet();
- Iterator<String> iter = sKey.iterator();
- while (iter.hasNext()) {
- String name = iter.next();
- String value = mOpts.get(name);
- tableModel.addRow(new String[]{name, value});
- }
- }
-
- private boolean fvOptionNameExists (String name) {
- int count = 0;
- for (int i = 0; i < jTableFvOptions.getRowCount(); ++i) {
- if (getTableModel().getValueAt(i, 0).equals(name)) {
- ++count;
- }
- }
- if (count > 1) {
- return true;
- }
- return false;
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(650, 400);
- this.setModal(true);
- this.setTitle("FV Options");
- this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.centerWindow();
- this.setVisible(true);
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJPanelS(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelC(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanelN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelN() {
- if (jPanelN == null) {
- jPanelN = new JPanel();
- }
- return jPanelN;
- }
-
- /**
- * This method initializes jPanelS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelS() {
- if (jPanelS == null) {
- jPanelS = new JPanel();
- jPanelS.add(getJButtonNew(), null);
- jPanelS.add(getJButtonDelete(), null);
- }
- return jPanelS;
- }
-
- /**
- * This method initializes jPanelC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelC() {
- if (jPanelC == null) {
- jPanelC = new JPanel();
- jPanelC.add(getJScrollPaneFvOptions(), null);
- }
- return jPanelC;
- }
-
- /**
- * This method initializes jScrollPaneFvOptions
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvOptions() {
- if (jScrollPaneFvOptions == null) {
- jScrollPaneFvOptions = new JScrollPane();
- jScrollPaneFvOptions.setPreferredSize(new java.awt.Dimension(600,320));
- jScrollPaneFvOptions.setViewportView(getJTableFvOptions());
- }
- return jScrollPaneFvOptions;
- }
-
- /**
- * This method initializes jTableFvOptions
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvOptions() {
- if (jTableFvOptions == null) {
- jTableFvOptions = new JTable(getTableModel()) {
- /**
- *
- */
- private static final long serialVersionUID = -1941328952828651192L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String optName = (String) model.getValueAt(rowIndex, 0);
- if (((FvOptsTableModel)model).getVKeyWords().contains(optName)){
- tip = optName + " is from Flash Definition File and it is NOT editable.";
- }
-
- return tip;
- }
-
- };
-
- jTableFvOptions.setRowHeight(20);
-
- jTableFvOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- oldOptionName = getTableModel().getValueAt(selectedRow, 0)+"";
- }
- }
- });
-
- tableModelListener = new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int col = arg0.getColumn();
- TableModel m = (TableModel) arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE) {
- String newOptionName = m.getValueAt(row, 0) + "";
- if (col == 0) {
- if (newOptionName.equals(oldOptionName)) {
- return;
- }
- if (fvOptionNameExists(newOptionName)) {
- JOptionPane.showMessageDialog(frame, "This Option already exists. Please choose another Option name.");
- m.setValueAt(oldOptionName, row, 0);
- return;
- }
-
- ffc.setTypedNamedFvImageNameValue(fvName, "Options", oldOptionName, m.getValueAt(row, 1)+"", newOptionName);
- docConsole.setSaved(false);
- oldOptionName = newOptionName;
- }
-
- if (col == 1) {
- ffc.setTypedNamedFvImageNameValue(fvName, "Options", oldOptionName, m.getValueAt(row, 1)+"", newOptionName);
- docConsole.setSaved(false);
- }
-
- }
- }
- };
-
- jTableFvOptions.getModel().addTableModelListener(tableModelListener);
- }
- return jTableFvOptions;
- }
-
- protected DefaultTableModel getTableModel() {
- return tableModel;
- }
-
- protected void setTableModel(DefaultTableModel tableModel) {
-
- this.tableModel = tableModel;
-
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-/**
- * This method initializes jButtonNew
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setText("New");
- jButtonNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- tableModel.addRow(new String[]{"", ""});
- oldOptionName = "";
- }
- });
- }
- return jButtonNew;
-}
-
-/**
- * This method initializes jButtonDelete
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonDelete() {
- if (jButtonDelete == null) {
- jButtonDelete = new JButton();
- jButtonDelete.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDelete.setText("Delete");
- jButtonDelete.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvOptions.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String optName = tableModel.getValueAt(selectedRow, 0)+"";
- if (((FvOptsTableModel)tableModel).getVKeyWords().contains(optName)){
- return;
- }
- if (((FvOptsTableModel)tableModel).getVNonEditableName().contains(optName)){
- return;
- }
-
- ffc.removeTypedNamedFvImageNameValue(fvName, "Options", optName);
- tableModel.removeRow(selectedRow);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonDelete;
-}
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java deleted file mode 100644 index 516b063d66..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java +++ /dev/null @@ -1,786 +0,0 @@ -/** @file
-
- The file is used to create, update FpdHeader of Fpd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- The class is used to create, update FpdHeader of Fpd file
- It extends IInternalFrame
-
- @since PackageEditor 1.0
-
- **/
-public class FpdHeader extends IInternalFrame implements DocumentListener{
-
- private int dialogWidth = 560;
-
- private int labelColumn = 12;
-
- private int labelWidth = 155;
-
- private int buttonWidth = 60;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 320;
-
- private final int specWidth = 420;
-
- private int shortValueWidth = valueWidth - (buttonWidth + 5);
-
- private final int oneRowHeight = 20;
-
- private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int rowSep = 5;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + rowSep;
-
- private final int rowThree = rowTwo + oneRowHeight + rowSep;
-
- private final int rowFour = rowThree + oneRowHeight + rowSep;
-
- private final int rowFive = rowFour + threeRowHeight + rowSep;
-
- private final int rowSix = rowFive + fourRowHeight + rowSep;
-
- private final int rowSeven = rowSix + oneRowHeight + rowSep;
-
- private final int rowEight = rowSeven + oneRowHeight + rowSep;
-
- private final int rowNine = rowEight + fourRowHeight + threeRowHeight +rowSep;
-
- private int dialogHeight = rowNine + threeRowHeight;
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,53"
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JScrollPane jCopyrightScrollPane = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private JTextArea jCopyrightTextArea = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldUrl = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private boolean amended = false;
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField jTextFieldBaseName
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));
- jTextFieldBaseName.getDocument().addDocumentListener(this);
- jTextFieldBaseName.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Package Name does not match the UiNameType datatype.");
- return;
- }
- if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) {
- return;
- }
- ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText());
- }
- });
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField jTextFieldGuid
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(shortValueWidth,oneRowHeight));
- jTextFieldGuid.getDocument().addDocumentListener(this);
- jTextFieldGuid.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isGuid(jTextFieldGuid.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Guid must be in registry (8-4-4-4-12) format.");
- return;
- }
- if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) {
- return;
- }
- ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
- }
- });
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField jTextFieldVersion
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
- jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));
- jTextFieldVersion.getDocument().addDocumentListener(this);
- jTextFieldVersion.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isVersion(jTextFieldVersion.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Version does not match the Version datatype.");
- return;
- }
- if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) {
- return;
- }
- ffc.setFpdHdrVer(jTextFieldVersion.getText());
- }
- });
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton jButtonGenerateGuid
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jTextAreaLicense
-
- @return javax.swing.JTextArea jTextAreaLicense
-
- **/
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.getDocument().addDocumentListener(this);
- jTextAreaLicense.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (jTextAreaLicense.getText().length() == 0) {
- JOptionPane.showMessageDialog(FpdHeader.this, "License must be entered!");
- return;
- }
- if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) {
- return;
- }
- ffc.setFpdHdrLicense(jTextAreaLicense.getText());
- }
- });
- }
- return jTextAreaLicense;
- }
-
- /**
- This method initializes jTextAreaDescription
-
- @return javax.swing.JTextArea jTextAreaDescription
-
- **/
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.getDocument().addDocumentListener(this);
- jTextAreaDescription.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (jTextAreaDescription.getText().length() == 0) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Description must be entered.");
- return;
- }
- if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) {
- return;
- }
- ffc.setFpdHdrDescription(jTextAreaDescription.getText());
- }
- });
- }
- return jTextAreaDescription;
- }
-
- /**
- This method initializes jTextFieldSpecification
-
- @return javax.swing.JTextField jTextFieldSpecification
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(labelColumn,rowNine,specWidth,oneRowHeight));
- jTextFieldSpecification.setEditable(false);
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth,oneRowHeight));
- jTextFieldSpecification.setBorder(null);
-// jTextFieldSpecification.addFocusListener(new FocusAdapter(){
-// public void focusLost(FocusEvent e) {
-// ffc.setFpdHdrSpec(jTextFieldSpecification.getText());
-// }
-// });
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setBounds(new java.awt.Rectangle(290,351,90,20));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(390,351,90,20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jScrollPaneLicense
-
- @return javax.swing.JScrollPane jScrollPaneLicense
-
- **/
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(valueColumn,rowFive,valueWidth,fourRowHeight));
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth,fourRowHeight));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- }
- return jScrollPaneLicense;
- }
-
- /**
- This method initializes jScrollPaneDescription
-
- @return javax.swing.JScrollPane jScrollPaneDescription
-
- **/
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(valueColumn,rowEight,valueWidth,fourRowHeight));
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- }
- return jScrollPaneDescription;
- }
-
- /**
- This method initializes jTextFieldAbstract
-
- @return javax.swing.JTextField jTextFieldAbstract
-
- **/
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(valueColumn,rowSeven,valueWidth,oneRowHeight));
- jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jTextFieldAbstract.getDocument().addDocumentListener(this);
- jTextFieldAbstract.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Abstract must be entered.");
- return;
- }
- if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) {
- return;
- }
- ffc.setFpdHdrAbs(jTextFieldAbstract.getText());
- }
- });
- }
- return jTextFieldAbstract;
- }
-
- private JScrollPane getCopyrightScrollPane() {
- if (jCopyrightScrollPane == null) {
- jCopyrightScrollPane = new JScrollPane();
- jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));
- jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());
- }
- return jCopyrightScrollPane;
- }
- /**
- This method initializes jTextFieldCopyright
-
- @return javax.swing.JTextField jTextFieldCopyright
-
- **/
- private JTextArea getJCopyrightTextArea() {
- if (jCopyrightTextArea == null) {
- jCopyrightTextArea = new JTextArea();
- jCopyrightTextArea.setWrapStyleWord(true);
- jCopyrightTextArea.setLineWrap(true);
- jCopyrightTextArea.getDocument().addDocumentListener(this);
- jCopyrightTextArea.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Copyright must be entered.");
- return;
- }
- if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) {
- return;
- }
- ffc.setFpdHdrCopyright(jCopyrightTextArea.getText());
- }
- });
- }
- return jCopyrightTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldUrl() {
- if (jTextFieldUrl == null) {
- jTextFieldUrl = new JTextField();
- jTextFieldUrl.setBounds(new java.awt.Rectangle(valueColumn,rowSix,valueWidth,oneRowHeight));
- jTextFieldUrl.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jTextFieldUrl.getDocument().addDocumentListener(this);
- jTextFieldUrl.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e){
- if (jTextFieldUrl.getText().length() == 0 && ffc.getFpdHdrUrl() == null) {
- return;
- }
- if (jTextFieldUrl.getText().equals(ffc.getFpdHdrUrl())) {
- return;
- }
- ffc.setFpdHdrLicense(jTextAreaLicense.getText());
- ffc.setFpdHdrUrl(jTextFieldUrl.getText());
- }
- });
- }
- return jTextFieldUrl;
- }
-
- public static void main(String[] args) {
- new FpdHeader().setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public FpdHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader
-
- **/
- public FpdHeader(PlatformSurfaceAreaDocument.PlatformSurfaceArea inFpd) {
- this();
- ffc = new FpdFileContents(inFpd);
- init(ffc);
-
- }
-
- public FpdHeader(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (amended) {
- docConsole.setSaved(false);
- amended = false;
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- //this.setSize(500, 515);
- this.setContentPane(getJContentPane());
- this.setTitle("Platform Surface Area Header");
- initFrame();
-
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader
-
- **/
- private void init(FpdFileContents ffc) {
-
- if (ffc.getFpdHdrPlatformName() != null) {
- jTextFieldBaseName.setText(ffc.getFpdHdrPlatformName());
- }
- if (ffc.getFpdHdrGuidValue() != null) {
- jTextFieldGuid.setText(ffc.getFpdHdrGuidValue());
- }
- if (ffc.getFpdHdrVer() != null) {
- jTextFieldVersion.setText(ffc.getFpdHdrVer());
- }
- if (ffc.getFpdHdrLicense() != null) {
- jTextAreaLicense.setText(ffc.getFpdHdrLicense());
- }
- if (ffc.getFpdHdrAbs() != null) {
- jTextFieldAbstract.setText(ffc.getFpdHdrAbs());
- }
- if (ffc.getFpdHdrUrl() != null) {
- jTextFieldUrl.setText(ffc.getFpdHdrUrl());
- }
- if (ffc.getFpdHdrCopyright() != null) {
- jCopyrightTextArea.setText(ffc.getFpdHdrCopyright());
- }
- if (ffc.getFpdHdrDescription() != null) {
- jTextAreaDescription.setText(ffc.getFpdHdrDescription());
- }
- if (ffc.getFpdHdrSpec() != null) {
- jTextFieldSpecification.setText(ffc.getFpdHdrSpec());
- }
- ffc.setFpdHdrSpec(jTextFieldSpecification.getText());
-
- if (ffc.getPlatformDefsSkuInfoCount() == 0) {
- ffc.genPlatformDefsSkuInfo("0", "DEFAULT");
- amended = true;
- JOptionPane.showMessageDialog(this, "Default SKU set for this platform.");
- }
- Vector<Object> v = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(v);
- if (v.size() == 0) {
- v.add("IA32");
- ffc.setPlatformDefsSupportedArchs(v);
- amended = true;
- JOptionPane.showMessageDialog(this, "Supported Arch. IA32 added for this platform.");
- }
- v.removeAllElements();
- ffc.getPlatformDefsBuildTargets(v);
- if (v.size() == 0) {
- v.add("DEBUG");
- ffc.setPlatformDefsBuildTargets(v);
- amended = true;
- JOptionPane.showMessageDialog(this, "Build target IA32 added for this platform.");
- }
- if (ffc.getPlatformDefsInterDir() == null) {
- ffc.setPlatformDefsInterDir("UNIFIED");
- amended = true;
- JOptionPane.showMessageDialog(this, "UNIFIED Intermediate Directory set for this platform.");
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setLocation(new java.awt.Point(0, 0));
- jContentPane.setSize(new java.awt.Dimension(dialogWidth - 20 ,dialogHeight - 20));
-
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(labelColumn,rowSix,labelWidth,oneRowHeight));
- jLabel.setText("URL");
- jLabelAbstract = new JLabel();
- jLabelAbstract.setBounds(new java.awt.Rectangle(labelColumn,rowSeven,labelWidth,oneRowHeight));
- jLabelAbstract.setText("Abstract");
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setBounds(new java.awt.Rectangle(labelColumn,rowEight,labelWidth,oneRowHeight));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn,rowFour,labelWidth,oneRowHeight));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setBounds(new java.awt.Rectangle(labelColumn,rowFive,labelWidth,oneRowHeight));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelGuid = new JLabel();
- jLabelGuid.setPreferredSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jLabelGuid.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelGuid.setText("Guid");
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("Platform Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, rowTwo));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, rowThree));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0,rowFour));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0,rowFive));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(0,rowSeven));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(0,rowEight));
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(getCopyrightScrollPane(), null);
-
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldUrl(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonGenerateGuid) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
- }
- }
-
-
- /**
- This method initializes Package type and Compontent type
-
- **/
- private void initFrame() {
-
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = dialogWidth;
- int intCurrentWidth = this.getJContentPane().getWidth();
-
- // Tools.resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth);
-// Tools.relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25);
- // Tools.resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth);
-
-
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
- */
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
- */
- public void insertUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
- */
- public void removeUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java deleted file mode 100644 index b2d577e4dd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ /dev/null @@ -1,2240 +0,0 @@ -package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JTabbedPane;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JSplitPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.platform.ui.global.LibraryClassDescriptor;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
-
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import javax.swing.JComboBox;
-
-public class FpdModuleSA extends JDialog implements ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JTabbedPane jTabbedPane = null;
- private JPanel jPanelPcd = null;
- private JPanel jPanelLibrary = null;
- private JLabel jLabelPcdData = null;
- private JScrollPane jScrollPaneTablePcd = null;
- private JTable jTablePcd = null;
- private JPanel jPanelPcdSouth = null;
- private JScrollPane jScrollPanePcdHelp = null;
- private JTextArea jTextAreaPcdHelp = null;
- private JPanel jPanelContentPaneSouth = null;
- private JSplitPane jSplitPane = null;
- private JPanel jPanelLibraryLeft = null;
- private JPanel jPanelLibraryRight = null;
- private JLabel jLabelLibClass = null;
- private JLabel jLabelQualifiedInstance = null;
- private JScrollPane jScrollPaneSelectedInstances = null;
- private JTable jTableSelectedInstances = null;
- private JScrollPane jScrollPaneLibClass = null;
- private JTable jTableLibClass = null;
- private JScrollPane jScrollPaneQualifiedInstance = null;
- private JTable jTableLibInstances = null;
- private JPanel jPanelLibrarySouth = null;
- private JPanel jPanelLibraryCenter = null;
- private JScrollPane jScrollPaneInstanceHelp = null;
- private JTextArea jTextAreaInstanceHelp = null;
- private JLabel jLabelSelectedInstances = null;
- private JLabel jLabelInstanceHelp = null;
- private JButton jButtonAdd = null;
- private JButton jButtonDeleteInstance = null;
- private JLabel jLabelPcdHelp = null;
- private JButton jButtonOk = null;
- private JButton jButtonCancel = null;
- private IDefaultTableModel model = null;
- private IDefaultTableModel selectedInstancesTableModel = null;
- private IDefaultTableModel libClassTableModel = null;
- private IDefaultTableModel libInstanceTableModel = null;
- private DefaultTableModel optionsTableModel = null;
- private FpdFileContents ffc = null;
- private String moduleKey = null;
- private ModuleIdentification moduleId = null;
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classInstanceMap = null;
- //
- // map of <{libName, supArch, supMod}, list of Module information>
- //
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classConsumed = null;
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classProduced = null;
-
- private JPanel jPanelModuleSaOpts = null;
- private JLabel jLabelFvBinding = null;
- private JTextField jTextFieldFvBinding = null;
- private JLabel jLabelFfsFileGuid = null;
- private JTextField jTextFieldFileGuid = null;
- private JLabel jLabelFfsFormatKey = null;
- private JTextField jTextFieldFfsKey = null;
- private JScrollPane jScrollPaneModuleSaOptions = null;
- private JTable jTableModuleSaOptions = null;
- private JButton jButtonNew = null;
- private JButton jButtonDeleteOption = null;
- private JPanel jPanelPcdFields = null;
- private JPanel jPanelPcdFieldsSecondRow = null;
- private JPanel jPanelPcdFieldsThirdRow = null;
- private JPanel jPanelPcdFieldsFirstRow = null;
- private JLabel jLabelItemType = null;
- private JComboBox jComboBoxItemType = null;
- private JLabel jLabelMaxDatumSize = null;
- private JTextField jTextFieldMaxDatumSize = null;
- private JLabel jLabelPcdDefaultValue = null;
- private JTextField jTextFieldPcdDefault = null;
- private JButton jButtonUpdatePcd = null;
- private JComboBox jComboBoxFeatureFlagValue = null;
- private OpeningPlatformType docConsole = null;
- private JPanel jPanelCustomToolChain = null;
- private JPanel jPanelToolchainS = null;
- private JPanel jPanelLibraryCenterN = null;
- private JPanel jPanelLibraryCenterC = null; // @jve:decl-index=0:visual-constraint="20,224"
-
- private final int buildTargetWidth = 150;
- private final int toolChainFamilyWidth = 150;
- private final int supportArchWidth = 150;
- private final int toolCmdCodeWidth = 200;
- private final int tagNameWidth = 150;
- private final int argWidth = 400;
-
- /**
- * This is the default constructor
- */
- public FpdModuleSA() {
- super(FrameworkWizardUI.getInstance());
- initialize();
- }
- public FpdModuleSA(FpdFileContents ffc) {
- this();
- this.ffc = ffc;
- }
-
- public void setKey(String k, int i, OpeningPlatformType dc){
- this.moduleKey = k;
- this.docConsole = dc;
- classInstanceMap = null;
- classProduced = null;
- classConsumed = null;
- int tabIndex = jTabbedPane.indexOfTab("FV Info");
- jTabbedPane.setSelectedIndex(tabIndex);
- initFvInfo(moduleKey);
- initPcdBuildDefinition(moduleKey);
- moduleId = WorkspaceProfile.getModuleId(moduleKey);
- if (moduleId == null) {
- return;
- }
- tabIndex = jTabbedPane.indexOfTab("Libraries");
- if (moduleId.isLibrary()) {
- jTabbedPane.setEnabledAt(tabIndex, false);
- }
- else {
- jTabbedPane.setEnabledAt(tabIndex, true);
- }
- }
-
- /**
- init will be called each time FpdModuleSA object is to be shown.
- @param key Module information.
- **/
- public void initPcdBuildDefinition(String key) {
- //
- // display pcd for key.
- //
- model.setRowCount(0);
- jTextAreaPcdHelp.setText("");
- jComboBoxItemType.setSelectedIndex(-1);
- jTextFieldMaxDatumSize.setText("");
- jTextFieldPcdDefault.setText("");
- int pcdCount = ffc.getPcdDataCount(key);
- if (pcdCount != 0) {
- String[][] saa = new String[pcdCount][7];
- ffc.getPcdData(key, saa);
- for (int j = 0; j < saa.length; ++j) {
- model.addRow(saa[j]);
- }
- }
- }
-
- public void initLibraries(String key) {
- libClassTableModel.setRowCount(0);
- libInstanceTableModel.setRowCount(0);
- selectedInstancesTableModel.setRowCount(0);
- Vector<String> errorMsg = new Vector<String>();
- Vector<ModuleIdentification> newInstances = new Vector<ModuleIdentification>();
-
- addConsumedClassFromModule (key);
- addProducedClassFromModule (key);
-
- int instanceCount = ffc.getLibraryInstancesCount(key);
- if (instanceCount != 0) {
- String[][] saa = new String[instanceCount][5];
- ffc.getLibraryInstances(key, saa);
- for (int i = 0; i < saa.length; ++i) {
- String libInstanceKey = saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(libInstanceKey);
- if (mi != null) {
- //
- // ToDo: verify this instance first.
- //
- saa[i][0] = mi.getName();
- saa[i][2] = mi.getVersion();
- saa[i][4] = mi.getPackageId().getVersion();
- //
- // re-evaluate lib instance usage when adding a already-selected lib instance.
- //
- addConsumedClassFromModule (libInstanceKey);
- addProducedClassFromModule (libInstanceKey);
- selectedInstancesTableModel.addRow(saa[i]);
- }
- }
- }
-
- Set<LibraryClassDescriptor> sLcd = this.classConsumed.keySet();
- Iterator<LibraryClassDescriptor> iter = sLcd.iterator();
- Stack<LibraryClassDescriptor> lcdStack = new Stack<LibraryClassDescriptor>();
- while (iter.hasNext()) {
- LibraryClassDescriptor lcd = iter.next();
- if (this.classConsumed.get(lcd) == null || this.classConsumed.get(lcd).size() == 0) {
- continue;
- }
- if (isBoundedClass(lcd, errorMsg)) {
- continue;
- }
-
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
-
- try {
- resolveLibraryInstances(lcdStack, true, errorMsg, newInstances);
- } catch (Exception e) {
- String exceptionMsg = e.getCause() + " " + e.getMessage();
- if (!errorMsg.contains(exceptionMsg)) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), e.getCause() + " " + e.getMessage());
- }
- }
-
- String newInstancesAddedMsg = "Library instance automatically added to this module :\n";
- for (int i = 0; i < newInstances.size(); ++i) {
- ModuleIdentification libMi = newInstances.get(i);
- newInstancesAddedMsg += libMi.getName();
- newInstancesAddedMsg += " ";
- }
- if (newInstances.size() > 0) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), newInstancesAddedMsg);
- }
-
- showClassToResolved();
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
- }
- }
-
- public void initFvInfo (String key) {
- //
- // display module SA options
- //
- jTextFieldFvBinding.setText("");
- String fvBinding = ffc.getFvBinding(key);
- if (fvBinding != null) {
- jTextFieldFvBinding.setText(fvBinding);
- }
- jTextFieldFileGuid.setText("");
- String fileGuid = ffc.getFfsFileNameGuid(key);
- if (fileGuid != null) {
- jTextFieldFileGuid.setText(fileGuid);
- }
- jTextFieldFfsKey.setText("");
- String ffsKey = ffc.getFfsFormatKey(key);
- if (ffsKey != null) {
- jTextFieldFfsKey.setText(ffsKey);
- }
- }
-
- public void initToolChainOptions(String key) {
-
- optionsTableModel.setRowCount(0);
- String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6];
- ffc.getModuleSAOptions(key, saa);
- for (int i = 0; i < saa.length; ++i) {
- optionsTableModel.addRow(saa[i]);
- }
- }
-
- private void filterClassConsumedByArch (Vector<LibraryClassDescriptor> v) {
- String[] moduleInfo = moduleKey.split(" ");
- Vector<String> vModuleArchs = new Vector<String>();
- //
- // Skip guid, version information, get archs to check.
- //
- for (int i = 4; i < moduleInfo.length; ++i) {
- vModuleArchs.add(moduleInfo[i]);
- }
- //
- // if module will be built on all platforms, no filter needed for lib classes.
- //
- if (vModuleArchs.size() == 0) {
- return;
- }
-
- Iterator<LibraryClassDescriptor> iter = v.iterator();
- while (iter.hasNext()) {
- LibraryClassDescriptor libInfo = iter.next();
-
- Vector<String> vSupArchs = libInfo.getVectorFromString(libInfo.supArchs);
-
- if (vSupArchs.size() == 0 || (vSupArchs.size() == 1 && vSupArchs.get(0).equalsIgnoreCase(""))) {
- //
- // update lib info to module archs only.
- //
- libInfo.supArchs = "";
- for (int i = 0; i < vModuleArchs.size(); ++i) {
- libInfo.supArchs += vModuleArchs.get(i);
- libInfo.supArchs += " ";
- }
- libInfo.supArchs.trim();
- continue;
- }
- //
- // only retain those lib class used by module archs.
- //
- vSupArchs.retainAll(vModuleArchs);
- if (vSupArchs.size() > 0) {
- //
- // update lib info to reflect which kind of arch need to select instance.
- //
- libInfo.supArchs = "";
- for (int i = 0; i < vSupArchs.size(); ++i) {
- libInfo.supArchs += vSupArchs.get(i);
- libInfo.supArchs += " ";
- }
- libInfo.supArchs.trim();
- continue;
- }
- //
- // remove this lib definition if it supports no archs module will be built under.
- //
- iter.remove();
- }
- }
-
- private void addProducedClassFromModule (String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
- Vector<LibraryClassDescriptor> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
- if (this.classProduced == null) {
- this.classProduced = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
- for (int i = 0; i < vClassProduced.size(); ++i) {
- ArrayList<String> producedBy = this.classProduced.get(vClassProduced.get(i));
- if (producedBy == null) {
- producedBy = new ArrayList<String>();
- }
- //
- // class already produced by previous module (lib instance).
- /*
- if (producedBy.size() == 1) {
- String instanceKey = producedBy.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
- throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
- }
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
- ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
- String instanceKey = alreadyProducedBy.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
- throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
- }
- }
- */
- // normal case.
- //
- producedBy.add(key);
- this.classProduced.put(vClassProduced.get(i), producedBy);
-
- }
- }
-
- private Vector<LibraryClassDescriptor> addConsumedClassFromModule (String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
-// PackageIdentification[] depPkgList = null;
-
- //
- // Get dependency pkg list into which we will search lib instances.
- //
- //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // Get the lib class consumed, produced by this module itself.
- //
- Vector<LibraryClassDescriptor> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
- for (int i = 0; i < vClassConsumed.size(); ++i) {
- vClassConsumed.get(i).supModTypes = WorkspaceProfile.getModuleType(moduleId);
- }
- filterClassConsumedByArch(vClassConsumed);
- if (this.classConsumed == null) {
- this.classConsumed = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
-
- for (int i = 0; i < vClassConsumed.size(); ++i) {
- ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));
- if (consumedBy == null) {
- consumedBy = new ArrayList<String>();
- }
- consumedBy.add(key);
- this.classConsumed.put(vClassConsumed.get(i), consumedBy);
- }
-
- return vClassConsumed;
- }
-
- private void resolveLibraryInstances(Stack<LibraryClassDescriptor> lcdStack, boolean autoSelectSingleInstance, Vector<String> errorMsg, Vector<ModuleIdentification> newInstances) throws MultipleInstanceException, NoInstanceException{
-
- if (classInstanceMap == null) {
- classInstanceMap = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
- while (!lcdStack.empty()) {
- LibraryClassDescriptor cls = lcdStack.pop();
- if (isBoundedClass(cls, errorMsg)) {
- continue;
- }
- ArrayList<String> instances = getInstancesForClass(cls, null);
- if (instances.size() == 0) {
-// throw new NoInstanceException (cls.className);
- String exceptionMsg = new NoInstanceException (cls.className).getMessage();
- if (!errorMsg.contains(exceptionMsg)) {
- errorMsg.add(exceptionMsg);
- }
-
- }
- classInstanceMap.put(cls, instances);
- if (instances.size() == 1 && autoSelectSingleInstance) {
- String instanceInfo = instances.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceInfo);
- try {
- Object[] row = {libMi.getName(), libMi.getGuid(), libMi.getVersion(),
- libMi.getPackageId().getGuid(), libMi.getPackageId().getVersion()};
- if (!ffc.instanceExistsInModuleSA(moduleKey, row[1]+"", row[2]+"", row[3]+"", row[4]+"")) {
- addLibInstance(libMi);
- newInstances.add(libMi);
- docConsole.setSaved(false);
- selectedInstancesTableModel.addRow(row);
- addProducedClassFromModule (instanceInfo);
- Vector<LibraryClassDescriptor> vLcd = addConsumedClassFromModule(instanceInfo);
- for (int i = 0; i < vLcd.size(); ++i) {
- LibraryClassDescriptor lcd = vLcd.get(i);
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
- }
- }
- catch (Exception e) {
- if (!errorMsg.contains(e.getMessage())) {
- errorMsg.add(e.getMessage());
- }
- }
- }
- }
- }
-//
-
- /**Search classProduced map to see if this class has been produced by some instance (module).
- * @param cls
- * @return
- */
- private boolean isBoundedClass (LibraryClassDescriptor cls, Vector<String> errorMsg) {
-// if (this.classProduced.containsKey(cls)) {
-// return true;
-// }
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.className.equals(lcd.className)) {
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
- return true;
- }
- else {
- ArrayList<String> producedBy = this.classProduced.get(lcd);
- String instancesName = "";
- for (int i = 0; i < producedBy.size(); ++i) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(producedBy.get(i));
- instancesName += mi.getName();
- instancesName += " ";
- }
- String msg = new ImproperInstanceException(lcd.className, instancesName, lcd.supArchs, lcd.supModTypes).getMessage();
- if (!errorMsg.contains(msg)) {
- errorMsg.add(msg);
- }
- }
- }
- }
-
- return false;
- }
-
- private ArrayList<String> getInstancesForClass(LibraryClassDescriptor cls, PackageIdentification[] depPkgList){
- ArrayList<String> al = new ArrayList<String>();
-
-// for (int i = 0; i < depPkgList.length; ++i) {
- Iterator ismi = GlobalData.vModuleList.iterator();
- while(ismi.hasNext()) {
- ModuleIdentification mi = (ModuleIdentification)ismi.next();
-// if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
-// continue;
-// }
- Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
-
- boolean isPotential = false;
- Iterator<LibraryClassDescriptor> lcdi = clsProduced.iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)){
- isPotential = true;
- }
-
- if (isPotential && hasBeenProduced(lcd)) {
- isPotential = false;
- break;
- }
- }
- if (isPotential) {
- al.add(mi.getGuid() + " " + mi.getVersion() + " " +
- mi.getPackageId().getGuid() + " " + mi.getPackageId().getVersion());
- }
- }
-// }
-
- return al;
- }
-
- private boolean hasBeenProduced (LibraryClassDescriptor cls) {
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
- return true;
- }
- }
- return false;
- }
-
- private ArrayList<String> getConsumedBy (String className) {
- Iterator<LibraryClassDescriptor> lcdi = this.classConsumed.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((lcd.className != null) && lcd.className.equals(className)) {
- return this.classConsumed.get(lcd);
- }
- }
- return null;
- }
-
- private ArrayList<String> getProducedBy (String className) {
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((lcd.className != null) && lcd.className.equals(className)) {
- return this.classProduced.get(lcd);
- }
- }
- return null;
- }
- //
- // Get class name list related with instanceKey from HashMap m<LibraryClass, ArrayList<instanceKey>>.
- //
- private ArrayList<String> getLibraryClassList (String instanceKey, HashMap<LibraryClassDescriptor, ArrayList<String>> m) {
- ArrayList<String> libraryClass = new ArrayList<String>();
- Iterator<LibraryClassDescriptor> lcdi = m.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((m.get(lcd) != null) && m.get(lcd).contains(instanceKey)) {
- libraryClass.add(lcd.className);
- }
- }
- return libraryClass;
- }
-
- private void removeInstance(String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
- //
- // remove pcd information of instance from current ModuleSA
- // Note that Pcd data SHOULD be removed prior to library instance
- // because Multi-Sourced PCD could not be removed, if we remove library instance first,
- // it will impact the judgement of whether a PCD entry is Multi-Sourced.
- //
- ffc.removePcdData(moduleKey, mi);
- ffc.removeLibraryInstance(moduleKey, key);
- //
- // remove class produced by this instance and add back these produced class to be bound.
- //
- Vector<LibraryClassDescriptor> clsProduced = getClassProduced(mi);
- for (int i = 0; i < clsProduced.size(); ++i) {
-
- classProduced.remove(clsProduced.get(i));
- }
- //
- // remove class consumed by this instance. we do not need to bound it now.
- //
- String[] clsConsumed = getClassConsumed(mi);
- for (int i = 0; i < clsConsumed.length; ++i) {
- ArrayList<String> al = getConsumedBy (clsConsumed[i]);
-
- if (al == null ) {
- continue;
- }
- al.remove(key);
- if (al.size() == 0) {
- ArrayList<String> from = getProducedBy (clsConsumed[i]);
- if (from == null) {
- continue;
- }
- boolean noUse = true;
- for (int j = 0; j < from.size(); ++j) {
- ArrayList<String> libClasses = getLibraryClassList(from.get(j), classProduced);
- for (int k = 0; k < libClasses.size(); ++k) {
- if (getConsumedBy (libClasses.get(k)) != null && getConsumedBy (libClasses.get(k)).size() > 0) {
- noUse = false;
- }
- }
- if (noUse) {
- removeInstance(from.get(j));
- }
- noUse = true;
- }
- }
- }
-
- }
-
-
- private Vector<LibraryClassDescriptor> getClassProduced(ModuleIdentification mi){
-
- Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
- return clsProduced;
-// String[] sClassProduced = new String[clsProduced.size()];
-// for (int i = 0; i < clsProduced.size(); ++i) {
-// sClassProduced[i] = clsProduced.get(i).className;
-// }
-// return sClassProduced;
- }
-
- private String[] getClassConsumed(ModuleIdentification mi){
-
- Vector<LibraryClassDescriptor> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
- String[] sClassConsumed = new String[clsConsumed.size()];
- for (int i = 0; i < clsConsumed.size(); ++i) {
- sClassConsumed[i] = clsConsumed.get(i).className;
- }
- return sClassConsumed;
- }
-
- private void showClassToResolved(){
- Vector<String> errorMsg = new Vector<String>();
- libClassTableModel.setRowCount(0);
- libInstanceTableModel.setRowCount(0);
- if (classConsumed == null || classConsumed.size() == 0) {
- return;
- }
-
- Iterator<LibraryClassDescriptor> li = classConsumed.keySet().iterator();
- while(li.hasNext()){
- LibraryClassDescriptor lcd = li.next();
- if (classConsumed.get(lcd) == null || classConsumed.get(lcd).size() == 0) {
- continue;
- }
-
- if (!isBoundedClass(lcd, errorMsg)){
-
- String[] s = { lcd.className, lcd.supArchs, lcd.supModTypes };
- libClassTableModel.addRow(s);
- }
- }
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
- }
- }
-
- private String getModuleArch () {
- String arch = "";
- String[] moduleInfo = moduleKey.split(" ");
- for (int i = 4; i < moduleInfo.length; ++i) {
- arch += moduleInfo[i];
- arch += " ";
- }
- return arch.trim();
- }
- private void addLibInstance (ModuleIdentification libMi) throws Exception{
-
- //
- // Add pcd information of selected instance to current moduleSA
- //
- ffc.addFrameworkModulesPcdBuildDefs(libMi, getModuleArch(), ffc.getModuleSA(moduleKey));
-
- ffc.genLibraryInstance(libMi, moduleKey);
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(877, 555);
- this.setResizable(false);
- this.centerWindow();
- this.setModal(true);
- this.setTitle("Module Settings");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- jContentPane.add(getJPanelContentPaneSouth(), java.awt.BorderLayout.SOUTH);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("PCD Build Definition", null, getJPanelPcd(), null);
- jTabbedPane.addTab("Libraries", null, getJPanelLibrary(), null);
- jTabbedPane.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
- jTabbedPane.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
-
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes jPanelPcd
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelPcd() {
- if (jPanelPcd == null) {
- jLabelPcdData = new JLabel();
- jLabelPcdData.setText(" PCD Data");
- jPanelPcd = new JPanel();
- jPanelPcd.setLayout(new BorderLayout());
- jPanelPcd.add(jLabelPcdData, java.awt.BorderLayout.NORTH);
- jPanelPcd.add(getJScrollPaneTablePcd(), java.awt.BorderLayout.CENTER);
- jPanelPcd.add(getJPanelPcdSouth(), java.awt.BorderLayout.SOUTH);
- jPanelPcd.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initPcdBuildDefinition(moduleKey);
- }
- });
-
- }
- return jPanelPcd;
- }
-
- /**
- * This method initializes jPanelLibrary
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrary() {
- if (jPanelLibrary == null) {
- jPanelLibrary = new JPanel();
- jPanelLibrary.setLayout(new BorderLayout());
- jPanelLibrary.add(getJSplitPane(), java.awt.BorderLayout.NORTH);
- jPanelLibrary.add(getJPanelLibrarySouth(), java.awt.BorderLayout.SOUTH);
- jPanelLibrary.add(getJPanelLibraryCenter(), java.awt.BorderLayout.CENTER);
- jPanelLibrary.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initLibraries(moduleKey);
- }
- });
- }
- return jPanelLibrary;
- }
-
- /**
- * This method initializes jScrollPaneTablePcd
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneTablePcd() {
- if (jScrollPaneTablePcd == null) {
- jScrollPaneTablePcd = new JScrollPane();
- jScrollPaneTablePcd.setViewportView(getJTablePcd());
- }
- return jScrollPaneTablePcd;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePcd() {
- if (jTablePcd == null) {
- model = new IDefaultTableModel();
- jTablePcd = new JTable(model);
- jTablePcd.setRowHeight(20);
- jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
- model.addColumn("CName");
- model.addColumn("TokenSpaceGUID");
- model.addColumn("ItemType");
- model.addColumn("Token");
- model.addColumn("MaxDatumSize");
- model.addColumn("DataType");
- model.addColumn("DefaultValue");
-
- jTablePcd.getColumnModel().getColumn(0).setMinWidth(250);
-
- TableColumn tokenColumn = jTablePcd.getColumnModel().getColumn(3);
- jTablePcd.removeColumn(tokenColumn);
-
- jTablePcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTablePcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
-
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- String cName = model.getValueAt(selectedRow, 0)+"";
- String tsGuid = model.getValueAt(selectedRow, 1)+"";
- String itemType = model.getValueAt(selectedRow, 2)+"";
- //
- // array for pcd related information: helpText, itemType, moduleType.
- //
- String[] pcdInfo = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo(moduleKey, cName, tsGuid, pcdInfo, validPcdTypes);
- jTextAreaPcdHelp.setText(pcdInfo[0]);
- initComboBox(pcdInfo[1], pcdInfo[2], validPcdTypes);
- jComboBoxItemType.setSelectedItem(itemType);
- jTextFieldMaxDatumSize.setEnabled(true);
- jTextFieldMaxDatumSize.setVisible(true);
- jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
- jTextFieldPcdDefault.setEnabled(true);
- jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
- if ((model.getValueAt(selectedRow, 5) != null) && model.getValueAt(selectedRow, 5).equals("VOID*")) {
- if (pcdInfo[1].equals("FEATURE_FLAG")) {
- jTextFieldMaxDatumSize.setVisible(false);
- }
- else if (pcdInfo[1].equals("FIXED_AT_BUILD")) {
- try{
- jTextFieldMaxDatumSize.setEnabled(false);
- jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(selectedRow, 6)+"")+"");
- }
- catch(Exception except){
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Unacceptable PCD Value: " + except.getMessage());
- }
- }
- else{
- jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
- }
- }
- else {
- jTextFieldMaxDatumSize.setEnabled(false);
- }
-
- if (!model.getValueAt(selectedRow, 2).equals("DYNAMIC") && !model.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) {
- jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
- if (model.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){
- jTextFieldPcdDefault.setVisible(false);
- jComboBoxFeatureFlagValue.setVisible(true);
- jComboBoxFeatureFlagValue.setSelectedItem(model.getValueAt(selectedRow, 6)+"");
- }
- else{
- jTextFieldPcdDefault.setVisible(true);
- jTextFieldPcdDefault.setEnabled(true);
- jComboBoxFeatureFlagValue.setVisible(false);
- }
- }
- else{
- jTextFieldPcdDefault.setEnabled(false);
- }
- }
-
-
- }
- });
-
- }
- return jTablePcd;
- }
-
- private void initComboBox(String originalType, String mType, Vector<String> validPcdTypes) {
- jComboBoxItemType.removeAllItems();
-
- if (originalType.equals("DYNAMIC")) {
- for (int i = 0; i < validPcdTypes.size(); ++i) {
- jComboBoxItemType.addItem(validPcdTypes.get(i));
- }
- }
- else {
- jComboBoxItemType.addItem(originalType);
- }
- }
-
- /**
- * @param cName
- * @param tsGuid
- * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
- */
- private void getPcdInfo(String moduleKey, String cName, String tsGuid, String[] sa, Vector<String> validPcdTypes) {
- String[][] saa = new String[ffc.getLibraryInstancesCount(moduleKey)][5];
- ffc.getLibraryInstances(moduleKey, saa);
-
- try{
- if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa, validPcdTypes)) {
- return;
- }
- for (int j = 0; j < saa.length; ++j) {
- if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),
- cName, tsGuid, sa, validPcdTypes)) {
- return;
- }
- }
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(this, "Get PCD details fail: " + e.getMessage());
- }
- }
-
- /**
- * This method initializes jPanelPcdSouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelPcdSouth() {
- if (jPanelPcdSouth == null) {
- jLabelPcdHelp = new JLabel();
- jLabelPcdHelp.setText("PCD Description");
- jPanelPcdSouth = new JPanel();
- jPanelPcdSouth.setPreferredSize(new java.awt.Dimension(607,200));
- jPanelPcdSouth.add(jLabelPcdHelp, null);
- jPanelPcdSouth.add(getJScrollPanePcdHelp(), null);
- jPanelPcdSouth.add(getJPanelPcdFields(), null);
- }
- return jPanelPcdSouth;
- }
-
- /**
- * This method initializes jScrollPanePcdHelp
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePcdHelp() {
- if (jScrollPanePcdHelp == null) {
- jScrollPanePcdHelp = new JScrollPane();
- jScrollPanePcdHelp.setPreferredSize(new java.awt.Dimension(500,100));
- jScrollPanePcdHelp.setViewportView(getJTextAreaPcdHelp());
- }
- return jScrollPanePcdHelp;
- }
-
- /**
- * This method initializes jTextAreaPcdHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaPcdHelp() {
- if (jTextAreaPcdHelp == null) {
- jTextAreaPcdHelp = new JTextArea();
- jTextAreaPcdHelp.setEditable(false);
- }
- return jTextAreaPcdHelp;
- }
-
- /**
- * This method initializes jPanelContentPaneSouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentPaneSouth() {
- if (jPanelContentPaneSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelContentPaneSouth = new JPanel();
- jPanelContentPaneSouth.setLayout(flowLayout);
- jPanelContentPaneSouth.add(getJButtonOk(), null);
- jPanelContentPaneSouth.add(getJButtonCancel(), null);
- }
- return jPanelContentPaneSouth;
- }
-
- /**
- * This method initializes jSplitPane
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane();
- jSplitPane.setDividerLocation(200);
- jSplitPane.setLeftComponent(getJPanelLibraryLeft());
- jSplitPane.setRightComponent(getJPanelLibraryRight());
- jSplitPane.setPreferredSize(new java.awt.Dimension(202,200));
- }
- return jSplitPane;
- }
-
- /**
- * This method initializes jPanelLibraryLeft
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryLeft() {
- if (jPanelLibraryLeft == null) {
- jLabelLibClass = new JLabel();
- jLabelLibClass.setText("Library Classes Uninstantiated");
- jPanelLibraryLeft = new JPanel();
- jPanelLibraryLeft.add(jLabelLibClass, null);
- jPanelLibraryLeft.add(getJScrollPaneLibClass(), null);
- }
- return jPanelLibraryLeft;
- }
-
- /**
- * This method initializes jPanelLibraryRight
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryRight() {
- if (jPanelLibraryRight == null) {
- jLabelQualifiedInstance = new JLabel();
- jLabelQualifiedInstance.setText("Instances Available");
- jPanelLibraryRight = new JPanel();
- jPanelLibraryRight.add(jLabelQualifiedInstance, null);
- jPanelLibraryRight.add(getJScrollPaneQualifiedInstance(), null);
- }
- return jPanelLibraryRight;
- }
-
- /**
- * This method initializes jScrollPaneSelectedInstances
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSelectedInstances() {
- if (jScrollPaneSelectedInstances == null) {
- jScrollPaneSelectedInstances = new JScrollPane();
- jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(600,150));
- jScrollPaneSelectedInstances.setViewportView(getJTableSelectedInstances());
- }
- return jScrollPaneSelectedInstances;
- }
-
- /**
- * This method initializes jTableSelectedInstances
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSelectedInstances() {
- if (jTableSelectedInstances == null) {
- selectedInstancesTableModel = new IDefaultTableModel();
- selectedInstancesTableModel.addColumn("Name");
- selectedInstancesTableModel.addColumn("ModuleGUID");
- selectedInstancesTableModel.addColumn("ModuleVersion");
- selectedInstancesTableModel.addColumn("PackageGUID");
- selectedInstancesTableModel.addColumn("PackageVersion");
- jTableSelectedInstances = new JTable(selectedInstancesTableModel);
- jTableSelectedInstances.setRowHeight(20);
-
- jTableSelectedInstances.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- jTableSelectedInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- }
- return jTableSelectedInstances;
- }
-
- /**
- * This method initializes jScrollPaneLibClass
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneLibClass() {
- if (jScrollPaneLibClass == null) {
- jScrollPaneLibClass = new JScrollPane();
- jScrollPaneLibClass.setPreferredSize(new java.awt.Dimension(200,170));
- jScrollPaneLibClass.setViewportView(getJTableLibClass());
- }
- return jScrollPaneLibClass;
- }
-
- /**
- * This method initializes jTableLibClass
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableLibClass() {
- if (jTableLibClass == null) {
- libClassTableModel = new IDefaultTableModel();
- libClassTableModel.addColumn("LibraryClass");
- libClassTableModel.addColumn("Arch");
- libClassTableModel.addColumn("ModType");
- jTableLibClass = new JTable(libClassTableModel);
- jTableLibClass.setRowHeight(20);
- jTableLibClass.setShowGrid(false);
- jTableLibClass.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- TableColumn column = jTableLibClass.getColumnModel().getColumn(1);
- jTableLibClass.getColumnModel().removeColumn(column);
- column = jTableLibClass.getColumnModel().getColumn(1);
- jTableLibClass.getColumnModel().removeColumn(column);
-
- jTableLibClass.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow2 = lsm.getMinSelectionIndex();
- if (selectedRow2 < 0) {
- return;
- }
- //
- // display potential lib instances according to class selection
- //
- libInstanceTableModel.setRowCount(0);
- String cls = libClassTableModel.getValueAt(selectedRow2, 0).toString();
- String arch = libClassTableModel.getValueAt(selectedRow2, 1).toString();
- String modType = libClassTableModel.getValueAt(selectedRow2, 2).toString();
- LibraryClassDescriptor lcd = new LibraryClassDescriptor(cls, arch, modType);
- ArrayList<String> al = classInstanceMap.get(lcd);
- if (al == null) {
- al = getInstancesForClass(lcd, null);
- if (al.size() != 0) {
- classInstanceMap.put(lcd, al);
- }
-
- }
- ListIterator<String> li = al.listIterator();
- while(li.hasNext()) {
- String instance = li.next();
- String[] s = {"", "", "", "", ""};
- if (WorkspaceProfile.getModuleId(instance) != null) {
- s[0] = WorkspaceProfile.getModuleId(instance).getName();
- }
-
- String[] instancePart = instance.split(" ");
- for (int i = 0; i < instancePart.length; ++i){
- s[i+1] = instancePart[i];
- }
- libInstanceTableModel.addRow(s);
- }
-
- }
- }
- });
- }
- return jTableLibClass;
- }
-
- /**
- * This method initializes jScrollPaneQualifiedInstance
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneQualifiedInstance() {
- if (jScrollPaneQualifiedInstance == null) {
- jScrollPaneQualifiedInstance = new JScrollPane();
- jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(600,170));
- jScrollPaneQualifiedInstance.setViewportView(getJTableLibInstances());
- }
- return jScrollPaneQualifiedInstance;
- }
-
- /**
- * This method initializes jTableLibInstances
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableLibInstances() {
- if (jTableLibInstances == null) {
- libInstanceTableModel = new IDefaultTableModel();
- libInstanceTableModel.addColumn("Name");
- libInstanceTableModel.addColumn("ModuleGUID");
- libInstanceTableModel.addColumn("ModuleVersion");
- libInstanceTableModel.addColumn("PackageGUID");
- libInstanceTableModel.addColumn("PackageVersion");
- jTableLibInstances = new JTable(libInstanceTableModel);
- jTableLibInstances.setRowHeight(20);
-
- jTableLibInstances.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- jTableLibInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- }
- return jTableLibInstances;
- }
-
- /**
- * This method initializes jPanelLibrarySouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrarySouth() {
- if (jPanelLibrarySouth == null) {
- jPanelLibrarySouth = new JPanel();
- }
- return jPanelLibrarySouth;
- }
-
- /**
- * This method initializes jPanelLibraryCenter
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryCenter() {
- if (jPanelLibraryCenter == null) {
- jLabelInstanceHelp = new JLabel();
- jLabelInstanceHelp.setText("Instance Description");
- jLabelSelectedInstances = new JLabel();
- jLabelSelectedInstances.setText("Selected Instances");
- jPanelLibraryCenter = new JPanel();
- jPanelLibraryCenter.setLayout(new BorderLayout());
-
- jPanelLibraryCenter.add(getJPanelLibraryCenterC(), java.awt.BorderLayout.CENTER);
- jPanelLibraryCenter.add(getJPanelLibraryCenterN(), java.awt.BorderLayout.NORTH);
-
- }
- return jPanelLibraryCenter;
- }
-
- /**
- * This method initializes jScrollPaneInstanceHelp
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneInstanceHelp() {
- if (jScrollPaneInstanceHelp == null) {
- jScrollPaneInstanceHelp = new JScrollPane();
- jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(400,50));
- jScrollPaneInstanceHelp.setViewportView(getJTextAreaInstanceHelp());
- }
- return jScrollPaneInstanceHelp;
- }
-
- /**
- * This method initializes jTextAreaInstanceHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaInstanceHelp() {
- if (jTextAreaInstanceHelp == null) {
- jTextAreaInstanceHelp = new JTextArea();
- jTextAreaInstanceHelp.setEditable(false);
- }
- return jTextAreaInstanceHelp;
- }
-
- /**
- * This method initializes jButtonAdd
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableLibInstances.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- String libInstanceKey = libInstanceTableModel.getValueAt(row, 1) + " " +
- libInstanceTableModel.getValueAt(row, 2) + " " +
- libInstanceTableModel.getValueAt(row, 3) + " " +
- libInstanceTableModel.getValueAt(row, 4);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libInstanceKey);
- try {
- addLibInstance (libMi);
- }
- catch (Exception exception) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Adding Instance " + libMi.getName() + " : \n"+ exception.getMessage());
- return;
- }
- docConsole.setSaved(false);
- Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),
- libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),
- libInstanceTableModel.getValueAt(row, 4)};
- selectedInstancesTableModel.addRow(s);
-
- Vector<LibraryClassDescriptor> vLcd = addConsumedClassFromModule (libInstanceKey);
- addProducedClassFromModule (libInstanceKey);
-
- Vector<String> errorMsg = new Vector<String>();
- Vector<ModuleIdentification> newInstances = new Vector<ModuleIdentification>();
- Stack<LibraryClassDescriptor> lcdStack = new Stack<LibraryClassDescriptor>();
- for (int i = 0; i < vLcd.size(); ++i) {
- LibraryClassDescriptor lcd = vLcd.get(i);
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
- try {
- resolveLibraryInstances(lcdStack, true, errorMsg, newInstances);
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, exp.getMessage());
- }
-
- showClassToResolved();
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FpdModuleSA.this, errors);
- }
- }
- });
- }
- return jButtonAdd;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDeleteInstance() {
- if (jButtonDeleteInstance == null) {
- jButtonDeleteInstance = new JButton();
- jButtonDeleteInstance.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDeleteInstance.setText("Delete");
- jButtonDeleteInstance.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableSelectedInstances.getSelectedRow();
- if (row < 0) {
- return;
- }
- docConsole.setSaved(false);
- String instanceKey = selectedInstancesTableModel.getValueAt(row, 1) + " "
- + selectedInstancesTableModel.getValueAt(row, 2) + " "
- + selectedInstancesTableModel.getValueAt(row, 3) + " "
- + selectedInstancesTableModel.getValueAt(row, 4);
- removeInstance(instanceKey);
-
- selectedInstancesTableModel.setRowCount(0);
- int instanceCount = ffc.getLibraryInstancesCount(moduleKey);
- if (instanceCount != 0) {
- String[][] saa = new String[instanceCount][5];
- ffc.getLibraryInstances(moduleKey, saa);
- for (int i = 0; i < saa.length; ++i) {
- String libInstanceKey = saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(libInstanceKey);
- if (mi != null) {
- //
- // ToDo: verify this instance first.
- //
- saa[i][0] = mi.getName();
- saa[i][2] = mi.getVersion();
- saa[i][4] = mi.getPackageId().getVersion();
- selectedInstancesTableModel.addRow(saa[i]);
- }
- }
- }
- showClassToResolved();
- }
- });
- }
- return jButtonDeleteInstance;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Close");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- if (jTableModuleSaOptions.isEditing()) {
- jTableModuleSaOptions.getCellEditor().stopCellEditing();
- }
- this.setVisible(false);
- }
- }
- /**
- * This method initializes jPanelModuleSaOpts
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModuleSaOpts() {
- if (jPanelModuleSaOpts == null) {
- FlowLayout flowLayout4 = new FlowLayout();
- flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelFfsFormatKey = new JLabel();
- jLabelFfsFormatKey.setText("FFS Format Key");
- jLabelFfsFormatKey.setPreferredSize(new java.awt.Dimension(90,16));
- jLabelFfsFileGuid = new JLabel();
- jLabelFfsFileGuid.setText("FFS File GUID");
- jLabelFfsFileGuid.setPreferredSize(new java.awt.Dimension(90,16));
- jLabelFfsFileGuid.setVisible(false);
- jLabelFvBinding = new JLabel();
- jLabelFvBinding.setText("FV Binding");
- jLabelFvBinding.setPreferredSize(new java.awt.Dimension(90,16));
- jPanelModuleSaOpts = new JPanel();
- jPanelModuleSaOpts.setLayout(flowLayout4);
- jPanelModuleSaOpts.add(jLabelFvBinding, null);
- jPanelModuleSaOpts.add(getJTextFieldFvBinding(), null);
- jPanelModuleSaOpts.add(jLabelFfsFileGuid, null);
- jPanelModuleSaOpts.add(getJTextFieldFileGuid(), null);
- jPanelModuleSaOpts.add(jLabelFfsFormatKey, null);
- jPanelModuleSaOpts.add(getJTextFieldFfsKey(), null);
- jPanelModuleSaOpts.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initFvInfo(moduleKey);
- }
- });
- }
- return jPanelModuleSaOpts;
- }
-
- private Vector<String> getVectorFromString (String s) {
- if (s == null || s.equals("null")) {
- s = "";
- }
- String[] sa1 = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sa1.length; ++i) {
- v.add(sa1[i]);
- }
- return v;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvBinding() {
- if (jTextFieldFvBinding == null) {
- jTextFieldFvBinding = new JTextField();
- jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(400,20));
- jTextFieldFvBinding.setEditable(true);
- jTextFieldFvBinding.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFvBinding = ffc.getFvBinding(moduleKey);
- String newFvBinding = jTextFieldFvBinding.getText();
- if (newFvBinding.equals(originalFvBinding)) {
- return;
- }
- if (newFvBinding.length() == 0 && originalFvBinding == null) {
- return;
- }
-
- Vector<String> oldFvList = getVectorFromString (originalFvBinding);
- Vector<String> newFvList = getVectorFromString (newFvBinding);
- String moduleInfo[] = moduleKey.split(" ");
- ffc.setFvBinding(moduleKey, newFvBinding);
- //
- // remove module from Fvs that not in newFvList now.
- //
- oldFvList.removeAll(newFvList);
- for (int j = 0; j < oldFvList.size(); ++j) {
- ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), "IMAGES", "1", moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
- }
- //
- // add module to Fvs that were not in oldFvList.
- //
- oldFvList = getVectorFromString (originalFvBinding);
- newFvList.removeAll(oldFvList);
- for (int i = 0; i < newFvList.size(); ++i) {
- ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), "IMAGES", "1", moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
- }
- docConsole.setSaved(false);
- }
- });
-
- }
- return jTextFieldFvBinding;
- }
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFileGuid() {
- if (jTextFieldFileGuid == null) {
- jTextFieldFileGuid = new JTextField();
- jTextFieldFileGuid.setPreferredSize(new java.awt.Dimension(300,20));
- jTextFieldFileGuid.setVisible(false);
- jTextFieldFileGuid.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFileGuid = ffc.getFfsFileNameGuid(moduleKey);
- String newFileGuid = jTextFieldFileGuid.getText();
- if (newFileGuid.equals(originalFileGuid)) {
- return;
- }
- if (newFileGuid.length() == 0 && originalFileGuid == null) {
- return;
- }
- if (newFileGuid.length() > 0) {
- if (!DataValidation.isGuid(newFileGuid)) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "FFS File Guid is NOT GUID Type.");
- return;
- }
- }
-
- docConsole.setSaved(false);
- if (newFileGuid.length() == 0) {
- newFileGuid = null;
- }
- ffc.setFfsFileNameGuid(moduleKey, newFileGuid);
- }
- });
-
- }
- return jTextFieldFileGuid;
- }
- /**
- * This method initializes jTextFieldFfsKey
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFfsKey() {
- if (jTextFieldFfsKey == null) {
- jTextFieldFfsKey = new JTextField();
- jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(250,20));
- jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFfsKey = ffc.getFfsFormatKey(moduleKey);
- String newFfsKey = jTextFieldFfsKey.getText();
- if (newFfsKey.equals(originalFfsKey)) {
- return;
- }
- if (newFfsKey.length() == 0 && originalFfsKey == null) {
- return;
- }
- docConsole.setSaved(false);
- ffc.setFfsFormatKey(moduleKey, newFfsKey);
- }
- });
-
- }
- return jTextFieldFfsKey;
- }
- /**
- * This method initializes jScrollPaneModuleSaOptions
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneModuleSaOptions() {
- if (jScrollPaneModuleSaOptions == null) {
- jScrollPaneModuleSaOptions = new JScrollPane();
- jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,350));
- jScrollPaneModuleSaOptions.setViewportView(getJTableModuleSaOptions());
- }
- return jScrollPaneModuleSaOptions;
- }
- /**
- * This method initializes jTableModuleSaOptions
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableModuleSaOptions() {
- if (jTableModuleSaOptions == null) {
- optionsTableModel = new DefaultTableModel();
- optionsTableModel.addColumn("BuildTargets");
- optionsTableModel.addColumn("ToolChainFamily");
- optionsTableModel.addColumn("TagName");
- optionsTableModel.addColumn("ToolCode");
- optionsTableModel.addColumn("SupportedArchs");
- optionsTableModel.addColumn("Contents");
- jTableModuleSaOptions = new JTable(optionsTableModel);
- jTableModuleSaOptions.setRowHeight(20);
-
- jTableModuleSaOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(2).setMinWidth(tagNameWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(4).setMinWidth(supportArchWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
-// javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
-// JComboBox cb = new JComboBox();
-// cb.addItem("MSFT");
-// cb.addItem("GCC");
-// cb.addItem("CYGWIN");
-// cb.addItem("INTEL");
-// cb.addItem("USER_DEFINED");
-// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance()));
-
- jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance()));
-
- jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE){
- //ToDo Data Validition check.
- String targets = m.getValueAt(row, 0) + "";
- Vector<Object> targetName = null;
- if (targets.length() > 0) {
- targetName = new Vector<Object>();
- String[] sArray = targets.split(" ");
- for (int i = 0; i < sArray.length; ++i) {
- targetName.add(sArray[i]);
- }
- }
-
- String toolChain = m.getValueAt(row, 1) + "";
- String tagName = m.getValueAt(row, 2) + "";
- String toolCode = m.getValueAt(row, 3) + "";
- String archs = m.getValueAt(row, 4) + "";
- Vector<Object> supArch = null;
- if (archs.length() > 0) {
- supArch = new Vector<Object>();
- String[] sArray1 = archs.split(" ");
- for (int i = 0; i < sArray1.length; ++i) {
- supArch.add(sArray1[i]);
- }
- }
-
- String contents = m.getValueAt(row, 5) + "";
- docConsole.setSaved(false);
- ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents);
- }
- }
- });
- }
- return jTableModuleSaOptions;
- }
- /**
- * This method initializes jButtonNew
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setText("New");
- jButtonNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- String[] row = {"", "", "", "", "", ""};
- optionsTableModel.addRow(row);
- Vector<Object> v = null;
- Vector<Object> v1 = null;
- docConsole.setSaved(false);
- ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, "");
- }
- });
- }
- return jButtonNew;
- }
- /**
- * This method initializes jButtonDelete
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDeleteOption() {
- if (jButtonDeleteOption == null) {
- jButtonDeleteOption = new JButton();
- jButtonDeleteOption.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDeleteOption.setText("Delete");
- jButtonDeleteOption.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableModuleSaOptions.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.removeModuleSAOptionsOpt(moduleKey, jTableModuleSaOptions.getSelectedRow());
- optionsTableModel.removeRow(jTableModuleSaOptions.getSelectedRow());
- }
- });
- }
- return jButtonDeleteOption;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-/**
- * This method initializes jPanelPcdFields
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFields() {
- if (jPanelPcdFields == null) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(3);
- gridLayout.setColumns(2);
- jPanelPcdFields = new JPanel();
- jPanelPcdFields.setLayout(gridLayout);
- jPanelPcdFields.setPreferredSize(new java.awt.Dimension(600,90));
- jPanelPcdFields.add(getJPanelPcdFieldsFirstRow(), null);
- jPanelPcdFields.add(getJPanelPcdFieldsSecondRow(), null);
- jPanelPcdFields.add(getJPanelPcdFieldsThirdRow(), null);
- }
- return jPanelPcdFields;
-}
-/**
- * This method initializes jPanelPcdFieldsSecondRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsSecondRow() {
- if (jPanelPcdFieldsSecondRow == null) {
- FlowLayout flowLayout2 = new FlowLayout();
- flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelMaxDatumSize = new JLabel();
- jLabelMaxDatumSize.setText("Max Datum Size");
- jPanelPcdFieldsSecondRow = new JPanel();
- jPanelPcdFieldsSecondRow.setLayout(flowLayout2);
- jPanelPcdFieldsSecondRow.add(jLabelMaxDatumSize, null);
- jPanelPcdFieldsSecondRow.add(getJTextFieldMaxDatumSize(), null);
- }
- return jPanelPcdFieldsSecondRow;
-}
-/**
- * This method initializes jPanelPcdFieldsThirdRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsThirdRow() {
- if (jPanelPcdFieldsThirdRow == null) {
- FlowLayout flowLayout3 = new FlowLayout();
- flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelPcdDefaultValue = new JLabel();
- jLabelPcdDefaultValue.setText("Default Value");
- jLabelPcdDefaultValue.setPreferredSize(new java.awt.Dimension(91,16));
- jPanelPcdFieldsThirdRow = new JPanel();
- jPanelPcdFieldsThirdRow.setLayout(flowLayout3);
- jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null);
- jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null);
- jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null);
- jPanelPcdFieldsThirdRow.add(getJButtonUpdatePcd(), null);
- }
- return jPanelPcdFieldsThirdRow;
-}
-/**
- * This method initializes jPanelPcdFieldsFirstRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsFirstRow() {
- if (jPanelPcdFieldsFirstRow == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelItemType = new JLabel();
- jLabelItemType.setText("Item Type");
- jLabelItemType.setPreferredSize(new java.awt.Dimension(91,16));
- jPanelPcdFieldsFirstRow = new JPanel();
- jPanelPcdFieldsFirstRow.setLayout(flowLayout1);
- jPanelPcdFieldsFirstRow.add(jLabelItemType, null);
- jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null);
- }
- return jPanelPcdFieldsFirstRow;
-}
-/**
- * This method initializes jComboBoxItemType
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxItemType() {
- if (jComboBoxItemType == null) {
- jComboBoxItemType = new JComboBox();
- jComboBoxItemType.setPreferredSize(new java.awt.Dimension(200,20));
- jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
-
- int row = jTablePcd.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- if (jComboBoxItemType.getSelectedItem() != null && jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) {
- jTextFieldPcdDefault.setEnabled(true);
- }
- else {
- jTextFieldPcdDefault.setEnabled(false);
- }
- }
- });
- }
- return jComboBoxItemType;
-}
-
-private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
- String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
- ffc.getDynamicPcdBuildData(saa);
- String maxSize = "";
- String value = "";
- for (int i = 0; i < saa.length; ++i) {
- if (saa[i][0].equals(cName) && saa[i][2].equals(tsGuid)) {
- maxSize = saa[i][3];
- value = ffc.getDynamicPcdBuildDataValue(i);
- break;
- }
- }
-
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- value = null;
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, maxSize, value);
- al.set(i, mKey + " " + itemType);
- }
-
- ffc.removeDynamicPcdBuildData(cName, tsGuid);
-}
-
-private void pcdNonDynamicToDynamic(String cName, String tsGuid) {
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
- al.set(i, mKey + " " + itemType);
- }
- try{
- ffc.addDynamicPcdBuildData(cName, model.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", model.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
- }
- catch(Exception e){
- JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD value format: " + e.getMessage());
- }
-}
-
-private void changePcdTypeWithinSameCategory (String cName, String tsGuid) {
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, null, null);
- al.set(i, mKey + " " + itemType);
- }
-}
-
-private String moduleInfo (String pcdInfo) {
-
- return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
-}
-
-/**
- * This method initializes jTextFieldMaxDatumSize
- *
- * @return javax.swing.JTextField
- */
-private JTextField getJTextFieldMaxDatumSize() {
- if (jTextFieldMaxDatumSize == null) {
- jTextFieldMaxDatumSize = new JTextField();
- jTextFieldMaxDatumSize.setPreferredSize(new java.awt.Dimension(200,20));
- }
- return jTextFieldMaxDatumSize;
-}
-/**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
-private JTextField getJTextFieldPcdDefault() {
- if (jTextFieldPcdDefault == null) {
- jTextFieldPcdDefault = new JTextField();
- jTextFieldPcdDefault.setPreferredSize(new java.awt.Dimension(200,20));
- }
- return jTextFieldPcdDefault;
-}
-/**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonUpdatePcd() {
- if (jButtonUpdatePcd == null) {
- jButtonUpdatePcd = new JButton();
- jButtonUpdatePcd.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonUpdatePcd.setText("Update PCD Data");
- jButtonUpdatePcd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTablePcd.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- String cName = model.getValueAt(row, 0)+"";
- String tsGuid = model.getValueAt(row, 1)+"";
- String oldItemType = model.getValueAt(row, 2)+"";
- String dataType = model.getValueAt(row, 5)+"";
- String newItemType = jComboBoxItemType.getSelectedItem()+"";
- String newValue = jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem()+"";
- if (newValue.length() == 0){
-
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {
- newValue = "0";
- }
- if (dataType.equals("BOOLEAN")){
- newValue = "FALSE";
- }
- if (dataType.equals("VOID*")) {
- newValue = "L\"\"";
- }
- }
-
- String[] pcdInfo = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo (moduleKey, cName, tsGuid, pcdInfo, validPcdTypes);
- if (pcdInfo[1].equals("FIXED_AT_BUILD") && model.getValueAt(row, 5).equals("VOID*")) {
- try {
- jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(newValue)+"");
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD Value MalFormed: " + exp.getMessage());
- return;
- }
- }
- String newMaxDatumSize = jTextFieldMaxDatumSize.getText();
-
- if (!newItemType.equals(oldItemType)) {
- Vector<ModuleIdentification> moduleInfo = new Vector<ModuleIdentification>();
- try {
- boolean changable = itemTypeCouldBeChanged (cName, tsGuid, newItemType, moduleInfo);
- if (!changable) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName());
- return;
- }
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName() + " " + exp.getMessage());
- return;
- }
-
- if ((oldItemType.equals("DYNAMIC") || oldItemType.equals("DYNAMIC_EX")) && !newItemType.equals("DYNAMIC") && !newItemType.equals("DYNAMIC_EX")) {
- pcdDynamicToNonDynamic(cName, tsGuid);
- }
- if (!oldItemType.equals("DYNAMIC") && !oldItemType.equals("DYNAMIC_EX") && (newItemType.equals("DYNAMIC") || newItemType.equals("DYNAMIC_EX"))) {
- pcdNonDynamicToDynamic(cName, tsGuid);
- }
- else {
- changePcdTypeWithinSameCategory (cName, tsGuid);
- }
- model.setValueAt(newItemType, row, 2);
- }
-
- ffc.updatePcdData(moduleKey, cName, tsGuid, model.getValueAt(row, 2)+"", newMaxDatumSize, newValue);
- docConsole.setSaved(false);
- model.setValueAt(newValue, row, 6);
- model.setValueAt(newMaxDatumSize, row, 4);
-
- }
- });
- }
- return jButtonUpdatePcd;
-}
-
-private boolean itemTypeCouldBeChanged (String cName, String tsGuid, String newItemType, Vector<ModuleIdentification> mi) throws Exception{
- ArrayList<String> pcdConsumers = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < pcdConsumers.size(); ++i) {
- String consumerInfo = moduleInfo (pcdConsumers.get(i));
- mi.removeAllElements();
- mi.add(WorkspaceProfile.getModuleId(consumerInfo));
- String[] sa = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo (consumerInfo, cName, tsGuid, sa, validPcdTypes);
- if (validPcdTypes.size() == 0) {
- return false;
- }
- if (!sa[1].equals("DYNAMIC")) {
- return false;
- }
- if (!validPcdTypes.contains(newItemType)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * This method initializes jComboBoxFeatureFlagValue
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxFeatureFlagValue() {
- if (jComboBoxFeatureFlagValue == null) {
- jComboBoxFeatureFlagValue = new JComboBox();
- jComboBoxFeatureFlagValue.setPreferredSize(new java.awt.Dimension(100,20));
- jComboBoxFeatureFlagValue.setVisible(false);
- jComboBoxFeatureFlagValue.addItem("TRUE");
- jComboBoxFeatureFlagValue.addItem("FALSE");
- }
- return jComboBoxFeatureFlagValue;
-}
-/**
- * This method initializes jPanelCustomToolChain
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelCustomToolChain() {
- if (jPanelCustomToolChain == null) {
- jPanelCustomToolChain = new JPanel();
- jPanelCustomToolChain.setLayout(new BorderLayout());
- jPanelCustomToolChain.add(getJPanelToolchainS(), java.awt.BorderLayout.SOUTH);
- jPanelCustomToolChain.add(getJScrollPaneModuleSaOptions(), java.awt.BorderLayout.CENTER);
- jPanelCustomToolChain.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initToolChainOptions(moduleKey);
- }
- });
- }
- return jPanelCustomToolChain;
-}
-/**
- * This method initializes jPanelToolchainS
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelToolchainS() {
- if (jPanelToolchainS == null) {
- jPanelToolchainS = new JPanel();
- jPanelToolchainS.add(getJButtonNew(), null);
- jPanelToolchainS.add(getJButtonDeleteOption(), null);
- }
- return jPanelToolchainS;
-}
-
-/**
- * This method initializes jPanelLibraryCenterN
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelLibraryCenterN() {
- if (jPanelLibraryCenterN == null) {
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setAlignment(java.awt.FlowLayout.CENTER);
- flowLayout5.setHgap(10);
- jPanelLibraryCenterN = new JPanel();
- jPanelLibraryCenterN.setLayout(flowLayout5);
- jPanelLibraryCenterN.add(jLabelInstanceHelp, null);
- jPanelLibraryCenterN.add(getJScrollPaneInstanceHelp(), null);
- jPanelLibraryCenterN.add(getJButtonAdd(), null);
- jPanelLibraryCenterN.add(getJButtonDeleteInstance(), null);
- }
- return jPanelLibraryCenterN;
-}
-/**
- * This method initializes jPanelLibraryCenterC
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelLibraryCenterC() {
- if (jPanelLibraryCenterC == null) {
- jPanelLibraryCenterC = new JPanel();
- jPanelLibraryCenterC.add(jLabelSelectedInstances, null);
- jPanelLibraryCenterC.add(getJScrollPaneSelectedInstances(), null);
- }
- return jPanelLibraryCenterC;
-}
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class MultipleInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -9148463005930920297L;
- private String className = null;
- private String libInstance1 = null;
- private String libInstance2 = null;
-
- MultipleInstanceException (String libClass, String instance1, String instance2) {
- super();
- className = libClass;
- libInstance1 = instance1;
- libInstance2 = instance2;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- // TODO Auto-generated method stub
- return " Library Class " + className + "is Produced by Two Instances: "
- + libInstance1 + " and " + libInstance2 + ". Platform Build will Fail.";
- }
-
-}
-
-class ImproperInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -5279700566993277033L;
- private String className = null;
- private String libInstance = null;
- private String instanceSupArch = null;
- private String instanceSupModType = null;
-
- ImproperInstanceException (String libClass, String instance1, String arch, String type) {
- super();
- className = libClass;
- libInstance = instance1;
- instanceSupArch = arch;
- instanceSupModType = type;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- // TODO Auto-generated method stub
- return " Library Class " + className + " Produced by Library Instance: "
- + libInstance + "\nOnly Supports " + instanceSupArch + " and Module Type " + instanceSupModType + ".\n This instance should be removed.\n";
- }
-
-}
-
-class NoInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1987122786598970598L;
-
- private String className = null;
-
- NoInstanceException (String libClass) {
- className = libClass;
- }
-
- public String getMessage() {
- return "No Applicable Instance for Library Class " + className
- + ", Platform Build will Fail.";
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java deleted file mode 100644 index c87f466bdd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java +++ /dev/null @@ -1,1043 +0,0 @@ -/** @file
- Java class FpdPlatformDefs is GUI for Flash element operation in SPD file.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.toolchain.ToolChainId;
-
-import javax.swing.JCheckBox;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-//import javax.swing.event.ListSelectionEvent;
-//import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JComboBox;
-import java.awt.Dimension;
-import java.util.Vector;
-
-public class FpdPlatformDefs extends IInternalFrame {
-
- private static boolean Debug = false;
-
- private final int dialogWidth = 600;
-
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- // private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int sepHeight = 6;
-
- // private final int sepWidth = 10;
-
- private final int offsetWidth = 70;
-
- private final int buttonWidth = 90;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight * 3;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + oneRowHeight + sepHeight;
-
- private final int rowFive = rowFour + fourRowHeight + sepHeight * 3;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int rowSeven = rowSix + oneRowHeight + sepHeight;
-
- private final int rowEight = rowSeven + oneRowHeight + sepHeight;
-
- private final int rowNine = rowEight + oneRowHeight + sepHeight;
-
- private final int rowTen = rowNine + fourRowHeight + sepHeight + sepHeight * 3;
-
- private final int rowEleven = rowTen + oneRowHeight + sepHeight;
-
- private final int rowTwelve = rowEleven + oneRowHeight + sepHeight;
-
- private final int dialogHeight = rowTwelve + twoRowHeight;
-
- private final int labelColumn = 12;
-
- private final int valueColumn = 168;
-
- private final int labelWidth = 155;
-
- private final int valueWidth = 320;
-
- private final int valueCenter = valueColumn + (valueWidth / 2);
-
- private final int tableHeight = fourRowHeight;
-
- private final int tableWidth = valueWidth;
-
- private JPanel jContentPane = null;
-
- private JTabbedPane jTabbedPane = null;
-
- private TargetTableModel buildTargetTableModel = null;
-
- private SkuInfoTableModel skuInfoTableModel = null;
-
- private OpeningPlatformType docConsole = null;
-
- private FpdFileContents ffc = null;
-
- private JPanel jPanelGeneralTab = null;
-
- private JPanel jPanelGeneralContainer = null;
-
- private JLabel jLabelSupArch = null;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JComboBox jComboBoxInterDir = null;
-
- private JComboBox jBuildTargetComboBox = null;
-
- private JTable jTableBuildTargets = null;
-
- private JPanel jArchitectureSelections = null;
-
- private JLabel jLabelBuildTargets = null;
-
- // private JTextField jTextFieldBuildTarget = null;
-
- private JButton jButtonAddBuildTarget = null;
-
- private JButton jButtonDelBuildTarget = null;
-
- private JScrollPane jScrollPaneBuildTargets = null;
-
- private JScrollPane jScrollPaneSkuInfo = null;
-
- private JTable jTableSkuInfo = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- private JLabel jLabelSkuInfo = null;
-
- private JLabel jLabelSkuId = null;
-
- private JTextField jTextFieldSkuId = null;
-
- private JLabel jLabelSkuName = null;
-
- private JTextField jTextFieldSkuName = null;
-
- private JButton jButtonSkuAdd = null;
-
- private JButton jButtonSkuDel = null;
-
- private JLabel jLabelIntermediateDirs = null;
-
- private JLabel jLabelOutputDir = null;
-
- private JTextField jTextFieldOutputDir = null;
-
- private JLabel jLabelOutputInfo = null;
-
- private int selectedRow = -1;
-
- /**
- * The following are not used by the UI
- */
- private static final long serialVersionUID = 1L;
-
- private ToolChainId tid = new ToolChainId();
-
- public FpdPlatformDefs() {
- super();
- initialize();
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- public FpdPlatformDefs(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdPlatformDefs(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("General", null, getJPanelGeneralTab(), null);
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(dialogWidth, dialogHeight);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle("FPD Platform Definitions");
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter() {
- public void internalFrameDeactivated(InternalFrameEvent e) {
- if (jTableBuildTargets.isEditing()) {
- jTableBuildTargets.getCellEditor().stopCellEditing();
- }
- if (jTableSkuInfo.isEditing()) {
- jTableSkuInfo.getCellEditor().stopCellEditing();
- }
-
- }
- });
- }
-
- private void init(FpdFileContents ffc) {
- Vector<Object> v = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(v);
- showSupportedArchitectures(v);
- v.removeAllElements();
-
- ffc.getPlatformDefsBuildTargets(v);
- buildTargetTableModel.setRowCount(0);
- for (int i = 0; i < v.size(); ++i) {
- Object[] row = { v.get(i) };
- buildTargetTableModel.addRow(row);
- }
-
- String[][] saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
- ffc.getPlatformDefsSkuInfos(saa);
- for (int i = 0; i < saa.length; ++i) {
- skuInfoTableModel.addRow(saa[i]);
- }
-
- String interDir = ffc.getPlatformDefsInterDir();
- if (interDir != null) {
- jComboBoxInterDir.setSelectedItem(interDir);
- }
-
- String outputDir = ffc.getPlatformDefsOutputDir();
- if (outputDir != null) {
- jTextFieldOutputDir.setText(outputDir);
- }
- }
-
- private void showSupportedArchitectures(Vector<Object> v) {
- if (v.contains("IA32")) {
- jCheckBoxIa32.setSelected(true);
- } else {
- jCheckBoxIa32.setSelected(false);
- }
- if (v.contains("X64")) {
- jCheckBoxX64.setSelected(true);
- } else {
- jCheckBoxX64.setSelected(false);
- }
- if (v.contains("IPF")) {
- jCheckBoxIpf.setSelected(true);
- } else {
- jCheckBoxIpf.setSelected(false);
- }
- if (v.contains("EBC")) {
- jCheckBoxEbc.setSelected(true);
- } else {
- jCheckBoxEbc.setSelected(false);
- }
- if (v.contains("ARM")) {
- jCheckBoxArm.setSelected(true);
- } else {
- jCheckBoxArm.setSelected(false);
- }
- if (v.contains("PPC")) {
- jCheckBoxPpc.setSelected(true);
- } else {
- jCheckBoxPpc.setSelected(false);
- }
- }
-
- private void getSupportedArchitectures(Vector<Object> v) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- v.removeAllElements();
- if (jCheckBoxIa32.isSelected()) {
- v.add("IA32");
- }
- if (jCheckBoxX64.isSelected()) {
- v.add("X64");
- }
- if (jCheckBoxIpf.isSelected()) {
- v.add("IPF");
- }
- if (jCheckBoxEbc.isSelected()) {
- v.add("EBC");
- }
- if (jCheckBoxArm.isSelected()) {
- v.add("ARM");
- }
- if (jCheckBoxPpc.isSelected()) {
- v.add("PPC");
- }
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelGeneralTab() {
- if (jPanelGeneralTab == null) {
- jPanelGeneralTab = new JPanel();
- jPanelGeneralTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
- jPanelGeneralTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
- jPanelGeneralTab.setAutoscrolls(true);
- jPanelGeneralTab.setLocation(0, 0);
- jPanelGeneralTab.setLayout(null);
- jPanelGeneralTab.add(getJPanelGeneralContainer(), null);
- }
- return jPanelGeneralTab;
- }
-
- /**
- * This method initializes jPanel5
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelGeneralContainer() {
- if (jPanelGeneralContainer == null) {
- jLabelSupArch = new JLabel();
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setText("Build Targets");
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelSkuInfo = new JLabel();
- jLabelSkuInfo.setText("SKU Information");
- jLabelSkuInfo.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jLabelSkuId = new JLabel();
- jLabelSkuId.setText("SKU ID Number");
- jLabelSkuId.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSix, labelWidth, oneRowHeight));
- jLabelSkuName = new JLabel();
- jLabelSkuName.setText("SKU Name");
- jLabelSkuName.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSeven, labelWidth, oneRowHeight));
- jLabelOutputInfo = new JLabel();
- jLabelOutputInfo.setText("Output Directory Configuration");
- jLabelOutputInfo.setBounds(new java.awt.Rectangle(labelColumn, rowTen, valueWidth, oneRowHeight));
- jLabelIntermediateDirs = new JLabel();
- jLabelIntermediateDirs.setText("Intermediate Build Directories");
- jLabelIntermediateDirs.setBounds(new java.awt.Rectangle(labelColumn + 10, rowEleven, valueWidth,
- oneRowHeight));
- jLabelOutputDir = new JLabel();
- jLabelOutputDir.setText("Name of the Output Directory");
- jLabelOutputDir.setBounds(new java.awt.Rectangle(labelColumn + 10, rowTwelve, valueWidth, oneRowHeight));
-
- jPanelGeneralContainer = new JPanel();
- jPanelGeneralContainer.setLayout(null);
- jPanelGeneralContainer.setLocation(new java.awt.Point(2, 2));
- jPanelGeneralContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight));
- jPanelGeneralContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
-
- jPanelGeneralContainer.add(jLabelSupArch, null);
- jPanelGeneralContainer.add(getArchitectureSelections(), null);
-
- jPanelGeneralContainer.add(jLabelBuildTargets, null);
- // jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);
- jPanelGeneralContainer.add(getJBuildTargetComboBox(), null);
-
- jPanelGeneralContainer.add(getJButtonAddBuildTarget(), null);
- jPanelGeneralContainer.add(getJButtonDelBuildTarget(), null);
- jPanelGeneralContainer.add(getJScrollPaneBuildTargets(), null);
-
- jPanelGeneralContainer.add(jLabelSkuInfo, null);
- jPanelGeneralContainer.add(jLabelSkuId, null);
- jPanelGeneralContainer.add(getJTextFieldSkuId(), null);
- jPanelGeneralContainer.add(jLabelSkuName, null);
- jPanelGeneralContainer.add(getJTextFieldSkuName(), null);
- jPanelGeneralContainer.add(getJButtonSkuAdd(), null);
- jPanelGeneralContainer.add(getJButtonSkuDel(), null);
- jPanelGeneralContainer.add(getJScrollPaneSkuInfo(), null);
-
- jPanelGeneralContainer.add(jLabelOutputInfo, null);
- jPanelGeneralContainer.add(jLabelIntermediateDirs, null);
- jPanelGeneralContainer.add(getJComboBoxInterDir(), null);
- jPanelGeneralContainer.add(jLabelOutputDir, null);
- jPanelGeneralContainer.add(getJTextFieldOutputDir(), null);
-
- }
- return jPanelGeneralContainer;
- }
-
- /**
- * This method initializes jArchitectureSelections Row 4
- *
- * @return jArchitectureSelections
- */
- private JPanel getArchitectureSelections() {
- if (jArchitectureSelections == null) {
- jArchitectureSelections = new JPanel();
- jArchitectureSelections.setLayout(null);
- jArchitectureSelections.add(getJCheckBoxIa32(), null);
- jArchitectureSelections.add(getJCheckBoxX64(), null);
- jArchitectureSelections.add(getJCheckBoxIpf(), null);
- jArchitectureSelections.add(getJCheckBoxEbc(), null);
- jArchitectureSelections.add(getJCheckBoxArm(), null);
- jArchitectureSelections.add(getJCheckBoxPpc(), null);
- jArchitectureSelections.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jArchitectureSelections.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jArchitectureSelections.setLocation(new java.awt.Point(valueColumn, rowOne));
- jArchitectureSelections.setToolTipText("<html>A Platform may support one or more architectures,"
- + "<br>at least one architecture must be selected!</html>");
- }
- return jArchitectureSelections;
- }
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIa32.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxIa32.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBox2
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- jCheckBoxX64.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxX64.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBox3
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxIpf.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- // jCheckBoxEbc.setPreferredSize(new java.awt.Dimension(50, 20));
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setVisible(true);
- jCheckBoxEbc.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxEbc.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBox5
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- // jCheckBoxArm.setPreferredSize(new java.awt.Dimension(52, 20));
- jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setVisible(true);
- jCheckBoxArm.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxArm.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBox6
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- // jCheckBoxPpc.setPreferredSize(new Dimension(50, 20));
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setVisible(true);
- jCheckBoxPpc.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxPpc.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxPpc;
- }
-
- /**
- * Use a ComboBox for BuildTargets
- *
- * @return javax.swing.JComboBox jBuildTargetComboBox
- */
- private JComboBox getJBuildTargetComboBox() {
- if (jBuildTargetComboBox == null) {
- String toolBt = null;
- if (tid.getToolsDefTargetNames() == null)
- toolBt = "DEBUG RELEASE";
- else
- toolBt = tid.getToolsDefTargetNames().trim();
-
- if ((toolBt.contains("*")) || (toolBt.length() < 1)) {
- toolBt = "DEBUG RELEASE";
- }
- if (Debug)
- System.out.println("Using Build Targets: " + toolBt.trim());
-
- toolBt = toolBt.replaceAll(" ", ":");
- toolBt = " :" + toolBt;
- if (Debug)
- System.out.println("Using Build Targets: " + toolBt.trim());
- String[] buildTargets = toolBt.trim().split(":");
-
- jBuildTargetComboBox = new JComboBox(buildTargets);
- jBuildTargetComboBox.setEditable(true);
- jBuildTargetComboBox.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jBuildTargetComboBox.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
- jBuildTargetComboBox.setLocation(new java.awt.Point(valueColumn, rowTwo));
- jBuildTargetComboBox.setToolTipText("<html>Select a defined Target and then click Add,<br>"
- + "or enter a new, one word TargetName and then click Add.<br>"
- + "Remember to define the Targetname in the tool defintion file."
- + "</html>");
-
- }
- return jBuildTargetComboBox;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- // private JTextField getJTextFieldBuildTarget() {
- // if (jTextFieldBuildTarget == null) {
- // jTextFieldBuildTarget = new JTextField();
- // jTextFieldBuildTarget.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- // jTextFieldBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
- // jTextFieldBuildTarget.setLocation(new java.awt.Point(valueColumn, rowTwo));
- // }
- // return jTextFieldBuildTarget;
- // }
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddBuildTarget() {
- if (jButtonAddBuildTarget == null) {
- jButtonAddBuildTarget = new JButton();
- jButtonAddBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonAddBuildTarget.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowThree,
- buttonWidth, oneRowHeight));
- jButtonAddBuildTarget.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowThree));
- jButtonAddBuildTarget.setText("Add");
- jButtonAddBuildTarget.setVisible(true);
-
- jButtonAddBuildTarget.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- // Used with Text Field
- // if (jTextFieldBuildTarget.getText().length() > 0) {
- // String[] row = { jTextFieldBuildTarget.getText() };
- // jTextFieldBuildTarget.setText("");
- // buildTargetTableModel.addRow(row);
- // Vector<Object> v = new Vector<Object>();
- // for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- // v.add(buildTargetTableModel.getValueAt(i, 0));
- // }
- // docConsole.setSaved(false);
- // ffc.setPlatformDefsBuildTargets(v);
- // }
- // Use with ComboBox
- if (jBuildTargetComboBox.getSelectedItem().toString().length() > 0) {
- String[] row = { jBuildTargetComboBox.getSelectedItem().toString() };
- buildTargetTableModel.addRow(row);
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(buildTargetTableModel.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- }
- });
- }
- return jButtonAddBuildTarget;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelBuildTarget() {
- if (jButtonDelBuildTarget == null) {
- jButtonDelBuildTarget = new JButton();
- jButtonDelBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonDelBuildTarget
- .setBounds(new java.awt.Rectangle(valueCenter + 5, rowThree, buttonWidth, oneRowHeight));
- jButtonDelBuildTarget.setLocation(new java.awt.Point(valueCenter + 5, rowThree));
- jButtonDelBuildTarget.setText("Delete");
- jButtonDelBuildTarget.setVisible(true);
-
- jButtonDelBuildTarget.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableBuildTargets.getSelectedRow() < 0) {
- return;
- }
- if (jTableBuildTargets.getRowCount() == 1) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "At least one build target should be set for this platform.");
- return;
- }
- buildTargetTableModel.removeRow(jTableBuildTargets.getSelectedRow());
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(buildTargetTableModel.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- });
- }
- return jButtonDelBuildTarget;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneBuildTargets() {
- if (jScrollPaneBuildTargets == null) {
- jScrollPaneBuildTargets = new JScrollPane();
- jScrollPaneBuildTargets.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
- jScrollPaneBuildTargets.setBounds(new java.awt.Rectangle(valueColumn, rowFour, tableWidth - 5,
- tableHeight - 5));
- jScrollPaneBuildTargets.setLocation(new java.awt.Point(valueColumn, rowFour));
- jScrollPaneBuildTargets
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jScrollPaneBuildTargets.setViewportView(getJTableBuildTargets());
- }
- return jScrollPaneBuildTargets;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableBuildTargets() {
- if (jTableBuildTargets == null) {
- buildTargetTableModel = new TargetTableModel();
-
- jTableBuildTargets = new JTable(buildTargetTableModel);
- jTableBuildTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableBuildTargets.setRowHeight(oneRowHeight);
- jTableBuildTargets.setToolTipText("<html>Select one of the Targets from the table and<br>"
- + "click Delete to remove the target from the platform.</html>");
- buildTargetTableModel.addColumn("Build Target");
-
- jTableBuildTargets.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- selectedRow = jTableBuildTargets.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(m.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- }
- });
-
- }
- return jTableBuildTargets;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldSkuId() {
- if (jTextFieldSkuId == null) {
- jTextFieldSkuId = new JTextField();
- jTextFieldSkuId.setPreferredSize(new Dimension(40, oneRowHeight));
- jTextFieldSkuId.setBounds(new java.awt.Rectangle(valueColumn, rowSix, 40, oneRowHeight));
- jTextFieldSkuId.setLocation(new java.awt.Point(valueColumn, rowSix));
- jTextFieldSkuId.setToolTipText("Enter a unique integer value.");
- }
- return jTextFieldSkuId;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldSkuName() {
- if (jTextFieldSkuName == null) {
- jTextFieldSkuName = new JTextField();
- jTextFieldSkuName.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jTextFieldSkuName.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
- jTextFieldSkuName.setLocation(new java.awt.Point(valueColumn, rowSeven));
- jTextFieldSkuName.setToolTipText("<html>Enter a name to help identify this SKU.<br>"
- + "This entry is not used by the build system, it is<br>"
- + "used only by this user interface.</html>");
- }
- return jTextFieldSkuName;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuAdd() {
- if (jButtonSkuAdd == null) {
- jButtonSkuAdd = new JButton();
-
- jButtonSkuAdd.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonSkuAdd.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowEight, buttonWidth,
- oneRowHeight));
- jButtonSkuAdd.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowEight));
- jButtonSkuAdd.setText("Add");
- jButtonSkuAdd.setVisible(true);
-
- jButtonSkuAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTextFieldSkuId.getText().length() > 0) {
- String[] row = { jTextFieldSkuId.getText(), jTextFieldSkuName.getText() };
- skuInfoTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genPlatformDefsSkuInfo(row[0], row[1]);
- }
- }
- });
- }
- return jButtonSkuAdd;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuDel() {
- if (jButtonSkuDel == null) {
- jButtonSkuDel = new JButton();
- jButtonSkuDel.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonSkuDel.setBounds(new java.awt.Rectangle(valueCenter + 5, rowEight, buttonWidth, oneRowHeight));
- jButtonSkuDel.setLocation(new java.awt.Point(valueCenter + 5, rowEight));
- jButtonSkuDel.setText("Delete");
- jButtonSkuDel.setVisible(true);
- jButtonSkuDel.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableSkuInfo.isEditing()) {
- jTableSkuInfo.getCellEditor().stopCellEditing();
- }
- if (jTableSkuInfo.getSelectedRow() < 1) {
- return;
- }
- docConsole.setSaved(false);
- ffc.removePlatformDefsSkuInfo(jTableSkuInfo.getSelectedRow());
- skuInfoTableModel.removeRow(jTableSkuInfo.getSelectedRow());
- }
- });
- }
- return jButtonSkuDel;
- }
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSkuInfo() {
- if (jScrollPaneSkuInfo == null) {
- jScrollPaneSkuInfo = new JScrollPane();
- jScrollPaneSkuInfo.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
- jScrollPaneSkuInfo.setBounds(new java.awt.Rectangle(valueColumn, rowNine, tableWidth - 5, tableHeight - 5));
- jScrollPaneSkuInfo.setLocation(new java.awt.Point(valueColumn, rowNine));
-
- jScrollPaneSkuInfo
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
- }
- return jScrollPaneSkuInfo;
- }
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSkuInfo() {
- if (jTableSkuInfo == null) {
- skuInfoTableModel = new SkuInfoTableModel();
- skuInfoTableModel.addColumn("SKU ID");
- skuInfoTableModel.addColumn("Name");
- jTableSkuInfo = new JTable(skuInfoTableModel);
- jTableSkuInfo.setToolTipText("<html>SKU ID 0 must always be defined as the default.<br>"
- + "0 can mean either SKU disabled, or it can be the<br>"
- + "default value if more than one SKU is defined, and the<br>"
- + "platform is not jumpered to use one of the other SKU values.</html>");
-
- jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableSkuInfo.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
- String name = m.getValueAt(row, 1) + "";
- docConsole.setSaved(false);
- ffc.updatePlatformDefsSkuInfo(row, id, name);
- }
- }
- });
- }
- return jTableSkuInfo;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxInterDir() {
- if (jComboBoxInterDir == null) {
- jComboBoxInterDir = new JComboBox();
- jComboBoxInterDir.setPreferredSize(new Dimension(75, oneRowHeight));
- jComboBoxInterDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowEleven, 95, oneRowHeight));
- jComboBoxInterDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowEleven));
- jComboBoxInterDir.addItem("UNIFIED");
- jComboBoxInterDir.addItem("MODULE");
- jComboBoxInterDir.setSelectedIndex(0);
- jComboBoxInterDir.setToolTipText("<html>Select UNIFIED to generate intermediate directories under<br>"
- + "under platform directory tree.<br>"
- + "Select MODULE to generate intermediate directories under the<br>"
- + "individual module directories.</html>");
- jComboBoxInterDir.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- ffc.setPlatformDefsInterDir(jComboBoxInterDir.getSelectedItem() + "");
- }
- });
- }
- return jComboBoxInterDir;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField Row Twelve
- */
- private JTextField getJTextFieldOutputDir() {
- if (jTextFieldOutputDir == null) {
- jTextFieldOutputDir = new JTextField();
- jTextFieldOutputDir.setPreferredSize(new java.awt.Dimension(290, 20));
- jTextFieldOutputDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowTwelve, valueWidth - 30,
- oneRowHeight));
- jTextFieldOutputDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowTwelve));
- jTextFieldOutputDir.setToolTipText("Select the name or URL for the output directory tree.");
- jTextFieldOutputDir.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- docConsole.setSaved(false);
- ffc.setPlatformDefsOutputDir(jTextFieldOutputDir.getText());
- }
- });
- }
- return jTextFieldOutputDir;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class SkuInfoTableModel extends DefaultTableModel {
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int column) {
- if (row == 0) {
- return false;
- }
- return true;
- }
-}
-
-class TargetTableModel extends DefaultTableModel {
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int column) {
- if (row < 2) {
- return false;
- }
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java deleted file mode 100644 index 401772f28a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java +++ /dev/null @@ -1,265 +0,0 @@ -/**
- *
- */
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JPanel;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Vector;
-
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JComboBox;
-import javax.swing.JTabbedPane;
-
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-
-/**
- * @author jlin16
- *
- */
-public class GenAprioriFileDialog extends JDialog implements ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 3627991301208644354L;
- private JPanel jContentPane = null;
- private JPanel jPanelN = null;
- private JLabel jLabelFvName = null;
- private JComboBox jComboBoxFvNames = null;
- private JTabbedPane jTabbedPane = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
-
- /**
- * This is the default constructor
- */
- public GenAprioriFileDialog(FpdFileContents inputFfc, OpeningPlatformType dc) {
- super();
- ffc = inputFfc;
- docConsole = dc;
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(670, 670);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle("Apriori Files");
- this.setContentPane(getJContentPane());
- this.setResizable(false);
- this.setModal(true);
-
- String fvName = jComboBoxFvNames.getSelectedItem()+"";
- if (fvName.length() > 0) {
- jTabbedPane.removeAll();
- AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
- peiPane.showModulesInFv(fvName);
- peiPane.showAllModulesInPlatform();
- jTabbedPane.addTab("PEIMs", peiPane);
- AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
- dxePane.showModulesInFv(fvName);
- dxePane.showAllModulesInPlatform();
- jTabbedPane.addTab("DXE Drivers", dxePane);
- }
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- docConsole.setSaved(false);
- return;
- }
- if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
- this.dispose();
- }
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-/**
- * This method initializes jPanelN
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelN() {
- if (jPanelN == null) {
- jLabelFvName = new JLabel();
- jLabelFvName.setText("FV Name");
- jPanelN = new JPanel();
- jPanelN.add(jLabelFvName, null);
- jPanelN.add(getJComboBoxFvNames(), null);
- }
- return jPanelN;
-}
-
-/**
- * This method initializes jComboBoxFvNames
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxFvNames() {
- if (jComboBoxFvNames == null) {
- jComboBoxFvNames = new JComboBox();
- jComboBoxFvNames.setPreferredSize(new java.awt.Dimension(200,20));
- Vector<String> vFvNames = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vFvNames);
- for (int i = 0; i < vFvNames.size(); ++i) {
- jComboBoxFvNames.addItem(vFvNames.get(i));
- }
-// if (jComboBoxFvNames.getItemCount() > 0) {
-// jComboBoxFvNames.setSelectedIndex(0);
-//
-// }
- jComboBoxFvNames.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- String fvName = jComboBoxFvNames.getSelectedItem()+"";
- if (fvName.length() > 0) {
- jTabbedPane.removeAll();
- AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
- peiPane.showModulesInFv(fvName);
- peiPane.showAllModulesInPlatform();
- jTabbedPane.addTab("PEIMs", peiPane);
- AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
- dxePane.showModulesInFv(fvName);
- dxePane.showAllModulesInPlatform();
- jTabbedPane.addTab("DXE Drivers", dxePane);
- }
-
- }
- });
- }
- return jComboBoxFvNames;
-}
-
-/**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
-private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- }
- return jTabbedPane;
-}
-
-private class AprioriModuleOrderPane extends ModuleOrderPane {
- /**
- *
- */
- private static final long serialVersionUID = -7952853414833230546L;
- private boolean forPEI = false;
- private String fvName = null;
-
- AprioriModuleOrderPane (String fvName, String file, ActionListener action, boolean b) {
-
- super(fvName, file, ffc, action);
- this.fvName = fvName;
- forPEI = b;
- getJTableModInFv().getColumnModel().getColumn(0).setHeaderValue("Modules in Apriori File");
- getJButtonOk().setText("Save");
- getJButtonCancel().setText("Close");
- }
-
- public void showModulesInFv (String fvName) {
- String id = "1";
- if (forPEI) {
- id = "0";
- }
- int size = ffc.getUserExtsIncModCount(fvName, "APRIORI", id);
-
- if (size != -1) {
- String[][] saa = new String[size][5];
- ffc.getUserExtsIncMods(fvName, "APRIORI", id, saa);
-
- for (int i = 0; i < size; ++i) {
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
-
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- getModInFvTableModel().addRow(row);
- }
- }
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- String id = "1";
- if (forPEI) {
- id = "0";
- }
-
- Vector<String[]> vModInFv = new Vector<String[]>();
- for (int i = 0; i < getJTableModInFv().getRowCount(); ++i) {
- String moduleName = getModInFvTableModel().getValueAt(i, 0)+"";
- if (moduleName.length() == 0 || moduleName.equals("N/A")) {
- continue;
- }
-
- String mg = getModInFvTableModel().getValueAt(i, 1)+"";
- String mv = getModInFvTableModel().getValueAt(i, 2)+"";
- String pg = getModInFvTableModel().getValueAt(i, 3)+"";
- String pv = getModInFvTableModel().getValueAt(i, 4)+"";
- String arch = getModInFvTableModel().getValueAt(i, 5)+"";
-
- String[] sa = { mg, mv, pg, pv, arch};
- vModInFv.add(sa);
-
- }
-
- ffc.removeBuildOptionsUserExtensions(fvName, "APRIORI", id);
- ffc.genBuildOptionsUserExtensions(fvName, "APRIORI", id, "", vModInFv);
-
- }
- }
-}
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java deleted file mode 100644 index ef918f0cd7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java +++ /dev/null @@ -1,244 +0,0 @@ -/** @file
- Java class GenListDialog.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.KeyStroke;
-
-import javax.swing.JButton;
-
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.util.Vector;
-
-import javax.swing.JScrollPane;
-
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-
-
-/**
- Dialog for List generation.
- @since PackageEditor 1.0
-**/
-public class GenListDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentCenter = null;
- private JButton jButtonCancel = null;
- private JButton jButtonOk = null;
- private ICheckBoxList checkBoxList = null;
-
-
- private JScrollPane jScrollPane = null;
-
-
-
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk){
-
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(10);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout);
- jPanelContentEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelContentEast.add(getJButtonOk(), null);
- jPanelContentEast.add(getJButtonCancel(), null);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentCenter() {
- if (jPanelContentCenter == null) {
- jPanelContentCenter = new JPanel();
- jPanelContentCenter.setLayout(new FlowLayout());
- jPanelContentCenter.add(getJScrollPane(), null);
-
- }
- return jPanelContentCenter;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(300,100));
- jScrollPane.setViewportView(getICheckBoxList());
- }
- return jScrollPane;
- }
-
- private ICheckBoxList getICheckBoxList() {
- if (checkBoxList == null) {
- checkBoxList = new ICheckBoxList();
- checkBoxList.setBounds(new java.awt.Rectangle(40,20,177,74));
-
- }
- return checkBoxList;
- }
-
- public void initList(Vector<String> v){
- checkBoxList.setAllItems(v);
- }
- public Vector<String> getList(){
- Vector<String> v = checkBoxList.getAllCheckedItemsString();
- return v;
- }
-
- public void setList(String s){
- Vector<String> v = new Vector<String>();
- if (s == null) {
- checkBoxList.setAllItemsUnchecked();
- return;
- }
- String[] sArray = s.split(" ");
- for (int i = 0; i < sArray.length; ++i){
- v.add(sArray[i]);
- }
- checkBoxList.initCheckedItem(true, v);
- }
- /**
- * This is the default constructor
- */
- public GenListDialog(JFrame frame) {
- super(frame);
- initialize();
- }
-
- public GenListDialog(ActionListener i, JFrame frame){
- this(frame);
- jButtonOk.addActionListener(i);
- jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(466, 157);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("List");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java deleted file mode 100644 index 856e227180..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java +++ /dev/null @@ -1,229 +0,0 @@ -/** @file
- Java class GenLongTextDialog.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.KeyStroke;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-
-import javax.swing.JScrollPane;
-
-
-
-/**
- Dialog for Long Text generation.
- @since PackageEditor 1.0
-**/
-public class GenLongTextDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentCenter = null;
- private JButton jButtonCancel = null;
- private JButton jButtonOk = null;
- private JTextArea jTextArea = null;
-
-
- private JScrollPane jScrollPane = null;
-
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk){
-
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(5);
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout);
- jPanelContentEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelContentEast.add(getJButtonOk(), null);
- jPanelContentEast.add(getJButtonCancel(), null);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentCenter() {
- if (jPanelContentCenter == null) {
- jPanelContentCenter = new JPanel();
- jPanelContentCenter.setLayout(new FlowLayout());
- jPanelContentCenter.add(getJScrollPane(), null);
-
- }
- return jPanelContentCenter;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(600,40));
- jScrollPane.setViewportView(getJTextArea());
- }
- return jScrollPane;
- }
-
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
-// jTextArea.setBounds(new java.awt.Rectangle(40,20,300,54));
-
- }
- return jTextArea;
- }
-
-
- public String getText(){
-
- return jTextArea.getText();
- }
-
- public void setText(String s){
- jTextArea.setText(s);
- }
- /**
- * This is the default constructor
- */
- public GenLongTextDialog(JFrame frame) {
- super(frame);
- initialize();
- }
-
- public GenLongTextDialog(ActionListener i, JFrame frame){
- this(frame);
- jButtonOk.addActionListener(i);
- jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(620, 120);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("Text Content");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java deleted file mode 100644 index 804dc605f4..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java +++ /dev/null @@ -1,119 +0,0 @@ -/** @file
- Java class GuidEditor.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Vector;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with GUID value.
- @since PackageEditor 1.0
- **/
-public class ListEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private boolean canNotBeEmpty = false;
- private JFrame topFrame = null;
- String archs;
- JButton button;
- GenListDialog dialog;
- protected static final String EDIT = "edit";
-
- public ListEditor(JFrame frame) {
- topFrame = frame;
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
- button.setBorderPainted(false);
-
-
- dialog = new GenListDialog(this, frame);
-
- }
-
- public ListEditor(Vector<String> v, JFrame frame) {
- this(frame);
- dialog.initList(v);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- archs = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return archs;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(archs);
- dialog.setList(archs);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
- Vector<String> v = dialog.getList();
- if (canNotBeEmpty && v.size() == 0) {
- JOptionPane.showMessageDialog(topFrame, "You must select at least one item.");
- return;
- }
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- archs = s.trim();
- dialog.dispose();
- }
-
- }
-
- /**
- * @param canNotBeEmpty The canNotBeEmpty to set.
- */
- public void setCanNotBeEmpty(boolean canNotBeEmpty) {
- this.canNotBeEmpty = canNotBeEmpty;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java deleted file mode 100644 index 6e89ba7334..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java +++ /dev/null @@ -1,93 +0,0 @@ -/** @file
- Java class LongTextEditor.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with Long Text.
- @since PackageEditor 1.0
- **/
-public class LongTextEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String text;
- JButton button;
- GenLongTextDialog dialog;
- protected static final String EDIT = "editLongText";
-
- public LongTextEditor(JFrame frame) {
-
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
- button.setBorderPainted(false);
-
- dialog = new GenLongTextDialog(this, frame);
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- text = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return text;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(text);
- dialog.setText(text);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
-
- text = dialog.getText().trim();
- dialog.dispose();
- }
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java deleted file mode 100644 index 3f37efb38c..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - - The file is used to sort FrameworkModules of Fpd file - - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ -package org.tianocore.frameworkwizard.platform.ui; - -import java.awt.event.*; -import java.util.*; - -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.*; - - -public class TableSorter extends AbstractTableModel { - /** - * - */ - private static final long serialVersionUID = 1L; - - protected DefaultTableModel tableModel; - private TableRow[] rowInView; - private int[] viewPos; - - public static final String DESCENDING = "down"; - public static final String NOT_SORTED = "none"; - public static final String ASCENDING = "up"; - - private JTableHeader tableHeader; - private MouseListener mouseListener = new MouseHandler(); - private TableModelListener tableModelListener = new TableModelHandler(); - - private HashMap<Integer, String> sortingOrders = new HashMap<Integer, String>(); - - public TableSorter(DefaultTableModel tableModel) { - setTableModel(tableModel); - } - - - private void resetSortState() { - rowInView = null; - viewPos = null; - } - - public DefaultTableModel getTableModel() { - return tableModel; - } - - public void setTableModel(DefaultTableModel dtm) { - if (tableModel != null) { - tableModel.removeTableModelListener(tableModelListener); - } - - tableModel = dtm; - if (tableModel != null) { - tableModel.addTableModelListener(tableModelListener); - } - - resetSortState(); - fireTableStructureChanged(); - } - - public JTableHeader getTableHeader() { - return tableHeader; - } - - public void setTableHeader(JTableHeader th) { - if (tableHeader != null) { - tableHeader.removeMouseListener(mouseListener); - } - tableHeader = th; - if (tableHeader != null) { - tableHeader.addMouseListener(mouseListener); - - } - } - - private String getSortState(int column) { - - Integer i = new Integer(column); - if (sortingOrders.get(i) != null) { - return sortingOrders.get(i); - } - return NOT_SORTED; - } - - private void sortStateChanged() { - resetSortState(); - fireTableDataChanged(); - - } - - public void setSortState(int column, String status) { - Integer i = new Integer(column); - sortingOrders.put(i, status); - sortStateChanged(); - } - - private TableRow[] getSortedViewRows() { - if (rowInView == null) { - int rowCount = tableModel.getRowCount(); - rowInView = new TableRow[rowCount]; - int i = 0; - while ( i < rowCount ) { - rowInView[i] = new TableRow(i); - ++i; - } - - if (sortingOrders.size() != 0) { - Arrays.sort(rowInView); - } - } - return rowInView; - } - - public int getModelRowIndex(int viewIndex) { - TableRow[] rArray = getSortedViewRows(); - return rArray[viewIndex].modelIndex; - } - - public int[] getViewIndexArray() { - if (viewPos == null) { - int n = getSortedViewRows().length; - viewPos = new int[n]; - for (int i = 0; i < n; i++) { - viewPos[getModelRowIndex(i)] = i; - } - } - return viewPos; - } - - - - public int getRowCount() { - if (tableModel == null) { - return 0; - } - return tableModel.getRowCount(); - } - - public String getColumnName(int col) { - return tableModel.getColumnName(col); - } - - public int getColumnCount() { - if (tableModel == null) { - return 0; - } - return tableModel.getColumnCount(); - } - - public Class<?> getColumnClass(int col) { - return tableModel.getColumnClass(col); - } - - public boolean isCellEditable(int row, int col) { - int modelIndex = getModelRowIndex(row); - return tableModel.isCellEditable(modelIndex, col); - } - - public Object getValueAt(int row, int col) { - int modelIndex = getModelRowIndex(row); - return tableModel.getValueAt(modelIndex, col); - } - - public void setValueAt(Object val, int row, int col) { - int modelIndex = getModelRowIndex(row); - tableModel.setValueAt(val, modelIndex, col); - } - - // Helper classes - - private class TableRow implements Comparable { - private int modelIndex; - - public TableRow(int index) { - this.modelIndex = index; - } - - public int compareTo(Object o) { - int row1 = modelIndex; - int row2 = ((TableRow) o).modelIndex; - - Iterator<Integer> mapIter = sortingOrders.keySet().iterator(); - - while (mapIter.hasNext()) { - - Integer column = mapIter.next(); - Object o1 = tableModel.getValueAt(row1, column); - Object o2 = tableModel.getValueAt(row2, column); - - int comparison = 0; - if (o1 == null && o2 == null) { - comparison = 0; - } else if (o1 == null) { - comparison = -1; - } else if (o2 == null) { - comparison = 1; - } else { - comparison = o1.toString().compareTo(o2.toString());; - } - if (comparison != 0) { - if (getSortState(column.intValue()).equals(DESCENDING)) { - return -comparison; - } - return comparison; - } - } - return 0; - } - } - - private class TableModelHandler implements TableModelListener { - public void tableChanged(TableModelEvent e) { - if (sortingOrders.size() != 0) { - resetSortState(); - fireTableChanged(e); - return; - } - if (e.getFirstRow() == TableModelEvent.HEADER_ROW) { - - fireTableChanged(e); - return; - } - int column = e.getColumn(); - if (e.getFirstRow() == e.getLastRow() - && column != TableModelEvent.ALL_COLUMNS - && getSortState(column).equals(NOT_SORTED) - && viewPos != null) { - int viewIndex = getViewIndexArray()[e.getFirstRow()]; - fireTableChanged(new TableModelEvent(TableSorter.this, - viewIndex, viewIndex, - column, e.getType())); - return; - } - - resetSortState(); - fireTableDataChanged(); - return; - } - } - - private class MouseHandler extends MouseAdapter { - public void mouseClicked(MouseEvent e) { - JTableHeader h = (JTableHeader) e.getSource(); - TableColumnModel columnModel = h.getColumnModel(); - int viewColumn = columnModel.getColumnIndexAtX(e.getX()); - int column = columnModel.getColumn(viewColumn).getModelIndex(); - if (column == 0) { - String status = getSortState(column); - - - if (status.equals(ASCENDING)) { - status = DESCENDING; - } - else if (status.equals(DESCENDING)) { - status = NOT_SORTED; - } - else if (status.equals(NOT_SORTED)) { - status = ASCENDING; - } - setSortState(column, status); - } - } - } - -} diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java deleted file mode 100644 index df689c6ef1..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java +++ /dev/null @@ -1,132 +0,0 @@ -/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import java.util.Vector;
-
-public class LibraryClassDescriptor {
- public String className = "";
- public String supArchs = "";
- public String supModTypes = "";
-
- public LibraryClassDescriptor (String s1, String s2, String s3) {
- className = s1;
- if (s2 != null) {
- supArchs = s2;
- }
- if (s3 != null) {
- supModTypes = s3;
- }
-
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof LibraryClassDescriptor) {
- LibraryClassDescriptor id = (LibraryClassDescriptor)obj;
- if (className.equals(id.className) && sameArchs (supArchs, id.supArchs) && sameModTypes(supModTypes, id.supModTypes)) {
- return true;
- }
- return false;
- }
- else {
- return super.equals(obj);
- }
- }
-
- public int hashCode(){
- return (className + supArchs + supModTypes).toLowerCase().hashCode();
- }
-
- public String toString() {
- return "Library Class "+ className + " [SupArchs: " + supArchs + " SupModTypes: " + supModTypes + "]";
- }
-
- public boolean isSubSetByArchs (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vArchs1 = getVectorFromString(supArchs);
- Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);
-
- if (isSubSet(vArchs1, vArchs2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isSubSetByModTypes (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vModTypes1 = getVectorFromString(supModTypes);
- Vector<String> vModTypes2 = getVectorFromString(lcd.supModTypes);
-
- if (isSubSet(vModTypes1, vModTypes2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasInterSectionWith (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vArchs1 = getVectorFromString(supArchs);
- Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);
- if (vArchs1.size() == 0 || (vArchs1.size() == 1 && vArchs1.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- if (vArchs2.size() == 0 || (vArchs2.size() == 1 && vArchs2.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- vArchs1.retainAll(vArchs2);
- if (vArchs1.size() > 0) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isSubSet (Vector<String> v1, Vector<String> v2) {
- if (v2.size() == 0 || (v2.size() == 1 && v2.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- if (v2.containsAll(v1)) {
- return true;
- }
- return false;
- }
-
- public Vector<String> getVectorFromString (String s) {
- if (s == null || s.equals("null")) {
- s = "";
- }
- String[] sa1 = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sa1.length; ++i) {
- v.add(sa1[i]);
- }
- return v;
- }
-
- private boolean sameArchs (String archs1, String archs2) {
- Vector<String> vArchs1 = getVectorFromString(archs1);
- Vector<String> vArchs2 = getVectorFromString(archs2);
-
- if (vArchs1.containsAll(vArchs2) && vArchs2.containsAll(vArchs1)) {
- return true;
- }
- return false;
- }
-
- private boolean sameModTypes (String modTypes1, String modTypes2) {
- return sameArchs(modTypes1, modTypes2);
- }
-}
\ No newline at end of file diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java deleted file mode 100644 index ad0e82ca3f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java +++ /dev/null @@ -1,413 +0,0 @@ -/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.BuildTargetList;
-import org.tianocore.LibraryClassDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.FilenameDocument.Filename;
-
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-/**
- * SurfaceAreaQuery class is used to query Surface Area information from msa,
- * mbd, spd and fpd files.
- *
- * This class should not instantiated. All the public interfaces is static.
- *
- * @since GenBuild 1.0
- */
-public class SurfaceAreaQuery {
-
- public static String prefix = "http://www.TianoCore.org/2006/Edk2.0";
-
- // /
- // / Contains name/value pairs of Surface Area document object. The name is
- // / always the top level element name.
- // /
- private static Map<String, XmlObject> map = null;
-
- // /
- // / mapStack is used to do nested query
- // /
- private static Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();
-
- // /
- // / prefix of name space
- // /
- private static String nsPrefix = "sans";
-
- // /
- // / xmlbeans needs a name space for each Xpath element
- // /
- private static String ns = null;
-
- // /
- // / keep the namep declaration for xmlbeans Xpath query
- // /
- private static String queryDeclaration = null;
-
- /**
- * Set a Surface Area document for query later
- *
- * @param map
- * A Surface Area document in TopLevelElementName/XmlObject
- * format.
- */
- public static void setDoc(Map<String, XmlObject> map) {
- ns = prefix;
- queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";
- SurfaceAreaQuery.map = map;
- }
-
- /**
- * Push current used Surface Area document into query stack. The given new
- * document will be used for any immediately followed getXXX() callings,
- * untill pop() is called.
- *
- * @param newMap
- * The TopLevelElementName/XmlObject format of a Surface Area
- * document.
- */
- public static void push(Map<String, XmlObject> newMap) {
- mapStack.push(SurfaceAreaQuery.map);
- SurfaceAreaQuery.map = newMap;
- }
-
- /**
- * Discard current used Surface Area document and use the top document in
- * stack instead.
- */
- public static void pop() {
- SurfaceAreaQuery.map = mapStack.pop();
- }
-
- // /
- // / Convert xPath to be namespace qualified, which is necessary for
- // XmlBeans
- // / selectPath(). For example, converting /MsaHeader/ModuleType to
- // / /ns:MsaHeader/ns:ModuleType
- // /
- private static String normalizeQueryString(String[] exp, String from) {
- StringBuffer normQueryString = new StringBuffer(4096);
-
- int i = 0;
- while (i < exp.length) {
- String newExp = from + exp[i];
- Pattern pattern = Pattern.compile("([^/]*)(/|//)([^/]+)");
- Matcher matcher = pattern.matcher(newExp);
-
- while (matcher.find()) {
- String starter = newExp.substring(matcher.start(1), matcher
- .end(1));
- String seperator = newExp.substring(matcher.start(2), matcher
- .end(2));
- String token = newExp.substring(matcher.start(3), matcher
- .end(3));
-
- normQueryString.append(starter);
- normQueryString.append(seperator);
- normQueryString.append(nsPrefix);
- normQueryString.append(":");
- normQueryString.append(token);
- }
-
- ++i;
- if (i < exp.length) {
- normQueryString.append(" | ");
- }
- }
-
- return normQueryString.toString();
- }
-
- /**
- * Search all XML documents stored in "map" for the specified xPath, using
- * relative path (starting with '$this')
- *
- * @param xPath
- * xpath query string array
- * @returns An array of XmlObject if elements are found at the specified
- * xpath
- * @returns NULL if nothing is at the specified xpath
- */
- public static XmlObject[] get(String[] xPath) {
- if (map == null) {
- return null;
- }
-
- String[] keys = (String[]) map.keySet().toArray(new String[map.size()]);
- List<XmlObject> result = new ArrayList<XmlObject>();
- for (int i = 0; i < keys.length; ++i) {
- XmlObject rootNode = (XmlObject) map.get(keys[i]);
- if (rootNode == null) {
- continue;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + keys[i]);
- XmlObject[] tmp = rootNode.selectPath(query);
- for (int j = 0; j < tmp.length; ++j) {
- result.add(tmp[j]);
- }
- }
-
- int size = result.size();
- if (size <= 0) {
- return null;
- }
-
- return (XmlObject[]) result.toArray(new XmlObject[size]);
- }
-
- /**
- * Search XML documents named by "rootName" for the given xPath, using
- * relative path (starting with '$this')
- *
- * @param rootName
- * The top level element name
- * @param xPath
- * The xpath query string array
- * @returns An array of XmlObject if elements are found at the given xpath
- * @returns NULL if nothing is found at the given xpath
- */
- public static XmlObject[] get(String rootName, String[] xPath) {
- if (map == null) {
- return null;
- }
-
- XmlObject root = (XmlObject) map.get(rootName);
- if (root == null) {
- return null;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + rootName);
- XmlObject[] result = root.selectPath(query);
- if (result.length > 0) {
- return result;
- }
-
- query = queryDeclaration + normalizeQueryString(xPath, "/" + rootName);
- result = root.selectPath(query);
- if (result.length > 0) {
- return result;
- }
-
- return null;
- }
-
- /**
- * Retrieve SourceFiles/Filename for specified ARCH type
- *
- * @param arch
- * architecture name
- * @returns An 2 dimension string array if elements are found at the known
- * xpath
- * @returns NULL if nothing is found at the known xpath
- */
- public static String[][] getSourceFiles(String arch) {
- String[] xPath;
- XmlObject[] returns;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[] { "/Filename" };
- } else {
- xPath = new String[] { "/Filename[not(@SupArchList) or @SupArchList='"
- + arch + "']" };
- }
-
- returns = get("SourceFiles", xPath);
-
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- Filename[] sourceFileNames = (Filename[]) returns;
- String[][] outputString = new String[sourceFileNames.length][2];
- for (int i = 0; i < sourceFileNames.length; i++) {
- outputString[i][0] = sourceFileNames[i].getToolCode();
- outputString[i][1] = sourceFileNames[i].getStringValue();
- }
- return outputString;
- }
-
- /**
- * Retrieve /PlatformDefinitions/OutputDirectory from FPD
- *
- * @returns Directory names array if elements are found at the known xpath
- * @returns Empty if nothing is found at the known xpath
- */
- public static String getFpdOutputDirectory() {
- String[] xPath = new String[] { "/PlatformDefinitions/OutputDirectory" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- // String TBD
- }
-
- return null;
- }
-
- public static String getFpdIntermediateDirectories() {
- String[] xPath = new String[] { "/PlatformDefinitions/IntermediateDirectories" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- // TBD
- }
- return "UNIFIED";
- }
-
- public static String getBuildTarget() {
- String[] xPath = new String[] { "/PlatformDefinitions/BuildTargets" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- return ((BuildTargetList) returns[0]).getStringValue();
- }
-
- return null;
- }
-
- /**
- * Retrieve <xxxHeader>/ModuleType
- *
- * @returns The module type name if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public static String getModuleType(ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = WorkspaceProfile.getModuleXmlObject(mi);
-
- return msa.getMsaHeader().getModuleType()+"";
- }
-
- /**
- * Retrieve PackageDependencies/Package
- *
- * @param arch
- * Architecture name
- *
- * @returns package name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
-
- public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi){
-
- String packageGuid = null;
- String packageVersion = null;
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile.getModuleXmlObject(mi);
- if (msa.getPackageDependencies() == null) {
- return new PackageIdentification[0];
- }
- int size = msa.getPackageDependencies().getPackageList().size();
- XmlObject[] returns = new XmlObject[size];
- for (int i = 0; i < size; ++i) {
- returns[i] = msa.getPackageDependencies().getPackageList().get(i);
- }
-
- PackageIdentification[] packageIdList = new PackageIdentification[returns.length];
- for (int i = 0; i < returns.length; i++) {
- PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
- packageGuid = item.getPackageGuid();
- packageVersion = item.getPackageVersion();
-
- Iterator<PackageIdentification> ispi = GlobalData.vPackageList.iterator();
- String ver = "";
- while(ispi.hasNext()) {
- PackageIdentification pi = ispi.next();
- if (packageVersion != null) {
- if (pi.getGuid().equalsIgnoreCase(packageGuid) && pi.getVersion().equals(packageVersion)) {
- packageIdList[i] = pi;
- break;
- }
- }
- else {
- if (pi.getGuid().equalsIgnoreCase(packageGuid)) {
- if (pi.getVersion() != null && pi.getVersion().compareTo(ver) > 0){
- ver = pi.getVersion();
- packageIdList[i] = pi;
- }
- else if (packageIdList[i] == null){
- packageIdList[i] = pi;
- }
- }
- }
-
- }
- }
- return packageIdList;
- }
-
- /**
- * Retrieve LibraryClassDefinitions/LibraryClass for specified usage
- *
- * @param usage
- * Library class usage
- *
- * @returns LibraryClass objects list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public static Vector<LibraryClassDescriptor> getLibraryClasses(String usage, ModuleIdentification mi){
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);
- Vector<LibraryClassDescriptor> libraryClassInfo = new Vector<LibraryClassDescriptor>();
- if (msa.getLibraryClassDefinitions() == null) {
- return libraryClassInfo;
- }
-
- int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();
-
- for (int i = 0; i < size; i++) {
- LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);
- if (usage.equals(libClass.getUsage().toString())) {
-
- libraryClassInfo.add(new LibraryClassDescriptor(libClass.getKeyword(), libClass.getSupArchList()+"", libClass.getSupModuleList()+""));
- }
- }
-
- return libraryClassInfo;
- }
-
- public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) {
- XmlObject[] returns = null;
- PackageSurfaceAreaDocument.PackageSurfaceArea psa = WorkspaceProfile.getPackageXmlObject(pi);
- if (psa.getPcdDeclarations() != null && psa.getPcdDeclarations().getPcdEntryList() != null) {
- int size = psa.getPcdDeclarations().getPcdEntryList().size();
- returns = new XmlObject[size];
- for (int i = 0; i < size; ++i) {
- returns[i] = psa.getPcdDeclarations().getPcdEntryList().get(i);
- }
- }
-
- return returns;
- }
-
-}
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java deleted file mode 100644 index 954cda112c..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java +++ /dev/null @@ -1,157 +0,0 @@ -/** @file
- WorkspaceProfile class.
-
- WorkspaceProfile provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-
-/**
- WorkspaceProfile provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
- <p>Note that all global information are initialized incrementally. All data will
- parse and record only of necessary during build time. </p>
-
- @since GenBuild 1.0
-**/
-public class WorkspaceProfile {
- ///
- /// Record current WORKSPACE Directory
- ///
- private static String workspaceDir = "";
-
- /**
- Get the current WORKSPACE Directory.
-
- @return current workspace directory
- **/
- public synchronized static String getWorkspacePath() {
- return workspaceDir;
- }
-
- public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) {
- //
- // If package already defined in module
- //
- if (moduleId.getPackageId() != null) {
- return moduleId.getPackageId();
- }
-
- return null;
- }
- //
- // expanded by FrameworkWizard
- //
- public synchronized static ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleXmlObject(ModuleIdentification moduleId) {
- return GlobalData.openingModuleList.getModuleSurfaceAreaFromId(moduleId);
- }
-
- public synchronized static PackageSurfaceAreaDocument.PackageSurfaceArea getPackageXmlObject(PackageIdentification packageId) {
- return GlobalData.openingPackageList.getPackageSurfaceAreaFromId(packageId);
- }
-
- public static ModuleIdentification getModuleId(String key){
- //
- // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
- //
- String[] keyPart = key.split(" ");
-
- Iterator<ModuleIdentification> iMiList = GlobalData.vModuleList.iterator();
-
- while (iMiList.hasNext()) {
- ModuleIdentification mi = iMiList.next();
- if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
- if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
- if(!mi.getVersion().equals(keyPart[1])){
- continue;
- }
- }
-
- PackageIdentification pi = mi.getPackageId();
- if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
- continue;
- }
- if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
- if(!pi.getVersion().equals(keyPart[3])){
- continue;
- }
- }
- return mi;
- }
- }
-
- return null;
- }
-
- public static Vector<String> getModuleSupArchs(ModuleIdentification mi){
- Vector<String> vArchs = null;
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
- if (msa.getModuleDefinitions() == null || msa.getModuleDefinitions().getSupportedArchitectures() == null) {
- return vArchs;
- }
- ListIterator li = msa.getModuleDefinitions().getSupportedArchitectures().listIterator();
- while (li.hasNext()) {
- if (vArchs == null) {
- vArchs = new Vector<String>();
- }
- vArchs.add((String)li.next());
- }
-
- return vArchs;
- }
-
- public static String getModuleType (ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = getModuleXmlObject(mi);
- if (msa.getMsaHeader() == null || msa.getMsaHeader().getModuleType() == null) {
- return null;
- }
- return msa.getMsaHeader().getModuleType().toString();
- }
-
- public static boolean pcdInMsa (String cName, String tsGuid, String supArchList, ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
- return false;
- }
- ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
- if (msaPcd.getCName().equals(cName) && msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {
- if (supArchList != null && msaPcd.getSupArchList() != null) {
- if (msaPcd.getSupArchList().toString().toLowerCase().contains(supArchList.trim().toLowerCase())) {
- return true;
- }
- }
- else{
- return true;
- }
- }
- }
- return false;
- }
-
-}
-
-
|