\r
if (opt.getSupArchList() != null){\r
saa[i][4] = listToString(opt.getSupArchList());\r
-\r
+ }\r
+ else {\r
+ saa[i][4] = "";\r
}\r
\r
saa[i][5] = opt.getStringValue();\r
}\r
\r
public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {\r
+ FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();\r
+ if (fis == null || fis.getFvImageList() == null) {\r
+ return;\r
+ }\r
\r
+ ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = li.next();\r
+ if (fi.getType().toString().equals("ImageName")) {\r
+ vImageNames.addAll(fi.getFvImageNamesList());\r
+ return;\r
+ }\r
+ }\r
}\r
\r
public void AddFvImageFvImageNames (String[] fvNames) {\r
cursor.dispose();\r
}\r
\r
+ /**\r
+ * @param oldFvName\r
+ * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.\r
+ */\r
public void updateFvImageNameAll (String oldFvName, String newFvName) {\r
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
return;\r
}\r
}\r
\r
+ /**\r
+ * @param fi\r
+ * @param oldFvName The FV Name to be replaced.\r
+ * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.\r
+ */\r
public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {\r
QName qFvImageNames = new QName(xmlNs, "FvImageNames");\r
XmlCursor cursor = fi.newCursor();\r
if (cursor.toChild(qFvImageNames)) {\r
do {\r
if (cursor.getTextValue().equals(oldFvName)){\r
- cursor.setTextValue(newFvName);\r
+ if (newFvName != null) {\r
+ cursor.setTextValue(newFvName);\r
+ }\r
+ else {\r
+ if (fi.getFvImageNamesList().size() == 1) {\r
+ removeElement(fi);\r
+ break;\r
+ }\r
+ else {\r
+ cursor.removeXml();\r
+ }\r
+ }\r
}\r
}while (cursor.toNextSibling(qFvImageNames));\r
}\r
cursor.dispose();\r
}\r
\r
- public int getFvImagesFvImageCount() {\r
+ public int getFvImagesFvImageCount(String type) {\r
\r
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
return 0;\r
}\r
- return getfpdFlash().getFvImages().getFvImageList().size();\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ ListIterator li = l.listIterator();\r
+ int i = 0;\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ \r
+ ++i;\r
+ }\r
+ \r
+ return i;\r
}\r
\r
- /**Only Get Fv image setting - name and type.\r
+ public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {\r
+ Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();\r
+ if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
+ return vFvImage;\r
+ }\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ ListIterator li = l.listIterator();\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ if (fi.getFvImageNamesList().contains(fvName)) {\r
+ vFvImage.add(fi);\r
+ }\r
+ }\r
+ \r
+ return vFvImage;\r
+ }\r
+ /**\r
* @param saa\r
+ * @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.\r
*/\r
- public void getFvImagesFvImages(String[][] saa) {\r
+ public void getFvImagesFvImages(String[][] saa, String type) {\r
\r
if (getfpdFlash().getFvImages() == null) {\r
return;\r
int i = 0;\r
while(li.hasNext()) {\r
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
//\r
// get FvImageNames array, space separated\r
//\r
}\r
}\r
\r
+ /**Add name-value pair to FvImage element with type.\r
+ * @param fvName FV name to add name-value pair.\r
+ * @param type FvImage attribute.\r
+ * @param name\r
+ * @param value\r
+ */\r
+ public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value) {\r
+ if (getfpdFlash().getFvImages() == null) {\r
+ return;\r
+ }\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ if (l == null) {\r
+ return;\r
+ }\r
+ ListIterator li = l.listIterator();\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ if (!fi.getFvImageNamesList().contains(fvName)) {\r
+ continue;\r
+ }\r
+ setFvImagesFvImageNameValue (fi, name, value, null);\r
+ }\r
+ }\r
+ \r
+ /**Add to all FvImage elements with type, the name-value pair.\r
+ * @param type\r
+ * @param name\r
+ * @param value\r
+ */\r
+ public void setTypedFvImageNameValue (String type, String name, String value) {\r
+ if (getfpdFlash().getFvImages() == null) {\r
+ return;\r
+ }\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ if (l == null) {\r
+ return;\r
+ }\r
+ ListIterator li = l.listIterator();\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ setFvImagesFvImageNameValue (fi, name, value, null);\r
+ }\r
+ }\r
+ \r
+ /**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.\r
+ * @param fi\r
+ * @param name\r
+ * @param value\r
+ * @param newName\r
+ */\r
+ public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {\r
+ if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+ return;\r
+ }\r
+ \r
+ XmlCursor cursor = fi.getFvImageOptions().newCursor();\r
+ if (cursor.toFirstChild()) {\r
+ do {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();\r
+ if (nv.getName().equals(name)) {\r
+ nv.setValue(value);\r
+ if (newName != null) {\r
+ nv.setName(newName);\r
+ }\r
+ cursor.dispose();\r
+ return;\r
+ }\r
+ }while (cursor.toNextSibling());\r
+ }\r
+ \r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();\r
+ nv.setName(name);\r
+ nv.setValue(value);\r
+ if (newName != null) {\r
+ nv.setName(newName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {\r
+ Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");\r
+ for (int i = 0; i < vFvImage.size(); ++i) {\r
+ FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);\r
+ if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+ continue;\r
+ }\r
+\r
+ ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()\r
+ .getNameValueList()\r
+ .listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r
+ m.put(nv.getName(), nv.getValue());\r
+ }\r
+ }\r
+ }\r
/**Get FvImage Options for FvImage i\r
* @param i the ith FvImage\r
*/\r