ix.iface.domain
Class DomainWriter

java.lang.Object
  |
  +--ix.iface.domain.DomainWriter
Direct Known Subclasses:
XMLTF_Writer

public abstract class DomainWriter
extends java.lang.Object

An object that writes a domain description in textual form.


Constructor Summary
DomainWriter()
           
 
Method Summary
static DomainWriter makeWriter(java.io.File file)
          Factory method that returns an appropriate writer for the indicated file, based on the file's type or extension.
static DomainWriter makeWriter(java.lang.String filename)
          Factory method that returns an appropriate writer for the indicated file.
static java.io.File saveDomain(java.awt.Component parentComponent, Domain domain)
          Writes a description of a domain to a file selected by the user, conducting all necessary dialogs along the way.
abstract  void writeDomain(Domain domain)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainWriter

public DomainWriter()
Method Detail

writeDomain

public abstract void writeDomain(Domain domain)
                          throws java.io.IOException

makeWriter

public static DomainWriter makeWriter(java.lang.String filename)
                               throws java.io.IOException
Factory method that returns an appropriate writer for the indicated file. It converts the filename to an abstract pathname (File) and calls the makeWriter(File) method.

makeWriter

public static DomainWriter makeWriter(java.io.File file)
                               throws java.io.IOException
Factory method that returns an appropriate writer for the indicated file, based on the file's type or extension. If the file does not specify a parent directory, the result of calling DomainParser.getLibraryDirectory() is used.

Here's how it might be used:

   File domainName = ...;
   Domain domain = ...;
   ...
   try {
       DomainWriter.makeWriter(domainName).writeDomain(domain);
   }
   catch (IOException e) { ... }
 

saveDomain

public static java.io.File saveDomain(java.awt.Component parentComponent,
                                      Domain domain)
Writes a description of a domain to a file selected by the user, conducting all necessary dialogs along the way. It repeatedly asks the user to select a file until either the domain description has been successfully written or the user decices to cancel the operation. The user is informed of any exceptions thrown while attempting to write, and "success" means that no exceptions were thrown. If the description has been written to a file, a corresponding File (abstract pathname) is returned; otherwise, the result is null.

The output syntax is a function of the file's type as understood by makeWriter(File).

Parameters:
parentComponent - determines the Frame in which dialogs are displayed.
domain - the Domain to save
Returns:
a File if the domain has been written to a file; otherwise null
See Also:
makeWriter(File)