dks.src.utils.XML
Class XMLWriter

java.lang.Object
  extended by dks.src.utils.XML.XMLWriter

public class XMLWriter
extends java.lang.Object


Field Summary
static java.lang.String XML_COLOR_ALPHA_PROPERTY
          The name of the alpha component of the color XML Property
static java.lang.String XML_COLOR_BLUE_PROPERTY
          The name of the blue component of the color XML Property
static java.lang.String XML_COLOR_GREEN_PROPERTY
          The name of the green component of the color XML Property
static java.lang.String XML_COLOR_RED_PROPERTY
          The name of the red component of the color XML Property
static java.lang.String XML_DIMENSION_HEIGHT_PROPERTY
          The name of the height of the dimension XML Property
static java.lang.String XML_DIMENSION_WIDTH_PROPERTY
          The name of the width of the dimension XML Property
static java.lang.String XML_FONT_BOLD_PROPERTY
          The name of the bold style of the font XML Property
static java.lang.String XML_FONT_FONTNAME_PROPERTY
          The name of the fontname of the font XML Property
static java.lang.String XML_FONT_ITALIC_PROPERTY
          The name of the italic style of the font XML Property
static java.lang.String XML_FONT_SIZE_PROPERTY
          The name of the size of the font XML Property
 
Constructor Summary
XMLWriter()
           
 
Method Summary
static org.jdom.Element createColorElement(java.lang.String title, java.awt.Color color)
           
static org.jdom.Element createDimensionElement(java.lang.String title, java.awt.Dimension dimension)
          Create an XML Element for a dimension
static org.jdom.Element createElement(java.lang.String title, java.lang.String value)
           
static org.jdom.Element createFontElement(java.lang.String title, java.awt.Font font)
           
static java.awt.Color getColorElement(java.lang.String title, org.jdom.Element root)
           
static java.awt.Dimension getDimensionElement(java.lang.String title, org.jdom.Element root)
          Read the properties of a dimension element and return an instance of the Dimension
static java.awt.Font getFontElement(java.lang.String title, org.jdom.Element root)
           
static org.jdom.Element openDocument(java.io.File file)
          Load a file into a XML DOM Element
static void saveDocument(java.io.File file, org.jdom.Element root)
          Save a XML DOM Element into a file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_COLOR_RED_PROPERTY

public static final java.lang.String XML_COLOR_RED_PROPERTY
The name of the red component of the color XML Property

See Also:
Constant Field Values

XML_COLOR_GREEN_PROPERTY

public static final java.lang.String XML_COLOR_GREEN_PROPERTY
The name of the green component of the color XML Property

See Also:
Constant Field Values

XML_COLOR_BLUE_PROPERTY

public static final java.lang.String XML_COLOR_BLUE_PROPERTY
The name of the blue component of the color XML Property

See Also:
Constant Field Values

XML_COLOR_ALPHA_PROPERTY

public static final java.lang.String XML_COLOR_ALPHA_PROPERTY
The name of the alpha component of the color XML Property

See Also:
Constant Field Values

XML_FONT_FONTNAME_PROPERTY

public static final java.lang.String XML_FONT_FONTNAME_PROPERTY
The name of the fontname of the font XML Property

See Also:
Constant Field Values

XML_FONT_SIZE_PROPERTY

public static final java.lang.String XML_FONT_SIZE_PROPERTY
The name of the size of the font XML Property

See Also:
Constant Field Values

XML_FONT_BOLD_PROPERTY

public static final java.lang.String XML_FONT_BOLD_PROPERTY
The name of the bold style of the font XML Property

See Also:
Constant Field Values

XML_FONT_ITALIC_PROPERTY

public static final java.lang.String XML_FONT_ITALIC_PROPERTY
The name of the italic style of the font XML Property

See Also:
Constant Field Values

XML_DIMENSION_WIDTH_PROPERTY

public static final java.lang.String XML_DIMENSION_WIDTH_PROPERTY
The name of the width of the dimension XML Property

See Also:
Constant Field Values

XML_DIMENSION_HEIGHT_PROPERTY

public static final java.lang.String XML_DIMENSION_HEIGHT_PROPERTY
The name of the height of the dimension XML Property

See Also:
Constant Field Values
Constructor Detail

XMLWriter

public XMLWriter()
Method Detail

createElement

public static org.jdom.Element createElement(java.lang.String title,
                                             java.lang.String value)
Parameters:
title - the name of the element
value - the value of the element
Returns:
the XML DOM Element created

createColorElement

public static org.jdom.Element createColorElement(java.lang.String title,
                                                  java.awt.Color color)
Parameters:
title - the name of the element
color - the color of the element
Returns:
the XML DOM Element which contains the color properties

getColorElement

public static java.awt.Color getColorElement(java.lang.String title,
                                             org.jdom.Element root)
Parameters:
title - the name of the element
root - the element which contains the colors properties
Returns:
the color

createFontElement

public static org.jdom.Element createFontElement(java.lang.String title,
                                                 java.awt.Font font)
Parameters:
title - the name of the element
font - the font of the element
Returns:
the XML DOM Element which contains the font properties

getFontElement

public static java.awt.Font getFontElement(java.lang.String title,
                                           org.jdom.Element root)
Parameters:
title - the name of the element
root - the element which contains the font properties
Returns:
the font

createDimensionElement

public static org.jdom.Element createDimensionElement(java.lang.String title,
                                                      java.awt.Dimension dimension)
Create an XML Element for a dimension

Parameters:
title - the name of the element
dimension - the dimension of the element
Returns:
the XML DOM Element which contains the dimension properties

getDimensionElement

public static java.awt.Dimension getDimensionElement(java.lang.String title,
                                                     org.jdom.Element root)
Read the properties of a dimension element and return an instance of the Dimension

Parameters:
title - the name of the element
root - the element which contains the dimension properties
Returns:
the Dimension instance

saveDocument

public static void saveDocument(java.io.File file,
                                org.jdom.Element root)
                         throws java.io.IOException
Save a XML DOM Element into a file

Parameters:
file - the file used to save the XML DOM Document
root - the XML DOM Element to save
Throws:
java.io.IOException

openDocument

public static org.jdom.Element openDocument(java.io.File file)
                                     throws java.io.IOException,
                                            org.jdom.JDOMException
Load a file into a XML DOM Element

Parameters:
file - the file used to load the XML DOM Element
Returns:
the XML DOM Element loaded
Throws:
java.io.IOException
org.jdom.JDOMException