summaryrefslogtreecommitdiff
path: root/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui')
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java445
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java98
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java1885
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java941
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java816
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java931
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java517
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java579
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java1242
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java148
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java146
11 files changed, 0 insertions, 7748 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java
deleted file mode 100644
index b219c9ed70..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/** @file
- Java class GenGuidDialog.
-
-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.packaging.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import java.awt.GridLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JRadioButton;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.KeyStroke;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-/**
- Dialog for GUID generation.
- @since PackageEditor 1.0
-**/
-public class GenGuidDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public static final String guidArrayPat = "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?";
-
- public static final String guidRegistryPat = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}";
-
- static private JFrame frame;
- private JPanel jContentPane = null;
- private JPanel jPanelEast = null;
- private JPanel jPanelCenter = null;
- private JTextField jTextField = null;
- private JLabel jLabel = null;
- private JRadioButton jRadioButton = null;
- private JRadioButton jRadioButtonReg = null;
- private JButton jButtonCancel = null;
- private JButton jButtonNew = null;
- private JButton jButtonOk = null;
- private ActionListener outerListener = null;
-
-// private String guid = null;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (arg0.getSource() == jButtonNew){
- String uuid = Tools.generateUuidString();
- if (jRadioButtonReg.isSelected()) {
- jTextField.setText(uuid);
- }
- else {
- //ToDo: transform to comma-sep guid
- String s = GenGuidDialog.formatGuidString(uuid);
- if (s.equals("0")) {
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
- return;
- }
- jTextField.setText(s);
- }
- }
-
- if (arg0.getSource() == jRadioButtonReg){
-
- //ToDo: check text field value against RegExp and transform if needed
- if (jTextField.getText().matches(GenGuidDialog.guidRegistryPat)){
- return;
- }
- if (jTextField.getText().matches(GenGuidDialog.guidArrayPat)) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- return;
- }
- if (jTextField.getText().length()>0)
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
-
- }
-
- if (arg0.getSource() == jRadioButton){
-
- //ToDo: check text field value against RegExp and transform if needed
- if (jTextField.getText().matches(GenGuidDialog.guidArrayPat)){
- return;
- }
- if (jTextField.getText().matches(GenGuidDialog.guidRegistryPat)) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- return;
- }
- if (jTextField.getText().length()>0)
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
-
- }
-
- if (arg0.getSource() == jButtonOk){
-// if (jTextField.getText().matches(Tools.guidArrayPat)
-// || jTextField.getText().matches(Tools.guidRegistryPat)){
-// this.setVisible(false);
-// }
-// else {
-// JOptionPane.showMessageDialog(frame, "Incorrect GUID Value Format.");
-// }
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelEast() {
- if (jPanelEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(10);
- jPanelEast = new JPanel();
- jPanelEast.setLayout(flowLayout);
- jPanelEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelEast.add(getJButtonNew(), null);
- jPanelEast.add(getJButtonOk(), null);
- jPanelEast.add(getJButtonCancel(), null);
- }
- return jPanelEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelCenter() {
- if (jPanelCenter == null) {
- jLabel = new JLabel();
- jLabel.setText("GUID Value");
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(4);
- jPanelCenter = new JPanel();
- jPanelCenter.setLayout(gridLayout);
- jPanelCenter.add(getJRadioButtonReg(), null);
- jPanelCenter.add(getJRadioButton(), null);
- jPanelCenter.add(jLabel, null);
- jPanelCenter.add(getJTextField(), null);
- ButtonGroup bg = new ButtonGroup();
- bg.add(jRadioButtonReg);
- bg.add(jRadioButton);
- }
- return jPanelCenter;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setHorizontalAlignment(JTextField.LEADING);
- jTextField.setPreferredSize(new java.awt.Dimension(100,20));
- }
- return jTextField;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton() {
- if (jRadioButton == null) {
- jRadioButton = new JRadioButton();
- jRadioButton.setText("Comma-Seperated Format");
- jRadioButton.setEnabled(false);
- jRadioButton.addActionListener(this);
- }
- return jRadioButton;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonReg() {
- if (jRadioButtonReg == null) {
- jRadioButtonReg = new JRadioButton();
- jRadioButtonReg.setText("Registry Format");
- jRadioButtonReg.setSelected(true);
- jRadioButtonReg.addActionListener(this);
- }
- return jRadioButtonReg;
- }
-
- /**
- * 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 jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
- jButtonNew.setText("New");
- jButtonNew.addActionListener(this);
- jButtonNew.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonNew;
- }
-
- /**
- * 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);
- jButtonOk.registerKeyboardAction(outerListener, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
-
- }
- return jButtonOk;
- }
-
- public String getGuid(){
- return jTextField.getText();
- }
-
- public void setGuid(String s){
- jTextField.setText(s);
- }
- /**
- * This is the default constructor
- */
- public GenGuidDialog() {
- super();
- initialize();
- }
-
- public GenGuidDialog(ActionListener i, JFrame frame){
- super(frame);
- outerListener = i;
- initialize();
- jButtonOk.addActionListener(i);
- this.addWindowListener(new WindowAdapter(){
-
- @Override
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
- super.windowActivated(arg0);
- if ((jRadioButtonReg.isSelected() && jTextField.getText().matches(GenGuidDialog.guidArrayPat))
- || (jRadioButton.isSelected() && jTextField.getText().matches(GenGuidDialog.guidRegistryPat))) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- }
-
-// if (!jTextField.getText().matches(Tools.guidArrayPat) || !jTextField.getText().matches(Tools.guidRegistryPat)) {
-// JOptionPane.showMessageDialog(frame, "InitVal: Incorrect GUID Value Format.");
-// return;
-// }
- }
-
- });
- }
-
- /**
- * 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("Editing GUID Value");
- 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(getJPanelEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelCenter(), 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);
- }
-
- public static String formatGuidString (String guidNameConv) {
- String[] strList;
- String guid = "";
- int index = 0;
- if (guidNameConv
- .matches(GenGuidDialog.guidRegistryPat)) {
- strList = guidNameConv.split("-");
- guid = "0x" + strList[0] + ", ";
- guid = guid + "0x" + strList[1] + ", ";
- guid = guid + "0x" + strList[2] + ", ";
-
- guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
- guid = guid + "0x" + strList[3].substring(2, 4);
-
- while (index < strList[4].length()) {
- guid = guid + ", ";
- guid = guid + "0x" + strList[4].substring(index, index + 2);
- index = index + 2;
- }
-
- return guid;
- }
- else if (guidNameConv
- .matches(GenGuidDialog.guidArrayPat)) {
- strList = guidNameConv.split(",");
-
- //
- // chang ANSI c form to registry form
- //
- for (int i = 0; i < strList.length; i++){
- strList[i] = strList[i].substring(strList[i].lastIndexOf("x") + 1);
- }
- if (strList[strList.length - 1].endsWith("}")) {
- strList[strList.length -1] = strList[strList.length-1].substring(0, strList[strList.length-1].length()-1);
- }
- //
- //inserting necessary leading zeros
- //
-
- int segLen = strList[0].length();
- if (segLen < 8){
- for (int i = 0; i < 8 - segLen; ++i){
- strList[0] = "0" + strList[0];
- }
- }
-
- segLen = strList[1].length();
- if (segLen < 4){
- for (int i = 0; i < 4 - segLen; ++i){
- strList[1] = "0" + strList[1];
- }
- }
- segLen = strList[2].length();
- if (segLen < 4){
- for (int i = 0; i < 4 - segLen; ++i){
- strList[2] = "0" + strList[2];
- }
- }
- for (int i = 3; i < 11; ++i) {
- segLen = strList[i].length();
- if (segLen < 2){
- strList[i] = "0" + strList[i];
- }
- }
-
- for (int i = 0; i < 3; i++){
- guid += strList[i] + "-";
- }
-
- guid += strList[3];
- guid += strList[4] + "-";
-
- for (int i = 5; i < strList.length; ++i){
- guid += strList[i];
- }
-
-
- return guid;
- } else {
-
- return "0";
-
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java
deleted file mode 100644
index 0d00f4a014..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java
+++ /dev/null
@@ -1,98 +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.packaging.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-//import java.awt.event.KeyEvent;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-//import javax.swing.JComponent;
-import javax.swing.JTable;
-//import javax.swing.KeyStroke;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with GUID value.
- @since PackageEditor 1.0
- **/
-public class GuidEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String currentGuid;
- JButton button;
- GenGuidDialog dialog;
- protected static final String EDIT = "edit";
-
- public GuidEditor(JFrame frame) {
-
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
-// button.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0, false), JComponent.WHEN_FOCUSED);
- button.setBorderPainted(false);
-
-
- dialog = new GenGuidDialog(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
- currentGuid = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return currentGuid;
- }
-
- /* (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(currentGuid);
- dialog.setGuid(currentGuid);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
- currentGuid = dialog.getGuid();
-// button.setText(currentGuid);
- dialog.dispose();
- }
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java
deleted file mode 100644
index 922d1355e8..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java
+++ /dev/null
@@ -1,1885 +0,0 @@
-/** @file
- Java class SpdFileContents is used to parse spd 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.packaging.ui;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlCursor;
-
-import org.tianocore.GuidDeclarationsDocument;
-
-import org.tianocore.LibraryClassDeclarationsDocument;
-
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaFilesDocument;
-import org.tianocore.PackageDefinitionsDocument;
-import org.tianocore.PackageHeadersDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PcdDataTypes;
-import org.tianocore.PcdDeclarationsDocument;
-import org.tianocore.PpiDeclarationsDocument;
-import org.tianocore.ProtocolDeclarationsDocument;
-import org.tianocore.SpdHeaderDocument;
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
-
-/**
- This class processes spd file contents such as add remove xml elements.
-
- @since PackageEditor 1.0
-**/
-
-public class SpdFileContents {
-
- private File file = null;
-
- private PackageSurfaceAreaDocument psad = null;
-
- private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null;
-
- private SpdHeaderDocument.SpdHeader spdHdr = null;
-
- private PackageDefinitionsDocument.PackageDefinitions spdPkgDefs = null;
-
- private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null;
-
- private MsaFilesDocument.MsaFiles spdMsaFiles = null;
-
- private PackageHeadersDocument.PackageHeaders spdModHdrs = null;
-
- private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null;
-
- private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null;
-
- private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null;
-
- private PcdDeclarationsDocument.PcdDeclarations spdPcdDefinitions = null;
-
- /**
- Constructor to create a new spd file
- **/
- public SpdFileContents() {
-
- psad = PackageSurfaceAreaDocument.Factory.newInstance();
- psaRoot = psad.addNewPackageSurfaceArea();
-
- }
-
- /**
- Constructor for existing document object
- @param psa
- **/
- public SpdFileContents(PackageSurfaceAreaDocument.PackageSurfaceArea psa) {
- psaRoot = psa;
- spdHdr = psaRoot.getSpdHeader();
- spdPkgDefs = psaRoot.getPackageDefinitions();
- }
- /**
- Constructor based on an existing spd file
-
- @param f Existing spd file
- **/
- public SpdFileContents(File f) {
- try {
- psad = PackageSurfaceAreaDocument.Factory.parse(f);
- psaRoot = psad.getPackageSurfaceArea();
- file = f;
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
-
- /**
- Remove existing pcd definitions elements using XmlCursor
- **/
- public void removeSpdPcdDefinition() {
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdPcdDefinitions = null;
- cursor.dispose();
- }
-
- public void removeSpdPcdDefinition(int i){
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPcdDefinitionCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing ppi declarations using XmlCursor
- **/
- public void removeSpdPpiDeclaration() {
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdPpiDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdPpiDeclaration(int i){
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPpiDeclarationCount() == 0){
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- /**
- Remove existing protocols declarations using XmlCursor
- **/
- public void removeSpdProtocolDeclaration() {
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdProtocolDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdProtocolDeclaration(int i) {
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdProtocolDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- /**
- Remove existing GUID declarations using XmlCursor
- **/
- public void removeSpdGuidDeclaration() {
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdGuidDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdGuidDeclaration(int i) {
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdGuidDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing spd package include files using XmlCursor
- **/
- public void removeSpdPkgHeader() {
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdModHdrs = null;
- cursor.dispose();
- }
-
- public void removeSpdPkgHeader(int i){
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPackageHeaderCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing msa files using XmlCursor
- **/
- public void removeSpdMsaFile() {
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdMsaFiles = null;
- cursor.dispose();
- }
-
- public void removeSpdMsaFile(int i){
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdMsaFileCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing library class declarations using XmlCursor
- **/
- public void removeSpdLibClass() {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdLibClassDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdLibClass(int i) {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdLibClassDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdLibClass(int i, String lib, String hdr, String hlp, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType) {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
- lc.setName(lib);
- lc.setIncludeHeader(hdr);
- lc.setHelpText(hlp);
- if (clsUsage != null) {
- lc.setRecommendedInstanceGuid(clsUsage);
- if (instanceVer != null){
- lc.setRecommendedInstanceVersion(instanceVer);
- } else {
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
- } else {
- if (lc.isSetRecommendedInstanceGuid()) {
- lc.unsetRecommendedInstanceGuid();
- }
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
-
- if (stringToList(hdrAttribArch) != null){
- lc.setSupArchList(stringToList(hdrAttribArch));
- } else {
- if (lc.isSetSupArchList()) {
- lc.unsetSupArchList();
- }
- }
- if (stringToList(hdrAttribModType) != null){
- lc.setSupModuleList(stringToList(hdrAttribModType));
- } else {
- if (lc.isSetSupModuleList()) {
- lc.unsetSupModuleList();
- }
- }
- }
-
- cursor.dispose();
- }
-
- public void updateSpdMsaFile(int i, String msaFile, String mName, String v, String g){
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.setTextValue(msaFile);
-
- }
-
- cursor.dispose();
- }
-
- public void updateSpdGuidDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- }
- cursor.dispose();
- }
-
- public void updateSpdPpiDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdProtocolDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdPkgHdr(int i, String pkgName, String hdrName){
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
-
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader iph = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
- iph.setModuleType(ModuleTypeDef.Enum.forString(pkgName));
- iph.setStringValue(hdrName);
- }
- cursor.dispose();
- }
-
- public void updateSpdPcdDefinition(int i, String cName, String token, String dataType, String pcdItemTypes,
- String spaceGuid, String defaultString, String help, String archList, String modTypeList){
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
- e.setCName(cName);
- e.setToken(token);
- e.setDatumType(PcdDataTypes.Enum.forString(dataType));
- if (pcdItemTypes != null && pcdItemTypes.length() > 0) {
- String usage[] = pcdItemTypes.split("( )+");
- List<String> l = new ArrayList<String>();
- for (int k = 0; k < usage.length; ++k) {
- l.add(usage[k]);
- }
- e.setValidUsage(l);
- }
-
- e.setTokenSpaceGuidCName(spaceGuid);
- e.setDefaultValue(defaultString);
- e.setHelpText(help);
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- }
- cursor.dispose();
- }
- /**
- Get spd file header contents into String array
-
- @param s Caller allocated String array
- **/
- public void getSpdHdrDetails(String[] s) {
- if (getSpdHdr() == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
- s[0] = getSpdHdrPkgName();
- s[1] = getSpdHdr().getGuidValue();
- s[2] = getSpdHdrVer();
-// s[3] = getSpdHdr().getAbstract();
- s[4] = getSpdHdr().getDescription();
- s[5] = getSpdHdr().getCopyright();
- s[6] = getSpdHdrLicense();
-
- }
-
- /**
- Get the number of library class declarations from the size of List
-
- @return int
- **/
- public int getSpdLibClassDeclarationCount() {
- if (psaRoot.getLibraryClassDeclarations() == null
- || psaRoot.getLibraryClassDeclarations().getLibraryClassList() == null) {
- return 0;
- }
- return psaRoot.getLibraryClassDeclarations().getLibraryClassList().size();
- }
-
- /**
- Get available library class declaration into String array
- @param libClass Caller allocated two-dimentional String array
- **/
- public void getSpdLibClassDeclarations(String[][] libClass) {
- if (psaRoot.getLibraryClassDeclarations() == null){
- return;
- }
-
- List<LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass> l = psaRoot.getLibraryClassDeclarations().getLibraryClassList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) li.next();
- if (lc != null) {
- libClass[i][0] = lc.getName();
- libClass[i][1] = lc.getIncludeHeader();
- libClass[i][2] = lc.getHelpText();
-// LAH added logic so you cannot set the version unless the GUID is defined.
-
-// if (lc.getRecommendedInstanceGuid() != null) {
- libClass[i][3] = lc.getRecommendedInstanceGuid();
-// if (lc.getRecommendedInstanceVersion() != null) {
- libClass[i][4] = lc.getRecommendedInstanceVersion();
-// }
-// }
-
- if (lc.getSupArchList() != null) {
- libClass[i][5] = listToString(lc.getSupArchList());
- }
- if (lc.getSupModuleList() != null) {
- libClass[i][6] = listToString(lc.getSupModuleList());
- }
-
- }
-
- i++;
- }
-
- }
-
- /**
- Get the number of Msa files from the size of List
-
- @return int
- **/
- public int getSpdMsaFileCount() {
- if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getFilenameList() == null) {
- return 0;
- }
- return psaRoot.getMsaFiles().getFilenameList().size();
- }
-
- /**
- Get available Msa file into String array
-
- @param msaFile Caller allocated two-dimentional String array
- **/
- public void getSpdMsaFiles(String[][] msaFile) {
- if (psaRoot.getMsaFiles() == null) {
- return;
- }
- List<String> l = psaRoot.getMsaFiles().getFilenameList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- msaFile[i][0] = (String)li.next();
-
- i++;
- }
- }
-
- /**
- Get the number of include header files in PackageHeaders from the size of List
-
- @return int
- **/
- public int getSpdPackageHeaderCount() {
- if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludePkgHeaderList() == null) {
- return 0;
- }
- return psaRoot.getPackageHeaders().getIncludePkgHeaderList().size();
- }
-
- /**
- Get available package header contents into String array
-
- @param pkgHeader Caller allocated two-dimentional String array
- **/
- public void getSpdPackageHeaders(String[][] pkgHeader) {
- if (psaRoot.getPackageHeaders() == null) {
- return;
- }
-
- List<PackageHeadersDocument.PackageHeaders.IncludePkgHeader> l = psaRoot.getPackageHeaders().getIncludePkgHeaderList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) li.next();
- if (ih.getModuleType() != null) {
- pkgHeader[i][0] = ih.getModuleType().toString();
- }
-
- pkgHeader[i][1] = ih.getStringValue();
- i++;
- }
- }
-
- public void getSpdGuidDeclWithType (Vector<String> vGuidCName, String type) {
- if (psaRoot.getGuidDeclarations() == null) {
- return;
- }
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();
- for (int i = 0; i < l.size(); ++i) {
- if (l.get(i).getGuidTypeList() == null || l.get(i).getGuidTypeList().contains(type)) {
- vGuidCName.add(l.get(i).getCName());
- }
- }
- }
- /**
- Get the number of GUID declarations from the size of List
-
- @return int
- **/
- public int getSpdGuidDeclarationCount() {
- if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getGuidDeclarations().getEntryList().size();
- }
-
- /**
- Get available Guid declaration contents into String array
-
- @param guid Caller allocated two-dimentional String array
- **/
- public void getSpdGuidDeclarations(String[][] guid) {
- if (psaRoot.getGuidDeclarations() == null) {
- return;
- }
-
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li
- .next();
- guid[i][0] = e.getName();
- guid[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- guid[i][2] = e.getGuidValue();
- }
- guid[i][3] = e.getHelpText();
- guid[i][4] = listToString(e.getSupArchList());
- guid[i][5] = listToString(e.getSupModuleList());
- guid[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of protocol declarations from the size of List
-
- @return int
- **/
- public int getSpdProtocolDeclarationCount() {
- if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getProtocolDeclarations().getEntryList().size();
- }
-
- /**
- Get available protocol declaration contents into String array
-
- @param protocol Caller allocated two-dimentional String array
- **/
- public void getSpdProtocolDeclarations(String[][] protocol) {
- if (psaRoot.getProtocolDeclarations() == null) {
- return;
- }
-
- List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()
- .getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li
- .next();
- protocol[i][0] = e.getName();
- protocol[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- protocol[i][2] = e.getGuidValue();
- }
- protocol[i][3] = e.getHelpText();
- protocol[i][4] = listToString(e.getSupArchList());
- protocol[i][5] = listToString(e.getSupModuleList());
- protocol[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of Ppi declarations from the size of List
-
- @return int
- **/
- public int getSpdPpiDeclarationCount() {
- if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getPpiDeclarations().getEntryList().size();
- }
-
- /**
- Get available Ppi declaration contents into String array
-
- @param ppi Caller allocated two-dimentional String array
- **/
- public void getSpdPpiDeclarations(String[][] ppi) {
- if (psaRoot.getPpiDeclarations() == null) {
- return;
- }
-
- List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();
- ppi[i][0] = e.getName();
- ppi[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- ppi[i][2] = e.getGuidValue();
- }
- ppi[i][3] = e.getHelpText();
- ppi[i][4] = listToString(e.getSupArchList());
- ppi[i][5] = listToString(e.getSupModuleList());
- ppi[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of Pcd definitions from the size of List
-
- @return int
- **/
- public int getSpdPcdDefinitionCount() {
- if (psaRoot.getPcdDeclarations() == null || psaRoot.getPcdDeclarations().getPcdEntryList() == null) {
- return 0;
- }
- return psaRoot.getPcdDeclarations().getPcdEntryList().size();
- }
-
- /**
- Get available Pcd definition contents into String array
-
- @param pcd Caller allocated two-dimentional String array
- **/
- public void getSpdPcdDefinitions(String[][] pcd, String pcdUsage[][]) {
- if (psaRoot.getPcdDeclarations() == null) {
- return;
- }
-
- List<PcdDeclarationsDocument.PcdDeclarations.PcdEntry> l = psaRoot.getPcdDeclarations().getPcdEntryList();
- int i = 0;
- while (i < l.size()) {
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)l.get(i);
- pcd[i][0] = e.getCName();
- pcd[i][1] = e.getToken() + "";
- pcd[i][2] = e.getTokenSpaceGuidCName();
- if (e.getDatumType() != null) {
- pcd[i][3] = e.getDatumType().toString();
- }
- pcd[i][4] = e.getDefaultValue()+"";
- pcd[i][5] = e.getHelpText();
- String archList = listToString(e.getSupArchList());
- if (archList != null) {
- pcd[i][6] = archList;
- }
- String modTypeList = listToString(e.getSupModuleList());
- if (modTypeList != null) {
- pcd[i][7] = modTypeList;
- }
-
- int j = 0;
- while (j < e.getValidUsage().size() && j < 5) {
- pcdUsage[i][j] = (String)e.getValidUsage().get(j);
- ++j;
- }
- i++;
- }
- }
-
- /**
- Save the processed xml contents to file
-
- @param spdFile The file to save xml contents
- @throws IOException Exceptions during file operation
- **/
- public void saveAs(File spdFile) throws IOException {
-
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- try {
- psad.save(spdFile, options);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- Generate SpdHeader contents using parameters passed in.
-
- @param pkgName PackageName
- @param pkgGuid Guid
- @param pkgVer Version
- @param pkgAbs Abstract
- @param pkgDes Description
- @param pkgCpRight Copyright
- @param pkgLicense License
- @param pkgCreateDate Created
- @param pkgUpdateDate Updated
- @param pkgURL URL
- @param pkgType PackageType
- @param pkgRdOnly ReadOnly
- @param pkgRePkg RePackage
- @param pkgSpec Reserved
- @param pkgOutDir Reserved
- **/
- public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,
- String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,
- String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,
- String pkgOutDir) {
- if (getSpdHdr() == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
-
- setSpdHdrPkgName(pkgName);
- setSpdHdrGuidValue(pkgGuid);
- setSpdHdrVer(pkgVer);
- setSpdHdrAbs(pkgAbs);
- setSpdHdrDescription(pkgDes);
- setSpdHdrCopyright(pkgCpRight);
- setSpdHdrLicense(pkgLicense);
-
-
- setSpdHdrSpec(pkgSpec);
- }
-
- /**
- Generate library class declaration element using parameters passed in
-
- @param libClassBaseName LibraryClass element value
- @param libClassUsage Reserved
- @param incHdrFileName IncludeHeader element value
- @param incHdrAttribGuid Reserved
- @param incHdrAttribArch Reserved
- @param incHdrAttribPath Reserved
- @param incHdrAttribClass Reserved
- @param incHdrAttribVer Reserved
- @param incHdrAttribOverrideID Reserved
- @param incHdrAttribModuleType Reserved
- **/
- public void genSpdLibClassDeclarations(String libClassBaseName, String instanceUsage, String incHdrFileName,
- String help, String incHdrAttribArch, String incHdrAttribPath,
- String incHdrAttribClass, String incHdrAttribVer,
- String incHdrAttribOverrideID, String incHdrAttribModuleType) {
- if (getSpdLibClassDeclarations() == null) {
- spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();
- }
- //
- // add contents under LibraryClassDeclarations tag
- //
- setSpdLibClassDeclaration(libClassBaseName, instanceUsage, incHdrFileName, help, incHdrAttribArch,
- incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,
- incHdrAttribModuleType, spdLibClassDeclarations);
- }
-
- public void getSpdLibClassDeclaration(String[] sa, int i) {
- if (getSpdLibClassDeclarations() == null) {
- return;
- }
- XmlCursor cursor = getSpdLibClassDeclarations().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
- sa[0] = lc.getName();
- sa[1] = lc.getIncludeHeader();
- sa[2] = lc.getHelpText();
- sa[3] = lc.getRecommendedInstanceGuid();
- sa[4] = lc.getRecommendedInstanceVersion();
- sa[5] = listToString(lc.getSupArchList());
- sa[6] = listToString(lc.getSupModuleList());
- }
- cursor.dispose();
- }
-
- /**
- Set library class declaration contents under parent tag
-
- @param clsName LibraryClass element value
- @param clsUsage Reserved
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- @param hdrAttribModType Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String help,
- String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,
- String instanceVer, String hdrAttribOverID, String hdrAttribModType,
- XmlObject parent) {
-
- setSpdLibraryClass(clsName, hdrFile, help, clsUsage, instanceVer, hdrAttribArch, hdrAttribModType, parent);
-
- }
-
- /**
- Set the contents of LibraryClass under parent element
-
- @param clsName LibraryClass element value
- @param clsUsage Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdLibraryClass(String clsName, String clsIncludeFile, String help, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType, XmlObject parent) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent).addNewLibraryClass();
- lc.setName(clsName);
- lc.setIncludeHeader(clsIncludeFile);
- lc.setHelpText(help);
-// LAH added logic so you cannot set the version unless the GUID is defined.
-
- if (clsUsage != null) {
- lc.setRecommendedInstanceGuid(clsUsage);
- if (instanceVer != null) {
- lc.setRecommendedInstanceVersion(instanceVer);
- }
- }
- else {
- if (lc.isSetRecommendedInstanceGuid()) {
- lc.unsetRecommendedInstanceGuid();
- }
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
-
- if (hdrAttribArch != null) {
- lc.setSupArchList(stringToList(hdrAttribArch));
- } else {
- if (lc.isSetSupArchList()) {
- lc.unsetSupArchList();
- }
- }
-
- if (hdrAttribModType != null) {
- lc.setSupModuleList(stringToList(hdrAttribModType));
- } else {
- if (lc.isSetSupModuleList()) {
- lc.unsetSupModuleList();
- }
- }
-
- }
-
- /**
- Set contents of IncludeHeader under parent element
-
- @param modType Reserved
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,
- String hdrAttribOverID, XmlObject parent) {
-
- if (parent instanceof LibraryClassDeclarationsDocument.LibraryClassDeclarations) {
- } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = null;
- ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludePkgHeader();
- ih.setStringValue(hdrFile);
- ih.setModuleType(ModuleTypeDef.Enum.forString(modType));
- } else {
- return;
- }
-
- if (hdrAttribGuid != null) {
- }
- if (hdrAttribPath != null) {
- }
- if (hdrAttribClass != null) {
- }
- if (hdrAttribVer != null) {
- }
- if (hdrAttribOverID != null) {
- }
-
- }
-
- /**
- Generate MsaFile element.
-
- @param msaFileName MsaFile element value
- @param archType Reserved
- **/
- public void genSpdMsaFiles(String msaFileName, String moduleName, String ver, String guid) {
- if (getSpdMsaFiles() == null) {
- spdMsaFiles = psaRoot.addNewMsaFiles();
- }
- setSpdMsaFile(msaFileName, moduleName, ver, guid, spdMsaFiles);
-
- }
-
- public void getSpdMsaFile (String[] sa, int i) {
- if (getSpdMsaFiles() == null) {
- return;
- }
- XmlCursor cursor = getSpdMsaFiles().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- sa[0] = cursor.getTextValue();
- }
- cursor.dispose();
- }
-
- /**
- Set MsaFile contents under parent element.
-
- @param msaFileName MsaFile element value
- @param parent Element under which MsaFile goes to
- **/
- public void setSpdMsaFile(String msaFileName, String moduleName, String ver, String guid, XmlObject parent) {
- MsaFilesDocument.MsaFiles f = (MsaFilesDocument.MsaFiles)parent;
- f.addNewFilename().setStringValue(msaFileName);
-// f.setFilename(msaFileName);
-// f.setModuleName(moduleName);
-// f.setModuleVersion(ver);
-// f.setModuleGuid(guid);
- }
-
- /**
- Generate PackageHeader element using parameters passed in.
-
- @param ModHdrModType ModuleType attribute of IncludeHeader element
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- **/
- public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,
- String hdrAttribOverID) {
- if (getSpdModHdrs() == null) {
- spdModHdrs = psaRoot.addNewPackageHeaders();
- }
-
- //
- // add IncludeHeader under PackageHeaders element
- //
- setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,
- hdrAttribVer, hdrAttribOverID, spdModHdrs);
- }
-
- public void getSpdModuleHeader(String[] sa, int i) {
- if (getSpdModHdrs() == null) {
- return;
- }
- XmlCursor cursor = getSpdModHdrs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
- sa[0] = ih.getModuleType()+"";
- sa[1] = ih.getStringValue();
- }
- cursor.dispose();
- }
-
- /**
- Generate GUID declaration element using parameters passed in.
-
- @param guidDeclEntryName Name attribute of Entry element
- @param guidDeclCName CName element value
- @param guidDeclGuid Guid element value
- @param guidDeclFeatureFlag Reserved
- **/
- public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,
- String guidDeclHelp, Vector<String> archList, Vector<String> modTypeList,
- Vector<String> guidTypeList) {
- if (getSpdGuidDeclarations() == null) {
- spdGuidDeclarations = psaRoot.addNewGuidDeclarations();
- }
-
- setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclHelp, archList, modTypeList, guidTypeList, spdGuidDeclarations);
- }
-
- /**
- Generate protocol declaration element using parameters passed in.
-
- @param protocolDeclEntryName Name attribute of Entry element
- @param protocolDeclCName CName element value
- @param protocolDeclGuid Guid element value
- @param protocolDeclFeatureFlag Reserved
- **/
- public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,
- String protocolDeclGuid, String protocolDeclFeatureFlag,
- Vector<String> archList, Vector<String> modTypeList, Vector<String> guidTypeList) {
- if (getSpdProtocolDeclarations() == null) {
- spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();
- }
-
- setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,
- archList, modTypeList, guidTypeList, spdProtocolDeclarations);
- }
-
- /**
- Generate PPI declaration element using parameters passed in.
-
- @param ppiDeclEntryName Name attribute of Entry element
- @param ppiDeclCName CName element value
- @param ppiDeclGuid Guid element value
- @param ppiDeclFeatureFlag Reserved
- **/
- public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,
- String ppiDeclFeatureFlag, Vector<String> archList, Vector<String> modTypeList, Vector<String> guidTypeList) {
- if (getSpdPpiDeclarations() == null) {
- spdPpiDeclarations = psaRoot.addNewPpiDeclarations();
- }
-
- setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, archList, modTypeList, guidTypeList, spdPpiDeclarations);
- }
-
- public void getSpdGuidDeclaration(String[] sa, int i) {
- if (getSpdGuidDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdGuidDeclarations());
- }
-
- public void getSpdProtocolDeclaration(String[] sa, int i) {
- if (getSpdProtocolDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdProtocolDeclarations());
- }
-
- public void getSpdPpiDeclaration(String[] sa, int i) {
- if (getSpdPpiDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdPpiDeclarations());
- }
-
- public void getSpdEntry(String[] sa, int i, XmlObject parent) {
- XmlCursor cursor = parent.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- }
- cursor.dispose();
- }
- /**
- Set Entry contents using parameters passed in
-
- @param entryName Name attribute of Entry element
- @param cName CName element value
- @param guid Guid element value
- @param featureFlag Reserved
- @param parent The tag under which Entry element goes to
- **/
- public void setSpdEntry(String entryName, String cName, String guid, String help,
- Vector<String> archList, Vector<String> modTypeList,
- Vector<String> guidTypeList, XmlObject parent) {
-
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();
- e.setName(entryName);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(help);
- if (guidTypeList != null) {
- e.setGuidTypeList(guidTypeList);
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- e.setSupArchList(archList);
- }
- else {
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- e.setSupModuleList(modTypeList);
- }
- else {
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- return;
- }
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)
- .addNewEntry();
- pe.setName(entryName);
- pe.setCName(cName);
- pe.setGuidValue(guid);
- pe.setHelpText(help);
- if (guidTypeList != null) {
- pe.setGuidTypeList(guidTypeList);
- }
- else{
- if (pe.isSetGuidTypeList()) {
- pe.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- pe.setSupArchList(archList);
- }
- else {
- if (pe.isSetSupArchList()) {
- pe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- pe.setSupModuleList(modTypeList);
- }
- else {
- if (pe.isSetSupModuleList()) {
- pe.unsetSupModuleList();
- }
- }
-
- return;
- }
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
- PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)
- .addNewEntry();
- ppe.setName(entryName);
- ppe.setCName(cName);
- ppe.setGuidValue(guid);
- ppe.setHelpText(help);
- if (guidTypeList != null) {
- ppe.setGuidTypeList(guidTypeList);
- }
- else{
- if (ppe.isSetGuidTypeList()) {
- ppe.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- ppe.setSupArchList(archList);
- }
- else {
- if (ppe.isSetSupArchList()) {
- ppe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- ppe.setSupModuleList(modTypeList);
- }
- else {
- if (ppe.isSetSupModuleList()) {
- ppe.unsetSupModuleList();
- }
- }
-
- return;
- }
-
- return;
-
- }
-
- /**
- Generate Pcd definition using parameters passed in
-
- @param pcdItemTypes ItemType attribute of PcdEntry element
- @param cName C_Name element value
- @param token Token element value
- @param dataType DatumType element value
- @param skuEnable Reserved
- @param sku Reserved
- @param maxSku Reserved
- @param hiiEnable Reserved
- @param varGuid Reserved
- @param varName Reserved
- @param defaultString DefaultString element value
- **/
- public void genSpdPcdDefinitions(String cName, String token, String dataType, String pcdItemTypes,
- String spaceGuid, String defaultString, String help, String archList,
- String modTypeList) {
- if (getSpdPcdDefinitions() == null) {
- spdPcdDefinitions = psaRoot.addNewPcdDeclarations();
- }
-
- setSpdPcdEntry(pcdItemTypes, cName, token, dataType, spaceGuid, help,
- defaultString, archList, modTypeList, spdPcdDefinitions);
- }
-
- public void getSpdPcdDeclaration(String[] sa, int i) {
- if (getSpdPcdDefinitions() == null) {
- return;
- }
-
- XmlCursor cursor = getSpdPcdDefinitions().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
- sa[0] = pe.getCName();
- sa[1] = pe.getToken()+"";
- sa[2] = pe.getTokenSpaceGuidCName();
- sa[3] = pe.getDatumType()+"";
- sa[4] = pe.getDefaultValue();
- sa[5] = pe.getHelpText();
- sa[6] = listToString(pe.getValidUsage());
- sa[7] = listToString(pe.getSupArchList());
- sa[8] = listToString(pe.getSupModuleList());
- }
- cursor.dispose();
- }
-
- /**
- Set Pcd entry contents under parent tag
-
- @param pcdItemTypes ItemType attribute of PcdEntry element
- @param cName C_Name element value
- @param token Token element value
- @param dataType DatumType element value
- @param spaceGuid Reserved
- @param help Reserved
- @param defaultString DefaultString element value
- @param parent Tag under which PcdEntry goes to
- **/
- public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String spaceGuid, String help,
- String defaultString, String archList, String modTypeList, XmlObject parent) {
-
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = ((PcdDeclarationsDocument.PcdDeclarations) parent).addNewPcdEntry();
-
- //ToDo: maybe multiple types in, need parse pcdItemTypes.
- String usage[] = pcdItemTypes.split("( )+");
- List<String> l = new ArrayList<String>();
- for (int i = 0; i < usage.length; ++i) {
- l.add(usage[i]);
- }
- pe.setValidUsage(l);
- pe.setCName(cName);
- pe.setToken(token);
- pe.setDatumType(PcdDataTypes.Enum.forString(dataType));
- pe.setDefaultValue(defaultString);
- pe.setTokenSpaceGuidCName(spaceGuid);
- pe.setHelpText(help);
- if (archList != null){
- pe.setSupArchList(stringToList(archList));
- } else {
- if (pe.isSetSupArchList()) {
- pe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- pe.setSupModuleList(stringToList(modTypeList));
- } else {
- if (pe.isSetSupModuleList()) {
- pe.unsetSupModuleList();
- }
- }
- }
-
- /**
- Get PpiDeclarations element
-
- @return PpiDeclarationsDocument.PpiDeclarations
- **/
- public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {
- if (spdPpiDeclarations == null) {
- spdPpiDeclarations = psaRoot.getPpiDeclarations();
- }
- return spdPpiDeclarations;
- }
-
- /**
- Get ProtocolDeclarations element
-
- @return ProtocolDeclarationsDocument.ProtocolDeclarations
- **/
- public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {
- if (spdProtocolDeclarations == null) {
- spdProtocolDeclarations = psaRoot.getProtocolDeclarations();
- }
- return spdProtocolDeclarations;
- }
-
- /**
- Get GuidDeclarations element
-
- @return GuidDeclarationsDocument.GuidDeclarations
- **/
- public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {
- if (spdGuidDeclarations == null) {
- spdGuidDeclarations = psaRoot.getGuidDeclarations();
- }
- return spdGuidDeclarations;
- }
-
- /**
- Get PcdDefinitions element
-
- @return PcdDefinitionsDocument.PcdDefinitions
- **/
- public PcdDeclarationsDocument.PcdDeclarations getSpdPcdDefinitions() {
- if (spdPcdDefinitions == null) {
- spdPcdDefinitions = psaRoot.getPcdDeclarations();
- }
- return spdPcdDefinitions;
- }
-
- /**
- Get PackageHeaders element
-
- @return PackageHeadersDocument.PackageHeaders
- **/
- public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {
- if (spdModHdrs == null) {
- spdModHdrs = psaRoot.getPackageHeaders();
- }
- return spdModHdrs;
- }
-
- /**
- Get MsaFiles element
-
- @return MsaFilesDocument.MsaFiles
- **/
- public MsaFilesDocument.MsaFiles getSpdMsaFiles() {
- if (spdMsaFiles == null) {
- spdMsaFiles = psaRoot.getMsaFiles();
- }
- return spdMsaFiles;
- }
-
- /**
- Get LibraryClassDeclarations element
-
- @return LibraryClassDeclarationsDocument.LibraryClassDeclarations
- **/
- public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {
- if (spdLibClassDeclarations == null) {
- spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();
- }
- return spdLibClassDeclarations;
- }
-
- public PackageDefinitionsDocument.PackageDefinitions getSpdPkgDefs() {
- if (spdPkgDefs == null) {
- spdPkgDefs = psaRoot.addNewPackageDefinitions();
- }
- return spdPkgDefs;
- }
- /**
- Get SpdHeader element
-
- @return SpdHeaderDocument.SpdHeader
- **/
- public SpdHeaderDocument.SpdHeader getSpdHdr() {
- if (spdHdr == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
- return spdHdr;
- }
-
- /**
- Set value to Guid element
-
- @param guid The value set to Guid element
- **/
- public void setSpdHdrGuidValue(String guid) {
- getSpdHdr().setGuidValue(guid);
- }
-
- /**
- Get Version element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrVer() {
- return getSpdHdr().getVersion();
- }
-
- /**
- Set value to Version element
-
- @param ver The value set to Version element
- **/
- public void setSpdHdrVer(String ver) {
- getSpdHdr().setVersion(ver);
- }
-
- public String getSpdHdrAbs(){
- return getSpdHdr().getAbstract();
-
- }
-
- /**
- Set value to Abstract element
-
- @param abs The value set to Abstract element
- **/
- public void setSpdHdrAbs(String abs) {
-
- getSpdHdr().setAbstract(abs);
- }
-
- public String getSpdHdrDescription(){
- return getSpdHdr().getDescription();
- }
- /**
- Set value to Description element
-
- @param des The value set to Description element
- **/
- public void setSpdHdrDescription(String des) {
- getSpdHdr().setDescription(des);
- }
-
- public String getSpdHdrCopyright(){
- return getSpdHdr().getCopyright();
- }
- /**
- Set value to Copyright element
-
- @param cpRit The value set to Copyright element
- **/
- public void setSpdHdrCopyright(String cpRit) {
-
- getSpdHdr().setCopyright(cpRit);
-
- }
- /**
- Get License element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrLicense() {
- if (getSpdHdr().getLicense() != null) {
- return getSpdHdr().getLicense().getStringValue();
- }
- return null;
- }
-
- /**
- Set value to License element
-
- @param license The value set to License element
- **/
- public void setSpdHdrLicense(String license) {
- if (getSpdHdr().getLicense() == null){
- getSpdHdr().addNewLicense().setStringValue(license);
- }
- else {
- getSpdHdr().getLicense().setStringValue(license);
- }
- }
-
- public String getSpdHdrUrl(){
- if (getSpdHdr().getLicense() != null) {
- return getSpdHdr().getLicense().getURL();
- }
- return null;
- }
-
- public void setSpdHdrUrl(String url){
- getSpdHdr().getLicense().setURL(url);
- }
-
- /**
- Get PackageName element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrPkgName() {
-
- return getSpdHdr().getPackageName();
- }
-
- /**
- Set value to PackageName element
-
- @param pkgName The value set to PackageName element
- **/
- public void setSpdHdrPkgName(String pkgName) {
- getSpdHdr().setPackageName(pkgName);
- }
-
- public String getSpdHdrGuidValue(){
- return getSpdHdr().getGuidValue();
- }
-
- /**
- Reserved method
-
- @return SpecificationDocument.Specification
- **/
- public String getSpdHdrSpec() {
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-// return getSpdHdr().getSpecification();
- }
-
- /**
- Reserved method
-
- @param spec
- **/
- public void setSpdHdrSpec(String spec) {
- spec = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
- getSpdHdr().setSpecification(spec);
-
- }
-
- public String getSpdPkgDefsRdOnly(){
- return getSpdPkgDefs().getReadOnly() + "";
- }
- /**
- Set value to ReadOnly element
-
- @param rdOnly The value set to ReadOnly element
- **/
- public void setSpdPkgDefsRdOnly(String rdOnly) {
-
- getSpdPkgDefs().setReadOnly(new Boolean(rdOnly));
- }
-
- public String getSpdPkgDefsRePkg(){
- return getSpdPkgDefs().getRePackage() + "";
- }
- /**
- Set value to RePackage element
-
- @param rePkg The value set to RePackage element
- **/
- public void setSpdPkgDefsRePkg(String rePkg) {
-
- getSpdPkgDefs().setRePackage(new Boolean(rePkg));
- }
-
- /**
- Set value to URL element
-
- @param url The value set to URL element
- **/
-// public void setSpdHdrURL(String url) {
-// getSpdHdr().setURL(url);
-// }
-
- /**
- Get xml file
-
- @return File
- **/
- public File getFile() {
- return file;
- }
-
- /**
- Set file
-
- @param file File with xml format
- **/
- public void setFile(File file) {
- this.file = file;
- }
-
- private List<String> stringToList(String s){
- if (s == null || s.length() == 0) {
- return null;
- }
- Vector<String> al = new Vector<String>();
- String[] sArray = s.split(" ");
- for(int i = 0; i < sArray.length; ++i){
- al.add(sArray[i]);
- }
- return al;
- }
-
- 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();
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java
deleted file mode 100644
index 8f39783a8f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java
+++ /dev/null
@@ -1,941 +0,0 @@
-/** @file
- Java class SpdGuidDecls is GUI for create library definition elements of 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.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.util.Vector;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-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.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JScrollPane jScrollPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonGen = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- protected int selectedRow = -1;
-
- private JLabel jLabelName = null;
-
- private JScrollPane jScrollPaneModule = null;
-
- private JTextField jTextFieldName = null;
-
- private JScrollPane jScrollPaneArch = null;
-
- private JScrollPane jScrollPaneGuid = null;
-
- private JLabel jLabelGuid = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,213"
-
- private JLabel jLabelCName = null;
-
- private GenGuidDialog guidDialog = null;
-
- private JTextField jTextFieldCName = null;
-
- private JLabel jLabelHelp = null;
-
- private JTextField jTextFieldHelp = null;
-
- private JLabel jLabelSupMod = null;
-
- private JLabel jLabelSupArch = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private ICheckBoxList iCheckBoxListGuid = null;
-
- private ICheckBoxList iCheckBoxListMod = null;
-
- private JLabel jLabelGuidType = null;
-
- protected String[][] saa = null;
-
- protected StarLabel starLabel = null;
-
- private final int guidNameMinWidth = 200;
- private final int guidCNameMinWidth = 200;
- private final int guidValueMinWidth = 300;
- private final int helpTextMinWidth = 300;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
- private final int guidTypeMinWidth = 200;
-
-
- /**
- This method initializes this
-
- **/
- protected void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField
- **/
- protected JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(137,60,336,20));
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(200,20));
-
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- **/
- protected JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5,256,472,292));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- protected JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- model.addColumn("Name");
- model.addColumn("The C Name");
- model.addColumn("GUID Value");
- model.addColumn("Help Text");
- model.addColumn("Supported Architectures");
- model.addColumn("Supported Module Types");
- model.addColumn("GuidTypes");
-
- TableColumn column = jTable.getColumnModel().getColumn(0);
- column.setMinWidth(this.guidNameMinWidth);
- column = jTable.getColumnModel().getColumn(1);
- column.setMinWidth(this.guidCNameMinWidth);
- column = jTable.getColumnModel().getColumn(2);
- column.setMinWidth(this.guidValueMinWidth);
- column = jTable.getColumnModel().getColumn(3);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(4);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(5);
- column.setMinWidth(this.supModMinWidth);
- column = jTable.getColumnModel().getColumn(6);
- column.setMinWidth(this.guidTypeMinWidth);
-
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor(topFrame));
- jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor(topFrame));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
- jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule, topFrame));
-
- Vector<String> vGuid = new Vector<String>();
- vGuid.add("DATA_HUB_RECORD");
- vGuid.add("EFI_EVENT");
- vGuid.add("EFI_SYSTEM_CONFIGURATION_TABLE");
- vGuid.add("EFI_VARIABLE");
- vGuid.add("GUID");
- vGuid.add("HII_PACKAGE_LIST");
- vGuid.add("HOB");
- vGuid.add("TOKEN_SPACE_GUID");
- ListEditor le = new ListEditor(vGuid, topFrame);
- le.setCanNotBeEmpty(true);
- jTable.getColumnModel().getColumn(6).setCellEditor(le);
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.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();
-
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- updateRow(row, column, m);
- }
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdGuidDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
-
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null){
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null){
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(167,227,90,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(270,227,90,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(380,227,90,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButton
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setSize(new java.awt.Dimension(90, 20));
- jButtonOk.setText("OK");
- jButtonOk.setLocation(new java.awt.Point(290, 305));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This is the default constructor
- **/
- public SpdGuidDecls(JFrame frame) {
- super();
- topFrame = frame;
- initialize();
- init();
-
- }
-
- public SpdGuidDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdGuidDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
- /**
- This method initializes this
-
- @return void
- **/
- protected void init() {
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- protected void init(SpdFileContents sfc){
- if (sfc.getSpdGuidDeclarationCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- saa = new String[sfc.getSpdGuidDeclarationCount()][7];
- sfc.getSpdGuidDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(617,500));
- topScrollPane.setPreferredSize(new java.awt.Dimension(498,500));
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- protected JPanel getJContentPane1() {
- if (jContentPane == null) {
-
- jLabelGuidType = new JLabel();
- jLabelGuidType.setBounds(new java.awt.Rectangle(420,122,103,16));
- jLabelGuidType.setText("GUID Type List");
- jLabelGuidType.setEnabled(true);
- starLabel = new StarLabel();
- starLabel.setLocation(new Point(jLabelGuidType.getX() - 10, jLabelGuidType.getY()));
- starLabel.setVisible(true);
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16));
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setEnabled(true);
- FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont());
- jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20);
- jLabelSupMod = new JLabel();
- jLabelSupMod.setBounds(new java.awt.Rectangle(14,120,110,16));
- jLabelSupMod.setText("Supported Module Types");
- jLabelSupMod.setEnabled(true);
- fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont());
- jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20);
- jLabelHelp = new JLabel();
- jLabelHelp.setText("HelpText");
- jLabelHelp.setSize(new java.awt.Dimension(109,20));
- jLabelHelp.setLocation(new java.awt.Point(14,85));
- jLabelCName = new JLabel();
- jLabelCName.setBounds(new java.awt.Rectangle(14,35,111,20));
- jLabelCName.setText("C Name");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15,60,112,20));
- jLabelGuid.setText("Guid Value");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15,10,113,20));
- jLabelName.setText("Name");
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, 35));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 60));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 85));
- jStarLabel2.setVisible(true);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new Dimension(480, 375));
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jLabelCName, null);
- jContentPane.add(getJTextFieldCName(), null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonOk(), null);
-
- jContentPane.add(getJButtonGen(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(jLabelHelp, null);
- jContentPane.add(getJTextFieldHelp(), null);
- jContentPane.add(jLabelSupMod, null);
- jContentPane.add(jLabelSupArch, null);
- jContentPane.add(getJScrollPaneArch(), null);
- jContentPane.add(getJScrollPaneGuid(), null);
- jContentPane.add(getJScrollPaneModule(), null);
- jContentPane.add(jLabelGuidType, null);
- jContentPane.add(starLabel, null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- protected void initFrame() {
-
- this.setTitle("GUID Declarations");
-
- boolean editable = true;
- if (getSfc().getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
-
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
-
- //ToDo: check before add
- String[] row = {"", "", "", "", "", "", ""};
- row[3] = jTextFieldHelp.getText();
- row[2] = jTextFieldGuid.getText();
- row[1] = jTextFieldCName.getText();
- row[0] = jTextFieldName.getText();
- row[4] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (row[4].length() == 0) {
- row[4] = null;
- }
- row[5] = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
- if (row[5].length() == 0) {
- row[5] = null;
- }
- row[6] = vectorToString(iCheckBoxListGuid.getAllCheckedItemsString());
- if (row[6].length() == 0) {
- row[6] = null;
- }
-
- if (!dataValidation(row)) {
- return;
- }
-
- if (addRow(row) == -1) {
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
-
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- removeRow(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- clearAllRow();
- }
-
- if (arg0.getSource() == jButtonGen) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getActionCommand().equals("GenGuidValue")) {
- jTextFieldGuid.setText(guidDialog.getGuid());
- }
-
- }
-
- protected boolean dataValidation(String[] row){
- if (!DataValidation.isUiNameType(row[0])) {
- JOptionPane.showMessageDialog(this, "Name must start with an alpha character.");
- return false;
- }
- if (!DataValidation.isGuid(row[2])) {
- JOptionPane.showMessageDialog(this, "Guid Value must be in registry format, 8-4-4-4-12.");
- return false;
- }
- if (!DataValidation.isC_NameType(row[1])) {
- JOptionPane.showMessageDialog(this, "C Name does not match C Name datatype.");
- return false;
- }
- if (row[3].length() == 0) {
- JOptionPane.showMessageDialog(this, "Help Text must be entered!");
- return false;
- }
- return true;
- }
-
- protected int addRow(String[] row) {
- Vector<String> vArch = iCheckBoxListArch.getAllCheckedItemsString();
- if (vArch.size() == 0) {
- vArch = null;
- }
- Vector<String> vModType = iCheckBoxListMod.getAllCheckedItemsString();
- if (vModType.size() == 0) {
- vModType = null;
- }
- Vector<String> vguidType = iCheckBoxListGuid.getAllCheckedItemsString();
- if (vguidType.size() == 0) {
- vguidType = null;
- }
- if (vguidType == null) {
- JOptionPane.showMessageDialog(this, "You must select at least one GUID type.");
- return -1;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdGuidDeclaration(i);
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- protected void clearAllRow(){
- sfc.removeSpdGuidDeclaration();
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonGen() {
- if (jButtonGen == null) {
- jButtonGen = new JButton();
- jButtonGen.setBounds(new java.awt.Rectangle(485,58,92,21));
- jButtonGen.setText("Gen");
- jButtonGen.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonGen.addActionListener(this);
- }
- return jButtonGen;
- }
-
- /**
- * This method initializes jTextFieldName
- *
- * @return javax.swing.JTextField
- */
- protected JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(138,10,337,20));
- jTextFieldName.setPreferredSize(new java.awt.Dimension(335,20));
- }
- return jTextFieldName;
- }
-
- /**
- * This method initializes jTextFieldCName
- *
- * @return javax.swing.JTextField
- */
- protected JTextField getJTextFieldCName() {
- if (jTextFieldCName == null) {
- jTextFieldCName = new JTextField();
- jTextFieldCName.setBounds(new java.awt.Rectangle(137,35,337,20));
- jTextFieldCName.setPreferredSize(new java.awt.Dimension(335,20));
- }
- return jTextFieldCName;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldName, this.getWidth(), intPreferredWidth);
-
- Tools.resizeComponentWidth(this.jTextFieldCName, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonGen, this.getWidth(), this.getPreferredSize().width, 40);
-
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHelp() {
- if (jTextFieldHelp == null) {
- jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(136,85,337,20));
- jTextFieldHelp.setPreferredSize(new Dimension(335, 20));
- }
- return jTextFieldHelp;
- }
-
- private JScrollPane getJScrollPaneArch() {
- if (jScrollPaneArch == null) {
- jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(197,142,188,74));
- jScrollPaneArch.setPreferredSize(new java.awt.Dimension(188, 74));
- jScrollPaneArch.setViewportView(getICheckBoxListArch());
- }
- return jScrollPaneArch;
- }
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new java.awt.Rectangle(197,142,188,74));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
- protected JScrollPane getJScrollPaneGuid() {
- if (jScrollPaneGuid== null) {
- jScrollPaneGuid = new JScrollPane();
- jScrollPaneGuid.setPreferredSize(new java.awt.Dimension(190,74));
- jScrollPaneGuid.setLocation(new java.awt.Point(400,142));
- jScrollPaneGuid.setSize(new java.awt.Dimension(260,74));
- jScrollPaneGuid.setViewportView(getICheckBoxListGuid());
- }
- return jScrollPaneGuid;
- }
- /**
- * This method initializes iCheckBoxList1
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListGuid() {
- if (iCheckBoxListGuid == null) {
- iCheckBoxListGuid = new ICheckBoxList();
- iCheckBoxListGuid.setBounds(new java.awt.Rectangle(400,142,177,74));
- Vector<String> v = new Vector<String>();
- v.add("DATA_HUB_RECORD");
- v.add("EFI_EVENT");
- v.add("EFI_SYSTEM_CONFIGURATION_TABLE");
- v.add("EFI_VARIABLE");
- v.add("GUID");
- v.add("HII_PACKAGE_LIST");
- v.add("HOB");
- v.add("TOKEN_SPACE_GUID");
-
- iCheckBoxListGuid.setAllItems(v);
- }
- return iCheckBoxListGuid;
- }
-
- private JScrollPane getJScrollPaneModule() {
- if (jScrollPaneModule == null) {
- jScrollPaneModule = new JScrollPane();
- jScrollPaneModule.setBounds(new java.awt.Rectangle(14,142,170,74));
- jScrollPaneModule.setPreferredSize(new java.awt.Dimension(170, 74));
- jScrollPaneModule.setViewportView(getICheckBoxListMod());
- }
- return jScrollPaneModule;
- }
- /**
- * This method initializes iCheckBoxList2
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListMod() {
- if (iCheckBoxListMod == null) {
- iCheckBoxListMod = new ICheckBoxList();
- iCheckBoxListMod.setBounds(new java.awt.Rectangle(14,142,170,74));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListMod.setAllItems(v);
- }
- return iCheckBoxListMod;
- }
-
- protected DefaultTableModel getModel() {
- return model;
- }
-
- protected void setModel(DefaultTableModel model) {
- this.model = model;
- }
-
- protected String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s){
- if (s == null) {
- return null;
- }
- String[] sArray = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- protected JLabel getJLabelGuidType() {
- return jLabelGuidType;
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
deleted file mode 100644
index a8def0a86b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/** @file
-
- The file is used to create, update spdHeader of 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.packaging.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-
-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 org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JCheckBox;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-/**
- The class is used to create, update spdHeader of Spd file
- It extends IInternalFrame
-
- @since PackageEditor 1.0
-
- **/
-public class SpdHeader 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 + rowSep;
-
- private final int rowTen = rowNine + oneRowHeight + rowSep;
-
- private int dialogHeight = rowTen + threeRowHeight;
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- //Define class members
- //
- private IInternalFrame topFrame;
-
- private JPanel jContentPane = null;
-
- private JLabel jPackageNameLabel = null;
-
- private JTextField jPackageNameTextField = null;
-
- private JLabel jGuidLabel = null;
-
- private JTextField jGuidTextField = null;
-
- private JLabel jVersionLabel = null;
-
- private JTextField jVersionTextField = null;
-
- private JButton jGenerateGuidButton = null;
-
- private JLabel jLicenseLabel = null;
-
- private JTextArea jLicenseTextArea = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jDescriptionLabel = null;
-
- private JTextArea jDescriptionTextArea = null;
-
- private JTextField jSpecificationTextField = null;
-
- private JScrollPane jLicenseScrollPane = null;
-
- private JScrollPane jDescriptionScrollPane = null;
-
- private JScrollPane jCopyrightScrollPane = null;
-
- private JLabel jAbstractLabel = null;
-
- private JTextField jAbstractTextField = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel9 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JTextArea jCopyrightTextArea = null;
-
- private JScrollPane topScrollPane = null;
-
- private JLabel jUrlLabel = null;
-
- private JTextField jUrlTextField = null;
-
- private JCheckBox jCheckBoxRdOnly = null;
-
- private JCheckBox jCheckBoxRePkg = null;
-
- /**
- This method initializes jPackageNameTextField
-
- @return javax.swing.JTextField jPackageNameTextField
-
- **/
- private JTextField getJPackageNameTextField() {
- if (jPackageNameTextField == null) {
- jPackageNameTextField = new JTextField();
- jPackageNameTextField.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jPackageNameTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jPackageNameTextField.getDocument().addDocumentListener(this);
- jPackageNameTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isUiNameType(jPackageNameTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Package Name must start with a letter.");
- return;
- }
- if (jPackageNameTextField.getText().equals(sfc.getSpdHdrPkgName())) {
- return;
- }
- sfc.setSpdHdrPkgName(jPackageNameTextField.getText());
- }
- });
- }
- return jPackageNameTextField;
- }
-
- /**
- This method initializes jGuidTextField
-
- @return javax.swing.JTextField jGuidTextField
-
- **/
- private JTextField getJGuidTextField() {
- if (jGuidTextField == null) {
- jGuidTextField = new JTextField();
- jGuidTextField.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
- jGuidTextField.setPreferredSize(new java.awt.Dimension(shortValueWidth, oneRowHeight));
- jGuidTextField.getDocument().addDocumentListener(this);
- jGuidTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isGuid(jGuidTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Guid must be in registry (8-4-4-4-12) format.");
- return;
- }
- if (jGuidTextField.getText().equals(sfc.getSpdHdrGuidValue())) {
- return;
- }
- sfc.setSpdHdrGuidValue(jGuidTextField.getText());
- }
- });
- }
- return jGuidTextField;
- }
-
- /**
- This method initializes jVersionTextField
-
- @return javax.swing.JTextField jVersionTextField
-
- **/
- private JTextField getJVersionTextField() {
- if (jVersionTextField == null) {
- jVersionTextField = new JTextField();
- jVersionTextField.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
- jVersionTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jVersionTextField.getDocument().addDocumentListener(this);
- jVersionTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isVersion(jVersionTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Version must start with a number.");
- return;
- }
- if (jVersionTextField.getText().equals(sfc.getSpdHdrVer())) {
- return;
- }
- sfc.setSpdHdrVer(jVersionTextField.getText());
- }
- });
- }
- return jVersionTextField;
- }
-
- /**
- This method initializes jGenerateGuidButton
-
- @return javax.swing.JButton jGenerateGuidButton
-
- **/
- private JButton getJGenerateGuidButton() {
- if (jGenerateGuidButton == null) {
- jGenerateGuidButton = new JButton();
- jGenerateGuidButton.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
- jGenerateGuidButton.setText("GEN");
- jGenerateGuidButton.addActionListener(this);
- }
- return jGenerateGuidButton;
- }
-
- /**
- This method initializes jLicenseTextArea
-
- @return javax.swing.JTextArea jLicenseTextArea
-
- **/
- private JTextArea getJLicenseTextArea() {
- if (jLicenseTextArea == null) {
- jLicenseTextArea = new JTextArea();
- jLicenseTextArea.setLineWrap(true);
- jLicenseTextArea.getDocument().addDocumentListener(this);
- jLicenseTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jLicenseTextArea.getText().length() == 0) {
- JOptionPane.showMessageDialog(topFrame, "License is a required field.");
- return;
- }
- if (jLicenseTextArea.getText().equals(sfc.getSpdHdrLicense())) {
- return;
- }
- sfc.setSpdHdrLicense(jLicenseTextArea.getText());
- }
- });
- }
- return jLicenseTextArea;
- }
-
- /**
- This method initializes jDescriptionTextArea
-
- @return javax.swing.JTextArea jDescriptionTextArea
-
- **/
- private JTextArea getJDescriptionTextArea() {
- if (jDescriptionTextArea == null) {
- jDescriptionTextArea = new JTextArea();
- jDescriptionTextArea.setLineWrap(true);
- jDescriptionTextArea.getDocument().addDocumentListener(this);
- jDescriptionTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jDescriptionTextArea.getText().length() == 0) {
- JOptionPane
- .showMessageDialog(topFrame,
- "Description is a required field, and should reflect the contents of the package.");
- return;
- }
- if (jDescriptionTextArea.getText().equals(sfc.getSpdHdrDescription())) {
- return;
- }
- sfc.setSpdHdrDescription(jDescriptionTextArea.getText());
- }
- });
- }
- return jDescriptionTextArea;
- }
-
- /**
- This method initializes jSpecificationTextField
-
- @return javax.swing.JTextField jSpecificationTextField
-
- **/
- private JTextField getJSpecificationTextField() {
- if (jSpecificationTextField == null) {
- jSpecificationTextField = new JTextField();
- jSpecificationTextField.setBounds(new java.awt.Rectangle(labelColumn, dialogHeight - 40, specWidth, oneRowHeight));
- jSpecificationTextField.setEditable(false);
- jSpecificationTextField.setPreferredSize(new java.awt.Dimension(specWidth, oneRowHeight));
- jSpecificationTextField.setLocation(new java.awt.Point(2, dialogHeight - oneRowHeight));
- jSpecificationTextField.setBorder(null);
-
- // jSpecificationTextField.addFocusListener(new FocusAdapter(){
- // public void focusLost(FocusEvent e){
- // sfc.setSpdHdrSpec(jSpecificationTextField.getText());
- // }
- // });
- }
- return jSpecificationTextField;
- }
-
- /**
- This method initializes jLicenseScrollPane
-
- @return javax.swing.JScrollPane jLicenseScrollPane
-
- **/
- private JScrollPane getJLicenseScrollPane() {
- if (jLicenseScrollPane == null) {
- jLicenseScrollPane = new JScrollPane();
- jLicenseScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFive, valueWidth, fourRowHeight));
- jLicenseScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jLicenseScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jLicenseScrollPane.setViewportView(getJLicenseTextArea());
- }
- return jLicenseScrollPane;
- }
-
- /**
- This method initializes jDescriptionScrollPane
-
- @return javax.swing.JScrollPane jDescriptionScrollPane
-
- **/
- private JScrollPane getJDescriptionScrollPane() {
- if (jDescriptionScrollPane == null) {
- jDescriptionScrollPane = new JScrollPane();
- jDescriptionScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowEight, valueWidth, fourRowHeight));
- jDescriptionScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jDescriptionScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jDescriptionScrollPane.setViewportView(getJDescriptionTextArea());
- }
- return jDescriptionScrollPane;
- }
-
- /**
- This method initializes jAbstractTextField
-
- @return javax.swing.JTextField jAbstractTextField
-
- **/
- private JTextField getJAbstractTextField() {
- if (jAbstractTextField == null) {
- jAbstractTextField = new JTextField();
- jAbstractTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
- jAbstractTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jAbstractTextField.getDocument().addDocumentListener(this);
- jAbstractTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isAbstract(jAbstractTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Abstract could NOT be empty.");
- return;
- }
- if (jAbstractTextField.getText().equals(sfc.getSpdHdrAbs())) {
- return;
- }
- sfc.setSpdHdrAbs(jAbstractTextField.getText());
- }
- });
- }
- return jAbstractTextField;
- }
-
- 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(topFrame, "Copyright must be entered.");
- return;
- }
- if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) {
- return;
- }
- sfc.setSpdHdrCopyright(jCopyrightTextArea.getText());
- }
- });
- }
- return jCopyrightTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJUrlTextField() {
- if (jUrlTextField == null) {
- jUrlTextField = new JTextField();
- jUrlTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSix, valueWidth, oneRowHeight));
- jUrlTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jUrlTextField.getDocument().addDocumentListener(this);
- jUrlTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jUrlTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
- return;
- }
- if (jUrlTextField.getText().equals(sfc.getSpdHdrUrl())) {
- return;
- }
- sfc.setSpdHdrLicense(jLicenseTextArea.getText());
- sfc.setSpdHdrUrl(jUrlTextField.getText());
- }
- });
- }
- return jUrlTextField;
- }
-
- /**
- * This method initializes jCheckBoxRdOnly
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxRdOnly() {
- if (jCheckBoxRdOnly == null) {
- jCheckBoxRdOnly = new JCheckBox();
- jCheckBoxRdOnly.setText("Read Only");
- jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));
- jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jCheckBoxRdOnly.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected()+"");
- initFrame();
- }
- });
- }
- return jCheckBoxRdOnly;
- }
-
- /**
- * This method initializes jCheckBoxRePkg
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxRePkg() {
- if (jCheckBoxRePkg == null) {
- jCheckBoxRePkg = new JCheckBox();
- jCheckBoxRePkg.setLocation(new java.awt.Point(labelColumn, rowTen));
- jCheckBoxRePkg.setText("RePackagable");
- jCheckBoxRePkg.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jCheckBoxRePkg.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected()+"");
- }
- });
- }
- return jCheckBoxRePkg;
- }
-
- public static void main(String[] args) {
- new SpdHeader().setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public SpdHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inspdHeader The input data of spdHeaderDocument.spdHeader
-
- **/
- public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
- this();
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdHeader(OpeningPackageType opt) {
- this(opt.getXmlSpd());
- docConsole = opt;
- initFrame();
- topFrame = this;
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getTopScrollPane());
- this.setTitle("Package Surface Area Header");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inspdHeader The input data of spdHeaderDocument.spdHeader
-
- **/
- private void init(SpdFileContents sfc) {
- if (sfc.getSpdHdrPkgName() != null) {
- jPackageNameTextField.setText(sfc.getSpdHdrPkgName());
- }
- if (sfc.getSpdHdrGuidValue() != null) {
- jGuidTextField.setText(sfc.getSpdHdrGuidValue());
- }
- if (sfc.getSpdHdrVer() != null) {
- jVersionTextField.setText(sfc.getSpdHdrVer());
- }
- if (sfc.getSpdHdrLicense() != null) {
- jLicenseTextArea.setText(sfc.getSpdHdrLicense());
- }
- if (sfc.getSpdHdrUrl() != null) {
- jUrlTextField.setText(sfc.getSpdHdrUrl());
- }
- if (sfc.getSpdHdrCopyright() != null) {
- jCopyrightTextArea.setText(sfc.getSpdHdrCopyright());
- }
- if (sfc.getSpdHdrAbs() != null) {
- jAbstractTextField.setText(sfc.getSpdHdrAbs());
- }
- if (sfc.getSpdHdrDescription() != null) {
- jDescriptionTextArea.setText(sfc.getSpdHdrDescription());
- }
- if (sfc.getSpdHdrSpec() != null) {
- jSpecificationTextField.setText(sfc.getSpdHdrSpec());
- }
- sfc.setSpdHdrSpec(jSpecificationTextField.getText());
-
- if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {
- sfc.setSpdPkgDefsRdOnly("false");
- jCheckBoxRdOnly.setSelected(false);
- } else {
- jCheckBoxRdOnly.setSelected(true);
- }
- if (!sfc.getSpdPkgDefsRePkg().equals("true")) {
- sfc.setSpdPkgDefsRePkg("false");
- jCheckBoxRePkg.setSelected(false);
- } else {
- jCheckBoxRePkg.setSelected(true);
- }
-
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, rowTwo));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, rowThree));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(2, rowFour));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(2, rowFive));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(2, rowSeven));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
- jStarLabel8.setVisible(false);
- jStarLabel9 = new StarLabel();
- jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
-
- jStarLabel9.setVisible(false);
- jPackageNameLabel = new JLabel();
- jPackageNameLabel.setText("Package Name");
- jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jGuidLabel = new JLabel();
- jGuidLabel.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jGuidLabel.setText("Guid");
- jVersionLabel = new JLabel();
- jVersionLabel.setText("Version");
- jVersionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
- jLicenseLabel = new JLabel();
- jLicenseLabel.setText("License");
- jLicenseLabel.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jUrlLabel = new JLabel();
- jUrlLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
- jUrlLabel.setText("URL");
- jAbstractLabel = new JLabel();
- jAbstractLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSeven, labelWidth, oneRowHeight));
- jAbstractLabel.setText("Abstract");
- jDescriptionLabel = new JLabel();
- jDescriptionLabel.setText("Description");
- jDescriptionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowEight, labelWidth, oneRowHeight));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setLocation(new java.awt.Point(0, 0));
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 20, dialogHeight - 20));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel9, null);
-
- jContentPane.add(jPackageNameLabel, null);
- jContentPane.add(getJPackageNameTextField(), null);
- jContentPane.add(jGuidLabel, null);
- jContentPane.add(getJGuidTextField(), null);
- jContentPane.add(jVersionLabel, null);
- jContentPane.add(getJVersionTextField(), null);
- jContentPane.add(getJGenerateGuidButton(), null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(getCopyrightScrollPane(), null);
- jContentPane.add(jLicenseLabel, null);
- jContentPane.add(getJLicenseScrollPane(), null);
- jContentPane.add(jUrlLabel, null);
- jContentPane.add(getJUrlTextField(), null);
- jContentPane.add(jAbstractLabel, null);
- jContentPane.add(getJAbstractTextField(), null);
- jContentPane.add(jDescriptionLabel, null);
- jContentPane.add(getJDescriptionScrollPane(), null);
-
-// jContentPane.add(getJButtonOk(), null);
-// jContentPane.add(getJButtonCancel(), null);
-
- jContentPane.add(getJCheckBoxRdOnly(), null);
- jContentPane.add(getJCheckBoxRePkg(), null);
- jContentPane.add(getJSpecificationTextField(), 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() == jGenerateGuidButton) {
- //ToDo: invoke GuidValueEditor
- jGuidTextField.setText(Tools.generateUuidString());
- sfc.setSpdHdrGuidValue(jGuidTextField.getText());
- }
- }
-
- /**
- This method initializes Package type and Compontent type
-
- **/
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
- jPackageNameTextField.setEditable(editable);
- jGuidTextField.setEditable(editable);
- jGenerateGuidButton.setEnabled(editable);
- jVersionTextField.setEditable(editable);
- jCopyrightTextArea.setEditable(editable);
- jLicenseTextArea.setEditable(editable);
- jUrlTextField.setEditable(editable);
- jAbstractTextField.setEditable(editable);
- jDescriptionTextArea.setEditable(editable);
- jCheckBoxRePkg.setEnabled(editable);
- }
-
- /* (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.jPackageNameTextField, intCurrentWidth, intPreferredWidth);
-// Tools.resizeComponentWidth(this.jGuidTextField, intCurrentWidth, intPreferredWidth);
-// Tools.resizeComponentWidth(this.jVersionTextField, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jUrlTextField, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jLicenseScrollPane, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jCopyrightTextArea, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jDescriptionScrollPane, intCurrentWidth, intPreferredWidth);
- // Tools.resizeComponentWidth(this.jSpecificationTextField, intCurrentWidth,intPreferredWidth);
- Tools.resizeComponentWidth(this.jAbstractTextField, intCurrentWidth, intPreferredWidth);
-// Tools.relocateComponentX(this.jGenerateGuidButton, intCurrentWidth, jGenerateGuidButton.getWidth(), 30);
- }
-
- private JScrollPane getTopScrollPane() {
- if (topScrollPane == null) {
- topScrollPane = new JScrollPane();
- topScrollPane.setViewportView(getJContentPane());
- }
- return topScrollPane;
- }
-
- /* (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/packaging/ui/SpdLibClassDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
deleted file mode 100644
index 9aac2464c9..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
+++ /dev/null
@@ -1,931 +0,0 @@
-/** @file
- Java class SpdLibClassDecls is GUI for create library definition elements of 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.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-import java.util.HashMap;
-//import java.util.Iterator;
-//import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-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.TableColumn;
-import javax.swing.table.TableModel;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-//import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-//import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-//import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdLibClassDecls extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JTextField jTextFieldAddClass = null;
-
- private JComboBox jComboBoxSelect = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonRemoveAll = null;
-
- private JLabel jLabelHdr = null;
-
- private JTextField jTextFieldHdr = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel starLabel1 = null;
-
- private StarLabel starLabel3 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JLabel jLabel1ClassName = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,53"
-
- private int selectedRow = -1;
-
- private StarLabel starLabel2 = null;
-
- private JLabel jLabel2HelpText = null;
-
- private JTextArea jTextAreaHelp = null;
-
- private JScrollPane jHelpTextScrollPane = null;
-
- private JLabel jLabel5SupArchList = null;
-
- private JLabel jLabel6SupModList = null;
-
- private JScrollPane jScrollPaneModules = null;
-
- private JScrollPane jScrollPane1Arch = null;
-
- private ICheckBoxList iCheckBoxListModules = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private int cnClassName = 0;
- private int cnHdrFile = 1;
- private int cnHelpText = 2;
-// private int cnRecInstName = 3;
-// private int cnRecInstVer = 4;
- private int cnSupArch = 5;
- private int cnSupMod = 6;
-
- private final int classNameMinWidth = 200;
- private final int hdrFileMinWidth = 300;
- private final int helpTextMinWidth = 300;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
-
- private final int shortLabel = 90;
- private final int longLabel = 220;
- private final int labelCol = 12;
- private final int shortValueCol = labelCol + shortLabel + 6;
- private final int longValueCol = labelCol + longLabel + 6;
- private final int longValueWidth = 347;
- private final int shortWidth = 140;
- private final int medWidth = 240;
-
- private final int buttonWidth = 99;
-
- private final int addButtonCol = shortValueCol + 10;
- private final int removeButtonCol = addButtonCol + buttonWidth + 10;
- private final int removeAllButtonCol = removeButtonCol + buttonWidth + 10;
-
- private final int rowOne = 12;
- private final int rowTwo = rowOne + 25;
- private final int rowThree = rowTwo + 60 + 25;
- private final int rowFour = rowThree + 25;
- private final int rowFive = rowFour + 40 + 25;
- private final int rowSix = rowFive + 40 + 25;
- private final int rowSeven = rowSix;
- private final int rowEight = rowSeven + 30;
-
- HashMap<String, String> libNameGuidMap = new HashMap<String, String>();
-
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jTextFieldAddClass
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldAddClass() {
- if (jTextFieldAddClass == null) {
- jTextFieldAddClass = new JTextField();
- jTextFieldAddClass.setBounds(new java.awt.Rectangle(shortValueCol,rowOne,longValueWidth,20));
- jTextFieldAddClass.setPreferredSize(new java.awt.Dimension(longValueWidth,20));
- jTextFieldAddClass.setEnabled(true);
- }
- return jTextFieldAddClass;
- }
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxSelect() {
- if (jComboBoxSelect == null) {
- jComboBoxSelect = new JComboBox();
- jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));
- jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,22));
- jComboBoxSelect.setEnabled(true);
- jComboBoxSelect.setVisible(false);
- }
- return jComboBoxSelect;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
-
- Used for the Table of Library Classes that are provided by this package
-
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(labelCol,rowEight,400,253));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTable.setColumnSelectionAllowed(false);
- model.addColumn("Class Name");
- model.addColumn("Header");
- model.addColumn("Help Text");
- model.addColumn("Recommended Instance");
- model.addColumn("Version");
- model.addColumn("Supported Architectures");
- model.addColumn("Supported Module Types");
-
- jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor(topFrame));
-
- jTable.removeColumn(jTable.getColumnModel().getColumn(3));
- jTable.removeColumn(jTable.getColumnModel().getColumn(3));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(cnSupArch - 2).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
-
- jTable.getColumnModel().getColumn(cnSupMod - 2).setCellEditor(new ListEditor(vModule, topFrame));
-
- TableColumn column = jTable.getColumnModel().getColumn(this.cnClassName);
- column.setMinWidth(this.classNameMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnHdrFile);
- column.setMinWidth(this.hdrFileMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnHelpText);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnSupArch - 2);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnSupMod - 2);
- column.setMinWidth(this.supModMinWidth);
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.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();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
-
- }
- return jTable;
- }
-
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- String lib = m.getValueAt(row, cnClassName) + "";
- String hdr = m.getValueAt(row, cnHdrFile) + "";
- String hlp = m.getValueAt(row, cnHelpText) + "";
- String name = null;
-// if (m.getValueAt(row, cnRecInstName) != null) {
-// name = m.getValueAt(row, cnRecInstName).toString();
-// }
-// String ver = null;
-// if (m.getValueAt(row, cnRecInstVer) != null){
-// ver = m.getValueAt(row, cnRecInstVer).toString();
-// }
- String arch = null;
- if (m.getValueAt(row, cnSupArch) != null) {
- arch = m.getValueAt(row, cnSupArch).toString();
- }
- String module = null;
- if (m.getValueAt(row, cnSupMod) != null) {
- module = m.getValueAt(row, cnSupMod).toString();
- }
- String[] rowData = {lib, hdr, hlp, name};
- if (!dataValidation(rowData)) {
- return;
- }
-
- String guid = null;
-// if (name != null && name.length() > 0) {
-// getLibInstances(lib);
-// guid = nameToGuid(name);
-// if (guid == null){
-// JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");
-// return;
-// }
-// }
-
- String[] sa = new String[7];
- sfc.getSpdLibClassDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
-// if (column == cnRecInstName) {
-// if (guid == null) {
-// if (sa[cnRecInstName] == null) {
-// return;
-// }
-// }
-// else {
-// if (guid.equals(sa[cnRecInstName])) {
-// return;
-// }
-// }
-// }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, null, arch, module);
- }
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setText("Add");
- jButtonAdd.setSize(new java.awt.Dimension(buttonWidth,20));
- jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowSeven,buttonWidth,20));
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setText("Delete");
- jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));
- jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemoveAll() {
- if (jButtonRemoveAll == null) {
- jButtonRemoveAll = new JButton();
- jButtonRemoveAll.setText("Clear All");
- jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven);
- FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont());
- jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20);
- jButtonRemoveAll.addActionListener(this);
- }
- return jButtonRemoveAll;
- }
-
- /**
- This is the default constructor
- **/
- public SpdLibClassDecls(JFrame frame) {
- super();
- topFrame = frame;
- initialize();
- init();
-
- }
-
- public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdLibClassDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
-
- this.setContentPane(getJContentPane());
- this.setTitle("Library Class Declarations");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(SpdFileContents sfc) {
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdLibClassDeclarationCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][7];
- sfc.getSpdLibClassDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
-// if (saa[i][3] != null && saa[i][3].length() > 0) {
-// getLibInstances(saa[i][0]);
-// saa[i][3] = guidToName(saa[i][3]);
-// }
-
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonRemoveAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- private JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane1() {
- if (jContentPane == null) {
- // Library Class
- starLabel1 = new StarLabel();
- starLabel1.setLocation(new java.awt.Point(1,rowOne));
- jLabel1ClassName = new JLabel();
- jLabel1ClassName.setBounds(new java.awt.Rectangle(labelCol,rowOne,shortLabel,20));
- jLabel1ClassName.setText("Library Class");
-
- // Help Text
- starLabel2 = new StarLabel();
- starLabel2.setBounds(new java.awt.Rectangle(1,rowTwo,10,20));
- jLabel2HelpText = new JLabel();
- jLabel2HelpText.setBounds(new java.awt.Rectangle(labelCol,rowTwo,shortLabel,20));
- jLabel2HelpText.setText("Help Text");
-
- // Header File
- starLabel3 = new StarLabel();
- starLabel3.setLocation(new java.awt.Point(1,rowThree));
- jLabelHdr = new JLabel();
- jLabelHdr.setBounds(new java.awt.Rectangle(labelCol,rowThree,longLabel,20));
- jLabelHdr.setText("Include Header for Specified Class");
-
- jLabel6SupModList = new JLabel();
- jLabel6SupModList.setBounds(new java.awt.Rectangle(labelCol,rowFive,longLabel,20));
- jLabel6SupModList.setText("Supported Module Types");
- jLabel6SupModList.setEnabled(true);
-
- jLabel5SupArchList = new JLabel();
- jLabel5SupArchList.setBounds(new java.awt.Rectangle(labelCol,rowFour,longLabel,20));
- jLabel5SupArchList.setText("Supported Architectures");
- jLabel5SupArchList.setEnabled(true);
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(680, 600));
- jContentPane.setLayout(null);
- jContentPane.add(jLabelHdr, null);
- jContentPane.add(starLabel1, null);
- jContentPane.add(starLabel3, null);
- jContentPane.add(getJTextFieldAddClass(), null);
- jContentPane.add(getJComboBoxSelect(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonRemoveAll(), null);
-
- jContentPane.add(getJTextFieldHdr(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(jLabel1ClassName, null);
- jContentPane.add(starLabel2, null);
- jContentPane.add(jLabel2HelpText, null);
- jContentPane.add(getJHelpTextScrollPane(), null);
-
- jContentPane.add(jLabel5SupArchList, null);
- jContentPane.add(jLabel6SupModList, null);
-
- jContentPane.add(getJScrollPaneModules(), null);
- jContentPane.add(getJScrollPane1Arch(), null);
-
- }
-
- return jContentPane;
- }
-
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonAdd) {
-
- //ToDo: check before add
- // LAH WAS String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2RecInstVer.getText(), null, null};
- String[] row = {null, null, null, null, null, null, null};
- row[cnClassName] = jTextFieldAddClass.getText();
- row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');
- row[cnHelpText] = jTextAreaHelp.getText();
-// row[cnRecInstName] = jComboBox.getSelectedItem()+"";
-// row[cnRecInstVer] = jTextField2RecInstVer.getText();
- row[cnSupArch] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (row[cnSupArch].length() == 0) {
- row[cnSupArch] = null;
- }
- row[cnSupMod] = vectorToString(iCheckBoxListModules.getAllCheckedItemsString());
- if (row[cnSupMod].length() == 0){
- row[cnSupMod] = null;
- }
- if (!dataValidation(row)) {
- return;
- }
- //
- //convert to GUID before storing recommended lib instance.
- //
-// getLibInstances(row[cnClassName]);
-// String recommendGuid = nameToGuid(row[cnRecInstName]);
-// if (row[cnRecInstName].equals("null")) {
-// row[cnRecInstName] = null;
-// }
-// else{
-// if (recommendGuid == null) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");
-// return;
-// }
-// }
-
- sfc.genSpdLibClassDeclarations(row[cnClassName], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, null, null, row[cnSupMod]);
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- docConsole.setSaved(false);
- sfc.removeSpdLibClass(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonRemoveAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- docConsole.setSaved(false);
- model.setRowCount(0);
- sfc.removeSpdLibClass();
- }
- }
-
- private boolean dataValidation(String[] row) {
- if (!DataValidation.isKeywordType(row[cnClassName])) {
- JOptionPane.showMessageDialog(this, "Library Class name entered does not match KeyWord datatype.");
- return false;
- }
- if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {
- JOptionPane.showMessageDialog(this, "Include Header does not match the PathAndFilename datatype.");
- return false;
- }
- if (row[cnHelpText].length() == 0) {
- JOptionPane.showMessageDialog(this, "Help Text must be entered!");
- return false;
- }
-// if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {
-// if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with the Instance Name.");
-// return false;
-// }
-//
-// if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance Version does not match Version datatype.");
-// return false;
-// }
-// }
- return true;
- }
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldHdr() {
- if (jTextFieldHdr == null) {
- jTextFieldHdr = new JTextField();
- jTextFieldHdr.setPreferredSize(new java.awt.Dimension(shortWidth,20));
- jTextFieldHdr.setLocation(new java.awt.Point(longValueCol,rowThree));
- jTextFieldHdr.setSize(new java.awt.Dimension(shortWidth,20));
- }
- return jTextFieldHdr;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(longValueCol + shortWidth + 7,rowThree,90,20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(99,20));
- jButtonBrowse.addActionListener(new AbstractAction() {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- //
- // Select files from current pkg
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(topFrame);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(topFrame, "You can only select files in current package directory structure!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
- jTextFieldHdr.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
-
- });
- }
- return jButtonBrowse;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldAddClass, this.getWidth(), intPreferredWidth-28);
- Tools.resizeComponentWidth(this.jHelpTextScrollPane, this.getWidth(), intPreferredWidth-28);
- Tools.resizeComponentWidth(this.jScrollPaneTable, this.getWidth(), intPreferredWidth-10);
- Tools.resizeComponentWidth(this.jTextFieldHdr, this.getWidth(), intPreferredWidth - 7);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), intPreferredWidth,
- DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- /**
- * This method initializes jHelpTextScrollPane
- *
- * @return javax.swing.JScrollPane jHelpTextScrollPane
- */
- private JScrollPane getJHelpTextScrollPane() {
- if (jHelpTextScrollPane == null) {
- jHelpTextScrollPane = new JScrollPane();
- jHelpTextScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jHelpTextScrollPane.setPreferredSize(new java.awt.Dimension(longValueWidth, 80));
- jHelpTextScrollPane.setSize(new java.awt.Dimension(longValueWidth, 80));
- jHelpTextScrollPane.setLocation(new java.awt.Point(shortValueCol,rowTwo));
- jHelpTextScrollPane.setViewportView(getJTextAreaHelp());
- }
- return jHelpTextScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaHelp() {
- if (jTextAreaHelp == null) {
- jTextAreaHelp = new JTextArea();
- jTextAreaHelp.setLineWrap(true);
- jTextAreaHelp.setWrapStyleWord(true);
- }
- return jTextAreaHelp;
- }
-
- private JScrollPane getJScrollPaneModules() {
- if (jScrollPaneModules == null) {
- jScrollPaneModules = new JScrollPane();
- jScrollPaneModules.setBounds(new java.awt.Rectangle(longValueCol,rowFive,medWidth,60));
- jScrollPaneModules.setPreferredSize(new java.awt.Dimension(medWidth, 60));
- jScrollPaneModules.setViewportView(getICheckBoxListSupportedModules());
- }
- return jScrollPaneModules;
- }
-
- private ICheckBoxList getICheckBoxListSupportedModules() {
- if (iCheckBoxListModules == null) {
- iCheckBoxListModules = new ICheckBoxList();
- iCheckBoxListModules.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListModules.setAllItems(v);
- }
- return iCheckBoxListModules;
- }
-
- private String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- private JScrollPane getJScrollPane1Arch() {
- if (jScrollPane1Arch == null) {
- jScrollPane1Arch = new JScrollPane();
- jScrollPane1Arch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- jScrollPane1Arch.setPreferredSize(new java.awt.Dimension(medWidth, 60));
- jScrollPane1Arch.setViewportView(getICheckBoxListArch());
- }
- return jScrollPane1Arch;
- }
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
-// private void getLibInstances(String libClass){
-// libNameGuidMap.clear();
-// try {
-// Iterator ismi = GlobalData.vModuleList.iterator();
-// while (ismi.hasNext()) {
-// ModuleIdentification mi = (ModuleIdentification) ismi.next();
-//
-// Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
-// for (int i = 0; i < classProduced.size(); ++i) {
-// if (classProduced.get(i).equals(libClass)) {
-// libNameGuidMap.put(mi.getName(), mi.getGuid());
-// }
-// }
-// }
-//
-// }
-// catch(Exception e){
-// JOptionPane.showMessageDialog(frame, "Search Instances Failed.");
-// }
-//
-// }
-
-// private String nameToGuid(String name) {
-// String s = null;
-// if (!libNameGuidMap.containsKey(name)) {
-// return s;
-// }
-//
-// s = libNameGuidMap.get(name);
-// return s;
-// }
-
-// private String guidToName(String guid){
-// String s = "";
-// if (!libNameGuidMap.containsValue(guid)) {
-// return s;
-// }
-// Set<String> key = libNameGuidMap.keySet();
-// Iterator<String> is = key.iterator();
-// while(is.hasNext()) {
-// s = is.next();
-// if (libNameGuidMap.get(s).equals(guid)) {
-// break;
-// }
-// }
-// return s;
-// }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java
deleted file mode 100644
index fb23e05659..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/** @file
- Java class SpdMsaFiles is GUI for create library definition elements of 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.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-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.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JScrollPane jScrollPane = null; // @jve:decl-index=0:visual-constraint="10,95"
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPaneMsa = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonOk = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextField = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel jStarLabel2 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private int selectedRow = -1;
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneMsa() {
- if (jScrollPaneMsa == null) {
- jScrollPaneMsa = new JScrollPane();
- jScrollPaneMsa.setBounds(new java.awt.Rectangle(13,177,461,421));
- jScrollPaneMsa.setViewportView(getJTable());
- }
- return jScrollPaneMsa;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- model.addColumn("MsaFile");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.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();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(163,148,90,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(266,148,90,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(374,148,90,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButton
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setSize(new java.awt.Dimension(90, 20));
- jButtonOk.setText("OK");
- jButtonOk.setLocation(new java.awt.Point(290, 305));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This is the default constructor
- **/
- public SpdMsaFiles(JFrame frame) {
- super();
- initialize();
- init();
- topFrame = frame;
- }
-
- public SpdMsaFiles(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdMsaFiles(OpeningPackageType opt, JFrame frame){
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setPreferredSize(new Dimension(490, 400));
- this.setContentPane(getJScrollPane());
- this.setTitle("Msa Files");
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- this.setVisible(true);
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdMsaFileCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- String[][] saa = new String[sfc.getSpdMsaFileCount()][4];
- sfc.getSpdMsaFiles(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private JScrollPane getJScrollPane(){
- if (jScrollPane == null){
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2,24));
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(17,24,111,22));
- jLabel.setText("Msa File ");
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(480, 325));
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJScrollPaneMsa(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonOk(), null);
-
- jContentPane.add(getJTextField(), null);
- jContentPane.add(getJButtonBrowse(), null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
-
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
- //ToDo: check before add
- String[] row = {jTextField.getText().replace('\\', '/')};
- if (jTextField.getText().length() == 0) {
- JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
- return;
- }
-
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- if (!new File(dirPrefix + File.separator + jTextField.getText()).exists()) {
- JOptionPane.showMessageDialog(this, "File NOT Exists in Current Package.");
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- sfc.genSpdMsaFiles(row[0], null, null, null);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdMsaFile(rowSelected);
- docConsole.setSaved(false);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdMsaFile();
- docConsole.setSaved(false);
- }
-
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[1];
- sfc.getSpdMsaFile(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- String file = m.getValueAt(row, 0) + "";
- if (file.length() == 0) {
- JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdMsaFile(row, file, null, null, null);
- }
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(14,51,346,21));
- jTextField.setPreferredSize(new java.awt.Dimension(345,20));
- }
- return jTextField;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(376,50,92,21));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(90,20));
- jButtonBrowse.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(SpdMsaFiles.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(SpdMsaFiles.this, "You can only select files in current package!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
-
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
- });
- }
- return jButtonBrowse;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jScrollPaneMsa, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 25);
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java
deleted file mode 100644
index 1c1d13a245..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java
+++ /dev/null
@@ -1,579 +0,0 @@
-/** @file
- Java class SpdPackageHeaders is GUI for create library definition elements of 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.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-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.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdPackageHeaders extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelSelect = null;
-
- private JComboBox jComboBoxSelect = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextField = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPanePkgHdr = null;
-
- private int selectedRow = -1;
-
- private JTable jTable = null;
-
- private final int buttonWidth = 100;
- private final int buttonSep = 6;
- private final int addButtonCol = 148;
- private final int removeButtonCol = addButtonCol + buttonWidth + buttonSep;
- private final int removeAllButtonCol = removeButtonCol + buttonWidth + buttonSep;
- private final int labelCol = 12;
- private final int valueCol = 168;
- private final int rowOne = 12;
- private final int rowTwo = rowOne + 25;
- private final int rowThree = rowTwo + 25;
- private final int rowFour = rowThree + 30;
- private final int rowFive = rowFour + 30;
-
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jLabelSelect
-
- @return javax.swing.JLabel jLabelSelect
- **/
- private JLabel getJLabelSelect() {
- if (jLabelSelect == null) {
- jLabelSelect = new JLabel();
- jLabelSelect.setBounds(new java.awt.Rectangle(labelCol,rowOne,155,20));
- jLabelSelect.setText("Select ModuleType");
-
- }
- return jLabelSelect;
- }
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxSelect() {
- if (jComboBoxSelect == null) {
- jComboBoxSelect = new JComboBox();
- jComboBoxSelect.setBounds(new java.awt.Rectangle(valueCol, rowOne, 260, 20));
- jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,20));
-
- jComboBoxSelect.setEnabled(true);
- }
- return jComboBoxSelect;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- *
- private JTable getJTable() {
- if (jTable == null) {
- model = new PackageHeaderTableModel();
- model.addColumn("ModuleType");
- model.addColumn("IncludeHeader");
-
-
- }
- return jTable;
- }*/
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowFour,buttonWidth,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowFour,buttonWidth,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(removeAllButtonCol,rowFour,buttonWidth,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This is the default constructor
- **/
- public SpdPackageHeaders(JFrame frame) {
- super();
- initialize();
- init();
- topFrame = frame;
- }
-
- public SpdPackageHeaders(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPackageHeaders(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
-
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Headers");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdPackageHeaderCount() == 0) {
- return ;
- }
- String[][] saa = new String[sfc.getSpdPackageHeaderCount()][2];
- sfc.getSpdPackageHeaders(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private JScrollPane getJScrollPane(){
- if (jScrollPane == null){
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0,rowTwo));
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(labelCol,rowTwo,320,22));
- jLabel.setText("Include Header for Module Type");
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(480, 325));
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJLabelSelect(), null);
- jContentPane.add(getJComboBoxSelect(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
-
- jContentPane.add(getJTextField(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(getJScrollPanePkgHdr(), null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- private void initFrame() {
- jComboBoxSelect.addItem("BASE");
- jComboBoxSelect.addItem("SEC");
- jComboBoxSelect.addItem("PEI_CORE");
- jComboBoxSelect.addItem("PEIM");
- jComboBoxSelect.addItem("DXE_CORE");
- jComboBoxSelect.addItem("DXE_DRIVER");
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");
- jComboBoxSelect.addItem("TOOL");
- jComboBoxSelect.addItem("UEFI_DRIVER");
- jComboBoxSelect.addItem("UEFI_APPLICATION");
- jComboBoxSelect.addItem("USER_DEFINED");
- jComboBoxSelect.setSelectedIndex(0);
-
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- docConsole.setSaved(false);
-
- if (arg0.getSource() == jButtonAdd) {
- String strLibClass = "";
-
- strLibClass = jComboBoxSelect.getSelectedItem().toString();
- //ToDo: check before add
- String[] row = {"", ""};
- row[0] = strLibClass;
- row[1] = jTextField.getText().replace('\\', '/');
- if (!dataValidation(row)) {
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- sfc.genSpdModuleHeaders(row[0], row[1], null, null, null, null, null, null);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdPkgHeader(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdPkgHeader();
- }
-
- }
-
- private boolean dataValidation(String[] row) {
- if (!DataValidation.isPathAndFilename(row[1])) {
- JOptionPane.showMessageDialog(this, "Include header path is NOT PathAndFilename type.");
- return false;
- }
-
- return true;
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(labelCol,rowThree,346,20));
- jTextField.setPreferredSize(new java.awt.Dimension(345,20));
- }
- return jTextField;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(374,rowThree,buttonWidth,20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth,20));
- jButtonBrowse.addActionListener(new javax.swing.AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(SpdPackageHeaders.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(SpdPackageHeaders.this, "You can only select files in current package!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
-
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
- });
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePkgHdr() {
- if (jScrollPanePkgHdr == null) {
- jScrollPanePkgHdr = new JScrollPane();
- jScrollPanePkgHdr.setBounds(new java.awt.Rectangle(labelCol,rowFive,453,258));
- jScrollPanePkgHdr.setViewportView(getJTable());
- }
- return jScrollPanePkgHdr;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- model.addColumn("ModuleType");
- model.addColumn("IncludeHeader");
- TableColumn typeColumn = jTable.getColumnModel().getColumn(0);
- JComboBox jComboBoxSelect = new JComboBox();
- jComboBoxSelect.addItem("BASE");
- jComboBoxSelect.addItem("SEC");
- jComboBoxSelect.addItem("PEI_CORE");
- jComboBoxSelect.addItem("PEIM");
- jComboBoxSelect.addItem("DXE_CORE");
- jComboBoxSelect.addItem("DXE_DRIVER");
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");
- jComboBoxSelect.addItem("TOOL");
- jComboBoxSelect.addItem("UEFI_DRIVER");
- jComboBoxSelect.addItem("UEFI_APPLICATION");
- jComboBoxSelect.addItem("USER_DEFINED");
- typeColumn.setCellEditor(new DefaultCellEditor(jComboBoxSelect));
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.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();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[2];
- sfc.getSpdModuleHeader(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- String pkg = m.getValueAt(row, 0) + "";
- String hdr = m.getValueAt(row, 1) + "";
- String[] rowData = {pkg, hdr};
- if (!dataValidation(rowData)) {
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPkgHdr(row, pkg, hdr);
- }
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- // Tools.resizeComponentWidth(this.jComboBoxSelect, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPanePkgHdr, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 30);
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java
deleted file mode 100644
index 3886843072..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java
+++ /dev/null
@@ -1,1242 +0,0 @@
-/** @file
- Java class SpdPcdDefs is GUI for create PCD definition elements of 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.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-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.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JCheckBox;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-
-import java.awt.Rectangle;
-import java.util.Vector;
-
-/**
- GUI for create PCD definition elements of spd file
-
- @since PackageEditor 1.0
-**/
-public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelItemType = null;
-
- private JLabel jLabelC_Name = null;
-
- private JTextField jTextFieldC_Name = null;
-
- private JLabel jLabelToken = null;
-
- private JTextField jTextFieldToken = null;
-
- private JLabel jLabelDataType = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JComboBox jComboBoxDataType = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelTokenSpace = null;
-
- private JComboBox jComboBoxTsGuid = null;
-
- private JLabel jLabelVarVal = null;
-
- private JTextField jTextFieldHelp = null;
-
- private JLabel jLabelDefVal = null;
-
- private JTextField jTextFieldDefaultValue = null;
-
- private JButton jButtonAdd = null;
-
- private CheckboxTableModel model = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTable = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="390,10"
-
- private int selectedRow = -1;
-
- private StarLabel starLabel = null;
-
- private JCheckBox jCheckBoxFeatureFlag = null;
-
- private JCheckBox jCheckBoxFixedAtBuild = null;
-
- private JCheckBox jCheckBoxPatchInMod = null;
-
- private JCheckBox jCheckBoxDyn = null;
-
- private JCheckBox jCheckBoxDynEx = null;
-
- private JScrollPane jScrollPaneArch = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private JScrollPane jScrollPaneMod = null;
-
- private ICheckBoxList iCheckBoxListMod = null;
-
- private JLabel jLabelSupMod = null;
-
- private JLabel jLabelSupArch = null;
-
- private final int pcdCNameMinWidth = 200;
- private final int pcdTokenMinWidth = 100;
- private final int pcdTokenSpaceMinWidth = 200;
- private final int datumTypeMinWidth = 80;
- private final int defaultValueMinWidth = 100;
- private final int helpTextMinWidth = 200;
- private final int usageMinWidth = 60;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
-
-// private Object boolModifyLock = new Object();
-// private boolean exclusiveUsage = false;
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
- this.setTitle("PCD Declarations");
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- int xPos = jCheckBoxPatchInMod.getX() + jCheckBoxPatchInMod.getWidth();
- jCheckBoxFixedAtBuild.setLocation(xPos,133);
-
- xPos = jCheckBoxFeatureFlag.getX() + jCheckBoxFeatureFlag.getWidth();
- jCheckBoxDyn.setLocation(xPos,161);
-
- xPos = jCheckBoxDyn.getX() + jCheckBoxDyn.getWidth();
- jCheckBoxDynEx.setLocation(xPos,161);
-
- }
-
- /**
- This method initializes jTextFieldC_Name
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldC_Name() {
- if (jTextFieldC_Name == null) {
- jTextFieldC_Name = new JTextField();
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(156,9,317,20));
- jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldC_Name;
- }
-
- /**
- This method initializes jTextFieldToken
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldToken() {
- if (jTextFieldToken == null) {
- jTextFieldToken = new JTextField();
- jTextFieldToken.setBounds(new java.awt.Rectangle(156,33,317,20));
- jTextFieldToken.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldToken;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setBounds(new java.awt.Rectangle(279,276,90,20));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(389,276,82,20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jComboBoxDataType
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxDataType() {
- if (jComboBoxDataType == null) {
- jComboBoxDataType = new JComboBox();
- jComboBoxDataType.setBounds(new java.awt.Rectangle(156,84,110,20));
- }
- return jComboBoxDataType;
- }
-
- /**
- This is the default constructor
- **/
- public SpdPcdDefs(JFrame frame) {
- super();
- init();
- initialize();
- topFrame = frame;
- }
-
- public SpdPcdDefs(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPcdDefs(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
- this.setSize(500, 650);
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
-
- this.setVisible(true);
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdPcdDefinitionCount() == 0) {
- return ;
- }
- String[][] saa = new String[sfc.getSpdPcdDefinitionCount()][8];
- String[][] usage = new String[sfc.getSpdPcdDefinitionCount()][5];
- Object[] rowData = new Object[13];
- sfc.getSpdPcdDefinitions(saa, usage);
- int i = 0;
- while (i < saa.length) {
-
- for (int k = 0; k < 6; ++k) {
- rowData[k] = saa[i][k];
- }
- for (int m = 6; m < 11; ++m) {
- rowData[m] = new Boolean("false");
- }
- int j = 0;
- while (j < 5) {
- if (usage[i][j] == null || usage[i][j].length()==0){
- ++j;
- continue;
- }
- if (usage[i][j].equals("FEATURE_FLAG")){
- rowData[6] = new Boolean("true");
- }
- if (usage[i][j].equals("FIXED_AT_BUILD")){
- rowData[7] = new Boolean("true");
- }
- if (usage[i][j].equals("PATCHABLE_IN_MODULE")){
- rowData[8] = new Boolean("true");
- }
- if (usage[i][j].equals("DYNAMIC")){
- rowData[9] = new Boolean("true");
- }
- if (usage[i][j].equals("DYNAMIC_EX")){
- rowData[10] = new Boolean("true");
- }
-
- ++j;
- }
-
- rowData[11] = saa[i][6];
- rowData[12] = saa[i][7];
-
- model.addRow(rowData);
-
- i++;
- }
-
- }
-
- private JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(482,451));
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
- private JPanel getJContentPane1() {
- if (jContentPane == null) {
-
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(241,192,89,16));
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setEnabled(true);
- FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont());
- jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20);
- jLabelSupMod = new JLabel();
- jLabelSupMod.setBounds(new java.awt.Rectangle(15,193,103,16));
- jLabelSupMod.setText("Supported Module types");
- jLabelSupMod.setEnabled(true);
- fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont());
- jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20);
- starLabel = new StarLabel();
- starLabel.setBounds(new java.awt.Rectangle(2,134,10,20));
- jLabelDefVal = new JLabel();
- jLabelDefVal.setBounds(new java.awt.Rectangle(277,84,80,20));
- jLabelDefVal.setText("Default Value");
- fm = jLabelDefVal.getFontMetrics(jLabelDefVal.getFont());
- jLabelDefVal.setSize(fm.stringWidth(jLabelDefVal.getText()) + 10, 20);
- jLabelVarVal = new JLabel();
- jLabelVarVal.setBounds(new java.awt.Rectangle(11,133,100,20));
- jLabelVarVal.setText("Valid Usage");
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(11,9,140,20));
- jLabelTokenSpace = new JLabel();
- jLabelTokenSpace.setBounds(new java.awt.Rectangle(11,58,140,20));
- jLabelTokenSpace.setText("Token Space");
- jLabelDataType = new JLabel();
- jLabelDataType.setText("Data Type");
- jLabelDataType.setBounds(new java.awt.Rectangle(11,83,140,20));
- jLabelToken = new JLabel();
- jLabelToken.setText("Token Number");
- jLabelToken.setBounds(new java.awt.Rectangle(11,33,140,20));
- jLabelItemType = new JLabel();
- jLabelItemType.setText("Help Text");
- jLabelItemType.setBounds(new java.awt.Rectangle(11,108,140,20));
-
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(479,375));
-
- jContentPane.add(jLabelItemType, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(jLabelTokenSpace, null);
- jContentPane.add(getJComboBoxTsGuid(), null);
- jContentPane.add(jLabelVarVal, null);
- jContentPane.add(getJTextFieldC_Name(), null);
- jContentPane.add(jLabelToken, null);
- jContentPane.add(getJTextFieldToken(), null);
- jContentPane.add(jLabelDataType, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJComboBoxDataType(), null);
-
- jStarLabel = new StarLabel();
- jStarLabel1 = new StarLabel();
- jStarLabel1.setBounds(new java.awt.Rectangle(2,8,10,20));
- jStarLabel2 = new StarLabel();
- jStarLabel3 = new StarLabel();
- jStarLabel4 = new StarLabel();
- jStarLabel.setLocation(new java.awt.Point(2,84));
- jStarLabel4.setLocation(new java.awt.Point(2, 109));
- jStarLabel2.setLocation(new java.awt.Point(2,33));
- jStarLabel3.setLocation(new java.awt.Point(2, 58));
- jStarLabel3.setSize(new java.awt.Dimension(8,20));
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel, null);
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(getJTextFieldHelp(), null);
- jContentPane.add(jLabelDefVal, null);
- jContentPane.add(getJTextFieldDefaultValue(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(starLabel, null);
- jContentPane.add(getJCheckBoxFeatureFlag(), null);
- jContentPane.add(getJCheckBoxFixedAtBuild(), null);
- jContentPane.add(getJCheckBoxPatchInMod(), null);
- jContentPane.add(getJCheckBoxDyn(), null);
- jContentPane.add(getJCheckBoxDynEx(), null);
- jContentPane.add(getJScrollPaneArch(), null);
- jContentPane.add(getJScrollPaneMod(), null);
- jContentPane.add(jLabelSupMod, null);
- jContentPane.add(jLabelSupArch, null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes comboboxes
- jContentPane.add(jLabelTokenSpace, null);
-
- **/
- private void initFrame() {
-
- jComboBoxDataType.addItem("UINT8");
- jComboBoxDataType.addItem("UINT16");
- jComboBoxDataType.addItem("UINT32");
- jComboBoxDataType.addItem("UINT64");
- jComboBoxDataType.addItem("VOID*");
- jComboBoxDataType.addItem("BOOLEAN");
- jComboBoxDataType.setSelectedIndex(0);
-
- Vector<String> vGuidCName = new Vector<String>();
- sfc.getSpdGuidDeclWithType(vGuidCName, "TOKEN_SPACE_GUID");
- for (int i = 0; i < vGuidCName.size(); ++i) {
- jComboBoxTsGuid.addItem(vGuidCName.get(i));
- }
-
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- public void actionPerformed(ActionEvent arg0) {
-
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
- //ToDo: check before add
-
- boolean[] b = {jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(), jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected()};
- if (!checkValidUsage(b)) {
- return;
- }
- String archList = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (archList.length() == 0) {
- archList = null;
- }
- String modTypeList = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
- if (modTypeList.length() == 0) {
- modTypeList = null;
- }
- Object[] row = {jTextFieldC_Name.getText(), jTextFieldToken.getText(),
- jComboBoxTsGuid.getSelectedItem(), jComboBoxDataType.getSelectedItem(),
- jTextFieldDefaultValue.getText(), jTextFieldHelp.getText(),
- jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(),
- jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected(),
- archList, modTypeList};
- try {
- if (!dataValidation(row)) {
- return;
- }
-
- if (tokenCNameExisted(jTextFieldToken.getText(), jTextFieldC_Name.getText())) {
- return;
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this, "Illegal Token:"+ e.getCause());
- return;
- }
-
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- String usage = getValidUsage(jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(), jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected());
- if (usage.length() == 0) {
- usage = null;
- }
- sfc.genSpdPcdDefinitions(row[0]+"", row[1]+"", row[3]+"", usage, row[2]+"", row[4]+"", row[5]+"", archList, modTypeList);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdPcdDefinition(rowSelected);
- docConsole.setSaved(false);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdPcdDefinition();
- docConsole.setSaved(false);
- }
-
- }
-
- protected void save() {
-
- }
-
- /**
- * This method initializes jComboBoxTsGuid
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxTsGuid() {
- if (jComboBoxTsGuid == null) {
- jComboBoxTsGuid = new JComboBox();
- jComboBoxTsGuid.setBounds(new java.awt.Rectangle(156,58,315,20));
-
- }
- return jComboBoxTsGuid;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHelp() {
- if (jTextFieldHelp == null) {
- jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(156,108,317,20));
- jTextFieldHelp.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldHelp;
- }
-
- /**
- * This method initializes jTextFieldDefaultValue
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- int xPos = jLabelDefVal.getX() + jLabelDefVal.getWidth();
- jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(xPos,84,105,20));
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(104,20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jButtonAdd
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(195,277,71,20));
- jButtonAdd.setPreferredSize(new java.awt.Dimension(70,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
-
- }
-
- /**
- * This method initializes jButtonRemove
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(278,277,81,20));
- jButtonRemove.setPreferredSize(new java.awt.Dimension(70,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonClearAll
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(382,277,90,20));
- jButtonClearAll.setPreferredSize(new java.awt.Dimension(81,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldC_Name, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldToken, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxTsGuid, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
-
- Tools.resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
-// relocateComponentX(this.jButtonClearAll, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
-// relocateComponentX(this.jButtonRemove, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
-// relocateComponentX(this.jButtonAdd, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5,301,1473,259));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- model = new CheckboxTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- jTable.setSize(new Dimension(1000, 300));
-
- model.addColumn("C_Name");
- model.addColumn("Token");
- model.addColumn("TokenSpace");
- model.addColumn("DatumType");
- model.addColumn("DefaultValue");
- model.addColumn("HelpText");
-
- model.addColumn("FeatureFlag");
- model.addColumn("FixedAtBuild");
- model.addColumn("PatchableInModule");
- model.addColumn("Dynamic");
- model.addColumn("DynamicEx");
- model.addColumn("SupportedArch");
- model.addColumn("SupportedModule");
-
- TableColumn column = jTable.getColumnModel().getColumn(0);
- column.setMinWidth(this.pcdCNameMinWidth);
- column = jTable.getColumnModel().getColumn(1);
- column.setMinWidth(this.pcdTokenMinWidth);
- column = jTable.getColumnModel().getColumn(2);
- column.setMinWidth(this.pcdTokenSpaceMinWidth);
- column = jTable.getColumnModel().getColumn(3);
- column.setMinWidth(this.datumTypeMinWidth);
- column = jTable.getColumnModel().getColumn(4);
- column.setMinWidth(this.defaultValueMinWidth);
- column = jTable.getColumnModel().getColumn(5);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(6);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(7);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(8);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(9);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(10);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(11);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(12);
- column.setMinWidth(this.supModMinWidth);
-
- //ToDo: add a valid usage editor
-
- JComboBox jComboBoxDataType = new JComboBox();
- jComboBoxDataType.addItem("UINT8");
- jComboBoxDataType.addItem("UINT16");
- jComboBoxDataType.addItem("UINT32");
- jComboBoxDataType.addItem("UINT64");
- jComboBoxDataType.addItem("VOID*");
- jComboBoxDataType.addItem("BOOLEAN");
- TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3);
- dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType));
-
- jTable.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(topFrame));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(11).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
- jTable.getColumnModel().getColumn(12).setCellEditor(new ListEditor(vModule, topFrame));
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.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();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[9];
- sfc.getSpdPcdDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (column < 6) {
-
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- }
-
- String usage = getValidUsage(new Boolean(m.getValueAt(row, 6)+""), new Boolean(m.getValueAt(row, 7)+""), new Boolean(m.getValueAt(row, 8)+""), new Boolean(m.getValueAt(row, 9)+""), new Boolean(m.getValueAt(row, 10)+""));
- if (usage.length() == 0) {
- JOptionPane.showMessageDialog(this, "You must choose at least one usage for PCD entry.");
- return;
- }
-
- if (column <= 10 && column >= 6) {
- Vector<String> v = stringToVector(usage);
- if (compareTwoVectors(v, stringToVector(sa[6]))) {
- return;
- }
- if (v.contains("FEATURE_FLAG")/* && v.size() > 1 && !exclusiveUsage*/) {
- if (v.size() > 1) {
- JOptionPane.showMessageDialog(this, "Usage Feature Flag can NOT co-exist with others.");
- return;
- }
-// synchronized (boolModifyLock){
-// exclusiveUsage = true;
-// }
-// m.setValueAt(false, row, 7);
-// m.setValueAt(false, row, 8);
-// m.setValueAt(false, row, 9);
-// m.setValueAt(false, row, 10);
- else {
- m.setValueAt("BOOLEAN", row, 3);
- }
-
- }
- }
-
- if (column == 11) {
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[7])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[7] == null) {
- return;
- }
- }
-
- if (column == 12) {
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[8])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[8] == null) {
- return;
- }
- }
- String cName = m.getValueAt(row, 0) + "";
- String token = m.getValueAt(row, 1) + "";
- String ts = m.getValueAt(row, 2) + "";
- String dataType = m.getValueAt(row, 3) + "";
- String defaultVal = m.getValueAt(row, 4) + "";
- String help = m.getValueAt(row, 5) + "";
-
-
- String archList = null;
- if (m.getValueAt(row, 11) != null){
- archList = m.getValueAt(row, 11).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 12) != null) {
- modTypeList = m.getValueAt(row, 12).toString();
- }
-
- Object[] o = {cName, token, ts, dataType, defaultVal, help};
- try {
- if (!dataValidation(o)){
- return;
- }
- }
- catch (Exception e) {
- JOptionPane.showMessageDialog(this, "Illegal Token:" + e.getCause());
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPcdDefinition(row, cName, token, dataType, usage, ts, defaultVal, help, archList, modTypeList);
- }
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFeatureFlag() {
- if (jCheckBoxFeatureFlag == null) {
- jCheckBoxFeatureFlag = new JCheckBox();
- jCheckBoxFeatureFlag.setBounds(new java.awt.Rectangle(156,161,100,21));
- jCheckBoxFeatureFlag.setText("Feature Flag");
- FontMetrics fm = jCheckBoxFeatureFlag.getFontMetrics(jCheckBoxFeatureFlag.getFont());
- jCheckBoxFeatureFlag.setSize(fm.stringWidth(jCheckBoxFeatureFlag.getText()) + 30, 20);
- jCheckBoxFeatureFlag.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxFeatureFlag.isSelected()) {
- jCheckBoxPatchInMod.setSelected(false);
- jCheckBoxFixedAtBuild.setSelected(false);
- jCheckBoxDyn.setSelected(false);
- jCheckBoxDynEx.setSelected(false);
- jComboBoxDataType.setSelectedItem("BOOLEAN");
- }
- }
- });
- }
- return jCheckBoxFeatureFlag;
- }
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFixedAtBuild() {
- if (jCheckBoxFixedAtBuild == null) {
- jCheckBoxFixedAtBuild = new JCheckBox();
-
- jCheckBoxFixedAtBuild.setText("Fixed at Build");
- FontMetrics fm = jCheckBoxFixedAtBuild.getFontMetrics(jCheckBoxFixedAtBuild.getFont());
- jCheckBoxFixedAtBuild.setSize(fm.stringWidth(jCheckBoxFixedAtBuild.getText()) + 30, 20);
- jCheckBoxFixedAtBuild.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxFixedAtBuild.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxFixedAtBuild;
- }
-
- /**
- * This method initializes jCheckBox2
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPatchInMod() {
- if (jCheckBoxPatchInMod == null) {
- jCheckBoxPatchInMod = new JCheckBox();
-
- jCheckBoxPatchInMod.setBounds(new java.awt.Rectangle(156,133,154,20));
- jCheckBoxPatchInMod.setText("Patchable in Module");
- FontMetrics fm = jCheckBoxPatchInMod.getFontMetrics(jCheckBoxPatchInMod.getFont());
- jCheckBoxPatchInMod.setSize(fm.stringWidth(jCheckBoxPatchInMod.getText()) + 30, 20);
- jCheckBoxPatchInMod.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxPatchInMod.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxPatchInMod;
- }
-
- /**
- * This method initializes jCheckBox3
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxDyn() {
- if (jCheckBoxDyn == null) {
- jCheckBoxDyn = new JCheckBox();
-
- jCheckBoxDyn.setText("Dynamic");
- FontMetrics fm = jCheckBoxDyn.getFontMetrics(jCheckBoxDyn.getFont());
- jCheckBoxDyn.setSize(fm.stringWidth(jCheckBoxDyn.getText()) + 30, 20);
- jCheckBoxDyn.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxDyn.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxDyn;
- }
-
- /**
- * This method initializes jCheckBox4
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxDynEx() {
- if (jCheckBoxDynEx == null) {
- jCheckBoxDynEx = new JCheckBox();
-
- jCheckBoxDynEx.setText("DynamicEx");
- FontMetrics fm = jCheckBoxDynEx.getFontMetrics(jCheckBoxDynEx.getFont());
- jCheckBoxDynEx.setSize(fm.stringWidth(jCheckBoxDynEx.getText()) + 30, 20);
- jCheckBoxDynEx.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxDynEx.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxDynEx;
- }
-
- private String getValidUsage(boolean ff, boolean fab, boolean pim, boolean d, boolean de) {
- String usage = "";
- if (ff){
- usage += "FEATURE_FLAG ";
- }
- if (fab){
- usage += "FIXED_AT_BUILD ";
- }
- if (pim){
- usage += "PATCHABLE_IN_MODULE ";
- }
- if (d){
- usage += "DYNAMIC ";
- }
- if (de){
- usage += "DYNAMIC_EX ";
- }
-
- return usage.trim();
- }
-
- private boolean tokenCNameExisted(String token, String cName) throws Exception{
- Long inputToken = Long.decode(token);
-
- for (int i = 0; i < model.getRowCount(); ++i) {
- if (model.getValueAt(i, 0).equals(cName)) {
- JOptionPane.showMessageDialog(this, "C_Name already existed in table.");
- return true;
- }
- if (model.getValueAt(i, 1).equals(token)) {
- JOptionPane.showMessageDialog(this, "Token already existed in table.");
- return true;
- }
- Long tokenValue = Long.decode(model.getValueAt(i, 1)+"");
- if (tokenValue.equals(inputToken)) {
- JOptionPane.showMessageDialog(this, "Same token value already existed in table.");
- return true;
- }
-
- }
- return false;
- }
-
- private boolean checkValidUsage(boolean[] b) {
- if (!(b[0] || b[1] || b[2] || b[3] || b[4])){
- JOptionPane.showMessageDialog(this, "You must specify at least one usage.");
- return false;
- }
- return true;
- }
- private boolean dataValidation(Object[] row) throws Exception{
-
- if (!DataValidation.isC_NameType(row[0].toString())) {
- JOptionPane.showMessageDialog(this, "C_Name is NOT C_NameType.");
- return false;
- }
- if (!DataValidation.isHexDoubleWordDataType(row[1].toString()) &&
- !DataValidation.isLongInt(row[1].toString(), 1, Long.MAX_VALUE)) {
- JOptionPane.showMessageDialog(this, "Token is NOT correct.");
- return false;
- }
- if (!DataValidation.isC_NameType(row[2].toString())) {
- JOptionPane.showMessageDialog(this, "Token Space is NOT C_NameType");
- return false;
- }
- if (row[5].toString().length() == 0) {
- JOptionPane.showMessageDialog(this, "HelpText could NOT be empty.");
- return false;
- }
- return true;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneArch() {
- if (jScrollPaneArch == null) {
- jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(242,213,188,54));
- jScrollPaneArch.setViewportView(getICheckBoxListArch());
- jScrollPaneArch.setPreferredSize(new Dimension(188, 74));
- }
- return jScrollPaneArch;
- }
-
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new Rectangle(197, 142, 188, 74));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneMod() {
- if (jScrollPaneMod == null) {
- jScrollPaneMod = new JScrollPane();
- jScrollPaneMod.setBounds(new java.awt.Rectangle(15,213,199,55));
- jScrollPaneMod.setViewportView(getICheckBoxListMod());
- jScrollPaneMod.setPreferredSize(new Dimension(170, 74));
- }
- return jScrollPaneMod;
- }
-
- /**
- * This method initializes iCheckBoxList1
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListMod() {
- if (iCheckBoxListMod == null) {
- iCheckBoxListMod = new ICheckBoxList();
- iCheckBoxListMod.setBounds(new Rectangle(14, 142, 170, 74));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListMod.setAllItems(v);
- }
- return iCheckBoxListMod;
- }
-
- protected String vectorToString(Vector<String> v) {
- if (v == null) {
- return null;
- }
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s){
- Vector<String> v = new Vector<String>();
- if (s == null) {
- return v;
- }
- String[] sArray = s.split(" ");
-
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- private boolean compareTwoVectors(Vector v1, Vector v2) {
- if (v1.size() != v2.size()) {
- return false;
- }
- for (int i = 0; i < v1.size(); ++i) {
- if (!v2.contains(v1.get(i))) {
- return false;
- }
- }
- return true;
- }
-} // @jve:decl-index=0:visual-constraint="22,11"
-
-class CheckboxTableModel 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;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java
deleted file mode 100644
index e0b96319a7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/** @file
- Java class SpdProtocolDecls is GUI for create library definition elements of 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.packaging.ui;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-
-/**
-GUI for create library definition elements of spd file.
-
-@since PackageEditor 1.0
-**/
-public class SpdPpiDecls extends SpdGuidDecls {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private SpdFileContents sfc = null;
- private OpeningPackageType docConsole = null;
-// private JFrame topFrame = null;
-
- public SpdPpiDecls(JFrame frame) {
- super(frame);
- // TODO Auto-generated constructor stub
- }
-
- public SpdPpiDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPpiDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
-
- protected void initFrame() {
- super.initFrame();
- this.setTitle("PPI Declarations");
- starLabel.setVisible(false);
- ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
- }
-
- protected void init(SpdFileContents sfc){
- //
- // initialize table using SpdFileContents object
- //
- DefaultTableModel model = getModel();
- if (sfc.getSpdPpiDeclarationCount() == 0) {
- return ;
- }
- saa = new String[sfc.getSpdPpiDeclarationCount()][7];
- sfc.getSpdPpiDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdPpiDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null) {
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null) {
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPpiDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
-
- protected int addRow(String[] row) {
-
- if (!dataValidation(row)){
- return -1;
- }
- docConsole.setSaved(false);
- sfc.genSpdPpiDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]), stringToVector(row[6]));
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdPpiDeclaration(i);
- docConsole.setSaved(false);
- }
-
- protected void clearAllRow(){
- sfc.removeSpdPpiDeclaration();
- docConsole.setSaved(false);
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java
deleted file mode 100644
index 1c4c0cf269..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/** @file
- Java class SpdProtocolDecls is GUI for create library definition elements of 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.packaging.ui;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-
-/**
-GUI for create library definition elements of spd file.
-
-@since PackageEditor 1.0
-**/
-public class SpdProtocolDecls extends SpdGuidDecls {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private SpdFileContents sfc = null;
- private OpeningPackageType docConsole = null;
-
- public SpdProtocolDecls(JFrame frame) {
- super(frame);
- // TODO Auto-generated constructor stub
- }
-
- public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdProtocolDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
-
- protected void initFrame() {
- super.initFrame();
- this.setTitle("Protocol Declarations");
- starLabel.setVisible(false);
- ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
- }
-
- protected void init(SpdFileContents sfc){
- //
- // initialize table using SpdFileContents object
- //
- DefaultTableModel model = getModel();
- if (sfc.getSpdProtocolDeclarationCount() == 0) {
- return ;
- }
- saa = new String[sfc.getSpdProtocolDeclarationCount()][7];
- sfc.getSpdProtocolDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdProtocolDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null) {
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null) {
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdProtocolDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
-
- protected int addRow(String[] row) {
- if (!dataValidation(row)){
- return -1;
- }
- docConsole.setSaved(false);
- sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]), stringToVector(row[6]));
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdProtocolDeclaration(i);
- docConsole.setSaved(false);
- }
-
- protected void clearAllRow(){
- sfc.removeSpdProtocolDeclaration();
- docConsole.setSaved(false);
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}