3 The file is used to define opening module list
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.common
.Identifications
;
17 import java
.util
.Vector
;
19 import javax
.swing
.tree
.TreePath
;
21 import org
.tianocore
.ModuleSurfaceAreaDocument
;
22 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
24 public class OpeningModuleList
{
25 private Vector
<OpeningModuleType
> vOpeningModuleList
= new Vector
<OpeningModuleType
>();
27 public OpeningModuleList() {
30 public Vector
<OpeningModuleType
> getVOpeningModuleList() {
31 return vOpeningModuleList
;
34 public void setVOpeningModuleList(Vector
<OpeningModuleType
> openingModuleList
) {
35 vOpeningModuleList
= openingModuleList
;
38 public void insertToOpeningModuleList(ModuleIdentification id
, ModuleSurfaceAreaDocument
.ModuleSurfaceArea xmlMsa
) {
39 vOpeningModuleList
.addElement(new OpeningModuleType(id
, xmlMsa
));
42 public OpeningModuleType
getOpeningModuleByIndex(int index
) {
43 if (index
> -1 && index
< vOpeningModuleList
.size()) {
44 return vOpeningModuleList
.elementAt(index
);
49 public OpeningModuleType
getOpeningModuleById(ModuleIdentification id
) {
50 int index
= findIndexOfListById(id
);
52 return vOpeningModuleList
.elementAt(index
);
57 public int findIndexOfListById(ModuleIdentification id
) {
58 for (int index
= 0; index
< vOpeningModuleList
.size(); index
++) {
59 if (vOpeningModuleList
.elementAt(index
).getId().equals(id
)) {
66 public void removeFromOpeningModuleListByIndex(int index
) {
67 if (index
> -1 && index
< vOpeningModuleList
.size()) {
68 vOpeningModuleList
.removeElementAt(index
);
72 public void removeFromOpeningModuleListById(ModuleIdentification id
) {
73 int index
= findIndexOfListById(id
);
75 vOpeningModuleList
.removeElementAt(findIndexOfListById(id
));
79 public void removeAllFromOpeningModuleList() {
80 vOpeningModuleList
.removeAllElements();
83 public ModuleSurfaceAreaDocument
.ModuleSurfaceArea
getModuleSurfaceAreaFromId(ModuleIdentification id
) {
84 int index
= findIndexOfListById(id
);
86 return vOpeningModuleList
.elementAt(index
).getXmlMsa();
91 public boolean existsModule(ModuleIdentification id
) {
92 int index
= findIndexOfListById(id
);
99 public void setModuleSaved(ModuleIdentification id
, boolean isSaved
) {
100 setModuleSaved(findIndexOfListById(id
), isSaved
);
103 public void setModuleSaved(int index
, boolean isSaved
) {
105 vOpeningModuleList
.elementAt(index
).setSaved(isSaved
);
109 public boolean getModuleSaved(ModuleIdentification id
) {
110 return getModuleSaved(findIndexOfListById(id
));
113 public boolean getModuleSaved(int index
) {
115 return vOpeningModuleList
.elementAt(index
).isSaved();
120 public void setModuleOpen(ModuleIdentification id
, boolean isOpen
) {
121 setModuleOpen(findIndexOfListById(id
), isOpen
);
124 public void setModuleOpen(int index
, boolean isOpen
) {
126 vOpeningModuleList
.elementAt(index
).setOpen(isOpen
);
130 public boolean getModuleOpen(ModuleIdentification id
) {
131 return getModuleOpen(findIndexOfListById(id
));
134 public boolean getModuleOpen(int index
) {
136 return vOpeningModuleList
.elementAt(index
).isOpen();
141 public void setTreePathById(ModuleIdentification id
, TreePath treePath
) {
142 int index
= findIndexOfListById(id
);
144 vOpeningModuleList
.elementAt(index
).setTreePath(treePath
);
148 public TreePath
getTreePathById(ModuleIdentification id
) {
149 int index
= findIndexOfListById(id
);
151 return vOpeningModuleList
.elementAt(index
).getTreePath();
156 public TreePath
getTreePathByIndex(int index
) {
158 return vOpeningModuleList
.elementAt(index
).getTreePath();
163 public ModuleIdentification
getIdByPath(String path
) {
164 ModuleIdentification id
= new ModuleIdentification(null, null, null, path
);
165 int index
= findIndexOfListById(id
);
167 return vOpeningModuleList
.elementAt(index
).getId();
172 public void setNew(ModuleIdentification id
, boolean isNew
) {
173 int index
= findIndexOfListById(id
);
175 vOpeningModuleList
.elementAt(index
).setNew(isNew
);
179 public void closeAll() {
180 for (int index
= 0; index
< this.size(); index
++) {
181 this.setModuleOpen(index
, false);
186 return vOpeningModuleList
.size();
189 public boolean isSaved() {
190 for (int index
= 0; index
< this.size(); index
++) {
191 if (!this.getModuleSaved(index
)) {
198 public boolean isOpen() {
199 for (int index
= 0; index
< this.size(); index
++) {
200 if (this.getModuleOpen(index
)) {