com.mindfusion.diagramming
Class Theme

java.lang.Object
  extended by com.mindfusion.diagramming.Theme
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Theme
extends java.lang.Object
implements java.io.Externalizable

Represents a set of Style objects for different diagram item types.

See Also:
Serialized Form

Constructor Summary
Theme()
          Initializes a new instance of the Theme class.
 
Method Summary
 void addThemeListener(ThemeListener listener)
          Registers listener so that it will receive events when the theme changes.
 void loadFromString(java.lang.String xml)
          Loads the theme from an XML string.
 void loadFromXml(java.lang.String fileName)
          Loads the theme from an XML file.
 void readExternal(java.io.ObjectInput in)
          Externalizable.readExternal(java.io.ObjectInput) implementation.
 void registerStyle(java.lang.Class type, Style style)
          Registers the specified Style object for the items of the specified type.
 void removeThemeListener(ThemeListener listener)
          Unregisters listener so that it will no longer receive theme events.
 java.lang.String saveToString()
          Loads the theme from an XML string.
 void saveToXml(java.lang.String fileName)
          Saves the theme to an XML file.
 void unregisterStyle(java.lang.Class type)
          Unregisters the Style object associated with the specified type.
 void writeExternal(java.io.ObjectOutput out)
          Externalizable.writeExternal(java.io.ObjectOutput) implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Theme

public Theme()
Initializes a new instance of the Theme class.

Method Detail

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Externalizable.writeExternal(java.io.ObjectOutput) implementation.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Externalizable.readExternal(java.io.ObjectInput) implementation.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

saveToXml

public void saveToXml(java.lang.String fileName)
               throws XmlException
Saves the theme to an XML file.

Parameters:
fileName - The name of the file to save to.
Throws:
XmlException

saveToString

public java.lang.String saveToString()
                              throws XmlException,
                                     java.io.UnsupportedEncodingException
Loads the theme from an XML string.

Returns:
The serialized string.
Throws:
XmlException
java.io.UnsupportedEncodingException

loadFromXml

public void loadFromXml(java.lang.String fileName)
                 throws XmlException,
                        org.xml.sax.SAXException,
                        java.io.IOException,
                        javax.xml.transform.TransformerException
Loads the theme from an XML file.

Parameters:
fileName - The name of the file to load from.
Throws:
XmlException
org.xml.sax.SAXException
java.io.IOException
javax.xml.transform.TransformerException

loadFromString

public void loadFromString(java.lang.String xml)
                    throws XmlException,
                           org.xml.sax.SAXException,
                           java.io.IOException,
                           javax.xml.transform.TransformerException
Loads the theme from an XML string.

Parameters:
xml - The string to load from.
Throws:
XmlException
org.xml.sax.SAXException
java.io.IOException
javax.xml.transform.TransformerException

registerStyle

public void registerStyle(java.lang.Class type,
                          Style style)
Registers the specified Style object for the items of the specified type.

Parameters:
type - The runtime type to register.
style - The style to associate with the specified type. The previously associated style, if any, is discarded.

unregisterStyle

public void unregisterStyle(java.lang.Class type)
Unregisters the Style object associated with the specified type.

Parameters:
type - The runtime type to unregister.

addThemeListener

public void addThemeListener(ThemeListener listener)
Registers listener so that it will receive events when the theme changes.

Parameters:
listener - An object implementing the ThemeListener interface.

removeThemeListener

public void removeThemeListener(ThemeListener listener)
Unregisters listener so that it will no longer receive theme events.

Parameters:
listener - An object implementing the ThemeListener interface.