+ /**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