ix.util.xml
Class XMLSaver

java.lang.Object
  |
  +--ix.util.xml.XMLSaver
Direct Known Subclasses:
PlanSaver

public class XMLSaver
extends java.lang.Object

A utility for saving XML documents to files, conducting dialogs as required.


Field Summary
protected  java.awt.Component frame
           
protected  java.io.File libDir
           
protected  XMLTranslator xmlt
           
 
Constructor Summary
XMLSaver(java.awt.Component frame)
           
 
Method Summary
 java.io.File chooseFileToWrite(java.awt.Component frame, java.io.File directory)
           
 org.jdom.Document getDocument(java.lang.Object obj)
          Converts the object to a JDOM document using this saver's XML translator.
 XMLTranslator getXMLTranslator()
          Returns the XMLTranslator that is used by the saveObject method to translate an object to a JDOM document.
 void saveDocument(org.jdom.Document doc)
          Writes a JDOM Document to a file selected by the user, conducting any necessary dialogs along the way.
 void saveObject(java.lang.Object obj)
          Converts an object to a JDOM Document by calling the getDocument method, then calls the saveDocument method on the result.
 void setXMLTranslator(XMLTranslator xmlt)
          Sets the XMLTranslator that is used by the saveObject and getDocument methods to translate an object to a JDOM document.
 boolean writeTo(java.io.File file, org.jdom.Document doc)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

libDir

protected java.io.File libDir

xmlt

protected XMLTranslator xmlt

frame

protected java.awt.Component frame
Constructor Detail

XMLSaver

public XMLSaver(java.awt.Component frame)
Method Detail

getXMLTranslator

public XMLTranslator getXMLTranslator()
Returns the XMLTranslator that is used by the saveObject method to translate an object to a JDOM document.

setXMLTranslator

public void setXMLTranslator(XMLTranslator xmlt)
Sets the XMLTranslator that is used by the saveObject and getDocument methods to translate an object to a JDOM document.

saveObject

public void saveObject(java.lang.Object obj)
Converts an object to a JDOM Document by calling the getDocument method, then calls the saveDocument method on the result.
See Also:
setXMLTranslator(XMLTranslator), saveDocument(Document)

getDocument

public org.jdom.Document getDocument(java.lang.Object obj)
Converts the object to a JDOM document using this saver's XML translator.

saveDocument

public void saveDocument(org.jdom.Document doc)
Writes a JDOM Document to a file selected by the user, conducting any necessary dialogs along the way. It repeatedly asks the user to select a file until either the Document has been successfully written or the user decides to cancel the operation. The user is informed of any exceptions thrown while attempting to write, and "success" means that no exceptions were thrown.

writeTo

public boolean writeTo(java.io.File file,
                       org.jdom.Document doc)

chooseFileToWrite

public java.io.File chooseFileToWrite(java.awt.Component frame,
                                      java.io.File directory)