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
;
17 import java
.util
.Vector
;
19 import javax
.swing
.tree
.TreePath
;
21 import org
.tianocore
.PlatformSurfaceAreaDocument
;
22 import org
.tianocore
.frameworkwizard
.platform
.PlatformIdentification
;
24 public class OpeningPlatformList
{
26 private Vector
<OpeningPlatformType
> vOpeningPlatformList
= new Vector
<OpeningPlatformType
>();
28 public OpeningPlatformList() {
32 public Vector
<OpeningPlatformType
> getVOpeningPlatformList() {
33 return vOpeningPlatformList
;
36 public void setVOpeningPlatformList(Vector
<OpeningPlatformType
> openingPlatformList
) {
37 vOpeningPlatformList
= openingPlatformList
;
40 public void insertToOpeningPlatformList(PlatformIdentification id
, PlatformSurfaceAreaDocument
.PlatformSurfaceArea xmlFpd
) {
41 vOpeningPlatformList
.addElement(new OpeningPlatformType(id
, xmlFpd
));
44 public OpeningPlatformType
getOpeningPlatformByIndex(int index
) {
45 if (index
> -1 && index
< vOpeningPlatformList
.size()) {
46 return vOpeningPlatformList
.elementAt(index
);
51 public OpeningPlatformType
getOpeningPlatformById(PlatformIdentification id
) {
52 int index
= findIndexOfListById(id
);
54 return vOpeningPlatformList
.elementAt(index
);
59 public int findIndexOfListById(PlatformIdentification id
) {
60 for (int index
= 0; index
< vOpeningPlatformList
.size(); index
++) {
61 if (vOpeningPlatformList
.elementAt(index
).getId().equals(id
)) {
68 public void removeFromOpeningPlatformListByIndex(int index
) {
69 if (index
> -1 && index
< vOpeningPlatformList
.size()) {
70 vOpeningPlatformList
.removeElementAt(index
);
74 public void removeFromOpeningPlatformListById(PlatformIdentification id
) {
75 int index
= findIndexOfListById(id
);
77 vOpeningPlatformList
.removeElementAt(findIndexOfListById(id
));
81 public void removeAllFromOpeningPlatformList() {
82 vOpeningPlatformList
.removeAllElements();
85 public PlatformSurfaceAreaDocument
.PlatformSurfaceArea
getPlatformSurfaceAreaFromId(PlatformIdentification id
) {
86 int index
= findIndexOfListById(id
);
88 return vOpeningPlatformList
.elementAt(index
).getXmlFpd();
93 public boolean existsPlatform(PlatformIdentification id
) {
94 int index
= findIndexOfListById(id
);
102 public void setPlatformSaved(PlatformIdentification id
, boolean isSaved
) {
103 setPlatformSaved(findIndexOfListById(id
), isSaved
);
106 public void setPlatformSaved(int index
, boolean isSaved
) {
108 vOpeningPlatformList
.elementAt(index
).setSaved(isSaved
);
112 public boolean getPlatformSaved(PlatformIdentification id
) {
113 return getPlatformSaved(findIndexOfListById(id
));
116 public boolean getPlatformSaved(int index
) {
118 return vOpeningPlatformList
.elementAt(index
).isSaved();
123 public void setPlatformOpen(PlatformIdentification id
, boolean isOpen
) {
124 setPlatformOpen(findIndexOfListById(id
), isOpen
);
127 public void setPlatformOpen(int index
, boolean isOpen
) {
129 vOpeningPlatformList
.elementAt(index
).setOpen(isOpen
);
133 public boolean getPlatformOpen(PlatformIdentification id
) {
134 return getPlatformOpen(findIndexOfListById(id
));
137 public boolean getPlatformOpen(int index
) {
139 return vOpeningPlatformList
.elementAt(index
).isOpen();
144 public void setTreePathById(PlatformIdentification id
, TreePath treePath
) {
145 int index
= findIndexOfListById(id
);
147 vOpeningPlatformList
.elementAt(index
).setTreePath(treePath
);
151 public TreePath
getTreePathById(PlatformIdentification id
) {
152 int index
= findIndexOfListById(id
);
154 return vOpeningPlatformList
.elementAt(index
).getTreePath();
159 public TreePath
getTreePathByIndex(int index
) {
161 return vOpeningPlatformList
.elementAt(index
).getTreePath();
166 public PlatformIdentification
getIdByPath(String path
) {
167 PlatformIdentification id
= new PlatformIdentification(null, null, null, path
);
168 int index
= findIndexOfListById(id
);
170 return vOpeningPlatformList
.elementAt(index
).getId();
175 public void setNew(PlatformIdentification id
, boolean isNew
) {
176 int index
= findIndexOfListById(id
);
178 vOpeningPlatformList
.elementAt(index
).setNew(isNew
);
182 public void closeAll() {
183 for (int index
= 0; index
< this.size(); index
++) {
184 this.setPlatformOpen(index
, false);
189 return vOpeningPlatformList
.size();
192 public boolean isSaved() {
193 for (int index
= 0; index
< this.size(); index
++) {
194 if (!this.getPlatformSaved(index
)) {
201 public boolean isOpen() {
202 for (int index
= 0; index
< this.size(); index
++) {
203 if (this.getPlatformOpen(index
)) {