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
;
23 public class OpeningModuleList
{
24 private Vector
<OpeningModuleType
> vOpeningModuleList
= new Vector
<OpeningModuleType
>();
26 public OpeningModuleList() {
29 public Vector
<OpeningModuleType
> getVOpeningModuleList() {
30 return vOpeningModuleList
;
33 public void setVOpeningModuleList(Vector
<OpeningModuleType
> openingModuleList
) {
34 vOpeningModuleList
= openingModuleList
;
37 public void insertToOpeningModuleList(Identification id
, ModuleSurfaceAreaDocument
.ModuleSurfaceArea xmlMsa
) {
38 vOpeningModuleList
.addElement(new OpeningModuleType(id
, xmlMsa
));
41 public OpeningModuleType
getOpeningModuleByIndex(int index
) {
42 if (index
> -1 && index
< vOpeningModuleList
.size()) {
43 return vOpeningModuleList
.elementAt(index
);
48 public OpeningModuleType
getOpeningModuleById(Identification id
) {
49 int index
= findIndexOfListById(id
);
51 return vOpeningModuleList
.elementAt(index
);
56 public int findIndexOfListById(Identification id
) {
57 for (int index
= 0; index
< vOpeningModuleList
.size(); index
++) {
58 if (vOpeningModuleList
.elementAt(index
).getId().equals(id
)) {
65 public void removeFromOpeningModuleListByIndex(int index
) {
66 if (index
> -1 && index
< vOpeningModuleList
.size()) {
67 vOpeningModuleList
.removeElementAt(index
);
71 public void removeFromOpeningModuleListById(Identification id
) {
72 int index
= findIndexOfListById(id
);
74 vOpeningModuleList
.removeElementAt(findIndexOfListById(id
));
78 public void removeAllFromOpeningModuleList() {
79 vOpeningModuleList
.removeAllElements();
82 public ModuleSurfaceAreaDocument
.ModuleSurfaceArea
getModuleSurfaceAreaFromId(Identification id
) {
83 int index
= findIndexOfListById(id
);
85 return vOpeningModuleList
.elementAt(index
).getXmlMsa();
90 public boolean existsModule(Identification id
) {
91 int index
= findIndexOfListById(id
);
98 public void setModuleSaved(Identification id
, boolean isSaved
) {
99 setModuleSaved(findIndexOfListById(id
), isSaved
);
102 public void setModuleSaved(int index
, boolean isSaved
) {
104 vOpeningModuleList
.elementAt(index
).setSaved(isSaved
);
108 public boolean getModuleSaved(Identification id
) {
109 return getModuleSaved(findIndexOfListById(id
));
112 public boolean getModuleSaved(int index
) {
114 return vOpeningModuleList
.elementAt(index
).isSaved();
119 public void setTreePathById(Identification id
, TreePath treePath
) {
120 int index
= findIndexOfListById(id
);
122 vOpeningModuleList
.elementAt(index
).setTreePath(treePath
);
126 public TreePath
getTreePathById(Identification id
) {
127 int index
= findIndexOfListById(id
);
129 return vOpeningModuleList
.elementAt(index
).getTreePath();
134 public TreePath
getTreePathByIndex(int index
) {
136 return vOpeningModuleList
.elementAt(index
).getTreePath();
141 public void setNew(Identification id
, boolean isNew
) {
142 int index
= findIndexOfListById(id
);
144 vOpeningModuleList
.elementAt(index
).setNew(isNew
);
149 return vOpeningModuleList
.size();
152 public boolean isSaved() {
153 for (int index
= 0; index
< this.size(); index
++) {
154 if (!this.getModuleSaved(index
)) {
161 public boolean isOpend() {
162 if (this.size() > 0 ) {