buoy.xml
Class WidgetDecoder

java.lang.Object
  extended by buoy.xml.WidgetDecoder

public class WidgetDecoder
extends java.lang.Object

This class is used for reconstructing user interfaces that were serialized as XML by WidgetDecoder.

To use this class, simply create a new WidgetDecoder, passing it an input stream from which it can read the XML file. You then can call getRootObject() to get the root object of the hierarchy, or getObject() to look up any Widget in the file by name.

Note that WidgetDecoder does not close the stream you pass to it, so be sure to close the stream when you are done with it.

Author:
Peter Eastman

Constructor Summary
WidgetDecoder(java.io.InputStream in)
          Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
WidgetDecoder(java.io.InputStream in, java.beans.ExceptionListener listener)
          Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
WidgetDecoder(java.io.InputStream in, java.beans.ExceptionListener listener, java.util.ResourceBundle resources)
          Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
WidgetDecoder(java.io.InputStream in, java.util.ResourceBundle resources)
          Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.
 
Method Summary
 java.lang.Object getObject(java.lang.String name)
          Get an object that was stored in the XML file.
 java.lang.Object getRootObject()
          Get the root object that was stored in the XML file.
static void registerObject(java.lang.String name, java.lang.Object obj)
          This method is used during decoding.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetDecoder

public WidgetDecoder(java.io.InputStream in)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.

Parameters:
in - the InputStream from which to read the XML

WidgetDecoder

public WidgetDecoder(java.io.InputStream in,
                     java.util.ResourceBundle resources)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation.

Parameters:
in - the InputStream from which to read the XML
resources - a ResourceBundle from which to obtain localized Strings. See WidgetLocalization for details.

WidgetDecoder

public WidgetDecoder(java.io.InputStream in,
                     java.beans.ExceptionListener listener)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation. If recoverable errors occur during reconstruction, the listener will be notified of them.

Parameters:
in - the InputStream from which to read the XML
listener - the listener to notify of recoverable errors

WidgetDecoder

public WidgetDecoder(java.io.InputStream in,
                     java.beans.ExceptionListener listener,
                     java.util.ResourceBundle resources)
Create a WidgetDecoder to reconstruct a Widget hierarchy from its XML representation. If recoverable errors occur during reconstruction, the listener will be notified of them.

Parameters:
in - the InputStream from which to read the XML
listener - the listener to notify of recoverable errors
resources - a ResourceBundle from which to obtain localized Strings. See WidgetLocalization for details.
Method Detail

getRootObject

public java.lang.Object getRootObject()
Get the root object that was stored in the XML file.


getObject

public java.lang.Object getObject(java.lang.String name)
Get an object that was stored in the XML file.

Parameters:
name - the name of the object to get
Returns:
the specified object, or null if there was no object in the file with that name

registerObject

public static void registerObject(java.lang.String name,
                                  java.lang.Object obj)
This method is used during decoding. It records a named object into the table of objects in the current file. If no file is currently being read, this does nothing. There usually is no reason for you to call this directly.



Written by Peter Eastman.