void restore(XmlNode node) throws XMLException { layerControls.restore(node); invertRegionSwitch.restore(node); colorControls.restore(node); if (node.hasAttribute(TabIndexTag)) { tabPane.setSelectedIndex(Integer.parseInt(node.getAttribute(TabIndexTag))); } }
/** * Preserve this ImageExportOptions in XML. * * @param node An XML context in which to save. */ public void write(XmlNode node) { node = node.addChild(ExportOptionsTag); node.setAttribute(TypeTag, m_imageType.getName()); save(node); if (m_exportFile != null) { node.setAttribute(FileTag, m_exportFile.getAbsolutePath()); } }
/** * 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; }
void save(XmlNode node) { layerControls.save(node); invertRegionSwitch.save(node); colorControls.save(node); node.setAttribute(TabIndexTag, Integer.toString(tabPane.getSelectedIndex())); }