JIDE 3.5.15

com.jidesoft.docking
Class DockingPersistenceUtils

java.lang.Object
  extended by com.jidesoft.docking.DockingPersistenceUtils

public class DockingPersistenceUtils
extends Object

The docking persistence utility class to save/load docking layout to/from XML format stream or file.


Constructor Summary
DockingPersistenceUtils()
           
 
Method Summary
static boolean compare(Document document1, Document document2)
          Compare two documents to check if the saved layout are the same.
static boolean compare(Document document1, String layoutName1, Document document2, String layoutName2)
          Compare two documents to check if the saved layout are the same.
static boolean load(DefaultDockingManager manager, Document document, PersistenceUtilsCallback.Load callback)
          Loads the docking manager from the document.
static boolean load(DefaultDockingManager manager, InputStream in)
           
static boolean load(DefaultDockingManager manager, InputStream in, PersistenceUtilsCallback.Load callback)
           
static boolean load(DefaultDockingManager manager, String fileName)
           
static boolean load(DefaultDockingManager manager, String fileName, PersistenceUtilsCallback.Load callback)
           
static void save(DefaultDockingManager manager, OutputStream out)
          Saves the DefaultDockingManager's layout to an output stream.
static void save(DefaultDockingManager manager, OutputStream out, String encoding)
          Saves the DefaultDockingManager's layout to an output stream.
static void save(DefaultDockingManager manager, OutputStream out, String encoding, PersistenceUtilsCallback.Save callback)
          Saves the DefaultDockingManager's layout to an output stream.
static Document save(DefaultDockingManager manager, PersistenceUtilsCallback.Save callback)
          Save the docking manager to a Document.
static void save(DefaultDockingManager manager, String fileName)
          Saves the DefaultDockingManager's layout to a file.
static void save(DefaultDockingManager manager, String fileName, String encoding)
          Saves the DefaultDockingManager's layout to a file.
static void save(DefaultDockingManager manager, String fileName, String encoding, PersistenceUtilsCallback.Save callback)
          Saves the DefaultDockingManager's layout to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockingPersistenceUtils

public DockingPersistenceUtils()
Method Detail

save

public static void save(DefaultDockingManager manager,
                        String fileName)
                 throws ParserConfigurationException,
                        IOException
Saves the DefaultDockingManager's layout to a file.

It's a thread safe method for you to use.

Parameters:
manager - the docking manager
fileName - the file name
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(DefaultDockingManager manager,
                        String fileName,
                        String encoding)
                 throws ParserConfigurationException,
                        IOException
Saves the DefaultDockingManager's layout to a file.

It's a thread safe method for you to use.

Parameters:
manager - the docking manager
fileName - the file name
encoding - the encoding choice. It would be UTF-8 in default if you call the method without this parameter.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(DefaultDockingManager manager,
                        String fileName,
                        String encoding,
                        PersistenceUtilsCallback.Save callback)
                 throws ParserConfigurationException,
                        IOException
Saves the DefaultDockingManager's layout to a file.

It's a thread safe method for you to use.

Parameters:
manager - the docking manager
fileName - the file name
encoding - the encoding choice. It would be UTF-8 in default if you call the method without this parameter.
callback - the callback which will be called when saving each element to the XML document.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(DefaultDockingManager manager,
                        OutputStream out)
                 throws ParserConfigurationException,
                        IOException
Saves the DefaultDockingManager's layout to an output stream.

It's a thread safe method for you to use.

Parameters:
manager - the docking manager
out - the output stream
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(DefaultDockingManager manager,
                        OutputStream out,
                        String encoding)
                 throws ParserConfigurationException,
                        IOException
Saves the DefaultDockingManager's layout to an output stream.

It's a thread safe method for you to use.

Parameters:
manager - the docking manager
out - the output stream
encoding - the encoding choice. It would be UTF-8 in default if you call the method without this parameter.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(DefaultDockingManager manager,
                        OutputStream out,
                        String encoding,
                        PersistenceUtilsCallback.Save callback)
                 throws ParserConfigurationException,
                        IOException
Saves the DefaultDockingManager's layout to an output stream.

It's a thread safe method for you to use.

Parameters:
manager - the docking manager
out - the output stream
encoding - the encoding choice. It would be UTF-8 in default if you call the method without this parameter.
callback - the callback which will be called when saving each element to the XML document.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static Document save(DefaultDockingManager manager,
                            PersistenceUtilsCallback.Save callback)
                     throws ParserConfigurationException
Save the docking manager to a Document.

Please be noted that you have to invoke this method inside EDT.

Parameters:
manager - the docking manager
callback - the callback which will be called when saving each element to the XML document.
Returns:
the XML document.
Throws:
ParserConfigurationException - if there is any parser configuration issue.

load

public static boolean load(DefaultDockingManager manager,
                           InputStream in)
                    throws ParserConfigurationException,
                           SAXException,
                           IOException
Throws:
ParserConfigurationException
SAXException
IOException

load

public static boolean load(DefaultDockingManager manager,
                           InputStream in,
                           PersistenceUtilsCallback.Load callback)
                    throws ParserConfigurationException,
                           SAXException,
                           IOException
Throws:
ParserConfigurationException
SAXException
IOException

load

public static boolean load(DefaultDockingManager manager,
                           String fileName)
                    throws ParserConfigurationException,
                           SAXException,
                           IOException
Throws:
ParserConfigurationException
SAXException
IOException

load

public static boolean load(DefaultDockingManager manager,
                           String fileName,
                           PersistenceUtilsCallback.Load callback)
                    throws ParserConfigurationException,
                           SAXException,
                           IOException
Throws:
ParserConfigurationException
SAXException
IOException

load

public static boolean load(DefaultDockingManager manager,
                           Document document,
                           PersistenceUtilsCallback.Load callback)
Loads the docking manager from the document.

Parameters:
manager - the DefaultDockingManager
document - the document to be loaded
callback - the load callback to customize reading
Returns:
true if load successfully. Otherwise false.

compare

public static boolean compare(Document document1,
                              Document document2)
Compare two documents to check if the saved layout are the same.

Parameters:
document1 - the layout in document1
document2 - the layout in document2
Returns:
true if these two layout files are the same. Otherwise false.

compare

public static boolean compare(Document document1,
                              String layoutName1,
                              Document document2,
                              String layoutName2)
Compare two documents to check if the saved layout are the same.

If there are two or more docking mangers' layout in a same document, layoutName is used to distinguish those different docking managers.

Parameters:
document1 - the layout in document1
layoutName1 - the layout name in document1
document2 - the layout in document2
layoutName2 - the layout name in document2
Returns:
true if these two layout files are the same. Otherwise false.

JIDE 3.5.15