]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java
1. Merge ModuleDefinitions to MsaHeader
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Identifications / OpeningModuleList.java
index 6796b17bc9af3a844665268f8a7aa790d9c7de7d..eab8d2a82465e2363d6d17c17e31db89bee75377 100644 (file)
@@ -19,6 +19,7 @@ import java.util.Vector;
 import javax.swing.tree.TreePath;\r
 \r
 import org.tianocore.ModuleSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
 \r
 public class OpeningModuleList {\r
     private Vector<OpeningModuleType> vOpeningModuleList = new Vector<OpeningModuleType>();\r
@@ -34,7 +35,7 @@ public class OpeningModuleList {
         vOpeningModuleList = openingModuleList;\r
     }\r
     \r
-    public void insertToOpeningModuleList(Identification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
+    public void insertToOpeningModuleList(ModuleIdentification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
         vOpeningModuleList.addElement(new OpeningModuleType(id, xmlMsa));\r
     }\r
     \r
@@ -45,7 +46,7 @@ public class OpeningModuleList {
         return null;\r
     }\r
     \r
-    public OpeningModuleType getOpeningModuleById(Identification id) {\r
+    public OpeningModuleType getOpeningModuleById(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index);\r
@@ -53,7 +54,7 @@ public class OpeningModuleList {
         return null;\r
     }\r
     \r
-    public int findIndexOfListById(Identification id) {\r
+    public int findIndexOfListById(ModuleIdentification id) {\r
         for (int index = 0; index < vOpeningModuleList.size(); index++) {\r
             if (vOpeningModuleList.elementAt(index).getId().equals(id)) {\r
                 return index;\r
@@ -68,7 +69,7 @@ public class OpeningModuleList {
         }\r
     }\r
     \r
-    public void removeFromOpeningModuleListById(Identification id) {\r
+    public void removeFromOpeningModuleListById(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             vOpeningModuleList.removeElementAt(findIndexOfListById(id));\r
@@ -79,7 +80,7 @@ public class OpeningModuleList {
         vOpeningModuleList.removeAllElements();\r
     }\r
     \r
-    public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(Identification id) {\r
+    public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index).getXmlMsa();\r
@@ -87,7 +88,7 @@ public class OpeningModuleList {
         return null;\r
     }\r
     \r
-    public boolean existsModule(Identification id) {\r
+    public boolean existsModule(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             return true;\r
@@ -95,7 +96,7 @@ public class OpeningModuleList {
         return false;\r
     }\r
     \r
-    public void setModuleSaved(Identification id, boolean isSaved) {\r
+    public void setModuleSaved(ModuleIdentification id, boolean isSaved) {\r
         setModuleSaved(findIndexOfListById(id), isSaved);\r
     }\r
     \r
@@ -105,7 +106,7 @@ public class OpeningModuleList {
         }\r
     }\r
     \r
-    public boolean getModuleSaved(Identification id) {\r
+    public boolean getModuleSaved(ModuleIdentification id) {\r
         return getModuleSaved(findIndexOfListById(id));\r
     }\r
     \r
@@ -116,14 +117,35 @@ public class OpeningModuleList {
         return true;\r
     }\r
     \r
-    public void setTreePathById(Identification id, TreePath treePath) {\r
+    public void setModuleOpen(ModuleIdentification id, boolean isOpen) {\r
+        setModuleOpen(findIndexOfListById(id), isOpen);\r
+    }\r
+    \r
+    public void setModuleOpen(int index, boolean isOpen) {\r
+        if (index > -1) {\r
+            vOpeningModuleList.elementAt(index).setOpen(isOpen);\r
+        }\r
+    }\r
+    \r
+    public boolean getModuleOpen(ModuleIdentification id) {\r
+        return getModuleOpen(findIndexOfListById(id));\r
+    }\r
+    \r
+    public boolean getModuleOpen(int index) {\r
+        if (index > -1) {\r
+            return vOpeningModuleList.elementAt(index).isOpen();\r
+        }\r
+        return true;\r
+    }\r
+    \r
+    public void setTreePathById(ModuleIdentification id, TreePath treePath) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             vOpeningModuleList.elementAt(index).setTreePath(treePath);\r
         }\r
     }\r
     \r
-    public TreePath getTreePathById(Identification id) {\r
+    public TreePath getTreePathById(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index).getTreePath();\r
@@ -138,13 +160,28 @@ public class OpeningModuleList {
         return null;\r
     }\r
     \r
-    public void setNew(Identification id, boolean isNew) {\r
+    public ModuleIdentification getIdByPath(String path) {\r
+        ModuleIdentification id = new ModuleIdentification(null, null, null, path);\r
+        int index = findIndexOfListById(id);\r
+        if (index > -1) {\r
+            return vOpeningModuleList.elementAt(index).getId();\r
+        }\r
+        return null;\r
+    }\r
+    \r
+    public void setNew(ModuleIdentification id, boolean isNew) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             vOpeningModuleList.elementAt(index).setNew(isNew);\r
         }\r
     }\r
     \r
+    public void closeAll() {\r
+        for (int index = 0; index < this.size(); index++) {\r
+           this.setModuleOpen(index, false);\r
+        }\r
+    }\r
+    \r
     public int size() {\r
         return vOpeningModuleList.size();\r
     }\r
@@ -158,9 +195,11 @@ public class OpeningModuleList {
         return true;\r
     }\r
     \r
-    public boolean isOpend() {\r
-        if (this.size() > 0 ) {\r
-            return true;\r
+    public boolean isOpen() {\r
+        for (int index = 0; index < this.size(); index++) {\r
+            if (this.getModuleOpen(index)) {\r
+                return true;\r
+            }\r
         }\r
         return false;\r
     }\r