public final class XmlSerializationContext extends SerializationContext
Constructor and Description |
---|
XmlSerializationContext(Schedule schedule,
org.w3c.dom.Document document)
Initializes a new instance of the
XmlSerializationContext class. |
XmlSerializationContext(Schedule schedule,
int fileVersion,
org.w3c.dom.Document document)
Initializes a new instance of the
XmlSerializationContext class. |
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Element |
addChildElement(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Adds a new child node with the specified name to the specified parent node.
|
org.w3c.dom.Element |
addChildElement(java.lang.String elementName,
org.w3c.dom.Element parentElement,
java.lang.String innerText)
Adds a new child node with the specified name and value to the specified parent node.
|
int |
getClassVersion()
Gets the class version of the currently deserialized item.
|
org.w3c.dom.Document |
getXmlDocument()
Gets the underlying XML document.
|
boolean |
readBool(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a boolean value with the specified name.
|
boolean |
readBool(java.lang.String elementName,
org.w3c.dom.Element parentElement,
boolean defaultValue)
Reads a boolean value with the specified name.
|
Brush |
readBrush(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
Brush object with the specified name. |
byte |
readByte(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a byte value with the specified name.
|
char |
readChar(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a char value with the specified name.
|
java.awt.Color |
readColor(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a color with the specified name.
|
java.awt.Color[] |
readColorArray(java.lang.String elementName,
java.lang.String subElementName,
org.w3c.dom.Element parentElement)
Reads a color array with the specified name.
|
CustomBrushes |
readCustomBrushes(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
CustomBrushes object with the specified name. |
DateTime |
readDateTime(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
DateTime object with the specified name. |
double |
readDouble(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a double value with the specified name.
|
int |
readEnum(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads an enumeration value with the specified name.
|
float |
readFloat(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a float value with the specified name.
|
float[] |
readFloatArray(java.lang.String elementName,
java.lang.String subElementName,
org.w3c.dom.Element parentElement)
Reads a float array with the specified name.
|
java.awt.Font |
readFont(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a Font object with the specified name.
|
ExtendedHashMap<java.lang.Object,java.lang.Object> |
readHashtable(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a hash table object with the specified name.
|
java.awt.Image |
readImage(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads an Image object with the specified name.
|
int |
readInt(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads an integer value with the specified name.
|
long |
readLong(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a long value with the specified name.
|
java.lang.Object |
readObject(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads an object with the specified name.
|
Pen |
readPen(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
Pen object with the specified name. |
Recurrence |
readRecurrence(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
Recurrence object with the specified name. |
Reminder |
readReminder(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
Reminder object with the specified name. |
short |
readShort(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a short value with the specified name.
|
java.lang.String |
readString(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a string value with the specified name.
|
Style |
readStyle(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
Style object with the specified name. |
java.lang.Object |
readTag(java.lang.Object item,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads the specified tag for the specified object.
|
TextFormat |
readTextFormat(java.lang.String elementName,
org.w3c.dom.Element parentElement)
Reads a
TextFormat object with the specified name. |
org.w3c.dom.Element |
writeBool(boolean value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a boolean value with the specified name.
|
org.w3c.dom.Element |
writeBrush(Brush brush,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a reference to the specified brush.
|
org.w3c.dom.Element |
writeByte(byte value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Write a byte value with the specified name.
|
org.w3c.dom.Element |
writeChar(char value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Write a char value with the specified name.
|
org.w3c.dom.Element |
writeColor(java.awt.Color color,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified color.
|
org.w3c.dom.Element |
writeColorArray(java.awt.Color[] array,
java.lang.String elementName,
java.lang.String subElementName,
org.w3c.dom.Element parentElement)
Writes the specified array.
|
org.w3c.dom.Element |
writeCustomBrushes(CustomBrushes customBrushes,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified
CustomBrushes object. |
org.w3c.dom.Element |
writeDateTime(DateTime value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified DateTime object.
|
org.w3c.dom.Element |
writeDouble(double value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a double value with the specified name.
|
org.w3c.dom.Element |
writeEnum(int value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified enumeration value.
|
org.w3c.dom.Element |
writeFloat(float value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a float value with the specified name.
|
org.w3c.dom.Element |
writeFloatArray(float[] array,
java.lang.String elementName,
java.lang.String subElementName,
org.w3c.dom.Element parentElement)
Writes the specified array.
|
org.w3c.dom.Element |
writeFont(java.awt.Font font,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified font.
|
org.w3c.dom.Element |
writeHashtable(ExtendedHashMap<?,?> hashtable,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified hashtable.
|
org.w3c.dom.Element |
writeImage(java.awt.Image image,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a reference to the specified image.
|
org.w3c.dom.Element |
writeInt(int value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes an integer value with the specified name.
|
org.w3c.dom.Element |
writeLong(long value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a long value with the specified name.
|
org.w3c.dom.Element |
writeObject(java.lang.Object value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified object under the specified name.
|
org.w3c.dom.Element |
writePen(Pen pen,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified pen.
|
org.w3c.dom.Element |
writeRecurrence(Recurrence recurrence,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified
Recurrence object. |
org.w3c.dom.Element |
writeReminder(Reminder reminder,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified
Reminder object. |
org.w3c.dom.Element |
writeShort(short value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a short value with the specified name.
|
org.w3c.dom.Element |
writeString(java.lang.String value,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes a string value with the specified name.
|
org.w3c.dom.Element |
writeStringFormat(TextFormat textFormat,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified
TextFormat object. |
org.w3c.dom.Element |
writeStyle(Style style,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified
Style object. |
org.w3c.dom.Element |
writeTag(java.lang.Object item,
java.lang.Object tagValue,
java.lang.String elementName,
org.w3c.dom.Element parentElement)
Writes the specified tag of the specified object.
|
addSerializationContextListener, getFileVersion, getSchedule, removeSerializationContextListener
public XmlSerializationContext(Schedule schedule, int fileVersion, org.w3c.dom.Document document)
XmlSerializationContext
class.schedule
- The Schedule
this class will operate on.fileVersion
- The file version of the file being deserialized.document
- The XML document to serialize/deserialize to/from.public XmlSerializationContext(Schedule schedule, org.w3c.dom.Document document)
XmlSerializationContext
class.schedule
- The Schedule
this class will operate on.document
- The XML document to serialize/deserialize to/from.public org.w3c.dom.Element addChildElement(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The desired name of the new node.parentElement
- The parent element of the newly created node.Element
object representing the newly created element.public org.w3c.dom.Element addChildElement(java.lang.String elementName, org.w3c.dom.Element parentElement, java.lang.String innerText)
elementName
- The desired name of the new node.parentElement
- The parent element of the newly created node.innerText
- The desired value of the new node.Element
object representing the newly created element.public org.w3c.dom.Element writeString(java.lang.String value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The string value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeBool(boolean value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The boolean value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeChar(char value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The char value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeByte(byte value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The byte value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeInt(int value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The int value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeShort(short value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The short value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeLong(long value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The long value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeFloat(float value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The float value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeDouble(double value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The double value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeBrush(Brush brush, java.lang.String elementName, org.w3c.dom.Element parentElement)
brush
- The Brush
instance to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeFloatArray(float[] array, java.lang.String elementName, java.lang.String subElementName, org.w3c.dom.Element parentElement)
array
- The array to write.elementName
- The name of the element under which the value should be written.subElementName
- The name of the XML elements under which the individual
array values will be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeColorArray(java.awt.Color[] array, java.lang.String elementName, java.lang.String subElementName, org.w3c.dom.Element parentElement)
array
- The array to write.elementName
- The name of the element under which the value should be written.subElementName
- The name of the XML elements under which the individual
array values will be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writePen(Pen pen, java.lang.String elementName, org.w3c.dom.Element parentElement)
pen
- The Pen
instance to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeDateTime(DateTime value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The DateTime
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeReminder(Reminder reminder, java.lang.String elementName, org.w3c.dom.Element parentElement)
Reminder
object.reminder
- The Reminder
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeRecurrence(Recurrence recurrence, java.lang.String elementName, org.w3c.dom.Element parentElement)
Recurrence
object.recurrence
- The Recurrence
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeCustomBrushes(CustomBrushes customBrushes, java.lang.String elementName, org.w3c.dom.Element parentElement)
CustomBrushes
object.customBrushes
- The CustomBrushes
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeStyle(Style style, java.lang.String elementName, org.w3c.dom.Element parentElement)
Style
object.style
- The Style
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeFont(java.awt.Font font, java.lang.String elementName, org.w3c.dom.Element parentElement)
font
- The Font object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeEnum(int value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The enumeration value to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeImage(java.awt.Image image, java.lang.String elementName, org.w3c.dom.Element parentElement)
image
- The Image object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeColor(java.awt.Color color, java.lang.String elementName, org.w3c.dom.Element parentElement)
color
- The Color object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeStringFormat(TextFormat textFormat, java.lang.String elementName, org.w3c.dom.Element parentElement)
TextFormat
object.textFormat
- The TextFormat
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeHashtable(ExtendedHashMap<?,?> hashtable, java.lang.String elementName, org.w3c.dom.Element parentElement)
hashtable
- The ExtendedHashMap
object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeObject(java.lang.Object value, java.lang.String elementName, org.w3c.dom.Element parentElement)
value
- The object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public org.w3c.dom.Element writeTag(java.lang.Object item, java.lang.Object tagValue, java.lang.String elementName, org.w3c.dom.Element parentElement)
Tags are written similarly to arbitrary objects except that the client of the calendar is given a chance to perform custom serialization through event handling.
item
- The Item
whose tag is being serialized.tagValue
- The tag object to write.elementName
- The name of the element under which the value should be written.parentElement
- The parent element of the newly created node.Element
class representing the newly created XML element.public java.lang.String readString(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the string value.parentElement
- The parent element of the node with the specified name.public boolean readBool(java.lang.String elementName, org.w3c.dom.Element parentElement, boolean defaultValue)
If there is no element with the specified name, returns the specified default value.
elementName
- The name of the element containing the boolean value.parentElement
- The parent element of the node with the specified name.defaultValue
- The value that should be returned if there is no node with the
specified name under the specified parent element.public boolean readBool(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the boolean value.parentElement
- The parent element of the node with the specified name.public byte readByte(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the byte value.parentElement
- The parent element of the node with the specified name.public char readChar(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the char value.parentElement
- The parent element of the node with the specified name.public int readInt(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the integer value.parentElement
- The parent element of the node with the specified name.public short readShort(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the short value.parentElement
- The parent element of the node with the specified name.public long readLong(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the long value.parentElement
- The parent element of the node with the specified name.public float readFloat(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the float value.parentElement
- The parent element of the node with the specified name.public double readDouble(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the double value.parentElement
- The parent element of the node with the specified name.public Brush readBrush(java.lang.String elementName, org.w3c.dom.Element parentElement)
Brush
object with the specified name.public float[] readFloatArray(java.lang.String elementName, java.lang.String subElementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the array.subElementName
- The name of the elements containing the individual array values.parentElement
- The parent element of the node with the specified name.public java.awt.Color[] readColorArray(java.lang.String elementName, java.lang.String subElementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the array.subElementName
- The name of the elements containing the individual array values.parentElement
- The parent element of the node with the specified name.public Pen readPen(java.lang.String elementName, org.w3c.dom.Element parentElement)
Pen
object with the specified name.public DateTime readDateTime(java.lang.String elementName, org.w3c.dom.Element parentElement)
DateTime
object with the specified name.elementName
- The name of the element containing the DateTime
object.parentElement
- The parent element of the node with the specified name.DateTime
object. Returns DateTime.MinValue
if there
is no element with the specified name under the specified parent.public Reminder readReminder(java.lang.String elementName, org.w3c.dom.Element parentElement)
Reminder
object with the specified name.public Recurrence readRecurrence(java.lang.String elementName, org.w3c.dom.Element parentElement)
Recurrence
object with the specified name.elementName
- The name of the element containing the Recurrence
object.parentElement
- The parent element of the node with the specified name.Recurrence
class. Returns null if there is
no element with the specified name under the specified parent.public CustomBrushes readCustomBrushes(java.lang.String elementName, org.w3c.dom.Element parentElement)
CustomBrushes
object with the specified name.elementName
- The name of the element containing the CustomBrushes
object.parentElement
- The parent element of the node with the specified name.CustomBrushes
class. Returns null if there is
no element with the specified name under the specified parent.public Style readStyle(java.lang.String elementName, org.w3c.dom.Element parentElement)
Style
object with the specified name.public java.awt.Font readFont(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the Font object.parentElement
- The parent element of the node with the specified name.public int readEnum(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the enumeration value.parentElement
- The parent element of the node with the specified name.public java.awt.Image readImage(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the Image object.parentElement
- The parent element of the node with the specified name.public java.awt.Color readColor(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the Color object.parentElement
- The parent element of the node with the specified name.Black
if there is
no element with the specified name under the specified parent.public TextFormat readTextFormat(java.lang.String elementName, org.w3c.dom.Element parentElement)
TextFormat
object with the specified name.elementName
- The name of the element containing the TextFormat
object.parentElement
- The parent element of the node with the specified name.TextFormat
object. Returns null if there is no element
with the specified name under the specified parent.public ExtendedHashMap<java.lang.Object,java.lang.Object> readHashtable(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the hashtable.parentElement
- The parent element of the node with the specified name.ExtendedHashMap
object. Returns null if there is no element
with the specified name under the specified parent.public java.lang.Object readObject(java.lang.String elementName, org.w3c.dom.Element parentElement)
elementName
- The name of the element containing the object.parentElement
- The parent element of the node with the specified name.public java.lang.Object readTag(java.lang.Object item, java.lang.String elementName, org.w3c.dom.Element parentElement)
Tags are read similarly to arbitrary objects except that the client of the calendar is given a chance to perform custom deserialization through event handling.
item
- The Item
whose tag is being deserialized.elementName
- The name of the element containing the tag object.parentElement
- The parent element of the node with the specified name.public org.w3c.dom.Document getXmlDocument()
Document
class.public int getClassVersion()
This property is only useful when deserializing items.
Schedule.registerItemClass(java.lang.Class<? extends com.mindfusion.scheduling.model.Item>, java.lang.String, int)
method at the
time the item type was registered.