summaryrefslogtreecommitdiff
path: root/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module
diff options
context:
space:
mode:
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-30 09:59:54 +0000
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-30 09:59:54 +0000
commita13899c5acad2f5e125abdae972b4c3d1e522f69 (patch)
tree783c4808ecc1baf15d679bc84450b77a23af4bd2 /Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module
parent30817eb4e418ea36a7245fddb2efdeab9526f455 (diff)
downloadedk2-platforms-a13899c5acad2f5e125abdae972b4c3d1e522f69.tar.xz
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@671 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module')
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesIdentification.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsIdentification.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsIdentification.java100
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsIdentification.java78
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsIdentification.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesIdentification.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsIdentification.java100
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassIdentification.java124
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassVector.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/ModuleIdentification.java69
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesIdentification.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedIdentification.java111
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisIdentification.java100
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsIdentification.java100
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesIdentification.java97
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesVector.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesIdentification.java89
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesIdentification.java100
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesVector.java90
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java759
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java772
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java347
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java852
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java894
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java771
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java774
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java795
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java952
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java862
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java827
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java850
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java852
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java864
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java768
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java813
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java1002
48 files changed, 16615 insertions, 0 deletions
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesIdentification.java
new file mode 100644
index 0000000000..45944d5771
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesIdentification.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.BootModes;
+
+import java.util.Vector;
+
+public class BootModesIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public BootModesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.usage = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ this.help = (arg4 == null ? "" : arg4);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(BootModesIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesVector.java
new file mode 100644
index 0000000000..c7c02e9f4b
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/BootModes/BootModesVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.BootModes;
+
+import java.util.Vector;
+
+public class BootModesVector {
+
+ private Vector<BootModesIdentification> vBootModes = new Vector<BootModesIdentification>();
+
+ public int findBootModes(BootModesIdentification sfi) {
+ for (int index = 0; index < vBootModes.size(); index++) {
+ if (vBootModes.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findBootModes(String name) {
+ for (int index = 0; index < vBootModes.size(); index++) {
+ if (vBootModes.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public BootModesIdentification getBootModes(int index) {
+ if (index > -1) {
+ return vBootModes.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addBootModes(BootModesIdentification arg0) {
+ vBootModes.addElement(arg0);
+ }
+
+ public void updateBootModes(BootModesIdentification arg0, int arg1) {
+ vBootModes.setElementAt(arg0, arg1);
+ }
+
+ public void removeBootModes(BootModesIdentification arg0) {
+ int index = findBootModes(arg0);
+ if (index > -1) {
+ vBootModes.removeElementAt(index);
+ }
+ }
+
+ public void removeBootModes(int index) {
+ if (index > -1 && index < this.size()) {
+ vBootModes.removeElementAt(index);
+ }
+ }
+
+ public Vector<BootModesIdentification> getvBootModes() {
+ return vBootModes;
+ }
+
+ public void setvBootModes(Vector<BootModesIdentification> BootModes) {
+ vBootModes = BootModes;
+ }
+
+ public Vector<String> getBootModesName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vBootModes.size(); index++) {
+ v.addElement(vBootModes.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vBootModes.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsIdentification.java
new file mode 100644
index 0000000000..deb72d3479
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsIdentification.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.DataHubs;
+
+import java.util.Vector;
+
+public class DataHubsIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public DataHubsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.usage = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ this.help = (arg4 == null ? "" : arg4);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(DataHubsIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsVector.java
new file mode 100644
index 0000000000..4348eb3697
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/DataHubs/DataHubsVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.DataHubs;
+
+import java.util.Vector;
+
+public class DataHubsVector {
+
+ private Vector<DataHubsIdentification> vDataHubs = new Vector<DataHubsIdentification>();
+
+ public int findDataHubs(DataHubsIdentification sfi) {
+ for (int index = 0; index < vDataHubs.size(); index++) {
+ if (vDataHubs.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findDataHubs(String name) {
+ for (int index = 0; index < vDataHubs.size(); index++) {
+ if (vDataHubs.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public DataHubsIdentification getDataHubs(int index) {
+ if (index > -1) {
+ return vDataHubs.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addDataHubs(DataHubsIdentification arg0) {
+ vDataHubs.addElement(arg0);
+ }
+
+ public void updateDataHubs(DataHubsIdentification arg0, int arg1) {
+ vDataHubs.setElementAt(arg0, arg1);
+ }
+
+ public void removeDataHubs(DataHubsIdentification arg0) {
+ int index = findDataHubs(arg0);
+ if (index > -1) {
+ vDataHubs.removeElementAt(index);
+ }
+ }
+
+ public void removeDataHubs(int index) {
+ if (index > -1 && index < this.size()) {
+ vDataHubs.removeElementAt(index);
+ }
+ }
+
+ public Vector<DataHubsIdentification> getvDataHubs() {
+ return vDataHubs;
+ }
+
+ public void setvDataHubs(Vector<DataHubsIdentification> DataHubs) {
+ vDataHubs = DataHubs;
+ }
+
+ public Vector<String> getDataHubsName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vDataHubs.size(); index++) {
+ v.addElement(vDataHubs.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vDataHubs.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsIdentification.java
new file mode 100644
index 0000000000..4258226af1
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsIdentification.java
@@ -0,0 +1,100 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Events;
+
+import java.util.Vector;
+
+public class EventsIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String type = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public EventsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.type = (arg1 == null ? "" : arg1);
+ this.usage = (arg2 == null ? "" : arg2);
+ this.featureFlag = (arg3 == null ? "" : arg3);
+ this.supArchList = arg4;
+ this.help = (arg5 == null ? "" : arg5);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(EventsIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsVector.java
new file mode 100644
index 0000000000..a2f597a0e4
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Events/EventsVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Events;
+
+import java.util.Vector;
+
+public class EventsVector {
+
+ private Vector<EventsIdentification> vEvents = new Vector<EventsIdentification>();
+
+ public int findEvents(EventsIdentification sfi) {
+ for (int index = 0; index < vEvents.size(); index++) {
+ if (vEvents.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findEvents(String name) {
+ for (int index = 0; index < vEvents.size(); index++) {
+ if (vEvents.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public EventsIdentification getEvents(int index) {
+ if (index > -1) {
+ return vEvents.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addEvents(EventsIdentification arg0) {
+ vEvents.addElement(arg0);
+ }
+
+ public void updateEvents(EventsIdentification arg0, int arg1) {
+ vEvents.setElementAt(arg0, arg1);
+ }
+
+ public void removeEvents(EventsIdentification arg0) {
+ int index = findEvents(arg0);
+ if (index > -1) {
+ vEvents.removeElementAt(index);
+ }
+ }
+
+ public void removeEvents(int index) {
+ if (index > -1 && index < this.size()) {
+ vEvents.removeElementAt(index);
+ }
+ }
+
+ public Vector<EventsIdentification> getvEvents() {
+ return vEvents;
+ }
+
+ public void setvEvents(Vector<EventsIdentification> Events) {
+ vEvents = Events;
+ }
+
+ public Vector<String> getEventsName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vEvents.size(); index++) {
+ v.addElement(vEvents.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vEvents.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsIdentification.java
new file mode 100644
index 0000000000..b925698109
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsIdentification.java
@@ -0,0 +1,78 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Externs;
+
+import java.util.Vector;
+
+public class ExternsIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String type = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ public ExternsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.type = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(ExternsIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsVector.java
new file mode 100644
index 0000000000..ac5ce34e16
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Externs/ExternsVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Externs;
+
+import java.util.Vector;
+
+public class ExternsVector {
+
+ private Vector<ExternsIdentification> vExterns = new Vector<ExternsIdentification>();
+
+ public int findExterns(ExternsIdentification sfi) {
+ for (int index = 0; index < vExterns.size(); index++) {
+ if (vExterns.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findExterns(String name) {
+ for (int index = 0; index < vExterns.size(); index++) {
+ if (vExterns.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public ExternsIdentification getExterns(int index) {
+ if (index > -1) {
+ return vExterns.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addExterns(ExternsIdentification arg0) {
+ vExterns.addElement(arg0);
+ }
+
+ public void updateExterns(ExternsIdentification arg0, int arg1) {
+ vExterns.setElementAt(arg0, arg1);
+ }
+
+ public void removeExterns(ExternsIdentification arg0) {
+ int index = findExterns(arg0);
+ if (index > -1) {
+ vExterns.removeElementAt(index);
+ }
+ }
+
+ public void removeExterns(int index) {
+ if (index > -1 && index < this.size()) {
+ vExterns.removeElementAt(index);
+ }
+ }
+
+ public Vector<ExternsIdentification> getvExterns() {
+ return vExterns;
+ }
+
+ public void setvExterns(Vector<ExternsIdentification> Externs) {
+ vExterns = Externs;
+ }
+
+ public Vector<String> getExternsName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vExterns.size(); index++) {
+ v.addElement(vExterns.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vExterns.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsIdentification.java
new file mode 100644
index 0000000000..7b11e2ca3f
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsIdentification.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Guids;
+
+import java.util.Vector;
+
+public class GuidsIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public GuidsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.usage = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ this.help = (arg4 == null ? "" : arg4);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(GuidsIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsVector.java
new file mode 100644
index 0000000000..68c2d88592
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Guids/GuidsVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Guids;
+
+import java.util.Vector;
+
+public class GuidsVector {
+
+ private Vector<GuidsIdentification> vGuids = new Vector<GuidsIdentification>();
+
+ public int findGuids(GuidsIdentification sfi) {
+ for (int index = 0; index < vGuids.size(); index++) {
+ if (vGuids.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findGuids(String name) {
+ for (int index = 0; index < vGuids.size(); index++) {
+ if (vGuids.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public GuidsIdentification getGuids(int index) {
+ if (index > -1) {
+ return vGuids.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addGuids(GuidsIdentification arg0) {
+ vGuids.addElement(arg0);
+ }
+
+ public void updateGuids(GuidsIdentification arg0, int arg1) {
+ vGuids.setElementAt(arg0, arg1);
+ }
+
+ public void removeGuids(GuidsIdentification arg0) {
+ int index = findGuids(arg0);
+ if (index > -1) {
+ vGuids.removeElementAt(index);
+ }
+ }
+
+ public void removeGuids(int index) {
+ if (index > -1 && index < this.size()) {
+ vGuids.removeElementAt(index);
+ }
+ }
+
+ public Vector<GuidsIdentification> getvGuids() {
+ return vGuids;
+ }
+
+ public void setvGuids(Vector<GuidsIdentification> Guids) {
+ vGuids = Guids;
+ }
+
+ public Vector<String> getGuidsName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vGuids.size(); index++) {
+ v.addElement(vGuids.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vGuids.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesIdentification.java
new file mode 100644
index 0000000000..546f4b809f
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesIdentification.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.HiiPackages;
+
+import java.util.Vector;
+
+public class HiiPackagesIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public HiiPackagesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.usage = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ this.help = (arg4 == null ? "" : arg4);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(HiiPackagesIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesVector.java
new file mode 100644
index 0000000000..c4a4bbbe3d
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/HiiPackages/HiiPackagesVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.HiiPackages;
+
+import java.util.Vector;
+
+public class HiiPackagesVector {
+
+ private Vector<HiiPackagesIdentification> vHiiPackages = new Vector<HiiPackagesIdentification>();
+
+ public int findHiiPackages(HiiPackagesIdentification sfi) {
+ for (int index = 0; index < vHiiPackages.size(); index++) {
+ if (vHiiPackages.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findHiiPackages(String name) {
+ for (int index = 0; index < vHiiPackages.size(); index++) {
+ if (vHiiPackages.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public HiiPackagesIdentification getHiiPackages(int index) {
+ if (index > -1) {
+ return vHiiPackages.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addHiiPackages(HiiPackagesIdentification arg0) {
+ vHiiPackages.addElement(arg0);
+ }
+
+ public void updateHiiPackages(HiiPackagesIdentification arg0, int arg1) {
+ vHiiPackages.setElementAt(arg0, arg1);
+ }
+
+ public void removeHiiPackages(HiiPackagesIdentification arg0) {
+ int index = findHiiPackages(arg0);
+ if (index > -1) {
+ vHiiPackages.removeElementAt(index);
+ }
+ }
+
+ public void removeHiiPackages(int index) {
+ if (index > -1 && index < this.size()) {
+ vHiiPackages.removeElementAt(index);
+ }
+ }
+
+ public Vector<HiiPackagesIdentification> getvHiiPackages() {
+ return vHiiPackages;
+ }
+
+ public void setvHiiPackages(Vector<HiiPackagesIdentification> HiiPackages) {
+ vHiiPackages = HiiPackages;
+ }
+
+ public Vector<String> getHiiPackagesName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vHiiPackages.size(); index++) {
+ v.addElement(vHiiPackages.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vHiiPackages.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsIdentification.java
new file mode 100644
index 0000000000..f577724d77
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsIdentification.java
@@ -0,0 +1,100 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Hobs;
+
+import java.util.Vector;
+
+public class HobsIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String type = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public HobsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.type = (arg1 == null ? "" : arg1);
+ this.usage = (arg2 == null ? "" : arg2);
+ this.featureFlag = (arg3 == null ? "" : arg3);
+ this.supArchList = arg4;
+ this.help = (arg5 == null ? "" : arg5);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(HobsIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsVector.java
new file mode 100644
index 0000000000..5e37245677
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Hobs/HobsVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Hobs;
+
+import java.util.Vector;
+
+public class HobsVector {
+
+ private Vector<HobsIdentification> vHobs = new Vector<HobsIdentification>();
+
+ public int findHobs(HobsIdentification sfi) {
+ for (int index = 0; index < vHobs.size(); index++) {
+ if (vHobs.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findHobs(String name) {
+ for (int index = 0; index < vHobs.size(); index++) {
+ if (vHobs.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public HobsIdentification getHobs(int index) {
+ if (index > -1) {
+ return vHobs.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addHobs(HobsIdentification arg0) {
+ vHobs.addElement(arg0);
+ }
+
+ public void updateHobs(HobsIdentification arg0, int arg1) {
+ vHobs.setElementAt(arg0, arg1);
+ }
+
+ public void removeHobs(HobsIdentification arg0) {
+ int index = findHobs(arg0);
+ if (index > -1) {
+ vHobs.removeElementAt(index);
+ }
+ }
+
+ public void removeHobs(int index) {
+ if (index > -1 && index < this.size()) {
+ vHobs.removeElementAt(index);
+ }
+ }
+
+ public Vector<HobsIdentification> getvHobs() {
+ return vHobs;
+ }
+
+ public void setvHobs(Vector<HobsIdentification> Hobs) {
+ vHobs = Hobs;
+ }
+
+ public Vector<String> getHobsName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vHobs.size(); index++) {
+ v.addElement(vHobs.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vHobs.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassIdentification.java
new file mode 100644
index 0000000000..7f88a97cee
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassIdentification.java
@@ -0,0 +1,124 @@
+/** @file
+
+ The file is used to define Library Class Identification
+
+ 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.module.Identification.LibraryClass;
+
+import java.util.Vector;
+
+public class LibraryClassIdentification {
+ private String libraryClassName = null;
+
+ private String usage = null;
+
+ private String recommendedInstanceVersion = null;
+
+ private String recommendedInstanceGuid = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private Vector<String> supModuleList = null;
+
+ private String help = null;
+
+ public LibraryClassIdentification() {
+
+ }
+
+ public LibraryClassIdentification(String strName, String strUsage, String strRecommendedInstanceVersion,
+ String strRecommendedInstanceGuid, Vector<String> vSupArchList,
+ String strFeatureFlag, Vector<String> vSupModuleList, String strHelp) {
+ this.libraryClassName = (strName == null ? "" : strName);
+ this.usage = (strUsage == null ? "" : strUsage);
+ this.recommendedInstanceVersion = (strRecommendedInstanceVersion == null ? "" : strRecommendedInstanceVersion);
+ this.recommendedInstanceGuid = (strRecommendedInstanceGuid == null ? "" : strRecommendedInstanceGuid);
+ this.supArchList = vSupArchList;
+ this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
+ this.supModuleList = vSupModuleList;
+ this.help = (strHelp == null ? "" : strHelp);
+ }
+
+ public String getLibraryClassName() {
+ return libraryClassName;
+ }
+
+ public void setLibraryClassName(String libraryClassName) {
+ this.libraryClassName = libraryClassName;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getRecommendedInstanceGuid() {
+ return recommendedInstanceGuid;
+ }
+
+ public void setRecommendedInstanceGuid(String recommendedInstanceGuid) {
+ this.recommendedInstanceGuid = recommendedInstanceGuid;
+ }
+
+ public String getRecommendedInstanceVersion() {
+ return recommendedInstanceVersion;
+ }
+
+ public void setRecommendedInstanceVersion(String recommendedInstanceVersion) {
+ this.recommendedInstanceVersion = recommendedInstanceVersion;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(LibraryClassIdentification lib) {
+ if (this.libraryClassName.equals(lib.libraryClassName) && this.usage.equals(lib.getUsage())) {
+ return true;
+ }
+ return false;
+ }
+
+ public Vector<String> getSupModuleList() {
+ return supModuleList;
+ }
+
+ public void setSupModuleList(Vector<String> supModuleList) {
+ this.supModuleList = supModuleList;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassVector.java
new file mode 100644
index 0000000000..ddacdda841
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/LibraryClass/LibraryClassVector.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Library Class Vector
+
+ 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.module.Identification.LibraryClass;
+
+import java.util.Vector;
+
+
+public class LibraryClassVector {
+ private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
+
+ public int findLibraryClass(LibraryClassIdentification lib) {
+ for (int index = 0; index < vLibraryClass.size(); index++) {
+ if (vLibraryClass.elementAt(index).equals(lib)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findLibraryClass(String name) {
+ for (int index = 0; index < vLibraryClass.size(); index++) {
+ if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public LibraryClassIdentification getLibraryClass(int index) {
+ if (index > -1) {
+ return vLibraryClass.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addLibraryClass(LibraryClassIdentification lib) {
+ vLibraryClass.addElement(lib);
+ }
+
+ public void updateLibraryClass(LibraryClassIdentification lib, int index) {
+ vLibraryClass.setElementAt(lib, index);
+ }
+
+ public void removeLibraryClass(LibraryClassIdentification lib) {
+ int index = findLibraryClass(lib);
+ if (index > -1) {
+ vLibraryClass.removeElementAt(index);
+ }
+ }
+
+ public void removeLibraryClass(int index) {
+ if (index > -1 && index < this.size()) {
+ vLibraryClass.removeElementAt(index);
+ }
+ }
+
+ public Vector<LibraryClassIdentification> getVLibraryClass() {
+ return vLibraryClass;
+ }
+
+ public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
+ vLibraryClass = libraryClass;
+ }
+
+ public Vector<String> getLibraryClassName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vLibraryClass.size(); index++) {
+ v.addElement(vLibraryClass.get(index).getLibraryClassName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vLibraryClass.size();
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/ModuleIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/ModuleIdentification.java
new file mode 100644
index 0000000000..95ada64f9f
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/ModuleIdentification.java
@@ -0,0 +1,69 @@
+/** @file
+
+ The file is used to save basic information of module
+
+ 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.module.Identification;
+
+
+import org.tianocore.frameworkwizard.common.Identification;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
+
+public class ModuleIdentification extends Identification {
+
+ private PackageIdentification packageId;
+
+ public ModuleIdentification(String name, String guid, String version, String path) {
+ super(name, guid, version, path);
+ }
+
+ public ModuleIdentification(Identification id) {
+ super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
+ }
+
+ public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId){
+ super(name, guid, version, path);
+ this.packageId = packageId;
+ }
+
+ public ModuleIdentification(Identification id, PackageIdentification packageId) {
+ super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
+ this.packageId = packageId;
+ }
+
+// public boolean equals(Object obj) {
+// if (obj instanceof Identification) {
+// Identification id = (Identification)obj;
+// if ( this.getName().equalsIgnoreCase(id.getName())) {
+// return true;
+// }
+// // and package is the same one
+// return false;
+// }
+// else {
+// return super.equals(obj);
+// }
+// }
+
+ public String toString(){
+ return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId;
+ }
+
+ public PackageIdentification getPackageId() {
+ return packageId;
+ }
+
+ public void setPackageId(PackageIdentification packageId) {
+ this.packageId = packageId;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesIdentification.java
new file mode 100644
index 0000000000..98a0245797
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesIdentification.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.PackageDependencies;
+
+import java.util.Vector;
+
+public class PackageDependenciesIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String version = null;
+
+ private String guid = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ public PackageDependenciesIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.version = (arg1 == null ? "" : arg1);
+ this.guid = (arg2 == null ? "" : arg2);
+ this.featureFlag = (arg3 == null ? "" : arg3);
+ this.supArchList = arg4;
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public boolean equals(PackageDependenciesIdentification pdi) {
+ if (this.guid.equals(pdi.guid)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesVector.java
new file mode 100644
index 0000000000..7c09710941
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PackageDependencies/PackageDependenciesVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.PackageDependencies;
+
+import java.util.Vector;
+
+public class PackageDependenciesVector {
+
+ private Vector<PackageDependenciesIdentification> vPackageDependencies = new Vector<PackageDependenciesIdentification>();
+
+ public int findPackageDependencies(PackageDependenciesIdentification sfi) {
+ for (int index = 0; index < vPackageDependencies.size(); index++) {
+ if (vPackageDependencies.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findPackageDependencies(String name) {
+ for (int index = 0; index < vPackageDependencies.size(); index++) {
+ if (vPackageDependencies.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public PackageDependenciesIdentification getPackageDependencies(int index) {
+ if (index > -1) {
+ return vPackageDependencies.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addPackageDependencies(PackageDependenciesIdentification arg0) {
+ vPackageDependencies.addElement(arg0);
+ }
+
+ public void updatePackageDependencies(PackageDependenciesIdentification arg0, int arg1) {
+ vPackageDependencies.setElementAt(arg0, arg1);
+ }
+
+ public void removePackageDependencies(PackageDependenciesIdentification arg0) {
+ int index = findPackageDependencies(arg0);
+ if (index > -1) {
+ vPackageDependencies.removeElementAt(index);
+ }
+ }
+
+ public void removePackageDependencies(int index) {
+ if (index > -1 && index < this.size()) {
+ vPackageDependencies.removeElementAt(index);
+ }
+ }
+
+ public Vector<PackageDependenciesIdentification> getvPackageDependencies() {
+ return vPackageDependencies;
+ }
+
+ public void setvPackageDependencies(Vector<PackageDependenciesIdentification> PackageDependencies) {
+ vPackageDependencies = PackageDependencies;
+ }
+
+ public Vector<String> getPackageDependenciesName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vPackageDependencies.size(); index++) {
+ v.addElement(vPackageDependencies.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vPackageDependencies.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedIdentification.java
new file mode 100644
index 0000000000..f605add248
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedIdentification.java
@@ -0,0 +1,111 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.PcdCoded;
+
+import java.util.Vector;
+
+public class PcdCodedIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String guid = null;
+
+ private String featureFlag = null;
+
+ private Vector<String> supArchList = null;
+
+ private String value = null;
+
+ private String help = null;
+
+ private String type = null;
+
+ public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.guid = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ this.value = (arg4 == null ? "" : arg4);
+ this.help = (arg5 == null ? "" : arg5);
+ this.type = (arg6 == null ? "" : arg6);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(PcdCodedIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedVector.java
new file mode 100644
index 0000000000..db2a8dcaf2
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/PcdCoded/PcdCodedVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.PcdCoded;
+
+import java.util.Vector;
+
+public class PcdCodedVector {
+
+ private Vector<PcdCodedIdentification> vPcdCoded = new Vector<PcdCodedIdentification>();
+
+ public int findPcdCoded(PcdCodedIdentification sfi) {
+ for (int index = 0; index < vPcdCoded.size(); index++) {
+ if (vPcdCoded.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findPcdCoded(String name) {
+ for (int index = 0; index < vPcdCoded.size(); index++) {
+ if (vPcdCoded.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public PcdCodedIdentification getPcdCoded(int index) {
+ if (index > -1) {
+ return vPcdCoded.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addPcdCoded(PcdCodedIdentification arg0) {
+ vPcdCoded.addElement(arg0);
+ }
+
+ public void updatePcdCoded(PcdCodedIdentification arg0, int arg1) {
+ vPcdCoded.setElementAt(arg0, arg1);
+ }
+
+ public void removePcdCoded(PcdCodedIdentification arg0) {
+ int index = findPcdCoded(arg0);
+ if (index > -1) {
+ vPcdCoded.removeElementAt(index);
+ }
+ }
+
+ public void removePcdCoded(int index) {
+ if (index > -1 && index < this.size()) {
+ vPcdCoded.removeElementAt(index);
+ }
+ }
+
+ public Vector<PcdCodedIdentification> getvPcdCoded() {
+ return vPcdCoded;
+ }
+
+ public void setvPcdCoded(Vector<PcdCodedIdentification> PcdCoded) {
+ vPcdCoded = PcdCoded;
+ }
+
+ public Vector<String> getPcdCodedName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vPcdCoded.size(); index++) {
+ v.addElement(vPcdCoded.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vPcdCoded.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisIdentification.java
new file mode 100644
index 0000000000..3df5c080f7
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisIdentification.java
@@ -0,0 +1,100 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Ppis;
+
+import java.util.Vector;
+
+public class PpisIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String type = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public PpisIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.type = (arg1 == null ? "" : arg1);
+ this.usage = (arg2 == null ? "" : arg2);
+ this.featureFlag = (arg3 == null ? "" : arg3);
+ this.supArchList = arg4;
+ this.help = (arg5 == null ? "" : arg5);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(PpisIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisVector.java
new file mode 100644
index 0000000000..85149189af
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Ppis/PpisVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Ppis;
+
+import java.util.Vector;
+
+public class PpisVector {
+
+ private Vector<PpisIdentification> vPpis = new Vector<PpisIdentification>();
+
+ public int findPpis(PpisIdentification sfi) {
+ for (int index = 0; index < vPpis.size(); index++) {
+ if (vPpis.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findPpis(String name) {
+ for (int index = 0; index < vPpis.size(); index++) {
+ if (vPpis.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public PpisIdentification getPpis(int index) {
+ if (index > -1) {
+ return vPpis.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addPpis(PpisIdentification arg0) {
+ vPpis.addElement(arg0);
+ }
+
+ public void updatePpis(PpisIdentification arg0, int arg1) {
+ vPpis.setElementAt(arg0, arg1);
+ }
+
+ public void removePpis(PpisIdentification arg0) {
+ int index = findPpis(arg0);
+ if (index > -1) {
+ vPpis.removeElementAt(index);
+ }
+ }
+
+ public void removePpis(int index) {
+ if (index > -1 && index < this.size()) {
+ vPpis.removeElementAt(index);
+ }
+ }
+
+ public Vector<PpisIdentification> getvPpis() {
+ return vPpis;
+ }
+
+ public void setvPpis(Vector<PpisIdentification> Ppis) {
+ vPpis = Ppis;
+ }
+
+ public Vector<String> getPpisName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vPpis.size(); index++) {
+ v.addElement(vPpis.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vPpis.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsIdentification.java
new file mode 100644
index 0000000000..79567e47d2
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsIdentification.java
@@ -0,0 +1,100 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Protocols;
+
+import java.util.Vector;
+
+public class ProtocolsIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String type = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public ProtocolsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.type = (arg1 == null ? "" : arg1);
+ this.usage = (arg2 == null ? "" : arg2);
+ this.featureFlag = (arg3 == null ? "" : arg3);
+ this.supArchList = arg4;
+ this.help = (arg5 == null ? "" : arg5);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(ProtocolsIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsVector.java
new file mode 100644
index 0000000000..e9e0106add
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Protocols/ProtocolsVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Protocols;
+
+import java.util.Vector;
+
+public class ProtocolsVector {
+
+ private Vector<ProtocolsIdentification> vProtocols = new Vector<ProtocolsIdentification>();
+
+ public int findProtocols(ProtocolsIdentification sfi) {
+ for (int index = 0; index < vProtocols.size(); index++) {
+ if (vProtocols.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findProtocols(String name) {
+ for (int index = 0; index < vProtocols.size(); index++) {
+ if (vProtocols.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public ProtocolsIdentification getProtocols(int index) {
+ if (index > -1) {
+ return vProtocols.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addProtocols(ProtocolsIdentification arg0) {
+ vProtocols.addElement(arg0);
+ }
+
+ public void updateProtocols(ProtocolsIdentification arg0, int arg1) {
+ vProtocols.setElementAt(arg0, arg1);
+ }
+
+ public void removeProtocols(ProtocolsIdentification arg0) {
+ int index = findProtocols(arg0);
+ if (index > -1) {
+ vProtocols.removeElementAt(index);
+ }
+ }
+
+ public void removeProtocols(int index) {
+ if (index > -1 && index < this.size()) {
+ vProtocols.removeElementAt(index);
+ }
+ }
+
+ public Vector<ProtocolsIdentification> getvProtocols() {
+ return vProtocols;
+ }
+
+ public void setvProtocols(Vector<ProtocolsIdentification> Protocols) {
+ vProtocols = Protocols;
+ }
+
+ public Vector<String> getProtocolsName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vProtocols.size(); index++) {
+ v.addElement(vProtocols.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vProtocols.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesIdentification.java
new file mode 100644
index 0000000000..31e95d32f9
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesIdentification.java
@@ -0,0 +1,97 @@
+/** @file
+
+ The file is used to define Source Files Identification
+
+ 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.module.Identification.SourceFiles;
+
+import java.util.Vector;
+
+public class SourceFilesIdentification {
+
+ private String filename = null;
+
+ private String tagName = null;
+
+ private String toolCode = null;
+
+ private String toolChainFamily = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ public SourceFilesIdentification(String strFilename, String strTagName, String strToolCode, String strToolChainFamily,
+ String strFeatureFlag, Vector<String> arch) {
+ this.filename = (strFilename == null ? "" : strFilename);
+ this.tagName = (strTagName == null ? "" : strTagName);
+ this.toolCode = (strToolCode == null ? "" : strToolCode);
+ this.toolChainFamily = (strToolChainFamily == null ? "" : strToolChainFamily);
+ this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
+ this.supArchList = arch;
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public String getTagName() {
+ return tagName;
+ }
+
+ public void setTagName(String tagName) {
+ this.tagName = tagName;
+ }
+
+ public String getToolChainFamily() {
+ return toolChainFamily;
+ }
+
+ public void setToolChainFamily(String toolChainFamily) {
+ this.toolChainFamily = toolChainFamily;
+ }
+
+ public String getToolCode() {
+ return toolCode;
+ }
+
+ public void setToolCode(String toolCode) {
+ this.toolCode = toolCode;
+ }
+
+ public boolean equals(SourceFilesIdentification sfid) {
+ if (this.filename.equals(sfid.filename)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesVector.java
new file mode 100644
index 0000000000..0b9623261e
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SourceFiles/SourceFilesVector.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Source Files Vector
+
+ 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.module.Identification.SourceFiles;
+
+import java.util.Vector;
+
+public class SourceFilesVector {
+ private Vector<SourceFilesIdentification> vSourceFiles = new Vector<SourceFilesIdentification>();
+
+ public int findSourceFiles(SourceFilesIdentification sfi) {
+ for (int index = 0; index < vSourceFiles.size(); index++) {
+ if (vSourceFiles.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findSourceFiles(String name) {
+ for (int index = 0; index < vSourceFiles.size(); index++) {
+ if (vSourceFiles.elementAt(index).getFilename().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public SourceFilesIdentification getSourceFiles(int index) {
+ if (index > -1) {
+ return vSourceFiles.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addSourceFiles(SourceFilesIdentification sfi) {
+ vSourceFiles.addElement(sfi);
+ }
+
+ public void updateSourceFiles(SourceFilesIdentification sfi, int index) {
+ vSourceFiles.setElementAt(sfi, index);
+ }
+
+ public void removeSourceFiles(SourceFilesIdentification sfi) {
+ int index = findSourceFiles(sfi);
+ if (index > -1) {
+ vSourceFiles.removeElementAt(index);
+ }
+ }
+
+ public void removeSourceFiles(int index) {
+ if (index > -1 && index < this.size()) {
+ vSourceFiles.removeElementAt(index);
+ }
+ }
+
+ public Vector<SourceFilesIdentification> getvSourceFiles() {
+ return vSourceFiles;
+ }
+
+ public void setvSourceFiles(Vector<SourceFilesIdentification> SourceFiles) {
+ vSourceFiles = SourceFiles;
+ }
+
+ public Vector<String> getSourceFilesName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vSourceFiles.size(); index++) {
+ v.addElement(vSourceFiles.get(index).getFilename());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vSourceFiles.size();
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesIdentification.java
new file mode 100644
index 0000000000..354e10b40e
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesIdentification.java
@@ -0,0 +1,89 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.SystemTables;
+
+import java.util.Vector;
+
+public class SystemTablesIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public SystemTablesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.usage = (arg1 == null ? "" : arg1);
+ this.featureFlag = (arg2 == null ? "" : arg2);
+ this.supArchList = arg3;
+ this.help = (arg4 == null ? "" : arg4);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(SystemTablesIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesVector.java
new file mode 100644
index 0000000000..eea0280ebf
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/SystemTables/SystemTablesVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.SystemTables;
+
+import java.util.Vector;
+
+public class SystemTablesVector {
+
+ private Vector<SystemTablesIdentification> vSystemTables = new Vector<SystemTablesIdentification>();
+
+ public int findSystemTables(SystemTablesIdentification sfi) {
+ for (int index = 0; index < vSystemTables.size(); index++) {
+ if (vSystemTables.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findSystemTables(String name) {
+ for (int index = 0; index < vSystemTables.size(); index++) {
+ if (vSystemTables.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public SystemTablesIdentification getSystemTables(int index) {
+ if (index > -1) {
+ return vSystemTables.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addSystemTables(SystemTablesIdentification arg0) {
+ vSystemTables.addElement(arg0);
+ }
+
+ public void updateSystemTables(SystemTablesIdentification arg0, int arg1) {
+ vSystemTables.setElementAt(arg0, arg1);
+ }
+
+ public void removeSystemTables(SystemTablesIdentification arg0) {
+ int index = findSystemTables(arg0);
+ if (index > -1) {
+ vSystemTables.removeElementAt(index);
+ }
+ }
+
+ public void removeSystemTables(int index) {
+ if (index > -1 && index < this.size()) {
+ vSystemTables.removeElementAt(index);
+ }
+ }
+
+ public Vector<SystemTablesIdentification> getvSystemTables() {
+ return vSystemTables;
+ }
+
+ public void setvSystemTables(Vector<SystemTablesIdentification> SystemTables) {
+ vSystemTables = SystemTables;
+ }
+
+ public Vector<String> getSystemTablesName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vSystemTables.size(); index++) {
+ v.addElement(vSystemTables.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vSystemTables.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesIdentification.java
new file mode 100644
index 0000000000..bfa4c127d2
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesIdentification.java
@@ -0,0 +1,100 @@
+/** @file
+
+ The file is used to define Package Dependencies Identification
+
+ 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.module.Identification.Variables;
+
+import java.util.Vector;
+
+public class VariablesIdentification {
+
+ //
+ // Define class members
+ //
+ private String name = null;
+
+ private String guid = null;
+
+ private String usage = null;
+
+ private Vector<String> supArchList = null;
+
+ private String featureFlag = null;
+
+ private String help = null;
+
+ public VariablesIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
+ this.name = (arg0 == null ? "" : arg0);
+ this.guid = (arg1 == null ? "" : arg1);
+ this.usage = (arg2 == null ? "" : arg2);
+ this.featureFlag = (arg3 == null ? "" : arg3);
+ this.supArchList = arg4;
+ this.help = (arg5 == null ? "" : arg5);
+ }
+
+ public String getFeatureFlag() {
+ return featureFlag;
+ }
+
+ public void setFeatureFlag(String featureFlag) {
+ this.featureFlag = featureFlag;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<String> getSupArchList() {
+ return supArchList;
+ }
+
+ public void setSupArchList(Vector<String> supArchList) {
+ this.supArchList = supArchList;
+ }
+
+ public boolean equals(VariablesIdentification pi) {
+ if (this.name.equals(pi.name)) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getUsage() {
+ return usage;
+ }
+
+ public void setUsage(String usage) {
+ this.usage = usage;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesVector.java
new file mode 100644
index 0000000000..543ebe6054
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identification/Variables/VariablesVector.java
@@ -0,0 +1,90 @@
+/** @file
+
+ The file is used to define Package Dependencies Vector
+
+ 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.module.Identification.Variables;
+
+import java.util.Vector;
+
+public class VariablesVector {
+
+ private Vector<VariablesIdentification> vVariables = new Vector<VariablesIdentification>();
+
+ public int findVariables(VariablesIdentification sfi) {
+ for (int index = 0; index < vVariables.size(); index++) {
+ if (vVariables.elementAt(index).equals(sfi)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public int findVariables(String name) {
+ for (int index = 0; index < vVariables.size(); index++) {
+ if (vVariables.elementAt(index).getName().equals(name)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public VariablesIdentification getVariables(int index) {
+ if (index > -1) {
+ return vVariables.elementAt(index);
+ } else {
+ return null;
+ }
+ }
+
+ public void addVariables(VariablesIdentification arg0) {
+ vVariables.addElement(arg0);
+ }
+
+ public void updateVariables(VariablesIdentification arg0, int arg1) {
+ vVariables.setElementAt(arg0, arg1);
+ }
+
+ public void removeVariables(VariablesIdentification arg0) {
+ int index = findVariables(arg0);
+ if (index > -1) {
+ vVariables.removeElementAt(index);
+ }
+ }
+
+ public void removeVariables(int index) {
+ if (index > -1 && index < this.size()) {
+ vVariables.removeElementAt(index);
+ }
+ }
+
+ public Vector<VariablesIdentification> getvVariables() {
+ return vVariables;
+ }
+
+ public void setvVariables(Vector<VariablesIdentification> Variables) {
+ vVariables = Variables;
+ }
+
+ public Vector<String> getVariablesName() {
+ Vector<String> v = new Vector<String>();
+ for (int index = 0; index < this.vVariables.size(); index++) {
+ v.addElement(vVariables.get(index).getName());
+ }
+ return v;
+ }
+
+ public int size() {
+ return this.vVariables.size();
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java
new file mode 100644
index 0000000000..4e0652cb4e
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java
@@ -0,0 +1,759 @@
+/** @file
+
+ The file is used to create, update BootModes of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.BootModeNames;
+import org.tianocore.BootModeUsage;
+import org.tianocore.BootModesDocument;
+import org.tianocore.BootModesDocument.BootModes;
+import org.tianocore.BootModesDocument.BootModes.BootMode;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.BootModes.BootModesIdentification;
+import org.tianocore.frameworkwizard.module.Identification.BootModes.BootModesVector;
+
+/**
+ The class is used to create, update BootModes of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleBootModes extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -3888558623432442561L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelBootModeName = null;
+
+ private JComboBox jComboBoxBootModeName = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private BootModesDocument.BootModes bootModes = null;
+
+ private BootModesIdentification id = null;
+
+ private BootModesVector vid = new BootModesVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jComboBoxBootModeName
+
+ @return javax.swing.JComboBox jComboBoxBootModeName
+
+ **/
+ private JComboBox getJComboBoxBootModeName() {
+ if (jComboBoxBootModeName == null) {
+ jComboBoxBootModeName = new JComboBox();
+ jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxBootModeName;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Boot Modes");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(BootModes inBootModes) {
+ init();
+ this.bootModes = inBootModes;
+
+ if (this.bootModes != null) {
+ if (this.bootModes.getBootModeList().size() > 0) {
+ for (int index = 0; index < this.bootModes.getBootModeList().size(); index++) {
+ String arg0 = null;
+ if (bootModes.getBootModeList().get(index).getBootModeName() != null) {
+ arg0 = bootModes.getBootModeList().get(index).getBootModeName().toString();
+ }
+ String arg1 = null;
+ if (bootModes.getBootModeList().get(index).getUsage() != null) {
+ arg1 = bootModes.getBootModeList().get(index).getUsage().toString();
+ }
+
+ String arg2 = bootModes.getBootModeList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools.convertListToVector(bootModes.getBootModeList().get(index).getSupArchList());
+ String arg4 = bootModes.getBootModeList().get(index).getHelpText();
+
+ id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
+ vid.addBootModes(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getBootModesName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleBootModes() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inBootModes The input BootModesDocument.BootModes
+
+ **/
+ public ModuleBootModes(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getBootModes());
+ this.setVisible(true);
+ }
+
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jComboBoxBootModeName.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelBootModeName = new JLabel();
+ jLabelBootModeName.setText("Boot Mode Name");
+ jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
+
+ jContentPane.add(jLabelBootModeName, null);
+ jContentPane.add(getJComboBoxBootModeName(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelArch, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes BootModeName groups and Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Mbd Header
+ if exists bootModes, set the value directly
+ if not exists bootModes, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.bootModes = BootModes.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ BootMode p = BootMode.Factory.newInstance();
+ if (!isEmpty(vid.getBootModes(index).getName())) {
+ p.setBootModeName(BootModeNames.Enum.forString(vid.getBootModes(index).getName()));
+ }
+ if (!isEmpty(vid.getBootModes(index).getUsage())) {
+ p.setUsage(BootModeUsage.Enum.forString(vid.getBootModes(index).getUsage()));
+ }
+ if (!isEmpty(vid.getBootModes(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getBootModes(index).getFeatureFlag());
+ }
+ if (vid.getBootModes(index).getSupArchList() != null && vid.getBootModes(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getBootModes(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getBootModes(index).getHelp())) {
+ p.setHelpText(vid.getBootModes(index).getHelp());
+ }
+ this.bootModes.addNewBootMode();
+ this.bootModes.setBootModeArray(bootModes.getBootModeList().size() - 1, p);
+ }
+ }
+
+ this.msa.setBootModes(bootModes);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Boot Modes", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jComboBoxBootModeName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private BootModesIdentification getCurrentBootModes() {
+ String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString();
+
+ String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg4 = this.jTextFieldHelpText.getText();
+ id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addBootModes(getCurrentBootModes());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeBootModes(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateBootModes(getCurrentBootModes(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getBootModes(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxBootModeName.setSelectedItem(vid.getBootModes(intSelectedItemId).getName());
+ this.jComboBoxUsage.setSelectedItem(vid.getBootModes(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getBootModes(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getBootModes(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getBootModes(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getBootModes(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java
new file mode 100644
index 0000000000..8905518a71
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java
@@ -0,0 +1,772 @@
+/** @file
+
+ The file is used to create, update DataHub of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.DataHubUsage;
+import org.tianocore.DataHubsDocument;
+import org.tianocore.DataHubsDocument.DataHubs;
+import org.tianocore.DataHubsDocument.DataHubs.DataHubRecord;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.DataHubs.DataHubsIdentification;
+import org.tianocore.frameworkwizard.module.Identification.DataHubs.DataHubsVector;
+
+/**
+ The class is used to create, update DataHub of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleDataHubs extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -3667906991966638892L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private JLabel jLabelDataHubRecord = null;
+
+ private JTextField jTextFieldDataHubRecord = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private DataHubsDocument.DataHubs dataHubs = null;
+
+ private DataHubsIdentification id = null;
+
+ private DataHubsVector vid = new DataHubsVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ This method initializes jTextFieldDataHubRecord
+
+ @return javax.swing.JTextField jTextFieldDataHubRecord
+
+ **/
+ private JTextField getJTextFieldDataHubRecord() {
+ if (jTextFieldDataHubRecord == null) {
+ jTextFieldDataHubRecord = new JTextField();
+ jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldDataHubRecord;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Data Hubs");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(DataHubs inDataHubs) {
+ init();
+ this.dataHubs = inDataHubs;
+
+ if (this.dataHubs != null) {
+ if (this.dataHubs.getDataHubRecordList().size() > 0) {
+ for (int index = 0; index < this.dataHubs.getDataHubRecordList().size(); index++) {
+ String arg0 = dataHubs.getDataHubRecordList().get(index).getDataHubCName();
+ String arg1 = null;
+ if (dataHubs.getDataHubRecordList().get(index).getUsage() != null) {
+ arg1 = dataHubs.getDataHubRecordList().get(index).getUsage().toString();
+ }
+
+ String arg2 = dataHubs.getDataHubRecordList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools.convertListToVector(dataHubs.getDataHubRecordList().get(index)
+ .getSupArchList());
+ String arg4 = dataHubs.getDataHubRecordList().get(index).getHelpText();
+
+ id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
+ vid.addDataHubs(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getDataHubsName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleDataHubs() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inDataHubs The input DataHubsDocument.DataHubs
+
+ **/
+ public ModuleDataHubs(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getDataHubs());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldDataHubRecord.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelDataHubRecord = new JLabel();
+ jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelDataHubRecord.setText("Data Hub Record");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
+
+ jContentPane.add(jLabelDataHubRecord, null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(jLabelArch, null);
+
+ jContentPane.add(getJTextFieldDataHubRecord(), null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check DataHubRecord
+ //
+ if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
+ Log.err("Data Hub Record couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {
+ if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {
+ Log.err("Incorrect data type for Data Hub Record");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of DataHubs
+ if exists dataHubs, set the value directly
+ if not exists dataHubs, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.dataHubs = DataHubs.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ DataHubRecord p = DataHubRecord.Factory.newInstance();
+ if (!isEmpty(vid.getDataHubs(index).getName())) {
+ p.setDataHubCName(vid.getDataHubs(index).getName());
+ }
+ if (!isEmpty(vid.getDataHubs(index).getUsage())) {
+ p.setUsage(DataHubUsage.Enum.forString(vid.getDataHubs(index).getUsage()));
+ }
+ if (!isEmpty(vid.getDataHubs(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getDataHubs(index).getFeatureFlag());
+ }
+ if (vid.getDataHubs(index).getSupArchList() != null
+ && vid.getDataHubs(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getDataHubs(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getDataHubs(index).getHelp())) {
+ p.setHelpText(vid.getDataHubs(index).getHelp());
+ }
+ this.dataHubs.addNewDataHubRecord();
+ this.dataHubs.setDataHubRecordArray(dataHubs.getDataHubRecordList().size() - 1, p);
+ }
+ }
+
+ this.msa.setDataHubs(dataHubs);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Data Hubs", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jTextFieldDataHubRecord, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private DataHubsIdentification getCurrentDataHubs() {
+ String arg0 = this.jTextFieldDataHubRecord.getText();
+ String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg4 = this.jTextFieldHelpText.getText();
+
+ id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addDataHubs(getCurrentDataHubs());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeDataHubs(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateDataHubs(getCurrentDataHubs(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getDataHubs(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldDataHubRecord.setText(vid.getDataHubs(intSelectedItemId).getName());
+ this.jComboBoxUsage.setSelectedItem(vid.getDataHubs(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getDataHubs(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getDataHubs(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getDataHubs(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getDataHubs(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java
new file mode 100644
index 0000000000..f3bc5e70c6
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java
@@ -0,0 +1,347 @@
+/** @file
+
+ The file is used to create, update Module Definitions of MSA 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.module.ui;
+
+import java.awt.event.ComponentEvent;
+import java.awt.event.FocusEvent;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.JComboBox;
+
+import org.tianocore.ModuleDefinitionsDocument;
+import org.tianocore.ModuleSurfaceAreaDocument;
+import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions.ClonedFrom;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
+import org.tianocore.frameworkwizard.common.ui.StarLabel;
+import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
+
+public class ModuleDefinitions extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = 5860378543553036323L;
+
+ private JScrollPane jScrollPane = null;
+
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelArch = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JLabel jLabelBinaryModule = null;
+
+ private JComboBox jComboBoxBinaryModule = null;
+
+ private JLabel jLabelOutputFileBasename = null;
+
+ private JTextField jTextFieldOutputFileBasename = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private StarLabel jStarLabel3 = null;
+
+ private OpeningModuleType omt = null;
+
+ private ClonedFrom cf = null;
+
+ private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
+
+ private ModuleDefinitionsDocument.ModuleDefinitions md = null;
+
+ /**
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelOutputFileBasename = new JLabel();
+ jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelOutputFileBasename.setText("Output File Basename");
+ jLabelBinaryModule = new JLabel();
+ jLabelBinaryModule.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelBinaryModule.setText("Binary Module");
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelArch.setText("Supported Architectures");
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+ jStarLabel3 = new StarLabel();
+ jStarLabel3.setLocation(new java.awt.Point(0, 60));
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 150));
+
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelBinaryModule, null);
+ jContentPane.add(getJComboBoxBinaryModule(), null);
+ jContentPane.add(jLabelOutputFileBasename, null);
+ jContentPane.add(getJTextFieldOutputFileBasename(), null);
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jStarLabel3, null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ * This method initializes jComboBoxBinaryModule
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxBinaryModule() {
+ if (jComboBoxBinaryModule == null) {
+ jComboBoxBinaryModule = new JComboBox();
+ jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxBinaryModule.addFocusListener(this);
+ jComboBoxBinaryModule.setToolTipText("Modules are either source modules which can be compiled or binary modules which are linked. A module cannot contain both. The GUID numbers should be identical for a binary and source MSA, but the BINARY MSA should have a higher version number.");
+ }
+ return jComboBoxBinaryModule;
+ }
+
+ /**
+ * This method initializes jTextFieldOutputFileBasename
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldOutputFileBasename() {
+ if (jTextFieldOutputFileBasename == null) {
+ jTextFieldOutputFileBasename = new JTextField();
+ jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldOutputFileBasename.addFocusListener(this);
+ jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names");
+ }
+ return jTextFieldOutputFileBasename;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 60, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 60));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+
+ @param args
+
+ **/
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * This is the default constructor
+ */
+ public ModuleDefinitions() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inMsa
+
+ **/
+ public ModuleDefinitions(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ if (msa.getModuleDefinitions() != null) {
+ this.cf = msa.getModuleDefinitions().getClonedFrom();
+ }
+ init(msa.getModuleDefinitions());
+ this.setVisible(true);
+ }
+
+ /**
+ * This method initializes this
+ *
+ * @return void
+ */
+ private void init() {
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Module Definitions");
+ initFrame();
+ this.setPreferredSize(new java.awt.Dimension(490, 520));
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
+
+ **/
+ private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) {
+ init();
+ if (inMd != null) {
+ this.md = inMd;
+ if (md.getSupportedArchitectures() != null) {
+ this.iCheckBoxListArch.initCheckedItem(true, Tools.convertListToVector(md.getSupportedArchitectures()));
+ }
+ if (md.getBinaryModule()) {
+ this.jComboBoxBinaryModule.setSelectedIndex(1);
+ } else {
+ this.jComboBoxBinaryModule.setSelectedIndex(0);
+ }
+ if (md.getOutputFileBasename() != null) {
+ this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());
+ }
+ }
+ }
+
+ /**
+ This method initializes Module type and Compontent type
+
+ **/
+ private void initFrame() {
+ EnumerationData ed = new EnumerationData();
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());
+ }
+
+ private boolean check() {
+ if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
+ Log.err("Output File Basename couldn't be empty!");
+ return false;
+ }
+ if (!DataValidation.isOutputFileBasename(this.jTextFieldOutputFileBasename.getText())) {
+ Log.err("Incorrect data type for Output File Basename");
+ return false;
+ }
+ return true;
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+
+ resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);
+ }
+
+ /**
+ Save all components of Module Definitions
+ if exists Module Definitions, set the value directly
+ if not exists Module Definitions, new an instance first
+
+ **/
+ public void save() {
+ check();
+ try {
+ if (this.md == null) {
+ md = ModuleDefinitionsDocument.ModuleDefinitions.Factory.newInstance();
+ }
+
+ if (!isEmpty(this.jTextFieldOutputFileBasename.getText())) {
+ md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());
+ }
+
+ if (this.jComboBoxBinaryModule.getSelectedIndex() == 0) {
+ md.setBinaryModule(false);
+ } else {
+ md.setBinaryModule(true);
+ }
+
+ //
+ // Set ClonedFrom field
+ //
+ if (this.cf != null) {
+ md.setClonedFrom(this.cf);
+ }
+
+ //
+ // Save Arch list
+ //
+ md.setSupportedArchitectures(this.iCheckBoxListArch.getAllCheckedItemsString());
+
+ msa.setModuleDefinitions(md);
+
+ this.omt.setSaved(false);
+
+ } catch (Exception e) {
+ Log.err("Save Module Definitions", e.getMessage());
+ }
+ }
+
+ public void focusLost(FocusEvent arg0) {
+ this.save();
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java
new file mode 100644
index 0000000000..165fbd6068
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java
@@ -0,0 +1,852 @@
+/** @file
+
+ The file is used to create, update Event of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.EventsDocument;
+import org.tianocore.ProtocolNotifyUsage;
+import org.tianocore.ProtocolUsage;
+import org.tianocore.EventsDocument.Events;
+import org.tianocore.EventsDocument.Events.CreateEvents;
+import org.tianocore.EventsDocument.Events.SignalEvents;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.Events.EventsIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Events.EventsVector;
+
+/**
+ The class is used to create, update Event of MSA/MBD file
+ It extends IInternalFrame
+
+ @since ModuleEditor 1.0
+
+ **/
+public class ModuleEvents extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -4396143706422842331L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelEventType = null;
+
+ private JLabel jLabelC_Name = null;
+
+ private JTextField jTextFieldC_Name = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JComboBox jComboBoxEventsType = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JLabel jLabelArch = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private EventsDocument.Events events = null;
+
+ private EventsIdentification id = null;
+
+ private EventsVector vid = new EventsVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextFieldC_Name
+
+ @return javax.swing.JTextField jTextFieldC_Name
+
+ **/
+ private JTextField getJTextFieldC_Name() {
+ if (jTextFieldC_Name == null) {
+ jTextFieldC_Name = new JTextField();
+ jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldC_Name;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ * This method initializes jComboBoxEventsType
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxEventsType() {
+ if (jComboBoxEventsType == null) {
+ jComboBoxEventsType = new JComboBox();
+ jComboBoxEventsType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxEventsType;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 135, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160,110,320,20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320,20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Events");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(Events inEvents) {
+ init();
+ this.events = inEvents;
+
+ if (this.events != null) {
+ if (this.events.getCreateEvents() != null) {
+ if (this.events.getCreateEvents().getEventTypesList().size() > 0) {
+ for (int index = 0; index < this.events.getCreateEvents().getEventTypesList().size(); index++) {
+ String arg0 = events.getCreateEvents().getEventTypesList().get(index).getEventGuidCName();
+ String arg1 = ed.getVEventType().get(0);
+ String arg2 = null;
+ if (events.getCreateEvents().getEventTypesList().get(index).getUsage() != null) {
+ arg2 = events.getCreateEvents().getEventTypesList().get(index).getUsage().toString();
+ }
+
+ String arg3 = events.getCreateEvents().getEventTypesList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(events.getCreateEvents().getEventTypesList().get(index)
+ .getSupArchList());
+ String arg5 = events.getCreateEvents().getEventTypesList().get(index).getHelpText();
+ id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addEvents(id);
+ }
+ }
+ }
+ if (this.events.getSignalEvents() != null) {
+ if (this.events.getSignalEvents().getEventTypesList().size() > 0) {
+ for (int index = 0; index < this.events.getSignalEvents().getEventTypesList().size(); index++) {
+ String arg0 = events.getSignalEvents().getEventTypesList().get(index).getEventGuidCName();
+ String arg1 = ed.getVEventType().get(1);
+ String arg2 = null;
+ if (events.getSignalEvents().getEventTypesList().get(index).getUsage() != null) {
+ arg2 = events.getSignalEvents().getEventTypesList().get(index).getUsage().toString();
+ }
+
+ String arg3 = events.getSignalEvents().getEventTypesList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(events.getSignalEvents().getEventTypesList().get(index)
+ .getSupArchList());
+ String arg5 = events.getSignalEvents().getEventTypesList().get(index).getHelpText();
+ id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addEvents(id);
+ }
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getEventsName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleEvents() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inEvents The input EventsDocument.Events
+
+ **/
+ public ModuleEvents(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getEvents());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldC_Name.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15,110,140,20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("Guid C_Name");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelEventType = new JLabel();
+ jLabelEventType.setText("Event Type");
+ jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
+
+ jContentPane.add(jLabelEventType, null);
+ jContentPane.add(jLabelC_Name, null);
+ jContentPane.add(getJTextFieldC_Name(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(getJComboBoxEventsType(), null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes events groups and usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check Name
+ //
+ if (isEmpty(this.jTextFieldC_Name.getText())) {
+ Log.err("Event Name couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldC_Name.getText())) {
+ if (!DataValidation.isC_NameType(this.jTextFieldC_Name.getText())) {
+ Log.err("Incorrect data type for Event Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Events
+ if exists events, set the value directly
+ if not exists events, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.events = Events.Factory.newInstance();
+ CreateEvents ce = CreateEvents.Factory.newInstance();
+ SignalEvents se = SignalEvents.Factory.newInstance();
+
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ if (vid.getEvents(index).getType().equals(ed.getVEventType().get(0))) {
+ CreateEvents.EventTypes e = CreateEvents.EventTypes.Factory.newInstance();
+ if (!isEmpty(vid.getEvents(index).getName())) {
+ e.setEventGuidCName(vid.getEvents(index).getName());
+ }
+ if (!isEmpty(vid.getEvents(index).getUsage())) {
+ e.setUsage(ProtocolUsage.Enum.forString(vid.getEvents(index).getUsage()));
+ }
+ if (!isEmpty(vid.getEvents(index).getFeatureFlag())) {
+ e.setFeatureFlag(vid.getEvents(index).getFeatureFlag());
+ }
+ if (vid.getEvents(index).getSupArchList() != null
+ && vid.getEvents(index).getSupArchList().size() > 0) {
+ e.setSupArchList(vid.getEvents(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getEvents(index).getHelp())) {
+ e.setHelpText(vid.getEvents(index).getHelp());
+ }
+ ce.addNewEventTypes();
+ ce.setEventTypesArray(ce.getEventTypesList().size() - 1, e);
+ }
+ if (vid.getEvents(index).getType().equals("Protocol Notify")) {
+ SignalEvents.EventTypes e = SignalEvents.EventTypes.Factory.newInstance();
+ if (!isEmpty(vid.getEvents(index).getName())) {
+ e.setEventGuidCName(vid.getEvents(index).getName());
+ }
+ if (!isEmpty(vid.getEvents(index).getUsage())) {
+ e.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getEvents(index).getUsage()));
+ }
+ if (!isEmpty(vid.getEvents(index).getFeatureFlag())) {
+ e.setFeatureFlag(vid.getEvents(index).getFeatureFlag());
+ }
+ if (vid.getEvents(index).getSupArchList() != null
+ && vid.getEvents(index).getSupArchList().size() > 0) {
+ e.setSupArchList(vid.getEvents(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getEvents(index).getHelp())) {
+ e.setHelpText(vid.getEvents(index).getHelp());
+ }
+ se.addNewEventTypes();
+ se.setEventTypesArray(ce.getEventTypesList().size() - 1, e);
+ }
+ }
+ }
+ if (ce.getEventTypesList().size() > 0) {
+ events.addNewCreateEvents();
+ events.setCreateEvents(ce);
+ }
+ if (se.getEventTypesList().size() > 0) {
+ events.addNewSignalEvents();
+ events.setSignalEvents(se);
+ }
+ this.msa.setEvents(events);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.err("Update Events", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jComboBoxEventsType, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldC_Name, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private EventsIdentification getCurrentEvents() {
+ String arg0 = this.jTextFieldC_Name.getText();
+ String arg1 = this.jComboBoxEventsType.getSelectedItem().toString();
+ String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg3 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg5 = this.jTextFieldHelpText.getText();
+ id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addEvents(getCurrentEvents());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeEvents(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateEvents(getCurrentEvents(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getEvents(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldC_Name.setText(vid.getEvents(intSelectedItemId).getName());
+ this.jComboBoxEventsType.setSelectedItem(vid.getEvents(intSelectedItemId).getType());
+ this.jComboBoxUsage.setSelectedItem(vid.getEvents(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getEvents(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getEvents(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getEvents(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getEvents(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java
new file mode 100644
index 0000000000..6654e06e22
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java
@@ -0,0 +1,894 @@
+/** @file
+
+ The file is used to create, update DataHub of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.ExternsDocument;
+import org.tianocore.PcdDriverTypes;
+import org.tianocore.ExternsDocument.Externs;
+import org.tianocore.ExternsDocument.Externs.Extern;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
+import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
+import org.tianocore.frameworkwizard.module.Identification.Externs.ExternsIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Externs.ExternsVector;
+
+/**
+ The class is used to create, update DataHub of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleExterns extends IInternalFrame implements ItemListener {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -7382008402932047191L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelName = null;
+
+ private JComboBox jComboBoxType = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JLabel jLabelPcdIsDriver = null;
+
+ private JComboBox jComboBoxPcdIsDriver = null;
+
+ private JLabel jLabelC_Name = null;
+
+ private JTextField jTextFieldC_Name = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private ExternsDocument.Externs externs = null;
+
+ private ExternsIdentification id = null;
+
+ private ExternsVector vid = new ExternsVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jComboBoxType
+
+ @return javax.swing.JComboBox jComboBoxType
+
+ **/
+ private JComboBox getJComboBoxType() {
+ if (jComboBoxType == null) {
+ jComboBoxType = new JComboBox();
+ jComboBoxType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxType.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxType;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ * This method initializes jComboBoxPcdIsDriver
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxPcdIsDriver() {
+ if (jComboBoxPcdIsDriver == null) {
+ jComboBoxPcdIsDriver = new JComboBox();
+ jComboBoxPcdIsDriver.setLocation(new java.awt.Point(160, 10));
+ jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxPcdIsDriver.setSize(new java.awt.Dimension(320, 20));
+ jComboBoxPcdIsDriver.addItemListener(this);
+ }
+ return jComboBoxPcdIsDriver;
+ }
+
+ /**
+ 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(160, 60, 320, 20));
+ jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(320,20));
+ }
+ return jTextFieldC_Name;
+ }
+
+ /**
+ This method initializes jTextFieldFeatureFlag
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Externs");
+ initFrame();
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(Externs inExterns) {
+ init();
+ this.externs = inExterns;
+
+ if (this.externs != null) {
+ //
+ // Get PcdIsDriver
+ //
+ if (this.externs.getPcdIsDriver() != null) {
+ this.jComboBoxPcdIsDriver.setSelectedItem(this.externs.getPcdIsDriver().toString());
+ }
+
+ //
+ // Get specification
+ //
+ if (this.externs.getSpecificationList().size() > 0) {
+ for (int index = 0; index < this.externs.getSpecificationList().size(); index++) {
+ String arg0 = externs.getSpecificationList().get(index);
+ String arg1 = EnumerationData.EXTERNS_SPECIFICATION;
+
+ id = new ExternsIdentification(arg0, arg1, null, null);
+ vid.addExterns(id);
+ }
+ }
+
+ //
+ // Get Externs list
+ //
+ if (this.externs.getExternList().size() > 0) {
+ for (int index = 0; index < this.externs.getExternList().size(); index++) {
+ String arg0 = null;
+ String arg1 = null;
+ if (this.externs.getExternList().get(index).getModuleEntryPoint() != null) {
+ arg0 = this.externs.getExternList().get(index).getModuleEntryPoint();
+ arg1 = EnumerationData.EXTERNS_MODULE_ENTRY_POINT;
+ }
+ if (this.externs.getExternList().get(index).getModuleUnloadImage() != null) {
+ arg0 = this.externs.getExternList().get(index).getModuleUnloadImage();
+ arg1 = EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE;
+ }
+
+ if (this.externs.getExternList().get(index).getConstructor() != null) {
+ arg0 = this.externs.getExternList().get(index).getConstructor();
+ arg1 = EnumerationData.EXTERNS_CONSTRUCTOR;
+ }
+ if (this.externs.getExternList().get(index).getDestructor() != null) {
+ arg0 = this.externs.getExternList().get(index).getDestructor();
+ arg1 = EnumerationData.EXTERNS_DESTRUCTOR;
+ }
+
+ if (this.externs.getExternList().get(index).getDriverBinding() != null) {
+ arg0 = this.externs.getExternList().get(index).getDriverBinding();
+ arg1 = EnumerationData.EXTERNS_DRIVER_BINDING;
+ }
+ if (this.externs.getExternList().get(index).getComponentName() != null) {
+ arg0 = this.externs.getExternList().get(index).getComponentName();
+ arg1 = EnumerationData.EXTERNS_COMPONENT_NAME;
+ }
+ if (this.externs.getExternList().get(index).getDriverConfig() != null) {
+ arg0 = this.externs.getExternList().get(index).getDriverConfig();
+ arg1 = EnumerationData.EXTERNS_DRIVER_CONFIG;
+ }
+ if (this.externs.getExternList().get(index).getDriverDiag() != null) {
+ arg0 = this.externs.getExternList().get(index).getDriverDiag();
+ arg1 = EnumerationData.EXTERNS_DRIVER_DIAG;
+ }
+
+ if (this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack() != null) {
+ arg0 = this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack();
+ arg1 = EnumerationData.EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK;
+ }
+ if (this.externs.getExternList().get(index).getExitBootServicesCallBack() != null) {
+ arg0 = this.externs.getExternList().get(index).getExitBootServicesCallBack();
+ arg1 = EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK;
+ }
+
+ String arg2 = externs.getExternList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools
+ .convertListToVector(externs.getExternList().get(index).getSupArchList());
+
+ id = new ExternsIdentification(arg0, arg1, arg2, arg3);
+ vid.addExterns(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getExternsName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleExterns() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inExterns The input data of ExternsDocument.Externs
+
+ **/
+ public ModuleExterns(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getExterns());
+ this.setVisible(true);
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelC_Name.setText("Value");
+ jLabelPcdIsDriver = new JLabel();
+ jLabelPcdIsDriver.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelPcdIsDriver.setText("Pcd Is Driver");
+ jLabelName = new JLabel();
+ jLabelName.setText("Choose Type");
+ jLabelName.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
+
+ jContentPane.add(jLabelName, null);
+ jContentPane.add(getJComboBoxType(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(jLabelPcdIsDriver, null);
+ jContentPane.add(getJComboBoxPcdIsDriver(), null);
+ jContentPane.add(jLabelC_Name, null);
+ jContentPane.add(getJTextFieldC_Name(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type and Externs type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(this.jComboBoxType, ed.getVExternTypes());
+ Tools.generateComboBoxByVector(this.jComboBoxPcdIsDriver, ed.getVPcdDriverTypes());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check CName
+ //
+ if (isEmpty(this.jTextFieldC_Name.getText())) {
+ Log.err("Value couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldC_Name.getText())) {
+ if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
+ if (!DataValidation.isSentence(this.jTextFieldC_Name.getText())) {
+ Log.err("Incorrect data type for Specification");
+ return false;
+ }
+ } else {
+ if (!DataValidation.isC_NameType(this.jTextFieldC_Name.getText())) {
+ Log.err("Incorrect data type for C_Name");
+ return false;
+ }
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Externs
+ if exists externs, set the value directly
+ if not exists externs, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.externs = Externs.Factory.newInstance();
+ //
+ // Save PcdIsDriver first
+ //
+ if (!this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(DataType.EMPTY_SELECT_ITEM)) {
+ externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
+ .toString()));
+ }
+
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ //
+ // Save specfication
+ //
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ this.externs.addNewSpecification();
+ this.externs.setSpecificationArray(externs.getSpecificationList().size() - 1,
+ vid.getExterns(index).getName());
+ }
+ } else {
+ //
+ // Save extern
+ //
+ Extern e = Extern.Factory.newInstance();
+
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_MODULE_ENTRY_POINT)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setModuleEntryPoint(vid.getExterns(index).getName());
+ }
+ }
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setModuleUnloadImage(vid.getExterns(index).getName());
+ }
+ }
+
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CONSTRUCTOR)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setConstructor(vid.getExterns(index).getName());
+ }
+ }
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DESTRUCTOR)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setDestructor(vid.getExterns(index).getName());
+ }
+ }
+
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER_BINDING)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setDriverBinding(vid.getExterns(index).getName());
+ }
+ }
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_COMPONENT_NAME)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setComponentName(vid.getExterns(index).getName());
+ }
+ }
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER_CONFIG)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setDriverConfig(vid.getExterns(index).getName());
+ }
+ }
+ if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER_DIAG)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setDriverDiag(vid.getExterns(index).getName());
+ }
+ }
+
+ if (vid.getExterns(index).getType()
+ .equals(EnumerationData.EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setSetVirtualAddressMapCallBack(vid.getExterns(index).getName());
+ }
+ }
+ if (vid.getExterns(index).getType()
+ .equals(EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK)) {
+ if (!isEmpty(vid.getExterns(index).getName())) {
+ e.setExitBootServicesCallBack(vid.getExterns(index).getName());
+ }
+ }
+
+ if (!isEmpty(vid.getExterns(index).getFeatureFlag())) {
+ e.setFeatureFlag(vid.getExterns(index).getFeatureFlag());
+ }
+ if (vid.getExterns(index).getSupArchList() != null
+ && vid.getExterns(index).getSupArchList().size() > 0) {
+ e.setSupArchList(vid.getExterns(index).getSupArchList());
+ }
+
+ this.externs.addNewExtern();
+ this.externs.setExternArray(this.externs.getExternList().size() - 1, e);
+ }
+ }
+ }
+
+ this.msa.setExterns(externs);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Externs", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jComboBoxType, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldC_Name, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private ExternsIdentification getCurrentExterns() {
+ String arg0 = this.jTextFieldC_Name.getText();
+ String arg1 = this.jComboBoxType.getSelectedItem().toString();
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+
+ id = new ExternsIdentification(arg0, arg1, arg2, arg3);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addExterns(getCurrentExterns());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeExterns(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateExterns(getCurrentExterns(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getExterns(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldC_Name.setText(vid.getExterns(intSelectedItemId).getName());
+ this.jComboBoxType.setSelectedItem(vid.getExterns(intSelectedItemId).getType());
+
+ jTextFieldFeatureFlag.setText(vid.getExterns(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getExterns(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getExterns(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ if (arg0.getSource() == this.jComboBoxPcdIsDriver && arg0.getStateChange() == ItemEvent.SELECTED && externs != null) {
+ String s = this.jComboBoxPcdIsDriver.getSelectedItem().toString();
+ if (s.equals(DataType.EMPTY_SELECT_ITEM)) {
+ this.externs.setPcdIsDriver(null);
+ } else {
+ this.externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(s));
+ }
+ this.msa.setExterns(externs);
+ this.omt.setSaved(false);
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
new file mode 100644
index 0000000000..b8d085104b
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
@@ -0,0 +1,771 @@
+/** @file
+
+ The file is used to create, update Guids of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.GuidUsage;
+import org.tianocore.GuidsDocument;
+import org.tianocore.GuidsDocument.Guids;
+import org.tianocore.GuidsDocument.Guids.GuidCNames;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.Guids.GuidsIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Guids.GuidsVector;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+/**
+ The class is used to create, update Guids of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleGuids extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = 6710858997766979803L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelC_Name = null;
+
+ private JComboBox jComboBoxCName = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private GuidsDocument.Guids guids = null;
+
+ private GuidsIdentification id = null;
+
+ private GuidsVector vid = new GuidsVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ /**
+ This method initializes jTextFieldC_Name
+
+ @return javax.swing.JTextField jTextFieldC_Name
+
+ **/
+ private JComboBox getJComboBoxCName() {
+ if (jComboBoxCName == null) {
+ jComboBoxCName = new JComboBox();
+ jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxCName;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ This method initializes jTextFieldFeatureFlag
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Guids");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(Guids inGuids) {
+ init();
+ this.guids = inGuids;
+
+ if (this.guids != null) {
+ if (this.guids.getGuidCNamesList().size() > 0) {
+ for (int index = 0; index < this.guids.getGuidCNamesList().size(); index++) {
+ String arg0 = guids.getGuidCNamesList().get(index).getGuidCName();
+ String arg1 = null;
+ if (guids.getGuidCNamesList().get(index).getUsage() != null) {
+ arg1 = guids.getGuidCNamesList().get(index).getUsage().toString();
+ }
+
+ String arg2 = guids.getGuidCNamesList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools.convertListToVector(guids.getGuidCNamesList().get(index)
+ .getSupArchList());
+ String arg4 = guids.getGuidCNamesList().get(index).getHelpText();
+
+ id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
+ vid.addGuids(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getGuidsName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleGuids() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inGuids The input data of GuidsDocument.Guids
+
+ **/
+ public ModuleGuids(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getGuids());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("C_Name");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
+
+ jContentPane.add(jLabelC_Name, null);
+ jContentPane.add(getJComboBoxCName(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+
+ initFrame();
+
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllGuidDeclarationsFromWorkspace());
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check Name
+ //
+ if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
+ if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
+ Log.err("Incorrect data type for Guid Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Guids
+ if exists guids, set the value directly
+ if not exists guids, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.guids = Guids.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ GuidCNames p = GuidCNames.Factory.newInstance();
+ if (!isEmpty(vid.getGuids(index).getName())) {
+ p.setGuidCName(vid.getGuids(index).getName());
+ }
+ if (!isEmpty(vid.getGuids(index).getUsage())) {
+ p.setUsage(GuidUsage.Enum.forString(vid.getGuids(index).getUsage()));
+ }
+ if (!isEmpty(vid.getGuids(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getGuids(index).getFeatureFlag());
+ }
+ if (vid.getGuids(index).getSupArchList() != null && vid.getGuids(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getGuids(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getGuids(index).getHelp())) {
+ p.setHelpText(vid.getGuids(index).getHelp());
+ }
+ this.guids.addNewGuidCNames();
+ this.guids.setGuidCNamesArray(guids.getGuidCNamesList().size() - 1, p);
+ }
+ }
+
+ this.msa.setGuids(guids);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Guids", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jComboBoxCName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private GuidsIdentification getCurrentGuids() {
+ String arg0 = this.jComboBoxCName.getSelectedItem().toString();
+ String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg4 = this.jTextFieldHelpText.getText();
+
+ id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addGuids(getCurrentGuids());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeGuids(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateGuids(getCurrentGuids(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getGuids(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxCName.setSelectedItem(vid.getGuids(intSelectedItemId).getName());
+ this.jComboBoxUsage.setSelectedItem(vid.getGuids(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getGuids(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getGuids(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getGuids(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getGuids(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java
new file mode 100644
index 0000000000..008ea5d109
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java
@@ -0,0 +1,774 @@
+/** @file
+
+ The file is used to create, update Formset of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.HiiPackageUsage;
+import org.tianocore.HiiPackagesDocument;
+import org.tianocore.HiiPackagesDocument.HiiPackages;
+import org.tianocore.HiiPackagesDocument.HiiPackages.HiiPackage;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.HiiPackages.HiiPackagesIdentification;
+import org.tianocore.frameworkwizard.module.Identification.HiiPackages.HiiPackagesVector;
+
+/**
+ The class is used to create, update Formset of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleHiiPackages extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -6851574146786158116L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelName = null;
+
+ private JTextField jTextFieldName = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private HiiPackagesDocument.HiiPackages hiiPackages = null;
+
+ private HiiPackagesIdentification id = null;
+
+ private HiiPackagesVector vid = new HiiPackagesVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextFieldName
+
+ @return javax.swing.JTextField jTextFieldName
+
+ **/
+ private JTextField getJTextFieldName() {
+ if (jTextFieldName == null) {
+ jTextFieldName = new JTextField();
+ jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldName;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Hii Packages");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(HiiPackages inHiiPackages) {
+ init();
+ this.hiiPackages = inHiiPackages;
+
+ if (this.hiiPackages != null) {
+ if (this.hiiPackages.getHiiPackageList().size() > 0) {
+ for (int index = 0; index < this.hiiPackages.getHiiPackageList().size(); index++) {
+ String arg0 = hiiPackages.getHiiPackageList().get(index).getHiiCName();
+ String arg1 = null;
+ if (hiiPackages.getHiiPackageList().get(index).getUsage() != null) {
+ arg1 = hiiPackages.getHiiPackageList().get(index).getUsage().toString();
+ }
+
+ String arg2 = hiiPackages.getHiiPackageList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools.convertListToVector(hiiPackages.getHiiPackageList().get(index)
+ .getSupArchList());
+ String arg4 = hiiPackages.getHiiPackageList().get(index).getHelpText();
+
+ id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
+ vid.addHiiPackages(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getHiiPackagesName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleHiiPackages() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ *
+ */
+ /**
+ This is the override edit constructor
+
+ @param inFormsets The input data of HiiPackagesDocument.HiiPackages
+
+ **/
+ public ModuleHiiPackages(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getHiiPackages());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldName.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelName = new JLabel();
+ jLabelName.setText("Name");
+ jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
+
+ jContentPane.add(jLabelName, null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJTextFieldName(), null);
+ jContentPane.add(getJComboBoxUsage(), null);
+
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check Hii Package Name
+ //
+ if (isEmpty(this.jTextFieldName.getText())) {
+ Log.err("Hii Package Name Record couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldName.getText())) {
+ if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) {
+ Log.err("Incorrect data type for Hii Package Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of hiiPackages
+ if exists formset, set the value directly
+ if not exists formset, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.hiiPackages = HiiPackages.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ HiiPackage p = HiiPackage.Factory.newInstance();
+ if (!isEmpty(vid.getHiiPackages(index).getName())) {
+ p.setHiiCName(vid.getHiiPackages(index).getName());
+ }
+ if (!isEmpty(vid.getHiiPackages(index).getUsage())) {
+ p.setUsage(HiiPackageUsage.Enum.forString(vid.getHiiPackages(index).getUsage()));
+ }
+ if (!isEmpty(vid.getHiiPackages(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getHiiPackages(index).getFeatureFlag());
+ }
+ if (vid.getHiiPackages(index).getSupArchList() != null
+ && vid.getHiiPackages(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getHiiPackages(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getHiiPackages(index).getHelp())) {
+ p.setHelpText(vid.getHiiPackages(index).getHelp());
+ }
+ this.hiiPackages.addNewHiiPackage();
+ this.hiiPackages.setHiiPackageArray(hiiPackages.getHiiPackageList().size() - 1, p);
+ }
+ }
+
+ this.msa.setHiiPackages(hiiPackages);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update hiiPackages", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jTextFieldName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private HiiPackagesIdentification getCurrentHiiPackages() {
+ String arg0 = this.jTextFieldName.getText();
+ String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg4 = this.jTextFieldHelpText.getText();
+
+ id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addHiiPackages(getCurrentHiiPackages());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeHiiPackages(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateHiiPackages(getCurrentHiiPackages(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getHiiPackages(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldName.setText(vid.getHiiPackages(intSelectedItemId).getName());
+ this.jComboBoxUsage.setSelectedItem(vid.getHiiPackages(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getHiiPackages(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getHiiPackages(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getHiiPackages(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getHiiPackages(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java
new file mode 100644
index 0000000000..81f2df92ff
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java
@@ -0,0 +1,795 @@
+/** @file
+
+ The file is used to create, update Hob of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.HobTypes;
+import org.tianocore.HobUsage;
+import org.tianocore.HobsDocument;
+import org.tianocore.HobsDocument.Hobs;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.Hobs.HobsIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Hobs.HobsVector;
+
+/**
+ The class is used to create, update Hob of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleHobs extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -553473437579358325L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabel = null;
+
+ private JTextField jTextFieldC_Name = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JLabel jLabelHobType = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private JComboBox jComboBoxHobType = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private HobsDocument.Hobs hobs = null;
+
+ private HobsIdentification id = null;
+
+ private HobsVector vid = new HobsVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextField
+
+ @return javax.swing.JTextField jTextFieldC_Name
+
+ **/
+ private JTextField getJTextFieldC_Name() {
+ if (jTextFieldC_Name == null) {
+ jTextFieldC_Name = new JTextField();
+ jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldC_Name;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ This method initializes jComboBoxHobType
+
+ @return javax.swing.JComboBox jComboBoxHobType
+
+ **/
+ private JComboBox getJComboBoxHobType() {
+ if (jComboBoxHobType == null) {
+ jComboBoxHobType = new JComboBox();
+ jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxHobType;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 135, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Hobs");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(Hobs inHobs) {
+ init();
+ this.hobs = inHobs;
+
+ if (this.hobs != null) {
+ if (this.hobs.getHobTypesList().size() > 0) {
+ for (int index = 0; index < this.hobs.getHobTypesList().size(); index++) {
+ String arg0 = hobs.getHobTypesList().get(index).getHobGuidCName();
+ String arg1 = null;
+ if (hobs.getHobTypesList().get(index).getHobType() != null) {
+ arg1 = hobs.getHobTypesList().get(index).getHobType().toString();
+ }
+ String arg2 = null;
+ if (hobs.getHobTypesList().get(index).getUsage() != null) {
+ arg2 = hobs.getHobTypesList().get(index).getUsage().toString();
+ }
+
+ String arg3 = hobs.getHobTypesList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(hobs.getHobTypesList().get(index).getSupArchList());
+ String arg5 = hobs.getHobTypesList().get(index).getHelpText();
+ id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addHobs(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getHobsName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleHobs() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inHobs The input data of HobsDocument.Hobs
+
+ **/
+ public ModuleHobs(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getHobs());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldC_Name.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ this.jComboBoxHobType.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ public JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelHobType = new JLabel();
+ jLabelHobType.setText("Hob Type");
+ jLabelHobType.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabel = new JLabel();
+ jLabel.setText("C_Name");
+ jLabel.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 495));
+
+ jContentPane.add(jLabel, null);
+ jContentPane.add(getJTextFieldC_Name(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(jLabelHobType, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jContentPane.add(getJComboBoxHobType(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jContentPane.add(jStarLabel1, null);
+
+ jContentPane.add(jLabelArch, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type and Hob type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());
+ Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check Name
+ //
+ if (isEmpty(this.jTextFieldC_Name.getText())) {
+ Log.err("Hob Name couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldC_Name.getText())) {
+ if (!DataValidation.isC_NameType(this.jTextFieldC_Name.getText())) {
+ Log.err("Incorrect data type for Hob Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Hobs
+ if exists hobs, set the value directly
+ if not exists hobs, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.hobs = Hobs.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ HobsDocument.Hobs.HobTypes p = HobsDocument.Hobs.HobTypes.Factory.newInstance();
+ if (!isEmpty(vid.getHobs(index).getName())) {
+ p.setHobGuidCName(vid.getHobs(index).getName());
+ }
+ if (!isEmpty(vid.getHobs(index).getUsage())) {
+ p.setUsage(HobUsage.Enum.forString(vid.getHobs(index).getUsage()));
+ }
+ if (!isEmpty(vid.getHobs(index).getType())) {
+ p.setHobType(HobTypes.Enum.forString(vid.getHobs(index).getType()));
+ }
+ if (!isEmpty(vid.getHobs(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getHobs(index).getFeatureFlag());
+ }
+ if (vid.getHobs(index).getSupArchList() != null && vid.getHobs(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getHobs(index).getSupArchList());
+ }
+ this.hobs.addNewHobTypes();
+ this.hobs.setHobTypesArray(hobs.getHobTypesList().size() - 1, p);
+ }
+ }
+
+ this.msa.setHobs(hobs);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.err("Update Hobs", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jTextFieldC_Name, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxHobType, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private HobsIdentification getCurrentHobs() {
+ String arg0 = this.jTextFieldC_Name.getText();
+ String arg1 = this.jComboBoxHobType.getSelectedItem().toString();
+ String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg3 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg5 = this.jTextFieldHelpText.getText();
+ id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addHobs(getCurrentHobs());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeHobs(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateHobs(getCurrentHobs(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getHobs(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldC_Name.setText(vid.getHobs(intSelectedItemId).getName());
+ this.jComboBoxHobType.setSelectedItem(vid.getHobs(intSelectedItemId).getType());
+ this.jComboBoxUsage.setSelectedItem(vid.getHobs(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getHobs(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getHobs(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getHobs(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getHobs(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
new file mode 100644
index 0000000000..6b060cb3ed
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
@@ -0,0 +1,952 @@
+/** @file
+
+ The file is used to create, update Library Class Definition of MSA/MBD 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.module.ui;
+
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.LibraryClassDefinitionsDocument;
+import org.tianocore.LibraryUsage;
+import org.tianocore.ModuleSurfaceAreaDocument;
+import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
+import org.tianocore.LibraryClassDocument.LibraryClass;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.LibraryClass.LibraryClassIdentification;
+import org.tianocore.frameworkwizard.module.Identification.LibraryClass.LibraryClassVector;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+/**
+ The class is used to create, update Library Class Definition of MSA/MBD file
+ It extends IInternalFrame
+
+ **/
+public class ModuleLibraryClassDefinitions extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -1743248695411382857L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JComboBox jComboBoxLibraryClassName = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JLabel jLabelLibraryClassName = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelRecommendedInstanceVersion = null;
+
+ private JTextField jTextFieldRecommendedInstanceVersion = null;
+
+ private JLabel jLabelRecommendedInstanceGuid = null;
+
+ private JTextField jTextFieldRecommendedInstanceGuid = null;
+
+ private JButton jButtonGenerateGuid = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JLabel jLabelModuleList = null;
+
+ private JScrollPane jScrollPaneModuleList = null;
+
+ private ICheckBoxList iCheckBoxListModule = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not for UI
+ //
+ private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
+
+ private LibraryClassDefinitions lcd = null;
+
+ private LibraryClassVector vLibraryClass = new LibraryClassVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ private Vector<String> vLib = new Vector<String>();
+
+ private int intSelectedItemId = 0;
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ private LibraryClassIdentification lcid = null;
+
+ private OpeningModuleType omt = null;
+
+ /**
+ This method initializes jComboBoxSelect
+
+ @return javax.swing.JComboBox jComboBoxSelect
+
+ **/
+ private JComboBox getJComboBoxLibraryClassName() {
+ if (jComboBoxLibraryClassName == null) {
+ jComboBoxLibraryClassName = new JComboBox();
+ jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20));
+ jComboBoxLibraryClassName.setEnabled(true);
+ }
+ return jComboBoxLibraryClassName;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxUsage.setPreferredSize(new Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 330, 210, 20));
+ jComboBoxList.setPreferredSize(new Dimension(210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 330, 80, 20));
+ jButtonAdd.setPreferredSize(new Dimension(80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 330, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.setPreferredSize(new Dimension(80, 20));
+ jButtonRemove.addActionListener(this);
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 330, 80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.setPreferredSize(new Dimension(80, 20));
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 355, 465, 100));
+ jScrollPaneList.setPreferredSize(new Dimension(465, 260));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ * This method initializes jTextFieldRecommendedInstanceVersion
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldRecommendedInstanceVersion() {
+ if (jTextFieldRecommendedInstanceVersion == null) {
+ jTextFieldRecommendedInstanceVersion = new JTextField();
+ jTextFieldRecommendedInstanceVersion.setPreferredSize(new java.awt.Dimension(260, 20));
+ jTextFieldRecommendedInstanceVersion.setSize(new java.awt.Dimension(260, 20));
+ jTextFieldRecommendedInstanceVersion.setLocation(new java.awt.Point(220, 85));
+ }
+ return jTextFieldRecommendedInstanceVersion;
+ }
+
+ /**
+ * This method initializes jTextFieldRecommendedInstanceGuid
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldRecommendedInstanceGuid() {
+ if (jTextFieldRecommendedInstanceGuid == null) {
+ jTextFieldRecommendedInstanceGuid = new JTextField();
+ jTextFieldRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(220, 110, 190, 20));
+ jTextFieldRecommendedInstanceGuid.setPreferredSize(new java.awt.Dimension(190, 20));
+ }
+ return jTextFieldRecommendedInstanceGuid;
+ }
+
+ /**
+ * This method initializes jButtonGenerateGuid
+ *
+ * @return javax.swing.JButton
+ */
+ private JButton getJButtonGenerateGuid() {
+ if (jButtonGenerateGuid == null) {
+ jButtonGenerateGuid = new JButton();
+ jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 110, 65, 20));
+ jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
+ jButtonGenerateGuid.setText("GEN");
+ jButtonGenerateGuid.addActionListener(this);
+ }
+ return jButtonGenerateGuid;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupModuleList() {
+ if (iCheckBoxListModule == null) {
+ iCheckBoxListModule = new ICheckBoxList();
+ }
+ return iCheckBoxListModule;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 160, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jScrollPaneModuleList
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneModuleList() {
+ if (jScrollPaneModuleList == null) {
+ jScrollPaneModuleList = new JScrollPane();
+ jScrollPaneModuleList.setBounds(new java.awt.Rectangle(160, 245, 320, 80));
+ jScrollPaneModuleList.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneModuleList.setViewportView(getICheckBoxListSupModuleList());
+ }
+ return jScrollPaneModuleList;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleLibraryClassDefinitions() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param
+
+ **/
+ public ModuleLibraryClassDefinitions(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ initLibraryClass();
+ init(msa.getLibraryClassDefinitions());
+ this.setVisible(true);
+ }
+
+ // private void initLibraryClass(MsaHeaderDocument.MsaHeader msaHeader) {
+ // Enum e = msaHeader.getModuleType();
+ // if (e == ModuleTypeDef.BASE) {
+ // vLib = ed.getVLibClassDefBase();
+ // } else if (e == ModuleTypeDef.PEI_CORE) {
+ // vLib = ed.getVLibClassDefPei();
+ // } else if (e == ModuleTypeDef.PEIM) {
+ // vLib = ed.getVLibClassDefPeim();
+ // } else if (e == ModuleTypeDef.DXE_CORE) {
+ // vLib = ed.getVLibClassDefDxeCore();
+ // } else if (e == ModuleTypeDef.DXE_DRIVER) {
+ // vLib = ed.getVLibClassDefDxeDriver();
+ // } else if (e == ModuleTypeDef.DXE_SMM_DRIVER) {
+ // vLib = ed.getVLibClassDefDxeSmmDriver();
+ // } else if (e == ModuleTypeDef.UEFI_DRIVER) {
+ // vLib = ed.getVLibClassDefUefiDriver();
+ // } else {
+ // //vLib = ed.getVLibClassDef();
+ // }
+ // }
+
+ /**
+
+ **/
+ private void initLibraryClass() {
+ vLib = wt.getAllLibraryClassDefinitionsFromWorkspace();
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inLibraryClassDefinitions The input data of LibraryClassDefinitionsDocument.LibraryClassDefinitions
+
+ **/
+ private void init(LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) {
+ init();
+ this.lcd = inLibraryClassDefinitions;
+ if (this.lcd != null) {
+ if (this.lcd.getLibraryClassList().size() > 0) {
+ for (int index = 0; index < this.lcd.getLibraryClassList().size(); index++) {
+ String name = lcd.getLibraryClassList().get(index).getKeyword();
+ String usage = null;
+ if (lcd.getLibraryClassList().get(index).getUsage() != null) {
+ usage = lcd.getLibraryClassList().get(index).getUsage().toString();
+ }
+ String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();
+ String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();
+ String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();
+ Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
+ .getSupArchList());
+ Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
+ .getSupModuleList());
+ String help = lcd.getLibraryClassList().get(index).getHelpText();
+ LibraryClassIdentification lcid = new LibraryClassIdentification(name, usage, version, guid, arch,
+ featureFlag, module, help);
+ vLibraryClass.addLibraryClass(lcid);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vLibraryClass.getLibraryClassName());
+ reloadListArea();
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Library Class Definitions");
+ this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jComboBoxLibraryClassName.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
+ jLabelHelpText.setText("Help Text");
+ jLabelModuleList = new JLabel();
+ jLabelModuleList.setBounds(new java.awt.Rectangle(15, 245, 140, 20));
+ jLabelModuleList.setText("Sup Module List");
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 160, 140, 20));
+ jLabelArch.setText("Sup Arch List");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelRecommendedInstanceGuid = new JLabel();
+ jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20));
+ jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");
+ jLabelRecommendedInstanceVersion = new JLabel();
+ jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(15, 85, 200, 20));
+ jLabelRecommendedInstanceVersion.setText("Recommended Instance Version");
+ jLabelLibraryClassName = new JLabel();
+ jLabelLibraryClassName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelLibraryClassName.setText("Library Class Name");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelUsage.setText("Usage");
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 465));
+
+ jContentPane.add(getJComboBoxLibraryClassName(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jContentPane.add(jLabelLibraryClassName, null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(jLabelRecommendedInstanceVersion, null);
+ jContentPane.add(getJTextFieldRecommendedInstanceVersion(), null);
+ jContentPane.add(jLabelRecommendedInstanceGuid, null);
+ jContentPane.add(getJTextFieldRecommendedInstanceGuid(), null);
+ jContentPane.add(getJButtonGenerateGuid(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jLabelModuleList, null);
+ jContentPane.add(getJScrollPaneModuleList(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes all existing libraries and usage types
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxLibraryClassName, vLib);
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ updateForList();
+ }
+ if (arg0.getSource() == jButtonGenerateGuid) {
+ this.jTextFieldRecommendedInstanceGuid.setText(Tools.generateUuidString());
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check LibraryClass
+ //
+ if (this.jComboBoxLibraryClassName.getSelectedItem() == null) {
+ Log.err("No Library Class can be added");
+ return false;
+ }
+ if (!DataValidation.isLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
+ Log.err("Incorrect data type for Library Class");
+ return false;
+ }
+
+ //
+ // Check RecommendedInstanceVersion
+ //
+ if (!isEmpty(this.jTextFieldRecommendedInstanceVersion.getText())) {
+ if (!DataValidation.isRecommendedInstanceVersion(this.jTextFieldRecommendedInstanceVersion.getText())) {
+ Log.err("Incorrect data type for Recommended Instance Version");
+ return false;
+ }
+ }
+
+ //
+ // Check RecommendedInstanceGuid
+ //
+ if (!isEmpty(this.jTextFieldRecommendedInstanceGuid.getText())) {
+ if (!DataValidation.isGuid(this.jTextFieldRecommendedInstanceGuid.getText())) {
+ Log.err("Incorrect data type for Recommended Instance Guid");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ if (this.vLibraryClass.findLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString()) > -1) {
+ Log.err("The Library Class has been added already!");
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ Save all components of Mbd Header
+ if exists mbdHeader, set the value directly
+ if not exists mbdHeader, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int intLibraryCount = this.vLibraryClass.size();
+
+ lcd = LibraryClassDefinitions.Factory.newInstance();
+ if (intLibraryCount > 0) {
+ for (int index = 0; index < intLibraryCount; index++) {
+ LibraryClass mLibraryClass = LibraryClass.Factory.newInstance();
+
+ mLibraryClass.setKeyword(vLibraryClass.getLibraryClass(index).getLibraryClassName());
+ mLibraryClass
+ .setUsage(LibraryUsage.Enum.forString(vLibraryClass.getLibraryClass(index).getUsage()));
+ if (!isEmpty(vLibraryClass.getLibraryClass(index).getRecommendedInstanceVersion())) {
+ mLibraryClass.setRecommendedInstanceVersion(vLibraryClass.getLibraryClass(index)
+ .getRecommendedInstanceVersion());
+ }
+ if (!isEmpty(vLibraryClass.getLibraryClass(index).getRecommendedInstanceGuid())) {
+ mLibraryClass.setRecommendedInstanceGuid(vLibraryClass.getLibraryClass(index)
+ .getRecommendedInstanceGuid());
+ }
+ if (!isEmpty(vLibraryClass.getLibraryClass(index).getFeatureFlag())) {
+ mLibraryClass.setFeatureFlag(vLibraryClass.getLibraryClass(index).getFeatureFlag());
+ }
+ if (vLibraryClass.getLibraryClass(index).getSupArchList() != null
+ && vLibraryClass.getLibraryClass(index).getSupArchList().size() > 0) {
+ mLibraryClass.setSupArchList(vLibraryClass.getLibraryClass(index).getSupArchList());
+ }
+ if (!isEmpty(vLibraryClass.getLibraryClass(index).getHelp())) {
+ mLibraryClass.setHelpText(vLibraryClass.getLibraryClass(index).getHelp());
+ }
+
+ this.lcd.addNewLibraryClass();
+ this.lcd.setLibraryClassArray(index, mLibraryClass);
+ }
+ }
+
+ if (msa.getLibraryClassDefinitions() == null) {
+ this.msa.addNewLibraryClassDefinitions();
+ }
+ this.msa.setLibraryClassDefinitions(this.lcd);
+
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Library Class Definitions", e.getMessage());
+ }
+ }
+
+ private LibraryClassIdentification getCurrentLibraryClass() {
+ String name = this.jComboBoxLibraryClassName.getSelectedItem().toString();
+ String usage = this.jComboBoxUsage.getSelectedItem().toString();
+ String version = this.jTextFieldRecommendedInstanceVersion.getText();
+ String guid = this.jTextFieldRecommendedInstanceGuid.getText();
+ String featureFlag = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arch = this.iCheckBoxListArch.getAllCheckedItemsString();
+ Vector<String> module = this.iCheckBoxListModule.getAllCheckedItemsString();
+ String help = this.jTextFieldHelpText.getText();
+ lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag, module, help);
+ return lcid;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vLibraryClass.size();
+
+ vLibraryClass.addLibraryClass(getCurrentLibraryClass());
+
+ jComboBoxList.addItem(lcid.getLibraryClassName());
+ jComboBoxList.setSelectedItem(lcid.getLibraryClassName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vLibraryClass.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vLibraryClass.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vLibraryClass.removeLibraryClass(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vLibraryClass.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vLibraryClass.updateLibraryClass(getCurrentLibraryClass(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vLibraryClass.size(); index++) {
+ jComboBoxList.addItem(vLibraryClass.getLibraryClass(index).getLibraryClassName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vLibraryClass.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxLibraryClassName.setSelectedItem(vLibraryClass.getLibraryClass(intSelectedItemId)
+ .getLibraryClassName());
+ this.jComboBoxUsage.setSelectedItem(vLibraryClass.getLibraryClass(intSelectedItemId).getUsage());
+ this.jTextFieldRecommendedInstanceVersion.setText(vLibraryClass.getLibraryClass(intSelectedItemId)
+ .getRecommendedInstanceVersion());
+ this.jTextFieldRecommendedInstanceGuid.setText(vLibraryClass.getLibraryClass(intSelectedItemId)
+ .getRecommendedInstanceGuid());
+ this.jTextFieldFeatureFlag.setText(vLibraryClass.getLibraryClass(intSelectedItemId).getFeatureFlag());
+ this.iCheckBoxListArch.setAllItemsUnchecked();
+ this.iCheckBoxListArch.initCheckedItem(true, vLibraryClass.getLibraryClass(intSelectedItemId)
+ .getSupArchList());
+ this.iCheckBoxListModule.setAllItemsUnchecked();
+ this.iCheckBoxListModule.initCheckedItem(true, vLibraryClass.getLibraryClass(intSelectedItemId)
+ .getSupModuleList());
+ this.jTextFieldHelpText.setText(vLibraryClass.getLibraryClass(intSelectedItemId).getHelp());
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vLibraryClass.size(); index++) {
+ strListItem = strListItem + vLibraryClass.getLibraryClass(index).getLibraryClassName()
+ + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(this.jComboBoxLibraryClassName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldRecommendedInstanceVersion, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldRecommendedInstanceGuid, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneModuleList, intCurrentWidth, intPreferredWidth);
+
+ relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
+
+ resizeComponentWidth(this.jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(this.jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+ relocateComponentX(this.jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(this.jButtonRemove, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(this.jButtonUpdate, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
new file mode 100644
index 0000000000..f2cd162245
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
@@ -0,0 +1,862 @@
+/** @file
+
+ The file is used to create, update PCD of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.PcdCodedDocument;
+import org.tianocore.PcdItemTypes;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.PcdCodedDocument.PcdCoded;
+import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.PcdCoded.PcdCodedIdentification;
+import org.tianocore.frameworkwizard.module.Identification.PcdCoded.PcdCodedVector;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+/**
+ The class is used to create, update PCD of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModulePCDs extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = 2227717658188438696L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelItemType = null;
+
+ private JLabel jLabelC_Name = null;
+
+ private JComboBox jComboBoxItemType = null;
+
+ private JComboBox jComboBoxCName = null;
+
+ private JLabel jLabelDefaultValue = null;
+
+ private JTextField jTextFieldDefaultValue = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private StarLabel jStarLabel3 = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JLabel jLabelTokenSpaceGuid = null;
+
+ private JTextField jTextFieldTokenSpaceGuid = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private PcdCodedDocument.PcdCoded pcds = null;
+
+ private PcdCodedIdentification id = null;
+
+ private PcdCodedVector vid = new PcdCodedVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ /**
+ This method initializes jComboBoxItemType
+
+ @return javax.swing.JComboBox jComboBoxItemType
+
+ **/
+ private JComboBox getJComboBoxItemType() {
+ if (jComboBoxItemType == null) {
+ jComboBoxItemType = new JComboBox();
+ jComboBoxItemType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxItemType.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxItemType;
+ }
+
+ /**
+ This method initializes jTextFieldC_Name
+
+ @return javax.swing.JTextField jTextFieldC_Name
+
+ **/
+ private JComboBox getJComboBoxCName() {
+ if (jComboBoxCName == null) {
+ jComboBoxCName = new JComboBox();
+ jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxCName;
+ }
+
+ /**
+ This method initializes jTextFieldDefaultValue
+
+ @return javax.swing.JTextField jTextFieldDefaultValue
+
+ **/
+ private JTextField getJTextFieldDefaultValue() {
+ if (jTextFieldDefaultValue == null) {
+ jTextFieldDefaultValue = new JTextField();
+ jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldDefaultValue;
+ }
+
+ /**
+ * This method initializes jTextFieldHelpText
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 245, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 245, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 245, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 245, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 270, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ * This method initializes jTextFieldTokenSpaceGuid
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldTokenSpaceGuid() {
+ if (jTextFieldTokenSpaceGuid == null) {
+ jTextFieldTokenSpaceGuid = new JTextField();
+ jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldTokenSpaceGuid.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldTokenSpaceGuid;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 160, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Pcd Coded");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(PcdCoded inPcdCodeds) {
+ init();
+ this.pcds = inPcdCodeds;
+
+ if (this.pcds != null) {
+ if (this.pcds.getPcdEntryList().size() > 0) {
+ for (int index = 0; index < this.pcds.getPcdEntryList().size(); index++) {
+ String arg0 = pcds.getPcdEntryList().get(index).getCName();
+ String arg1 = pcds.getPcdEntryList().get(index).getTokenSpaceGuidCName();
+
+
+ String arg2 = pcds.getPcdEntryList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools.convertListToVector(pcds.getPcdEntryList().get(index).getSupArchList());
+
+ String arg4 = pcds.getPcdEntryList().get(index).getDefaultValue();
+ String arg5 = pcds.getPcdEntryList().get(index).getHelpText();
+ String arg6 = null;
+ if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) {
+ arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString();
+ }
+
+ id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ vid.addPcdCoded(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getPcdCodedName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModulePCDs() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inPcds The input data of PCDsDocument.PCDs
+
+ **/
+ public ModulePCDs(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getPcdCoded());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldDefaultValue.setEnabled(!isView);
+ this.jComboBoxItemType.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 160, 140, 20));
+ jLabelArch.setText("Sup Arch List");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelTokenSpaceGuid = new JLabel();
+ jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelTokenSpaceGuid.setText("Token Space C_Name");
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 137, 19));
+ jLabelHelpText.setText("Help Text");
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("C_Name");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelDefaultValue = new JLabel();
+ jLabelDefaultValue.setText("Default Value");
+ jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelItemType = new JLabel();
+ jLabelItemType.setText("Item Type");
+ jLabelItemType.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 520));
+
+ jContentPane.add(jLabelItemType, null);
+ jContentPane.add(jLabelC_Name, null);
+ jContentPane.add(getJComboBoxCName(), null);
+ jContentPane.add(jLabelDefaultValue, null);
+ jContentPane.add(getJTextFieldDefaultValue(), null);
+ jContentPane.add(getJComboBoxItemType(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+ jStarLabel3 = new StarLabel();
+ jStarLabel3.setLocation(new java.awt.Point(0, 110));
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jStarLabel3, null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(jLabelTokenSpaceGuid, null);
+ jContentPane.add(getJTextFieldTokenSpaceGuid(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type, Item type and Datum type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPcdDeclarationsFromWorkspace());
+ Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check C_Name
+ //
+ if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
+ if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
+ Log.err("Incorrect data type for C_Name");
+ return false;
+ }
+ }
+
+ //
+ // Check TokenSpaceGuid
+ //
+ if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) {
+ if (!DataValidation.isGuid(this.jTextFieldTokenSpaceGuid.getText())) {
+ Log.err("Incorrect data type for Token Space C_Name");
+ return false;
+ }
+ }
+
+ //
+ // Check DefaultValue
+ //
+ if (!isEmpty(this.jTextFieldDefaultValue.getText())) {
+ if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue.getText())) {
+ Log.err("Incorrect data type for Default Value");
+ return false;
+ }
+ }
+
+ //
+ // Check HelpText
+ //
+ if (isEmpty(this.jTextFieldHelpText.getText())) {
+ Log.err("Help Text couldn't be empty");
+ return false;
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of PCDs
+ if exists pcds, set the value directly
+ if not exists pcds, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.pcds = PcdCoded.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ PcdEntry p = PcdEntry.Factory.newInstance();
+ if (!isEmpty(vid.getPcdCoded(index).getName())) {
+ p.setCName(vid.getPcdCoded(index).getName());
+ }
+ if (!isEmpty(vid.getPcdCoded(index).getGuid())) {
+ p.setTokenSpaceGuidCName(vid.getPcdCoded(index).getGuid());
+ }
+ if (!isEmpty(vid.getPcdCoded(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getPcdCoded(index).getFeatureFlag());
+ }
+ if (vid.getPcdCoded(index).getSupArchList() != null && vid.getPcdCoded(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getPcdCoded(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getPcdCoded(index).getValue())) {
+ p.setDefaultValue(vid.getPcdCoded(index).getValue());
+ }
+ if (!isEmpty(vid.getPcdCoded(index).getHelp())) {
+ p.setHelpText(vid.getPcdCoded(index).getHelp());
+ }
+ if (!isEmpty(vid.getPcdCoded(index).getType())) {
+ p.setPcdItemType(PcdItemTypes.Enum.forString(vid.getPcdCoded(index).getType()));
+ }
+ this.pcds.addNewPcdEntry();
+ this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p);
+ }
+ }
+
+ this.msa.setPcdCoded(pcds);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Hobs", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jComboBoxCName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldTokenSpaceGuid, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxItemType, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldDefaultValue, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private PcdCodedIdentification getCurrentPcdCoded() {
+ String arg0 = this.jComboBoxCName.getSelectedItem().toString();
+ String arg1 = this.jTextFieldTokenSpaceGuid.getText();
+
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+
+ String arg4 = this.jTextFieldDefaultValue.getText();
+ String arg5 = this.jTextFieldHelpText.getText();
+ String arg6 = this.jComboBoxItemType.getSelectedItem().toString();
+ id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addPcdCoded(getCurrentPcdCoded());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removePcdCoded(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updatePcdCoded(getCurrentPcdCoded(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getPcdCoded(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxCName.setSelectedItem(vid.getPcdCoded(intSelectedItemId).getName());
+ this.jTextFieldTokenSpaceGuid.setText(vid.getPcdCoded(intSelectedItemId).getGuid());
+
+ this.jTextFieldDefaultValue.setText(vid.getPcdCoded(intSelectedItemId).getValue());
+ this.jTextFieldHelpText.setText(vid.getPcdCoded(intSelectedItemId).getHelp());
+ this.jComboBoxItemType.setSelectedItem(vid.getPcdCoded(intSelectedItemId).getType());
+
+ jTextFieldFeatureFlag.setText(vid.getPcdCoded(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getPcdCoded(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getPcdCoded(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java
new file mode 100644
index 0000000000..beefb879da
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java
@@ -0,0 +1,827 @@
+/** @file
+
+ The file is used to create, update Include of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.PackageDependenciesDocument;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.PackageDependenciesDocument.PackageDependencies;
+import org.tianocore.PackageDependenciesDocument.PackageDependencies.Package;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.PackageDependencies.PackageDependenciesIdentification;
+import org.tianocore.frameworkwizard.module.Identification.PackageDependencies.PackageDependenciesVector;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+/**
+ The class is used to create, update Include of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModulePackageDependencies extends IInternalFrame implements ItemListener {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = 3465193035145152131L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelPackageName = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private JComboBox jComboBoxPackageName = null;
+
+ private JLabel jLabelPackageGuid = null;
+
+ private JTextField jTextFieldPackageGuid = null;
+
+ private JButton jButtonGenerateGuid = null;
+
+ private JLabel jLabelPackageVersion = null;
+
+ private JTextField jTextFieldPackageVersion = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JLabel jLabelArch = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private PackageDependenciesIdentification id = null;
+
+ private PackageDependenciesVector vid = new PackageDependenciesVector();
+
+ private PackageDependenciesDocument.PackageDependencies packageDependencies = null;
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ private Vector<PackageIdentification> vPackage = wt.getAllPackages();
+
+ /**
+ * This method initializes jComboBoxPackageName
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxPackageName() {
+ if (jComboBoxPackageName == null) {
+ jComboBoxPackageName = new JComboBox();
+ jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");
+ jComboBoxPackageName.addItemListener(this);
+ }
+ return jComboBoxPackageName;
+ }
+
+ /**
+ * This method initializes jTextFieldPackageGuid
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldPackageGuid() {
+ if (jTextFieldPackageGuid == null) {
+ jTextFieldPackageGuid = new JTextField();
+ jTextFieldPackageGuid.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jTextFieldPackageGuid.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldPackageGuid.setEditable(false);
+ }
+ return jTextFieldPackageGuid;
+ }
+
+ /**
+ * This method initializes jButtonGenerateGuid
+ *
+ * @return javax.swing.JButton
+ */
+ private JButton getJButtonGenerateGuid() {
+ if (jButtonGenerateGuid == null) {
+ jButtonGenerateGuid = new JButton();
+ jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));
+ jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
+ jButtonGenerateGuid.setText("GEN");
+ jButtonGenerateGuid.addActionListener(this);
+ jButtonGenerateGuid.setVisible(false);
+ }
+ return jButtonGenerateGuid;
+ }
+
+ /**
+ * This method initializes jTextFieldPackageVersion
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldPackageVersion() {
+ if (jTextFieldPackageVersion == null) {
+ jTextFieldPackageVersion = new JTextField();
+ jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldPackageVersion
+ .setToolTipText("If this module depends on a specific version of a package, enter the package version here. If the module can use the latest version that does not break backward compatibility, leave this field blank");
+ }
+ return jTextFieldPackageVersion;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Includes");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(PackageDependencies inPackageDependencies) {
+ init();
+ this.packageDependencies = inPackageDependencies;
+
+ if (this.packageDependencies != null) {
+ if (this.packageDependencies.getPackageList().size() > 0) {
+ for (int index = 0; index < this.packageDependencies.getPackageList().size(); index++) {
+ String arg0 = "";
+ String arg1 = packageDependencies.getPackageList().get(index).getPackageVersion();
+ String arg2 = packageDependencies.getPackageList().get(index).getPackageGuid();
+ //
+ // If no guid, skip current item
+ //
+ if (arg2 == null) {
+ continue;
+ }
+ for (int indexJ = 0; indexJ < this.vPackage.size(); indexJ++) {
+ if (vPackage.get(indexJ).getGuid().equals(arg2)) {
+ arg0 = vPackage.get(indexJ).getName();
+ }
+ }
+ String arg3 = packageDependencies.getPackageList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(packageDependencies.getPackageList().get(index)
+ .getSupArchList());
+ id = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);
+ vid.addPackageDependencies(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getPackageDependenciesName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModulePackageDependencies() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override constructor
+
+ **/
+ public ModulePackageDependencies(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getPackageDependencies());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jComboBoxPackageName.setEnabled(!isView);
+ this.jButtonAdd.setEnabled(!isView);
+ this.jButtonUpdate.setEnabled(!isView);
+ this.jButtonRemove.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Sup Arch List");
+ jLabelPackageVersion = new JLabel();
+ jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelPackageVersion.setText("Package Version");
+ jLabelPackageGuid = new JLabel();
+ jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelPackageGuid.setText("Package Guid");
+ jLabelPackageName = new JLabel();
+ jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelPackageName.setText("Package Name");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 470));
+
+ jContentPane.add(jLabelPackageName, null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 35));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(getJComboBoxPackageName(), null);
+ jContentPane.add(jLabelPackageGuid, null);
+ jContentPane.add(getJTextFieldPackageGuid(), null);
+ jContentPane.add(getJButtonGenerateGuid(), null);
+ jContentPane.add(jLabelPackageVersion, null);
+ jContentPane.add(getJTextFieldPackageVersion(), null);
+
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJScrollPaneArch(), 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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ This method initializes Usage type, Package type and Arch type
+
+ **/
+ private void initFrame() {
+ EnumerationData ed = new EnumerationData();
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+
+ for (int index = 0; index < vPackage.size(); index++) {
+ jComboBoxPackageName.addItem(vPackage.elementAt(index).getName());
+ }
+ //jComboBoxPackageName.addItemListener(this);
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean check() {
+ return true;
+ }
+
+ /**
+ Data validation for all fields before add current item to Vector
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check PackageGuid
+ //
+ if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
+ if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
+ Log.err("Incorrect data type for Package Guid");
+ return false;
+ }
+ }
+
+ //
+ // Check PackageVersion
+ //
+ if (!isEmpty(this.jTextFieldPackageVersion.getText())) {
+ if (!DataValidation.isVersion(this.jTextFieldPackageVersion.getText())) {
+ Log.err("Incorrect data type for Package Version");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+ /**
+ Save all components of Includes
+ if exists includes, set the value directly
+ if not exists includes, new an instance first
+
+ **/
+ public void save() {
+ try {
+ //
+ //Save as file name
+ //
+ int count = this.vid.size();
+
+ this.packageDependencies = PackageDependencies.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ Package p = Package.Factory.newInstance();
+
+ if (!isEmpty(vid.getPackageDependencies(index).getVersion())) {
+ p.setPackageVersion(vid.getPackageDependencies(index).getVersion());
+ }
+ if (!isEmpty(vid.getPackageDependencies(index).getGuid())) {
+ p.setPackageGuid(vid.getPackageDependencies(index).getGuid());
+ }
+ if (!isEmpty(vid.getPackageDependencies(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getPackageDependencies(index).getFeatureFlag());
+ }
+ if (vid.getPackageDependencies(index).getSupArchList() != null
+ && vid.getPackageDependencies(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getPackageDependencies(index).getSupArchList());
+ }
+
+ this.packageDependencies.addNewPackage();
+ this.packageDependencies.setPackageArray(index, p);
+ }
+ }
+ this.msa.setPackageDependencies(packageDependencies);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.err("Update Package Dependencies", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(this.jComboBoxPackageName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldPackageGuid, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldPackageVersion, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
+ }
+
+ private PackageDependenciesIdentification getCurrentPackageDependencies() {
+ String arg0 = this.jComboBoxPackageName.getSelectedItem().toString();
+ String arg1 = this.jTextFieldPackageVersion.getText();
+ String arg2 = this.jTextFieldPackageGuid.getText();
+
+ String arg3 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ id = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addPackageDependencies(getCurrentPackageDependencies());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removePackageDependencies(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updatePackageDependencies(getCurrentPackageDependencies(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getPackageDependencies(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxPackageName.setSelectedItem(vid.getPackageDependencies(intSelectedItemId).getName());
+ this.jTextFieldPackageVersion.setText(vid.getPackageDependencies(intSelectedItemId).getVersion());
+ this.jTextFieldPackageGuid.setText(vid.getPackageDependencies(intSelectedItemId).getGuid());
+
+ jTextFieldFeatureFlag.setText(vid.getPackageDependencies(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getPackageDependencies(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getPackageDependencies(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ if (arg0.getSource() == this.jComboBoxPackageName && arg0.getStateChange() == ItemEvent.SELECTED) {
+ for (int index = 0; index < vPackage.size(); index++) {
+ if (this.jComboBoxPackageName.getSelectedItem().toString().equals(vPackage.get(index).getName())) {
+ this.jTextFieldPackageGuid.setText(vPackage.get(index).getGuid());
+ }
+ }
+ }
+ }
+
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
new file mode 100644
index 0000000000..941c05acbe
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
@@ -0,0 +1,850 @@
+/** @file
+
+ The file is used to create, update Ppi of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.PPIsDocument;
+import org.tianocore.PpiNotifyUsage;
+import org.tianocore.PpiUsage;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.PPIsDocument.PPIs;
+import org.tianocore.PPIsDocument.PPIs.Ppi;
+import org.tianocore.PPIsDocument.PPIs.PpiNotify;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.Ppis.PpisIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Ppis.PpisVector;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+/**
+ The class is used to create, update Ppi of MSA/MBD file
+ It extends IInternalFrame
+
+ **/
+public class ModulePpis extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -4284901202357037724L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelC_Name = null;
+
+ private JComboBox jComboBoxCName = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private JLabel jLabelPpiType = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JComboBox jComboBoxPpiType = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private PPIsDocument.PPIs ppis = null;
+
+ private PpisIdentification id = null;
+
+ private PpisVector vid = new PpisVector();
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextFieldC_Name
+
+ @return javax.swing.JTextField jTextFieldC_Name
+
+ **/
+ private JComboBox getJComboBoxCName() {
+ if (jComboBoxCName == null) {
+ jComboBoxCName = new JComboBox();
+ jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxCName;
+ }
+
+ /**
+ This method initializes jTextFieldFeatureFlag
+
+ @return javax.swing.JTextField jTextFieldFeatureFlag
+
+ **/
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBox
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBox() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ * This method initializes jComboBoxPpiType
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxPpiType() {
+ if (jComboBoxPpiType == null) {
+ jComboBoxPpiType = new JComboBox();
+ jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxPpiType.addItemListener(this);
+ }
+ return jComboBoxPpiType;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 135, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Ppis");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(PPIs inPpis) {
+ init();
+ this.ppis = inPpis;
+
+ if (this.ppis != null) {
+ if (this.ppis.getPpiList().size() > 0) {
+ for (int index = 0; index < this.ppis.getPpiList().size(); index++) {
+ String arg0 = ppis.getPpiList().get(index).getPpiCName();
+ String arg1 = ed.getVPpiType().get(0);
+ String arg2 = null;
+ if (ppis.getPpiList().get(index).getUsage() != null) {
+ arg2 = ppis.getPpiList().get(index).getUsage().toString();
+ }
+
+ String arg3 = ppis.getPpiList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(ppis.getPpiList().get(index)
+ .getSupArchList());
+ String arg5 = ppis.getPpiList().get(index).getHelpText();
+
+ id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addPpis(id);
+ }
+ }
+ if (this.ppis.getPpiNotifyList().size() > 0) {
+ for (int index = 0; index < this.ppis.getPpiNotifyList().size(); index++) {
+ String arg0 = ppis.getPpiNotifyList().get(index).getPpiNotifyCName();
+ String arg1 = ed.getVPpiType().get(1);
+ String arg2 = null;
+ if (ppis.getPpiNotifyList().get(index).getUsage() != null) {
+ arg2 = ppis.getPpiNotifyList().get(index).getUsage().toString();
+ }
+
+ String arg3 = ppis.getPpiNotifyList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(ppis.getPpiNotifyList().get(index)
+ .getSupArchList());
+ String arg5 = ppis.getPpiNotifyList().get(index).getHelpText();
+
+ id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addPpis(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getPpisName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModulePpis() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inPpis The input data of PPIsDocument.PPIs
+
+ **/
+ public ModulePpis(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getPPIs());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jComboBoxCName.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ this.jTextFieldFeatureFlag.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelPpiType = new JLabel();
+ jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelPpiType.setText("Ppi Type");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("C_Name Type");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 495));
+
+ jContentPane.add(jLabelC_Name, null);
+ jContentPane.add(getJComboBoxCName(), null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBox(), null);
+ jContentPane.add(getJComboBoxPpiType(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(jLabelPpiType, null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ EnumerationData ed = new EnumerationData();
+
+ Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace());
+ Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check Name
+ //
+ if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
+ if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
+ Log.err("Incorrect data type for Ppi/PpiNotify Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of PPIs
+ if exists ppis, set the value directly
+ if not exists ppis, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.ppis = PPIs.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ if (vid.getPpis(index).getType().equals(ed.getVPpiType().get(0))) {
+ Ppi p = Ppi.Factory.newInstance();
+ if (!isEmpty(vid.getPpis(index).getName())) {
+ p.setPpiCName(vid.getPpis(index).getName());
+ }
+ if (!isEmpty(vid.getPpis(index).getUsage())) {
+ p.setUsage(PpiUsage.Enum.forString(vid.getPpis(index).getUsage()));
+ }
+ if (!isEmpty(vid.getPpis(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getPpis(index).getFeatureFlag());
+ }
+ if (vid.getPpis(index).getSupArchList() != null
+ && vid.getPpis(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getPpis(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getPpis(index).getHelp())) {
+ p.setHelpText(vid.getPpis(index).getHelp());
+ }
+ this.ppis.addNewPpi();
+ this.ppis.setPpiArray(ppis.getPpiList().size() - 1, p);
+ }
+ if (vid.getPpis(index).getType().equals(ed.getVPpiType().get(1))) {
+ PpiNotify p = PpiNotify.Factory.newInstance();
+ if (!isEmpty(vid.getPpis(index).getName())) {
+ p.setPpiNotifyCName(vid.getPpis(index).getName());
+ }
+ if (!isEmpty(vid.getPpis(index).getUsage())) {
+ p.setUsage(PpiNotifyUsage.Enum.forString(vid.getPpis(index).getUsage()));
+ }
+ if (!isEmpty(vid.getPpis(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getPpis(index).getFeatureFlag());
+ }
+ if (vid.getPpis(index).getSupArchList() != null
+ && vid.getPpis(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getPpis(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getPpis(index).getHelp())) {
+ p.setHelpText(vid.getPpis(index).getHelp());
+ }
+ this.ppis.addNewPpiNotify();
+ this.ppis.setPpiNotifyArray(ppis.getPpiNotifyList().size() - 1, p);
+ }
+ }
+ }
+
+ this.msa.setPPIs(ppis);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.err("Update Ppis", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jComboBoxPpiType, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxCName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private PpisIdentification getCurrentPpis() {
+ String arg0 = this.jComboBoxCName.getSelectedItem().toString();
+ String arg1 = this.jComboBoxPpiType.getSelectedItem().toString();
+ String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg3 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg5 = this.jTextFieldHelpText.getText();
+
+ id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addPpis(getCurrentPpis());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removePpis(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updatePpis(getCurrentPpis(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getPpis(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxCName.setSelectedItem(vid.getPpis(intSelectedItemId).getName());
+ this.jComboBoxPpiType.setSelectedItem(vid.getPpis(intSelectedItemId).getType());
+ this.jComboBoxUsage.setSelectedItem(vid.getPpis(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getPpis(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getPpis(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getPpis(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getPpis(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ if (arg0.getSource() == this.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) {
+ if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) {
+ Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage());
+ } else {
+ Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiNotifyUsage());
+ }
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
new file mode 100644
index 0000000000..e591292883
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
@@ -0,0 +1,852 @@
+/** @file
+
+ The file is used to create, update Protocol of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.ProtocolNotifyUsage;
+import org.tianocore.ProtocolUsage;
+import org.tianocore.ProtocolsDocument;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.ProtocolsDocument.Protocols;
+import org.tianocore.ProtocolsDocument.Protocols.Protocol;
+import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.Protocols.ProtocolsIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Protocols.ProtocolsVector;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+/**
+ The class is used to create, update Protocol of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleProtocols extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -9084913640747858848L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelC_Name = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JLabel jLabelProtocolType = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JComboBox jComboBoxProtocolType = null;
+
+ private JComboBox jComboBoxCName = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private ProtocolsDocument.Protocols protocols = null;
+
+ private ProtocolsIdentification id = null;
+
+ private ProtocolsVector vid = new ProtocolsVector();
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextFieldFeatureFlag
+
+ @return javax.swing.JTextField jTextFieldFeatureFlag
+
+ **/
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxProtocolUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ * This method initializes jComboBoxProtocolType
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxProtocolType() {
+ if (jComboBoxProtocolType == null) {
+ jComboBoxProtocolType = new JComboBox();
+ jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxProtocolType.addItemListener(this);
+ }
+ return jComboBoxProtocolType;
+ }
+
+ /**
+ * This method initializes jComboBoxCName
+ *
+ * @return javax.swing.JComboBox
+ */
+ private JComboBox getJComboBoxCName() {
+ if (jComboBoxCName == null) {
+ jComboBoxCName = new JComboBox();
+ jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
+
+ }
+ return jComboBoxCName;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 135, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Protocols");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(Protocols inProtocols) {
+ init();
+ this.protocols = inProtocols;
+
+ if (this.protocols != null) {
+ if (this.protocols.getProtocolList().size() > 0) {
+ for (int index = 0; index < this.protocols.getProtocolList().size(); index++) {
+ String arg0 = protocols.getProtocolList().get(index).getProtocolCName();
+ String arg1 = ed.getVProtocolType().get(0);
+ String arg2 = null;
+ if (protocols.getProtocolList().get(index).getUsage() != null) {
+ arg2 = protocols.getProtocolList().get(index).getUsage().toString();
+ }
+
+ String arg3 = protocols.getProtocolList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolList().get(index)
+ .getSupArchList());
+ String arg5 = protocols.getProtocolList().get(index).getHelpText();
+ id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addProtocols(id);
+ }
+ }
+ if (this.protocols.getProtocolNotifyList().size() > 0) {
+ for (int index = 0; index < this.protocols.getProtocolNotifyList().size(); index++) {
+ String arg0 = protocols.getProtocolNotifyList().get(index).getProtocolNotifyCName();
+ String arg1 = ed.getVProtocolType().get(1);
+ String arg2 = null;
+ if (protocols.getProtocolNotifyList().get(index).getUsage() != null) {
+ arg2 = protocols.getProtocolNotifyList().get(index).getUsage().toString();
+ }
+
+ String arg3 = protocols.getProtocolNotifyList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolNotifyList().get(index)
+ .getSupArchList());
+ String arg5 = protocols.getProtocolNotifyList().get(index).getHelpText();
+ id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addProtocols(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getProtocolsName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleProtocols() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inProtocol The input data of ProtocolsDocument.Protocols
+
+ **/
+ public ModuleProtocols(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getProtocols());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jComboBoxUsage.setEnabled(!isView);
+ this.jTextFieldFeatureFlag.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
+ jLabelHelpText.setText("Help Text");
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelArch.setText("Arch Type");
+ jLabelProtocolType = new JLabel();
+ jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelProtocolType.setText("Protocol Type");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("C_Name Type");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 495));
+
+ jContentPane.add(jLabelC_Name, null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxProtocolUsage(), null);
+ jContentPane.add(jLabelProtocolType, null);
+
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+
+ jContentPane.add(getJComboBoxProtocolType(), null);
+ jContentPane.add(getJComboBoxCName(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
+ Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace());
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check Name
+ //
+ if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
+ if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
+ Log.err("Incorrect data type for Protocol/ProtocolNotify Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Protocols
+ if exists protocols, set the value directly
+ if not exists protocols, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.protocols = Protocols.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(0))) {
+ Protocol p = Protocol.Factory.newInstance();
+ if (!isEmpty(vid.getProtocols(index).getName())) {
+ p.setProtocolCName(vid.getProtocols(index).getName());
+ }
+ if (!isEmpty(vid.getProtocols(index).getUsage())) {
+ p.setUsage(ProtocolUsage.Enum.forString(vid.getProtocols(index).getUsage()));
+ }
+ if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());
+ }
+ if (vid.getProtocols(index).getSupArchList() != null
+ && vid.getProtocols(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getProtocols(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getProtocols(index).getHelp())) {
+ p.setHelpText(vid.getProtocols(index).getHelp());
+ }
+ this.protocols.addNewProtocol();
+ this.protocols.setProtocolArray(protocols.getProtocolList().size() - 1, p);
+ }
+ if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(1))) {
+ ProtocolNotify p = ProtocolNotify.Factory.newInstance();
+ if (!isEmpty(vid.getProtocols(index).getName())) {
+ p.setProtocolNotifyCName(vid.getProtocols(index).getName());
+ }
+ if (!isEmpty(vid.getProtocols(index).getUsage())) {
+ p.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getProtocols(index).getUsage()));
+ }
+ if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());
+ }
+ if (vid.getProtocols(index).getSupArchList() != null
+ && vid.getProtocols(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getProtocols(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getProtocols(index).getHelp())) {
+ p.setHelpText(vid.getProtocols(index).getHelp());
+ }
+ this.protocols.addNewProtocolNotify();
+ this.protocols.setProtocolNotifyArray(protocols.getProtocolNotifyList().size() - 1, p);
+ }
+ }
+ }
+
+ this.msa.setProtocols(protocols);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.err("Update Protocols", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(this.jComboBoxProtocolType, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jComboBoxCName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(this.jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(this.jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(this.jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(this.jButtonRemove, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(this.jButtonUpdate, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private ProtocolsIdentification getCurrentProtocols() {
+ String arg0 = this.jComboBoxCName.getSelectedItem().toString();
+ String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString();
+ String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg3 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg5 = this.jTextFieldHelpText.getText();
+ id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addProtocols(getCurrentProtocols());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeProtocols(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateProtocols(getCurrentProtocols(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getProtocols(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jComboBoxCName.setSelectedItem(vid.getProtocols(intSelectedItemId).getName());
+ this.jComboBoxProtocolType.setSelectedItem(vid.getProtocols(intSelectedItemId).getType());
+ this.jComboBoxUsage.setSelectedItem(vid.getProtocols(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getProtocols(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getProtocols(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getProtocols(intSelectedItemId).getSupArchList());
+
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getProtocols(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) {
+ if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) {
+ Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage());
+ } else {
+ Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage());
+ }
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java
new file mode 100644
index 0000000000..739fec0119
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java
@@ -0,0 +1,864 @@
+/** @file
+
+ The file is used to create, update SourceFile of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.SourceFilesDocument;
+import org.tianocore.FilenameDocument.Filename;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.SourceFilesDocument.SourceFiles;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.SourceFiles.SourceFilesIdentification;
+import org.tianocore.frameworkwizard.module.Identification.SourceFiles.SourceFilesVector;
+import org.tianocore.frameworkwizard.workspace.Workspace;
+
+/**
+ The class is used to create, update SourceFile of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleSourceFiles extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -6765742852142775378L;
+
+ //
+ // Define class members
+ //
+ private SourceFilesDocument.SourceFiles sourceFiles = null;
+
+ private int intSelectedItemId = 0;
+
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelFileName = null;
+
+ private JTextField jTextFieldFileName = null;
+
+ private JButton jButtonOpenFile = null;
+
+ private JLabel jLabelToolChainFamily = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JCheckBox jCheckBoxArch = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JLabel jLabelArch = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JLabel jLabelTagName = null;
+
+ private JTextField jTextFieldTagName = null;
+
+ private JLabel jLabelToolCode = null;
+
+ private JTextField jTextFieldToolCode = null;
+
+ private JTextField jTextFieldToolChainFamily = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ //
+ // Not used by UI
+ //
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private SourceFilesIdentification sfid = null;
+
+ private SourceFilesVector vSourceFiles = new SourceFilesVector();
+
+ /**
+ This method initializes jTextFieldFileName
+
+ @return javax.swing.JTextField jTextFieldFileName
+
+ **/
+ private JTextField getJTextFieldSourceFilesDirectory() {
+ if (jTextFieldFileName == null) {
+ jTextFieldFileName = new JTextField();
+ jTextFieldFileName.setBounds(new java.awt.Rectangle(140, 10, 250, 20));
+ jTextFieldFileName.setPreferredSize(new java.awt.Dimension(250, 20));
+ jTextFieldFileName.setToolTipText("Path is relative to the MSA file and must include the file name");
+ }
+ return jTextFieldFileName;
+ }
+
+ /**
+ This method initializes jButtonOpenFile
+
+ @return javax.swing.JButton jButtonOpenFile
+
+ **/
+ private JButton getJButtonOpenFile() {
+ if (jButtonOpenFile == null) {
+ jButtonOpenFile = new JButton();
+ jButtonOpenFile.setText("Browse");
+ jButtonOpenFile.setBounds(new java.awt.Rectangle(395, 10, 85, 20));
+ jButtonOpenFile.setPreferredSize(new java.awt.Dimension(85, 20));
+ jButtonOpenFile.addActionListener(this);
+ }
+ return jButtonOpenFile;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextFieldTagName
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldTagName() {
+ if (jTextFieldTagName == null) {
+ jTextFieldTagName = new JTextField();
+ jTextFieldTagName.setBounds(new java.awt.Rectangle(140, 35, 340, 20));
+ jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20));
+ jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");
+ }
+ return jTextFieldTagName;
+ }
+
+ /**
+ * This method initializes jTextFieldToolCode
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldToolCode() {
+ if (jTextFieldToolCode == null) {
+ jTextFieldToolCode = new JTextField();
+ jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20));
+ jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
+ jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");
+ }
+ return jTextFieldToolCode;
+ }
+
+ /**
+ * This method initializes jTextFieldToolChainFamily
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldToolChainFamily() {
+ if (jTextFieldToolChainFamily == null) {
+ jTextFieldToolChainFamily = new JTextField();
+ jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(140, 85, 340, 20));
+ jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20));
+ jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC");
+ }
+ return jTextFieldToolChainFamily;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(140, 110, 340, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(340, 20));
+ jTextFieldFeatureFlag.setToolTipText("RESERVED FOR FUTURE USE");
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(140, 135, 340, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(340, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleSourceFiles() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param
+
+ **/
+ public ModuleSourceFiles(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = inOmt.getXmlMsa();
+ init(msa.getSourceFiles());
+ this.setVisible(true);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+
+ @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
+
+ **/
+ private void init(SourceFilesDocument.SourceFiles inSourceFiles) {
+ init();
+ this.sourceFiles = inSourceFiles;
+
+ if (this.sourceFiles != null) {
+ if (this.sourceFiles.getFilenameList().size() > 0) {
+ for (int index = 0; index < this.sourceFiles.getFilenameList().size(); index++) {
+ String name = sourceFiles.getFilenameList().get(index).getStringValue();
+ String tagName = sourceFiles.getFilenameList().get(index).getTagName();
+ String toolCode = sourceFiles.getFilenameList().get(index).getToolCode();
+ String tcf = sourceFiles.getFilenameList().get(index).getToolChainFamily();
+ String featureFlag = sourceFiles.getFilenameList().get(index).getFeatureFlag();
+ Vector<String> arch = Tools.convertListToVector(sourceFiles.getFilenameList().get(index)
+ .getSupArchList());
+ SourceFilesIdentification sfid = new SourceFilesIdentification(name, tagName, toolCode, tcf,
+ featureFlag, arch);
+ vSourceFiles.addSourceFiles(sfid);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vSourceFiles.getSourceFilesName());
+ reloadListArea();
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Source Files");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldFileName.setEnabled(!isView);
+ this.jButtonOpenFile.setEnabled(!isView);
+
+ this.jButtonAdd.setEnabled(!isView);
+ this.jButtonRemove.setEnabled(!isView);
+ this.jButtonUpdate.setEnabled(!isView);
+ this.jCheckBoxArch.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelToolCode = new JLabel();
+ jLabelToolCode.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
+ jLabelToolCode.setText("Tool Code");
+ jLabelTagName = new JLabel();
+ jLabelTagName.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
+ jLabelTagName.setText("Tag Name");
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
+ jLabelArch.setText("Sup Arch List");
+ jLabelToolChainFamily = new JLabel();
+ jLabelToolChainFamily.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
+ jLabelToolChainFamily.setText("Tool Chain Family");
+ jLabelFileName = new JLabel();
+ jLabelFileName.setText("File Name");
+ jLabelFileName.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
+
+ jContentPane.add(jLabelFileName, null);
+ jContentPane.add(getJTextFieldSourceFilesDirectory(), null);
+ jContentPane.add(getJButtonOpenFile(), null);
+ jContentPane.add(jLabelToolChainFamily, null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(jLabelTagName, null);
+ jContentPane.add(getJTextFieldTagName(), null);
+ jContentPane.add(jLabelToolCode, null);
+ jContentPane.add(getJTextFieldToolCode(), null);
+ jContentPane.add(getJTextFieldToolChainFamily(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(getJScrollPaneArch(), 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() == jButtonOpenFile) {
+ selectFile();
+ }
+ if (arg0.getSource() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ This method initializes Usage type and Arch type
+
+ **/
+ private void initFrame() {
+ EnumerationData ed = new EnumerationData();
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ private SourceFilesIdentification getCurrentSourceFiles() {
+ String name = this.jTextFieldFileName.getText();
+ String tagName = this.jTextFieldTagName.getText();
+ String toolCode = this.jTextFieldToolCode.getText();
+ String tcf = this.jTextFieldToolChainFamily.getText();
+ String featureFlag = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arch = this.iCheckBoxListArch.getAllCheckedItemsString();
+ sfid = new SourceFilesIdentification(name, tagName, toolCode, tcf, featureFlag, arch);
+ return sfid;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vSourceFiles.size();
+
+ vSourceFiles.addSourceFiles(getCurrentSourceFiles());
+
+ jComboBoxList.addItem(sfid.getFilename());
+ jComboBoxList.setSelectedItem(sfid.getFilename());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vSourceFiles.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vSourceFiles.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vSourceFiles.removeSourceFiles(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vSourceFiles.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vSourceFiles.updateSourceFiles(getCurrentSourceFiles(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vSourceFiles.size(); index++) {
+ jComboBoxList.addItem(vSourceFiles.getSourceFiles(index).getFilename());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vSourceFiles.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldFileName.setText(vSourceFiles.getSourceFiles(intSelectedItemId).getFilename());
+ this.jTextFieldTagName.setText(vSourceFiles.getSourceFiles(intSelectedItemId).getTagName());
+ this.jTextFieldToolCode.setText(vSourceFiles.getSourceFiles(intSelectedItemId).getToolCode());
+ this.jTextFieldToolChainFamily.setText(vSourceFiles.getSourceFiles(intSelectedItemId).getToolChainFamily());
+ jTextFieldFeatureFlag.setText(vSourceFiles.getSourceFiles(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vSourceFiles.getSourceFiles(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vSourceFiles.size(); index++) {
+ strListItem = strListItem + vSourceFiles.getSourceFiles(index).getFilename() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check Filename
+ //
+ if (isEmpty(this.jTextFieldFileName.getText())) {
+ Log.err("File Name couldn't be empty");
+ return false;
+ }
+ if (!DataValidation.isFilename(this.jTextFieldFileName.getText())) {
+ Log.err("Incorrect data type for File Name");
+ return false;
+ }
+
+ //
+ // Check TagName
+ //
+ if (!isEmpty(this.jTextFieldTagName.getText())) {
+ if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) {
+ Log.err("Incorrect data type for Tag Name");
+ return false;
+ }
+ }
+
+ //
+ // Check ToolCode
+ //
+ if (!isEmpty(this.jTextFieldToolCode.getText())) {
+ if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) {
+ Log.err("Incorrect data type for Tool Code");
+ return false;
+ }
+ }
+
+ //
+ // Check ToolChainFamily
+ //
+ if (!isEmpty(this.jTextFieldToolChainFamily.getText())) {
+ if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) {
+ Log.err("Incorrect data type for Tool Chain Family");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of SourceFiles
+ if exists sourceFiles, set the value directly
+ if not exists sourceFiles, new an instance first
+
+ **/
+ public void save() {
+ try {
+ //
+ //Save as file name
+ //
+ int count = this.vSourceFiles.size();
+
+ this.sourceFiles = SourceFiles.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ Filename mFilename = Filename.Factory.newInstance();
+ if (!isEmpty(vSourceFiles.getSourceFiles(index).getFilename())) {
+ mFilename.setStringValue(vSourceFiles.getSourceFiles(index).getFilename());
+ }
+ if (!isEmpty(vSourceFiles.getSourceFiles(index).getTagName())) {
+ mFilename.setTagName(vSourceFiles.getSourceFiles(index).getTagName());
+ }
+ if (!isEmpty(vSourceFiles.getSourceFiles(index).getToolCode())) {
+ mFilename.setToolCode(vSourceFiles.getSourceFiles(index).getToolCode());
+ }
+ if (!isEmpty(vSourceFiles.getSourceFiles(index).getToolChainFamily())) {
+ mFilename.setToolChainFamily(vSourceFiles.getSourceFiles(index).getToolChainFamily());
+ }
+ if (!isEmpty(vSourceFiles.getSourceFiles(index).getFeatureFlag())) {
+ mFilename.setFeatureFlag(vSourceFiles.getSourceFiles(index).getFeatureFlag());
+ }
+ if (vSourceFiles.getSourceFiles(index).getSupArchList() != null
+ && vSourceFiles.getSourceFiles(index).getSupArchList().size() > 0) {
+ mFilename.setSupArchList(vSourceFiles.getSourceFiles(index).getSupArchList());
+ }
+
+ this.sourceFiles.addNewFilename();
+ this.sourceFiles.setFilenameArray(index, mFilename);
+ }
+ }
+ this.msa.setSourceFiles(sourceFiles);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.err("Update Source Files", e.getMessage());
+ }
+ }
+
+ /**
+ Display a file open browser to let user select file
+
+ **/
+ private void selectFile() {
+ JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
+
+ int result = fc.showOpenDialog(new JPanel());
+ if (result == JFileChooser.APPROVE_OPTION) {
+ this.jTextFieldFileName.setText(fc.getSelectedFile().getName());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(this.jTextFieldFileName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldTagName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldToolCode, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldToolChainFamily, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(this.jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(this.jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+ relocateComponentX(this.jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(this.jButtonOpenFile, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
+ relocateComponentX(this.jButtonRemove, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(this.jButtonUpdate, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java
new file mode 100644
index 0000000000..64f1137b54
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java
@@ -0,0 +1,768 @@
+/** @file
+
+ The file is used to create, update SystemTable of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.SystemTableUsage;
+import org.tianocore.SystemTablesDocument;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.SystemTablesDocument.SystemTables;
+import org.tianocore.SystemTablesDocument.SystemTables.SystemTableCNames;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.SystemTables.SystemTablesIdentification;
+import org.tianocore.frameworkwizard.module.Identification.SystemTables.SystemTablesVector;
+
+/**
+ The class is used to create, update SystemTable of MSA/MBD file
+ It extends IInternalFrame
+
+
+
+ **/
+public class ModuleSystemTables extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = 7488769180379442276L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelEntry = null;
+
+ private JTextField jTextFieldGuidC_Name = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private SystemTablesDocument.SystemTables systemTables = null;
+
+ private SystemTablesIdentification id = null;
+
+ private SystemTablesVector vid = new SystemTablesVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextFieldEntry
+
+ @return javax.swing.JTextField jTextFieldEntry
+
+ **/
+ private JTextField getJTextFieldEntry() {
+ if (jTextFieldGuidC_Name == null) {
+ jTextFieldGuidC_Name = new JTextField();
+ jTextFieldGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jTextFieldGuidC_Name.setPreferredSize(new java.awt.Dimension(320,20));
+ }
+ return jTextFieldGuidC_Name;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320,20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ * This method initializes jTextFieldFeatureFlag
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320,20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("System Tables");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(SystemTables inSystemTables) {
+ init();
+ this.systemTables = inSystemTables;
+
+ if (this.systemTables != null) {
+ if (this.systemTables.getSystemTableCNamesList().size() > 0) {
+ for (int index = 0; index < this.systemTables.getSystemTableCNamesList().size(); index++) {
+ String arg0 = systemTables.getSystemTableCNamesList().get(index).getSystemTableCName();
+ String arg1 = null;
+ if (systemTables.getSystemTableCNamesList().get(index).getUsage() != null) {
+ arg1 = systemTables.getSystemTableCNamesList().get(index).getUsage().toString();
+ }
+
+ String arg2 = systemTables.getSystemTableCNamesList().get(index).getFeatureFlag();
+ Vector<String> arg3 = Tools.convertListToVector(systemTables.getSystemTableCNamesList().get(index).getSupArchList());
+ String arg4 = systemTables.getSystemTableCNamesList().get(index).getHelpText();
+
+ id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
+ vid.addSystemTables(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getSystemTablesName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleSystemTables() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inSystemTables The input data of SystemTablesDocument.SystemTables
+
+ **/
+ public ModuleSystemTables(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getSystemTables());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldGuidC_Name.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelEntry = new JLabel();
+ jLabelEntry.setText("Guid C_Name");
+ jLabelEntry.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
+
+ jContentPane.add(jLabelEntry, null);
+ jContentPane.add(getJTextFieldEntry(), null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), null);
+ }
+ return jContentPane;
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage());
+
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /* (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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check GuidC_Name
+ //
+ if (isEmpty(this.jTextFieldGuidC_Name.getText())) {
+ Log.err("Guid C_Name couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldGuidC_Name.getText())) {
+ if (!DataValidation.isC_NameType(this.jTextFieldGuidC_Name.getText())) {
+ Log.err("Incorrect data type for Guid C_Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of SystemTables
+ if exists systemTables, set the value directly
+ if not exists systemTables, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.systemTables = SystemTables.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ SystemTableCNames p = SystemTableCNames.Factory.newInstance();
+ if (!isEmpty(vid.getSystemTables(index).getName())) {
+ p.setSystemTableCName(vid.getSystemTables(index).getName());
+ }
+ if (!isEmpty(vid.getSystemTables(index).getUsage())) {
+ p.setUsage(SystemTableUsage.Enum.forString(vid.getSystemTables(index).getUsage()));
+ }
+ if (!isEmpty(vid.getSystemTables(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getSystemTables(index).getFeatureFlag());
+ }
+ if (vid.getSystemTables(index).getSupArchList() != null && vid.getSystemTables(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getSystemTables(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getSystemTables(index).getHelp())) {
+ p.setHelpText(vid.getSystemTables(index).getHelp());
+ }
+ this.systemTables.addNewSystemTableCNames();
+ this.systemTables.setSystemTableCNamesArray(systemTables.getSystemTableCNamesList().size() - 1, p);
+ }
+ }
+
+ this.msa.setSystemTables(systemTables);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update System Tables", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jTextFieldGuidC_Name, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private SystemTablesIdentification getCurrentSystemTables() {
+ String arg0 = this.jTextFieldGuidC_Name.getText();
+ String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg2 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg4 = this.jTextFieldHelpText.getText();
+
+ id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addSystemTables(getCurrentSystemTables());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeSystemTables(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateSystemTables(getCurrentSystemTables(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getSystemTables(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldGuidC_Name.setText(vid.getSystemTables(intSelectedItemId).getName());
+ this.jComboBoxUsage.setSelectedItem(vid.getSystemTables(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getSystemTables(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getSystemTables(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getSystemTables(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getSystemTables(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java
new file mode 100644
index 0000000000..2b56122f13
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java
@@ -0,0 +1,813 @@
+/** @file
+
+ The file is used to create, update Variable of MSA/MBD 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ItemEvent;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.VariableUsage;
+import org.tianocore.VariablesDocument;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.VariablesDocument.Variables;
+import org.tianocore.VariablesDocument.Variables.Variable;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+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.module.Identification.Variables.VariablesIdentification;
+import org.tianocore.frameworkwizard.module.Identification.Variables.VariablesVector;
+
+/**
+ The class is used to create, update Variable of MSA/MBD file
+ It extends IInternalFrame
+
+ **/
+public class ModuleVariables extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -6998982978030439446L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelVariableName = null;
+
+ private JTextField jTextFieldVariableName = null;
+
+ private JLabel jLabelUsage = null;
+
+ private JComboBox jComboBoxUsage = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private JTextArea jTextAreaList = null;
+
+ private JComboBox jComboBoxList = null;
+
+ private JButton jButtonAdd = null;
+
+ private JButton jButtonRemove = null;
+
+ private JButton jButtonUpdate = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JScrollPane jScrollPaneList = null;
+
+ private JLabel jLabelGuidCName = null;
+
+ private JTextField jTextFieldGuidC_Name = null;
+
+ private JTextField jTextFieldFeatureFlag = null;
+
+ private JLabel jLabelFeatureFlag = null;
+
+ private JLabel jLabelArch = null;
+
+ private ICheckBoxList iCheckBoxListArch = null;
+
+ private JScrollPane jScrollPaneArch = null;
+
+ private JLabel jLabelHelpText = null;
+
+ private JTextField jTextFieldHelpText = null;
+
+ //
+ // Not used by UI
+ //
+ private int intSelectedItemId = 0;
+
+ private OpeningModuleType omt = null;
+
+ private ModuleSurfaceArea msa = null;
+
+ private VariablesDocument.Variables variables = null;
+
+ private VariablesIdentification id = null;
+
+ private VariablesVector vid = new VariablesVector();
+
+ private EnumerationData ed = new EnumerationData();
+
+ /**
+ This method initializes jTextFieldString
+
+ @return javax.swing.JTextField jTextFieldString
+
+ **/
+ private JTextField getJTextFieldString() {
+ if (jTextFieldVariableName == null) {
+ jTextFieldVariableName = new JTextField();
+ jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20));
+ jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldVariableName.setLocation(new java.awt.Point(160, 10));
+ }
+ return jTextFieldVariableName;
+ }
+
+ /**
+ This method initializes jComboBoxUsage
+
+ @return javax.swing.JComboBox jComboBoxUsage
+
+ **/
+ private JComboBox getJComboBoxUsage() {
+ if (jComboBoxUsage == null) {
+ jComboBoxUsage = new JComboBox();
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jComboBoxUsage;
+ }
+
+ /**
+ This method initializes jComboBoxFileList
+
+ @return javax.swing.JComboBox jComboBoxFileList
+
+ **/
+ private JComboBox getJComboBoxList() {
+ if (jComboBoxList == null) {
+ jComboBoxList = new JComboBox();
+ jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));
+ jComboBoxList.addItemListener(this);
+ jComboBoxList.addActionListener(this);
+ jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
+ }
+ return jComboBoxList;
+ }
+
+ /**
+ This method initializes jButtonAdd
+
+ @return javax.swing.JButton jButtonAdd
+
+ **/
+ private JButton getJButtonAdd() {
+ if (jButtonAdd == null) {
+ jButtonAdd = new JButton();
+ jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));
+ jButtonAdd.setText("Add");
+ jButtonAdd.addActionListener(this);
+ jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonAdd;
+ }
+
+ /**
+ This method initializes jButtonRemove
+
+ @return javax.swing.JButton jButtonRemove
+
+ **/
+ private JButton getJButtonRemove() {
+ if (jButtonRemove == null) {
+ jButtonRemove = new JButton();
+ jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));
+ jButtonRemove.setText("Remove");
+ jButtonRemove.addActionListener(this);
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
+ }
+ return jButtonRemove;
+ }
+
+ /**
+ This method initializes jButtonUpdate
+
+ @return javax.swing.JButton jButtonUpdate
+
+ **/
+ private JButton getJButtonUpdate() {
+ if (jButtonUpdate == null) {
+ jButtonUpdate = new JButton();
+ jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));
+ jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonUpdate.setText("Update");
+ jButtonUpdate.addActionListener(this);
+ }
+ return jButtonUpdate;
+ }
+
+ /**
+ * This method initializes jScrollPaneFileList
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPaneList() {
+ if (jScrollPaneList == null) {
+ jScrollPaneList = new JScrollPane();
+ jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));
+ jScrollPaneList.setViewportView(getJTextAreaList());
+ jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
+ }
+ return jScrollPaneList;
+ }
+
+ /**
+ This method initializes jScrollPane
+
+ @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextAreaFileList
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextAreaList() {
+ if (jTextAreaList == null) {
+ jTextAreaList = new JTextArea();
+ jTextAreaList.setEditable(false);
+
+ }
+ return jTextAreaList;
+ }
+
+ /**
+ * This method initializes jTextFieldGuidCName
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldGuidC_Name() {
+ if (jTextFieldGuidC_Name == null) {
+ jTextFieldGuidC_Name = new JTextField();
+ jTextFieldGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jTextFieldGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldGuidC_Name;
+ }
+
+ /**
+ This method initializes jTextFieldFeatureFlag
+
+ @return javax.swing.JTextField jTextFieldFeatureFlag
+
+ **/
+ private JTextField getJTextFieldFeatureFlag() {
+ if (jTextFieldFeatureFlag == null) {
+ jTextFieldFeatureFlag = new JTextField();
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
+ jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldFeatureFlag;
+ }
+
+ /**
+ This method initializes iCheckBoxListArch
+
+ @return ICheckBoxList
+ **/
+ private ICheckBoxList getICheckBoxListSupportedArchitectures() {
+ if (iCheckBoxListArch == null) {
+ iCheckBoxListArch = new ICheckBoxList();
+ iCheckBoxListArch.addFocusListener(this);
+ iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
+ }
+ return iCheckBoxListArch;
+ }
+
+ /**
+ This method initializes jScrollPaneArch
+
+ @return javax.swing.JScrollPane
+
+ **/
+ private JScrollPane getJScrollPaneArch() {
+ if (jScrollPaneArch == null) {
+ jScrollPaneArch = new JScrollPane();
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 135, 320, 80));
+ jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
+ jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
+ }
+ return jScrollPaneArch;
+ }
+
+ /**
+ This method initializes jTextFieldHelpText
+
+ @return javax.swing.JTextField
+
+ **/
+ private JTextField getJTextFieldHelpText() {
+ if (jTextFieldHelpText == null) {
+ jTextFieldHelpText = new JTextField();
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
+ jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
+ }
+ return jTextFieldHelpText;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Variables");
+ initFrame();
+ this.setViewMode(false);
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inPackageDependencies
+
+ **/
+ private void init(Variables inVariables) {
+ init();
+ this.variables = inVariables;
+
+ if (this.variables != null) {
+ if (this.variables.getVariableList().size() > 0) {
+ for (int index = 0; index < this.variables.getVariableList().size(); index++) {
+ String arg0 = variables.getVariableList().get(index).getVariableName();
+ String arg1 = variables.getVariableList().get(index).getGuidCName();
+ String arg2 = null;
+ if (variables.getVariableList().get(index).getUsage() != null) {
+ arg2 = variables.getVariableList().get(index).getUsage().toString();
+ }
+
+ String arg3 = variables.getVariableList().get(index).getFeatureFlag();
+ Vector<String> arg4 = Tools.convertListToVector(variables.getVariableList().get(index).getSupArchList());
+ String arg5 = variables.getVariableList().get(index).getHelpText();
+ id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ vid.addVariables(id);
+ }
+ }
+ }
+ //
+ // Update the list
+ //
+ Tools.generateComboBoxByVector(jComboBoxList, vid.getVariablesName());
+ reloadListArea();
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public ModuleVariables() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inVariables The input data of VariablesDocument.Variables
+
+ **/
+ public ModuleVariables(OpeningModuleType inOmt) {
+ super();
+ this.omt = inOmt;
+ this.msa = omt.getXmlMsa();
+ init(msa.getVariables());
+ this.setVisible(true);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ if (isView) {
+ this.jTextFieldVariableName.setEnabled(!isView);
+ this.jComboBoxUsage.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jLabelGuidCName = new JLabel();
+ jLabelGuidCName.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelGuidCName.setText("Guid C_Name");
+ jLabelUsage = new JLabel();
+ jLabelUsage.setText("Usage");
+ jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelVariableName = new JLabel();
+ jLabelVariableName.setText("Variable Name");
+ jLabelVariableName.setLocation(new java.awt.Point(15, 10));
+ jLabelVariableName.setSize(new java.awt.Dimension(140, 20));
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
+ jLabelArch.setText("Arch");
+ jLabelFeatureFlag = new JLabel();
+ jLabelFeatureFlag.setText("Feature Flag");
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 495));
+
+ jContentPane.add(jLabelVariableName, null);
+ jContentPane.add(jLabelGuidCName, null);
+ jContentPane.add(getJTextFieldGuidC_Name(), null);
+ jContentPane.add(getJTextFieldString(), null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxUsage(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
+ jLabelHelpText.setText("Help Text");
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+
+ jContentPane.add(getJComboBoxList(), null);
+ jContentPane.add(getJButtonAdd(), null);
+ jContentPane.add(getJButtonRemove(), null);
+ jContentPane.add(getJButtonUpdate(), null);
+ jContentPane.add(getJScrollPaneList(), null);
+
+ jContentPane.add(jLabelArch, null);
+ jContentPane.add(jLabelFeatureFlag, null);
+ jContentPane.add(getJTextFieldFeatureFlag(), null);
+ jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(jLabelHelpText, null);
+ jContentPane.add(getJTextFieldHelpText(), 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() == jButtonAdd) {
+ if (!checkAdd()) {
+ return;
+ }
+ addToList();
+ }
+ if (arg0.getSource() == jButtonRemove) {
+ removeFromList();
+ }
+ if (arg0.getSource() == jButtonUpdate) {
+ if (!checkAdd()) {
+ return;
+ }
+ updateForList();
+ }
+ }
+
+ /**
+ This method initializes Usage type
+
+ **/
+ private void initFrame() {
+ Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
+ this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean checkAdd() {
+ //
+ // Check if all fields have correct data types
+ //
+
+ //
+ // Check VariableName
+ //
+ if (isEmpty(this.jTextFieldVariableName.getText())) {
+ Log.err("Variable Name couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldVariableName.getText())) {
+ if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName.getText())) {
+ Log.err("Incorrect data type for Variable Name");
+ return false;
+ }
+ }
+
+ //
+ // Check GuidC_Name
+ //
+ if (isEmpty(this.jTextFieldGuidC_Name.getText())) {
+ Log.err("Guid C_Name couldn't be empty");
+ return false;
+ }
+
+ if (!isEmpty(this.jTextFieldGuidC_Name.getText())) {
+ if (!DataValidation.isC_NameType(this.jTextFieldGuidC_Name.getText())) {
+ Log.err("Incorrect data type for Guid C_Name");
+ return false;
+ }
+ }
+
+ //
+ // Check FeatureFlag
+ //
+ if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
+ if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
+ Log.err("Incorrect data type for Feature Flag");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Variables
+ if exists variables, set the value directly
+ if not exists variables, new an instance first
+
+ **/
+ public void save() {
+ try {
+ int count = this.vid.size();
+
+ this.variables = Variables.Factory.newInstance();
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ Variable p = Variable.Factory.newInstance();
+ if (!isEmpty(vid.getVariables(index).getName())) {
+ p.setVariableName(vid.getVariables(index).getName());
+ }
+ if (!isEmpty(vid.getVariables(index).getGuid())) {
+ p.setGuidCName(vid.getVariables(index).getGuid());
+ }
+ if (!isEmpty(vid.getVariables(index).getUsage())) {
+ p.setUsage(VariableUsage.Enum.forString(vid.getVariables(index).getUsage()));
+ }
+ if (!isEmpty(vid.getVariables(index).getFeatureFlag())) {
+ p.setFeatureFlag(vid.getVariables(index).getFeatureFlag());
+ }
+ if (vid.getVariables(index).getSupArchList() != null && vid.getVariables(index).getSupArchList().size() > 0) {
+ p.setSupArchList(vid.getVariables(index).getSupArchList());
+ }
+ if (!isEmpty(vid.getVariables(index).getHelp())) {
+ p.setHelpText(vid.getVariables(index).getHelp());
+ }
+ this.variables.addNewVariable();
+ this.variables.setVariableArray(variables.getVariableList().size() - 1, p);
+ }
+ }
+
+ this.msa.setVariables(variables);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Update Variables", e.getMessage());
+ }
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intCurrentHeight = this.getJContentPane().getHeight();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+ int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
+
+ resizeComponentWidth(jTextFieldVariableName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldGuidC_Name, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
+
+ resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
+ resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
+ relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
+ relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
+ relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
+ }
+
+ private VariablesIdentification getCurrentVariables() {
+ String arg0 = this.jTextFieldVariableName.getText();
+ String arg1 = this.jTextFieldGuidC_Name.getText();
+ String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
+
+ String arg3 = this.jTextFieldFeatureFlag.getText();
+ Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();
+ String arg5 = this.jTextFieldHelpText.getText();
+
+ id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
+ return id;
+ }
+
+ /**
+ Add current item to Vector
+
+ **/
+ private void addToList() {
+ intSelectedItemId = vid.size();
+
+ vid.addVariables(getCurrentVariables());
+
+ jComboBoxList.addItem(id.getName());
+ jComboBoxList.setSelectedItem(id.getName());
+
+ //
+ // Reset select item index
+ //
+ intSelectedItemId = vid.size();
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Remove current item from Vector
+
+ **/
+ private void removeFromList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ int intTempIndex = intSelectedItemId;
+
+ jComboBoxList.removeItemAt(intSelectedItemId);
+
+ vid.removeVariables(intTempIndex);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Update current item of Vector
+
+ **/
+ private void updateForList() {
+ //
+ // Check if exist items
+ //
+ if (this.vid.size() < 1) {
+ return;
+ }
+
+ //
+ // Backup selected item index
+ //
+ int intTempIndex = intSelectedItemId;
+
+ vid.updateVariables(getCurrentVariables(), intTempIndex);
+
+ jComboBoxList.removeAllItems();
+ for (int index = 0; index < vid.size(); index++) {
+ jComboBoxList.addItem(vid.getVariables(index).getName());
+ }
+
+ //
+ // Restore selected item index
+ //
+ intSelectedItemId = intTempIndex;
+
+ //
+ // Reset select item index
+ //
+ jComboBoxList.setSelectedIndex(intSelectedItemId);
+
+ //
+ // Reload all fields of selected item
+ //
+ reloadFromList();
+
+ //
+ // Save to memory
+ //
+ save();
+ }
+
+ /**
+ Refresh all fields' values of selected item of Vector
+
+ **/
+ private void reloadFromList() {
+ if (vid.size() > 0) {
+ //
+ // Get selected item index
+ //
+ intSelectedItemId = jComboBoxList.getSelectedIndex();
+
+ this.jTextFieldVariableName.setText(vid.getVariables(intSelectedItemId).getName());
+ this.jTextFieldGuidC_Name.setText(vid.getVariables(intSelectedItemId).getGuid());
+ this.jComboBoxUsage.setSelectedItem(vid.getVariables(intSelectedItemId).getUsage());
+ this.jTextFieldHelpText.setText(vid.getVariables(intSelectedItemId).getHelp());
+
+ jTextFieldFeatureFlag.setText(vid.getVariables(intSelectedItemId).getFeatureFlag());
+ iCheckBoxListArch.setAllItemsUnchecked();
+ iCheckBoxListArch.initCheckedItem(true, vid.getVariables(intSelectedItemId).getSupArchList());
+
+ } else {
+ }
+
+ reloadListArea();
+ }
+
+ /**
+ Update list area pane via the elements of Vector
+
+ **/
+ private void reloadListArea() {
+ String strListItem = "";
+ for (int index = 0; index < vid.size(); index++) {
+ strListItem = strListItem + vid.getVariables(index).getName() + DataType.UNIX_LINE_SEPARATOR;
+ }
+ this.jTextAreaList.setText(strListItem);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ *
+ * Reflesh the frame when selected item changed
+ *
+ */
+ public void itemStateChanged(ItemEvent arg0) {
+ if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
+ reloadFromList();
+ }
+ }
+}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java
new file mode 100644
index 0000000000..c4576a8327
--- /dev/null
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java
@@ -0,0 +1,1002 @@
+/** @file
+
+ The file is used to create, update MsaHeader of MSA 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.module.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.FocusEvent;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.tianocore.ModuleSurfaceAreaDocument;
+import org.tianocore.ModuleTypeDef;
+import org.tianocore.MsaHeaderDocument;
+import org.tianocore.LicenseDocument.License;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
+import org.tianocore.frameworkwizard.common.EnumerationData;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.common.OpeningModuleType;
+import org.tianocore.frameworkwizard.common.Tools;
+import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
+import org.tianocore.frameworkwizard.common.ui.StarLabel;
+
+/**
+ The class is used to create, update MsaHeader of MSA file
+ It extends IInternalFrame
+
+
+
+ **/
+public class MsaHeader extends IInternalFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -8152099582923006900L;
+
+ //
+ //Define class members
+ //
+ private JPanel jContentPane = null;
+
+ private JLabel jLabelBaseName = null;
+
+ private JTextField jTextFieldBaseName = null;
+
+ private JLabel jLabelGuid = null;
+
+ private JTextField jTextFieldGuid = null;
+
+ private JLabel jLabelVersion = null;
+
+ private JTextField jTextFieldVersion = null;
+
+ private JButton jButtonGenerateGuid = null;
+
+ private JLabel jLabelLicense = null;
+
+ private JTextArea jTextAreaLicense = null;
+
+ private JLabel jLabelCopyright = null;
+
+ private JLabel jLabelDescription = null;
+
+ private JTextArea jTextAreaDescription = null;
+
+ private JLabel jLabelSpecification = null;
+
+ private JTextField jTextFieldSpecification = null;
+
+ private JButton jButtonOk = null;
+
+ private JButton jButtonCancel = null;
+
+ private JScrollPane jScrollPaneLicense = null;
+
+ private JScrollPane jScrollPaneDescription = null;
+
+ private JLabel jLabelAbstract = null;
+
+ private JTextField jTextFieldAbstract = null;
+
+ private JLabel jLabelModuleType = null;
+
+ private JComboBox jComboBoxModuleType = null;
+
+ private StarLabel jStarLabel1 = null;
+
+ private StarLabel jStarLabel2 = null;
+
+ private StarLabel jStarLabel4 = null;
+
+ private StarLabel jStarLabel5 = null;
+
+ private StarLabel jStarLabel6 = null;
+
+ private StarLabel jStarLabel7 = null;
+
+ private StarLabel jStarLabel8 = null;
+
+ private StarLabel jStarLabel10 = null;
+
+ private StarLabel jStarLabel12 = null;
+
+ private MsaHeaderDocument.MsaHeader msaHeader = null;
+
+ private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
+
+ private JTextField jTextFieldCopyright = null;
+
+ private JLabel jLabelURL = null;
+
+ private JTextField jTextFieldURL = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private OpeningModuleType omt = null;
+
+ /**
+ This method initializes jTextFieldBaseName
+
+ @return javax.swing.JTextField jTextFieldBaseName
+
+ **/
+ private JTextField getJTextFieldBaseName() {
+ if (jTextFieldBaseName == null) {
+ jTextFieldBaseName = new JTextField();
+ jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldBaseName.addFocusListener(this);
+ jTextFieldBaseName.setToolTipText("An brief Identifier, such as USB I/O Library, of the module");
+ }
+ return jTextFieldBaseName;
+ }
+
+ /**
+ This method initializes jTextFieldGuid
+
+ @return javax.swing.JTextField jTextFieldGuid
+
+ **/
+ private JTextField getJTextFieldGuid() {
+ if (jTextFieldGuid == null) {
+ jTextFieldGuid = new JTextField();
+ jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250, 20));
+ jTextFieldGuid.setLocation(new java.awt.Point(160, 60));
+ jTextFieldGuid.setSize(new java.awt.Dimension(250, 20));
+ jTextFieldGuid.addFocusListener(this);
+ jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number (8-4-4-4-12)");
+ }
+ return jTextFieldGuid;
+ }
+
+ /**
+ This method initializes jTextFieldVersion
+
+ @return javax.swing.JTextField jTextFieldVersion
+
+ **/
+ private JTextField getJTextFieldVersion() {
+ if (jTextFieldVersion == null) {
+ jTextFieldVersion = new JTextField();
+ jTextFieldVersion.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldVersion.setLocation(new java.awt.Point(160, 85));
+ jTextFieldVersion.setSize(new java.awt.Dimension(320, 20));
+ jTextFieldVersion.addFocusListener(this);
+ jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01");
+ }
+ return jTextFieldVersion;
+ }
+
+ /**
+ This method initializes jButtonGenerateGuid
+
+ @return javax.swing.JButton jButtonGenerateGuid
+
+ **/
+ private JButton getJButtonGenerateGuid() {
+ if (jButtonGenerateGuid == null) {
+ jButtonGenerateGuid = new JButton();
+ jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
+ jButtonGenerateGuid.setSize(new java.awt.Dimension(65, 20));
+ jButtonGenerateGuid.setLocation(new java.awt.Point(415, 60));
+ jButtonGenerateGuid.setText("GEN");
+ jButtonGenerateGuid.addActionListener(this);
+ }
+ return jButtonGenerateGuid;
+ }
+
+ /**
+ This method initializes jTextAreaLicense
+
+ @return javax.swing.JTextArea jTextAreaLicense
+
+ **/
+ private JTextArea getJTextAreaLicense() {
+ if (jTextAreaLicense == null) {
+ jTextAreaLicense = new JTextArea();
+ jTextAreaLicense.setText("");
+ jTextAreaLicense.setLineWrap(true);
+ jTextAreaLicense.addFocusListener(this);
+ jTextAreaLicense.setToolTipText("The License for this file");
+ }
+ return jTextAreaLicense;
+ }
+
+ /**
+ This method initializes jTextAreaDescription
+
+ @return javax.swing.JTextArea jTextAreaDescription
+
+ **/
+ private JTextArea getJTextAreaDescription() {
+ if (jTextAreaDescription == null) {
+ jTextAreaDescription = new JTextArea();
+ jTextAreaDescription.setLineWrap(true);
+ jTextAreaDescription.addFocusListener(this);
+ jTextAreaDescription.setToolTipText("A verbose description of the module");
+ }
+ return jTextAreaDescription;
+ }
+
+ /**
+ This method initializes jTextFieldSpecification
+
+ @return javax.swing.JTextField jTextFieldSpecification
+
+ **/
+ private JTextField getJTextFieldSpecification() {
+ if (jTextFieldSpecification == null) {
+ jTextFieldSpecification = new JTextField();
+ jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
+ jTextFieldSpecification.setSize(new java.awt.Dimension(320, 20));
+ jTextFieldSpecification.setLocation(new java.awt.Point(160, 435));
+ jTextFieldSpecification.setEditable(false);
+ jTextFieldSpecification.addFocusListener(this);
+ jTextFieldSpecification
+ .setToolTipText("Deselecting a checkbox"
+ + " will restrict this module for use with the selected architectures, "
+ + "based on the list of items that are checked. "
+ + "If all boxes are checked, "
+ + "then the module will support all current AND FUTURE architectures");
+ }
+ return jTextFieldSpecification;
+ }
+
+ /**
+ This method initializes jButtonOk
+
+ @return javax.swing.JButton jButtonOk
+
+ **/
+ private JButton getJButtonOk() {
+ if (jButtonOk == null) {
+ jButtonOk = new JButton();
+ jButtonOk.setText("OK");
+ jButtonOk.setPreferredSize(new java.awt.Dimension(90, 20));
+ jButtonOk.setBounds(new java.awt.Rectangle(390, 455, 90, 20));
+ jButtonOk.addActionListener(this);
+ jButtonOk.setVisible(false);
+ }
+ return jButtonOk;
+ }
+
+ /**
+ This method initializes jButtonCancel
+
+ @return javax.swing.JButton jButtonCancel
+
+ **/
+ private JButton getJButtonCancel() {
+ if (jButtonCancel == null) {
+ jButtonCancel = new JButton();
+ jButtonCancel.setText("Cancel");
+ jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));
+ jButtonCancel.addActionListener(this);
+ jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
+ jButtonCancel.setVisible(false);
+ }
+ return jButtonCancel;
+ }
+
+ /**
+ This method initializes jScrollPaneLicense
+
+ @return javax.swing.JScrollPane jScrollPaneLicense
+
+ **/
+ private JScrollPane getJScrollPaneLicense() {
+ if (jScrollPaneLicense == null) {
+ jScrollPaneLicense = new JScrollPane();
+ jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ jScrollPaneLicense.setSize(new java.awt.Dimension(320, 120));
+ jScrollPaneLicense.setLocation(new java.awt.Point(160, 285));
+ jScrollPaneLicense.setViewportView(getJTextAreaLicense());
+ jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(320, 120));
+ }
+ return jScrollPaneLicense;
+ }
+
+ /**
+ This method initializes jScrollPaneDescription
+
+ @return javax.swing.JScrollPane jScrollPaneDescription
+
+ **/
+ private JScrollPane getJScrollPaneDescription() {
+ if (jScrollPaneDescription == null) {
+ jScrollPaneDescription = new JScrollPane();
+ jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ jScrollPaneDescription.setSize(new java.awt.Dimension(320, 120));
+ jScrollPaneDescription.setLocation(new java.awt.Point(160, 135));
+ jScrollPaneDescription.setViewportView(getJTextAreaDescription());
+ jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(320, 120));
+ }
+ return jScrollPaneDescription;
+ }
+
+ /**
+ This method initializes jTextFieldAbstract
+
+ @return javax.swing.JTextField jTextFieldAbstract
+
+ **/
+ private JTextField getJTextFieldAbstract() {
+ if (jTextFieldAbstract == null) {
+ jTextFieldAbstract = new JTextField();
+ jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldAbstract.setLocation(new java.awt.Point(160, 110));
+ jTextFieldAbstract.setSize(new java.awt.Dimension(320, 20));
+ jTextFieldAbstract.addFocusListener(this);
+ jTextFieldAbstract.setToolTipText("A one sentence description of this module");
+ }
+ return jTextFieldAbstract;
+ }
+
+ /**
+ This method initializes jComboBoxModuleType
+
+ @return javax.swing.JComboBox jComboBoxModuleType
+
+ **/
+ private JComboBox getJComboBoxModuleType() {
+ if (jComboBoxModuleType == null) {
+ jComboBoxModuleType = new JComboBox();
+ jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxModuleType.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxModuleType.addFocusListener(this);
+ }
+ return jComboBoxModuleType;
+ }
+
+ /**
+ This method initializes jTextFieldCopyright
+
+ @return javax.swing.JTextField jTextFieldCopyright
+
+ **/
+ private JTextField getJTextFieldCopyright() {
+ if (jTextFieldCopyright == null) {
+ jTextFieldCopyright = new JTextField();
+ jTextFieldCopyright.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldCopyright.setLocation(new java.awt.Point(160, 260));
+ jTextFieldCopyright.setSize(new java.awt.Dimension(320, 20));
+ jTextFieldCopyright.addFocusListener(this);
+ jTextFieldCopyright.setToolTipText("One or more copyright lines");
+ }
+ return jTextFieldCopyright;
+ }
+
+ /**
+ * This method initializes jTextFieldURL
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextFieldURL() {
+ if (jTextFieldURL == null) {
+ jTextFieldURL = new JTextField();
+ jTextFieldURL.setPreferredSize(new java.awt.Dimension(320, 20));
+ jTextFieldURL.setLocation(new java.awt.Point(160, 410));
+ jTextFieldURL.setSize(new java.awt.Dimension(320, 20));
+ jTextFieldURL.addFocusListener(this);
+ jTextFieldURL.setToolTipText("A URL for the latest version of the license");
+ }
+ return jTextFieldURL;
+ }
+
+ /**
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setViewportView(getJContentPane());
+ }
+ return jScrollPane;
+ }
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ This is the default constructor
+
+ **/
+ public MsaHeader() {
+ super();
+ init();
+ this.setVisible(true);
+ }
+
+ /**
+ This is the override edit constructor
+
+ @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
+
+ **/
+ public MsaHeader(OpeningModuleType inMsa) {
+ super();
+ this.omt = inMsa;
+ this.msa = omt.getXmlMsa();
+ init(msa.getMsaHeader());
+ this.setVisible(true);
+ this.setViewMode(false);
+ }
+
+ /**
+ Disable all components when the mode is view
+
+ @param isView true - The view mode; false - The non-view mode
+
+ **/
+ public void setViewMode(boolean isView) {
+ //this.jButtonOk.setVisible(false);
+ //this.jButtonCancel.setVisible(false);
+ if (isView) {
+ this.jTextFieldBaseName.setEnabled(!isView);
+ this.jTextFieldGuid.setEnabled(!isView);
+ this.jTextFieldVersion.setEnabled(!isView);
+ this.jTextAreaLicense.setEnabled(!isView);
+ this.jTextFieldCopyright.setEnabled(!isView);
+ this.jTextAreaDescription.setEnabled(!isView);
+ this.jTextFieldSpecification.setEnabled(!isView);
+ this.jTextFieldAbstract.setEnabled(!isView);
+ this.jComboBoxModuleType.setEnabled(!isView);
+ this.jButtonCancel.setEnabled(!isView);
+ this.jButtonGenerateGuid.setEnabled(!isView);
+ this.jButtonOk.setEnabled(!isView);
+ }
+ }
+
+ /**
+ This method initializes this
+
+ **/
+ private void init() {
+ this.setSize(500, 515);
+ this.setPreferredSize(new java.awt.Dimension(490, 520));
+ this.setContentPane(getJScrollPane());
+ this.setTitle("Module Surface Area Header");
+ initFrame();
+ }
+
+ /**
+ This method initializes this
+ Fill values to all fields if these values are not empty
+
+ @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
+
+ **/
+ private void init(MsaHeaderDocument.MsaHeader inMsaHeader) {
+ init();
+ if (inMsaHeader != null) {
+ setMsaHeader(inMsaHeader);
+ if (this.msaHeader.getModuleName() != null) {
+ this.jTextFieldBaseName.setText(this.msaHeader.getModuleName());
+ }
+ if (this.msaHeader.getModuleType() != null) {
+ this.jComboBoxModuleType.setSelectedItem(this.msaHeader.getModuleType().toString());
+ }
+ if (this.msaHeader.getGuidValue() != null) {
+ this.jTextFieldGuid.setText(this.msaHeader.getGuidValue());
+ }
+ if (this.msaHeader.getVersion() != null) {
+ this.jTextFieldVersion.setText(this.msaHeader.getVersion());
+ }
+ if (this.msaHeader.getAbstract() != null) {
+ this.jTextFieldAbstract.setText(this.msaHeader.getAbstract());
+ }
+ if (this.msaHeader.getDescription() != null) {
+ this.jTextAreaDescription.setText(this.msaHeader.getDescription());
+ }
+ if (this.msaHeader.getCopyright() != null) {
+ this.jTextFieldCopyright.setText(this.msaHeader.getCopyright());
+ }
+ if (this.msaHeader.getLicense() != null) {
+ this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());
+ }
+ if (this.msaHeader.getLicense() != null && this.msaHeader.getLicense().getURL() != null) {
+ this.jTextFieldURL.setText(this.msaHeader.getLicense().getURL());
+ }
+ if (this.msaHeader.getSpecification() != null) {
+ this.jTextFieldSpecification.setText(this.msaHeader.getSpecification());
+ }
+ }
+ }
+
+ /**
+ This method initializes jContentPane
+
+ @return javax.swing.JPanel jContentPane
+
+ **/
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+
+ jLabelURL = new JLabel();
+ jLabelURL.setText("License URL");
+ jLabelURL.setLocation(new java.awt.Point(15, 410));
+ jLabelURL.setSize(new java.awt.Dimension(140, 20));
+ jLabelBaseName = new JLabel();
+ jLabelBaseName.setText("Module Name");
+ jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
+ jLabelModuleType = new JLabel();
+ jLabelModuleType.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelModuleType.setText("Module Type");
+ jLabelGuid = new JLabel();
+ jLabelGuid.setText("Guid Value");
+ jLabelGuid.setLocation(new java.awt.Point(15, 60));
+ jLabelGuid.setSize(new java.awt.Dimension(140, 20));
+ jLabelVersion = new JLabel();
+ jLabelVersion.setText("Version");
+ jLabelVersion.setLocation(new java.awt.Point(15, 85));
+ jLabelVersion.setSize(new java.awt.Dimension(140, 20));
+ jLabelAbstract = new JLabel();
+ jLabelAbstract.setText("Abstract");
+ jLabelAbstract.setLocation(new java.awt.Point(15, 110));
+ jLabelAbstract.setSize(new java.awt.Dimension(140, 20));
+ jLabelDescription = new JLabel();
+ jLabelDescription.setText("Description");
+ jLabelDescription.setLocation(new java.awt.Point(15, 135));
+ jLabelDescription.setSize(new java.awt.Dimension(140, 20));
+ jLabelCopyright = new JLabel();
+ jLabelCopyright.setText("Copyright");
+ jLabelCopyright.setLocation(new java.awt.Point(15, 260));
+ jLabelCopyright.setSize(new java.awt.Dimension(140, 20));
+ jLabelLicense = new JLabel();
+ jLabelLicense.setText("License");
+ jLabelLicense.setLocation(new java.awt.Point(15, 285));
+ jLabelLicense.setSize(new java.awt.Dimension(140, 20));
+ jLabelSpecification = new JLabel();
+ jLabelSpecification.setText("Specification");
+ jLabelSpecification.setLocation(new java.awt.Point(14, 435));
+ jLabelSpecification.setSize(new java.awt.Dimension(140, 20));
+
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 470));
+
+ jContentPane.add(jLabelBaseName, null);
+ jContentPane.add(getJTextFieldBaseName(), null);
+ jContentPane.add(jLabelGuid, null);
+ jContentPane.add(getJTextFieldGuid(), null);
+ jContentPane.add(jLabelVersion, null);
+ jContentPane.add(getJTextFieldVersion(), null);
+ jContentPane.add(getJButtonGenerateGuid(), null);
+ jContentPane.add(jLabelLicense, null);
+ jContentPane.add(jLabelCopyright, null);
+ jContentPane.add(jLabelDescription, null);
+ jContentPane.add(jLabelSpecification, null);
+ jContentPane.add(getJTextFieldSpecification(), null);
+ jContentPane.add(getJButtonOk(), null);
+ jContentPane.add(getJButtonCancel(), null);
+ jContentPane.add(getJScrollPaneLicense(), null);
+ jContentPane.add(getJScrollPaneDescription(), null);
+ jContentPane.add(jLabelAbstract, null);
+ jContentPane.add(getJTextFieldAbstract(), null);
+ jContentPane.add(jLabelModuleType, null);
+ jContentPane.add(getJComboBoxModuleType(), null);
+ jContentPane.add(jLabelURL, null);
+ jContentPane.add(getJTextFieldURL(), null);
+ jContentPane.add(getJTextFieldCopyright(), null);
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(0, 10));
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(0, 35));
+ jStarLabel4 = new StarLabel();
+ jStarLabel4.setLocation(new java.awt.Point(0, 60));
+ jStarLabel5 = new StarLabel();
+ jStarLabel5.setLocation(new java.awt.Point(0, 85));
+ jStarLabel6 = new StarLabel();
+ jStarLabel6.setLocation(new java.awt.Point(0, 135));
+ jStarLabel7 = new StarLabel();
+ jStarLabel7.setLocation(new java.awt.Point(0, 260));
+ jStarLabel8 = new StarLabel();
+ jStarLabel8.setLocation(new java.awt.Point(0, 285));
+ jStarLabel10 = new StarLabel();
+ jStarLabel10.setLocation(new java.awt.Point(0, 110));
+ jStarLabel12 = new StarLabel();
+ jStarLabel12.setLocation(new java.awt.Point(0, 435));
+
+ jContentPane.add(jStarLabel1, null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jStarLabel4, null);
+ jContentPane.add(jStarLabel5, null);
+ jContentPane.add(jStarLabel6, null);
+ jContentPane.add(jStarLabel7, null);
+ jContentPane.add(jStarLabel8, null);
+ jContentPane.add(jStarLabel10, null);
+ jContentPane.add(jStarLabel12, 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() == jButtonOk) {
+ if (this.check()) {
+ this.save();
+ } else {
+ return;
+ }
+ this.setEdited(true);
+ this.dispose();
+ }
+ if (arg0.getSource() == jButtonCancel) {
+ this.setEdited(false);
+ }
+ if (arg0.getSource() == jButtonGenerateGuid) {
+ jTextFieldGuid.setText(Tools.generateUuidString());
+ }
+ }
+
+ /**
+ Data validation for all fields
+
+ @retval true - All datas are valid
+ @retval false - At least one data is invalid
+
+ **/
+ public boolean check() {
+ //
+ // Check if all required fields are not empty
+ // and check if all data fields values are valid
+ //
+
+ //
+ // Check Base Name
+ //
+ if (isEmpty(this.jTextFieldBaseName.getText())) {
+ Log.err("Base Name couldn't be empty");
+ //this.jTextFieldBaseName.requestFocus();
+ return false;
+ }
+ if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
+ Log.err("Incorrect data type for Base Name");
+ //this.jTextFieldBaseName.requestFocus();
+ return false;
+ }
+
+ //
+ // Check Guid
+ //
+ if (isEmpty(this.jTextFieldGuid.getText())) {
+ Log.err("Guid Value couldn't be empty");
+ //this.jTextFieldGuid.requestFocus();
+ return false;
+ }
+ if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
+ Log.err("Incorrect data type for Guid");
+ //this.jTextFieldGuid.requestFocus();
+ return false;
+ }
+
+ //
+ // Check Version
+ //
+ if (isEmpty(this.jTextFieldVersion.getText())) {
+ Log.err("Version couldn't be empty");
+ //this.jTextFieldVersion.requestFocus();
+ return false;
+ }
+ if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
+ Log.err("Incorrect data type for Version");
+ //this.jTextFieldVersion.requestFocus();
+ return false;
+ }
+
+ //
+ // Check Abstact
+ //
+ if (isEmpty(this.jTextFieldAbstract.getText())) {
+ Log.err("Abstract couldn't be empty");
+ //this.jTextFieldAbstract.requestFocus();
+ return false;
+ }
+ if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
+ Log.err("Incorrect data type for Abstract");
+ //this.jTextFieldAbstract.requestFocus();
+ return false;
+ }
+
+ //
+ // Check Description
+ //
+ if (isEmpty(this.jTextAreaDescription.getText())) {
+ Log.err("Description couldn't be empty");
+ //this.jTextAreaDescription.requestFocus();
+ return false;
+ }
+
+ //
+ // Check Copyright
+ //
+ if (isEmpty(this.jTextFieldCopyright.getText())) {
+ Log.err("Copyright couldn't be empty");
+ //this.jTextFieldCopyright.requestFocus();
+ return false;
+ }
+
+ //
+ // Check License
+ //
+ if (isEmpty(this.jTextAreaLicense.getText())) {
+ Log.err("License couldn't be empty");
+ //this.jTextAreaLicense.requestFocus();
+ return false;
+ }
+
+ //
+ // Check Specification
+ //
+ if (isEmpty(this.jTextFieldSpecification.getText())) {
+ Log.err("Specification couldn't be empty");
+ //this.jTextFieldSpecification.requestFocus();
+ return false;
+ }
+ if (!DataValidation.isSpecification(this.jTextFieldSpecification.getText())) {
+ Log.err("Incorrect data type for Specification");
+ //this.jTextFieldSpecification.requestFocus();
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ Save all components of Msa Header
+ if exists msaHeader, set the value directly
+ if not exists msaHeader, new an instance first
+
+ **/
+ public void save() {
+ try {
+ // this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());
+ // this.msaHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem()
+ // .toString()));
+ // this.msaHeader.setGuidValue(this.jTextFieldGuid.getText());
+ // this.msaHeader.setVersion(this.jTextFieldVersion.getText());
+ // this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());
+ // this.msaHeader.setDescription(this.jTextAreaDescription.getText());
+ // this.msaHeader.setCopyright(this.jTextFieldCopyright.getText());
+ // if (this.msaHeader.getLicense() != null) {
+ // this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
+ // } else {
+ // License mLicense = License.Factory.newInstance();
+ // mLicense.setStringValue(this.jTextAreaLicense.getText());
+ // this.msaHeader.setLicense(mLicense);
+ // }
+ // if (!isEmpty(this.jTextFieldURL.getText())) {
+ // this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());
+ // }
+ // this.msaHeader.setSpecification(this.jTextFieldSpecification.getText());
+
+ msa.setMsaHeader(msaHeader);
+ this.omt.setSaved(false);
+ } catch (Exception e) {
+ Log.err("Save Module", e.getMessage());
+ }
+ }
+
+ /**
+ This method initializes Module type and Compontent type
+
+ **/
+ private void initFrame() {
+ EnumerationData ed = new EnumerationData();
+ Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());
+ }
+
+ /**
+ Get MsaHeaderDocument.MsaHeader
+
+ @return MsaHeaderDocument.MsaHeader
+
+ **/
+ public MsaHeaderDocument.MsaHeader getMsaHeader() {
+ return msaHeader;
+ }
+
+ /**
+ Set MsaHeaderDocument.MsaHeader
+
+ @param msaHeader The input data of MsaHeaderDocument.MsaHeader
+
+ **/
+ public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {
+ this.msaHeader = msaHeader;
+ }
+
+ /* (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 intCurrentWidth = this.getJContentPane().getWidth();
+ int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
+
+ resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldCopyright, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
+ resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);
+ relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
+ DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
+ }
+
+ public void focusLost(FocusEvent arg0) {
+ if (this.msaHeader == null) {
+ msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
+ }
+
+ //
+ // Check BaseName
+ //
+ if (arg0.getSource() == this.jTextFieldBaseName) {
+ if (isEmpty(this.jTextFieldBaseName.getText())) {
+ Log.err("Base Name couldn't be empty");
+ //this.jTextFieldBaseName.requestFocus();
+ return;
+ }
+ if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
+ Log.err("Incorrect data type for Base Name");
+ //this.jTextFieldBaseName.requestFocus();
+ return;
+ }
+ this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());
+ }
+
+ //
+ // Check Module Type
+ //
+ if (arg0.getSource() == this.jComboBoxModuleType) {
+ msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString()));
+ }
+
+ //
+ // Check Guid
+ //
+ if (arg0.getSource() == this.jTextFieldGuid) {
+ if (isEmpty(this.jTextFieldGuid.getText())) {
+ Log.err("Guid Value couldn't be empty");
+ //this.jTextFieldGuid.requestFocus();
+ return;
+ }
+ if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
+ Log.err("Incorrect data type for Guid");
+ //this.jTextFieldGuid.requestFocus();
+ return;
+ }
+ this.msaHeader.setGuidValue(jTextFieldGuid.getText());
+ }
+
+ //
+ // Check Version
+ //
+ if (arg0.getSource() == this.jTextFieldVersion) {
+
+ if (isEmpty(this.jTextFieldVersion.getText())) {
+ Log.err("Version couldn't be empty");
+ //this.jTextFieldVersion.requestFocus();
+ return;
+ }
+ if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
+ Log.err("Incorrect data type for Version");
+ //this.jTextFieldVersion.requestFocus();
+ return;
+ }
+ this.msaHeader.setVersion(this.jTextFieldVersion.getText());
+ }
+
+ //
+ // Check Abstact
+ //
+ if (arg0.getSource() == this.jTextFieldAbstract) {
+ if (isEmpty(this.jTextFieldAbstract.getText())) {
+ Log.err("Abstract couldn't be empty");
+ //this.jTextFieldAbstract.requestFocus();
+ return;
+ }
+ if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
+ Log.err("Incorrect data type for Abstract");
+ //this.jTextFieldAbstract.requestFocus();
+ return;
+ }
+ this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());
+ }
+
+ //
+ // Check Description
+ //
+ if (arg0.getSource() == this.jTextAreaDescription) {
+ if (isEmpty(this.jTextAreaDescription.getText())) {
+ Log.err("Description couldn't be empty");
+ //this.jTextAreaDescription.requestFocus();
+ return;
+ }
+ this.msaHeader.setDescription(this.jTextAreaDescription.getText());
+ }
+
+ //
+ // Check Copyright
+ //
+ if (arg0.getSource() == this.jTextFieldCopyright) {
+ if (isEmpty(this.jTextFieldCopyright.getText())) {
+ Log.err("Copyright couldn't be empty");
+ //this.jTextFieldCopyright.requestFocus();
+ return;
+ }
+ this.msaHeader.setDescription(this.jTextFieldCopyright.getText());
+ }
+
+ //
+ // Check License
+ //
+ if (arg0.getSource() == this.jTextAreaLicense) {
+ if (isEmpty(this.jTextAreaLicense.getText())) {
+ Log.err("License couldn't be empty");
+ //this.jTextAreaLicense.requestFocus();
+ return;
+ }
+ if (this.msaHeader.getLicense() != null) {
+ this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
+ } else {
+ License mLicense = License.Factory.newInstance();
+ mLicense.setStringValue(this.jTextAreaLicense.getText());
+ this.msaHeader.setLicense(mLicense);
+ }
+ }
+
+ //
+ // Check License URL
+ //
+ if (arg0.getSource() == this.jTextFieldURL) {
+ if (!isEmpty(this.jTextFieldURL.getText())) {
+ if (this.msaHeader.getLicense() == null) {
+ License mLicense = License.Factory.newInstance();
+ mLicense.setURL(this.jTextFieldURL.getText());
+ this.msaHeader.setLicense(mLicense);
+ } else {
+ this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());
+ }
+ }
+ }
+
+ this.save();
+ }
+}