3 The file is used to define opening package 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
;
18 import java
.util
.Vector
;
20 import javax
.swing
.tree
.TreePath
;
22 import org
.tianocore
.PlatformSurfaceAreaDocument
;
23 import org
.tianocore
.frameworkwizard
.platform
.PlatformIdentification
;
25 public class OpeningPlatformList
{
27 private Vector
<OpeningPlatformType
> vOpeningPlatformList
= new Vector
<OpeningPlatformType
>();
29 public OpeningPlatformList() {
33 public Vector
<OpeningPlatformType
> getVOpeningPlatformList() {
34 return vOpeningPlatformList
;
37 public void setVOpeningPlatformList(Vector
<OpeningPlatformType
> openingPlatformList
) {
38 vOpeningPlatformList
= openingPlatformList
;
41 public void insertToOpeningPlatformList(PlatformIdentification id
, PlatformSurfaceAreaDocument
.PlatformSurfaceArea xmlFpd
) {
42 vOpeningPlatformList
.addElement(new OpeningPlatformType(id
, xmlFpd
));
45 public OpeningPlatformType
getOpeningPlatformByIndex(int index
) {
46 if (index
> -1 && index
< vOpeningPlatformList
.size()) {
47 return vOpeningPlatformList
.elementAt(index
);
52 public OpeningPlatformType
getOpeningPlatformById(PlatformIdentification id
) {
53 int index
= findIndexOfListById(id
);
55 return vOpeningPlatformList
.elementAt(index
);
60 public int findIndexOfListById(PlatformIdentification id
) {
61 for (int index
= 0; index
< vOpeningPlatformList
.size(); index
++) {
62 if (vOpeningPlatformList
.elementAt(index
).getId().equals(id
)) {
69 public void removeFromOpeningPlatformListByIndex(int index
) {
70 if (index
> -1 && index
< vOpeningPlatformList
.size()) {
71 vOpeningPlatformList
.removeElementAt(index
);
75 public void removeFromOpeningPlatformListById(PlatformIdentification id
) {
76 int index
= findIndexOfListById(id
);
78 vOpeningPlatformList
.removeElementAt(findIndexOfListById(id
));
82 public void removeAllFromOpeningPlatformList() {
83 vOpeningPlatformList
.removeAllElements();
86 public PlatformSurfaceAreaDocument
.PlatformSurfaceArea
getPlatformSurfaceAreaFromId(PlatformIdentification id
) {
87 int index
= findIndexOfListById(id
);
89 return vOpeningPlatformList
.elementAt(index
).getXmlFpd();
94 public boolean existsPlatform(PlatformIdentification id
) {
95 int index
= findIndexOfListById(id
);
103 public void setPlatformSaved(PlatformIdentification id
, boolean isSaved
) {
104 setPlatformSaved(findIndexOfListById(id
), isSaved
);
107 public void setPlatformSaved(int index
, boolean isSaved
) {
109 vOpeningPlatformList
.elementAt(index
).setSaved(isSaved
);
113 public boolean getPlatformSaved(PlatformIdentification id
) {
114 return getPlatformSaved(findIndexOfListById(id
));
117 public boolean getPlatformSaved(int index
) {
119 return vOpeningPlatformList
.elementAt(index
).isSaved();
124 public void setPlatformOpen(PlatformIdentification id
, boolean isOpen
) {
125 setPlatformOpen(findIndexOfListById(id
), isOpen
);
128 public void setPlatformOpen(int index
, boolean isOpen
) {
130 vOpeningPlatformList
.elementAt(index
).setOpen(isOpen
);
134 public boolean getPlatformOpen(PlatformIdentification id
) {
135 return getPlatformOpen(findIndexOfListById(id
));
138 public boolean getPlatformOpen(int index
) {
140 return vOpeningPlatformList
.elementAt(index
).isOpen();
145 public void setTreePathById(PlatformIdentification id
, Set
<TreePath
> treePath
) {
146 int index
= findIndexOfListById(id
);
148 vOpeningPlatformList
.elementAt(index
).setTreePath(treePath
);
152 public Set
<TreePath
> getTreePathById(PlatformIdentification id
) {
153 int index
= findIndexOfListById(id
);
155 return vOpeningPlatformList
.elementAt(index
).getTreePath();
160 public Set
<TreePath
> getTreePathByIndex(int index
) {
162 return vOpeningPlatformList
.elementAt(index
).getTreePath();
167 public PlatformIdentification
getIdByPath(String path
) {
168 PlatformIdentification id
= new PlatformIdentification(null, null, null, path
);
169 int index
= findIndexOfListById(id
);
171 return vOpeningPlatformList
.elementAt(index
).getId();
176 public void setNew(PlatformIdentification id
, boolean isNew
) {
177 int index
= findIndexOfListById(id
);
179 vOpeningPlatformList
.elementAt(index
).setNew(isNew
);
183 public void closeAll() {
184 for (int index
= 0; index
< this.size(); index
++) {
185 this.setPlatformOpen(index
, false);
190 return vOpeningPlatformList
.size();
193 public boolean isSaved() {
194 for (int index
= 0; index
< this.size(); index
++) {
195 if (!this.getPlatformSaved(index
)) {
202 public boolean isOpen() {
203 for (int index
= 0; index
< this.size(); index
++) {
204 if (this.getPlatformOpen(index
)) {