com.mindfusion.diagramming
Class Style

java.lang.Object
  extended by com.mindfusion.diagramming.Style
All Implemented Interfaces:
NotifyPropertyChanged, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
DiagramItemStyle, DiagramStyle

public class Style
extends java.lang.Object
implements java.io.Externalizable, NotifyPropertyChanged

Represents an unordered dynamic collection of properties that can be identified by name.

See Also:
Serialized Form

Constructor Summary
Style()
          Initializes a new instance of the Style class.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
protected  java.lang.Object getValue(java.lang.Object property)
          Gets the value of the specified property.
protected  boolean isPropertySet(java.lang.Object property)
          Checks whether the specified property has a value.
protected  void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
          Loads the style content from an XML element.
 void readExternal(java.io.ObjectInput in)
          Externalizable.readExternal(java.io.ObjectInput) implementation.
protected  java.lang.Object registerProperty(java.lang.String name)
          Registers a new property with the specified name and type.
static void registerType(java.lang.Class<?> type, java.lang.String alias)
          Associates a type with an alias.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
protected  void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
          Saves the style content into an XML element.
protected  void setValue(java.lang.Object property, java.lang.Object value)
          Sets the value of the specified property.
protected  void unsetValue(java.lang.Object property)
          Clears the value of the specified property.
 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

Style

public Style()
Initializes a new instance of the Style 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

protected void saveToXml(org.w3c.dom.Element xmlElement,
                         XmlPersistContext context)
Saves the style content into an XML element.

Parameters:
xmlElement - An Element the style's data should be stored into.
context - An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.

loadFromXml

protected void loadFromXml(org.w3c.dom.Element xmlElement,
                           XmlPersistContext context)
                    throws javax.xml.transform.TransformerException,
                           XmlException
Loads the style content from an XML element.

Parameters:
xmlElement - An Element containing the style's data.
context - An XmlPersistContext object providing contextual information about /// the serialization process and some helper serialization methods.
Throws:
javax.xml.transform.TransformerException
XmlException

registerProperty

protected java.lang.Object registerProperty(java.lang.String name)
Registers a new property with the specified name and type.

Parameters:
name - The name of the property.
Returns:
An object that can be used to identify the property in subsequent calls to methods like setValue(java.lang.Object, java.lang.Object) and getValue(java.lang.Object).

getValue

protected java.lang.Object getValue(java.lang.Object property)
Gets the value of the specified property.

Parameters:
property - The property to get.
Returns:
The value of the property or null if the property is not defined.

setValue

protected void setValue(java.lang.Object property,
                        java.lang.Object value)
Sets the value of the specified property.

Parameters:
property - The property to set.
value - The new property value.

unsetValue

protected void unsetValue(java.lang.Object property)
Clears the value of the specified property.

Parameters:
property - The property to clear.

isPropertySet

protected boolean isPropertySet(java.lang.Object property)
Checks whether the specified property has a value.

Parameters:
property - The property to check.
Returns:
true if the property has a local value; otherwise, false.

registerType

public static void registerType(java.lang.Class<?> type,
                                java.lang.String alias)
Associates a type with an alias. The alias is used when saving and loading objects of the specified type during style serialization and deserialization.

Parameters:
type - The type to associate.
alias - The unique alias for the type.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface NotifyPropertyChanged

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface NotifyPropertyChanged