org.pf.joi.xml
Class XMLObjectExporter

java.lang.Object
  extended byorg.pf.joi.xml.XMLTags
      extended byorg.pf.joi.xml.XMLObjectExporter
All Implemented Interfaces:
org.pf.joi.ExportProvider

public class XMLObjectExporter
extends org.pf.joi.xml.XMLTags
implements org.pf.joi.ExportProvider

This class provides export functionality for inspected objects to XML files.
For it's XML writing it requires any XML parser package that supports the JAXP factory mechanism and implements a SAX parser

Version:
2.0.1
Author:
Manfred Duchrow

Constructor Summary
XMLObjectExporter()
          Initialize the new instance with default values.
 
Method Summary
 org.w3c.dom.Document createDocument(org.pf.joi.AbstractObjectSpy objectSpy)
          Returns a DOM document containing all data of the given object.
 org.pf.six.Element createXMLTree(org.pf.joi.AbstractObjectSpy objectSpy)
          Returns a simple XML tree representing the object's internal state that is encapsulated in the given object spy.
 boolean export(org.pf.joi.AbstractObjectSpy objectSpy, java.io.File file)
          Exports the given object to the specified file.
 boolean export(org.pf.joi.AbstractObjectSpy objectSpy, java.awt.Frame parent)
          Displays a file dialog to select the directory and filename and than writes the object contents to that file as XML data.
 boolean export(org.pf.joi.AbstractObjectSpy objectSpy, java.lang.String filename)
          Exports the given object to the file with the specified name.
 boolean export(org.pf.joi.AbstractObjectSpy objectSpy, java.io.Writer writer)
          Exports the given object to the specified writer.
 java.lang.String exportLabel()
          Returns the label that will be shown in an inspector's 'File' menu.
 java.lang.String getVendor()
          Returns the vendor of this export provider
 java.lang.String getVersion()
          Returns the version of this export provider
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLObjectExporter

public XMLObjectExporter()
Initialize the new instance with default values.

Method Detail

export

public boolean export(org.pf.joi.AbstractObjectSpy objectSpy,
                      java.awt.Frame parent)
               throws java.lang.Exception
Displays a file dialog to select the directory and filename and than writes the object contents to that file as XML data.

Specified by:
export in interface org.pf.joi.ExportProvider
Parameters:
objectSpy - The wrapped object to be exported
parent - The parent window. Usually that is the inspector window
Throws:
java.lang.Exception

export

public boolean export(org.pf.joi.AbstractObjectSpy objectSpy,
                      java.lang.String filename)
               throws java.lang.Exception
Exports the given object to the file with the specified name.

Specified by:
export in interface org.pf.joi.ExportProvider
Parameters:
objectSpy - The wrapped object to be exported
filename - The name of the output file
Throws:
java.lang.Exception

export

public boolean export(org.pf.joi.AbstractObjectSpy objectSpy,
                      java.io.Writer writer)
               throws java.lang.Exception
Exports the given object to the specified writer.

Parameters:
objectSpy - The wrapped object to be exported
writer - The writer to which the object contents will be written
Throws:
java.lang.Exception

export

public boolean export(org.pf.joi.AbstractObjectSpy objectSpy,
                      java.io.File file)
               throws java.lang.Exception
Exports the given object to the specified file.

Parameters:
objectSpy - The wrapped object to be exported
file - The file to which the object contents will be written
Throws:
java.lang.Exception

exportLabel

public java.lang.String exportLabel()
Returns the label that will be shown in an inspector's 'File' menu.

Specified by:
exportLabel in interface org.pf.joi.ExportProvider

createXMLTree

public org.pf.six.Element createXMLTree(org.pf.joi.AbstractObjectSpy objectSpy)
                                 throws java.lang.Exception
Returns a simple XML tree representing the object's internal state that is encapsulated in the given object spy.

Parameters:
objectSpy - The wrapper around the object to represent as XML
Throws:
java.lang.Exception

createDocument

public org.w3c.dom.Document createDocument(org.pf.joi.AbstractObjectSpy objectSpy)
                                    throws java.lang.Exception
Returns a DOM document containing all data of the given object.

Throws:
java.lang.Exception

getVersion

public java.lang.String getVersion()
Returns the version of this export provider

Specified by:
getVersion in interface org.pf.joi.ExportProvider

getVendor

public java.lang.String getVendor()
Returns the vendor of this export provider

Specified by:
getVendor in interface org.pf.joi.ExportProvider