/** * Instantiate a new ImageExportOptions from a preserved state. * * @param node An XML context in which state was saved * @return The new ImageExportOptions * @throws XMLException If the given node has invalid content. */ public static ImageExportOptions read(XmlNode node) throws XMLException { node = node.getChild(ExportOptionsTag); final String typeName = node.getAttribute(TypeTag); final ImageType type = ImageType.getImageTypeByName(typeName); if (type == null) { throw new XMLException("Unrecognized image export type"); } final ImageExportOptions options = type.newExportOptions(); options.restore(node); if (node.hasAttribute(FileTag)) { options.m_exportFile = new File(node.getAttribute(FileTag)); } return options; }