org.vizzini.ui.table
Class TableDescriptorParser

java.lang.Object
  extended by org.vizzini.ui.table.TableDescriptorParser

public class TableDescriptorParser
extends Object

Provides an XML parser for table descriptor files.

Here is an example XML file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<root>
    <columnDescriptor>
        <columnName>STRING_screenCol</columnName>
        <columnClass>java.lang.String</columnClass>
        <propertyName>name</propertyName>
    </columnDescriptor>
    <columnDescriptor>
        <columnName>STRING_lowRankCol</columnName>
        <columnClass>java.lang.Integer</columnClass>
        <propertyName>rank</propertyName>
    </columnDescriptor>
    <columnDescriptor>
        <columnName>STRING_rating</columnName>
        <columnClass>org.vizzini.util.DefaultEnumeratedType</columnClass>
        <editable>true</editable>
        <propertyName>rating</propertyName>
        <enumList>
            <item>Not rated</item>
            <item>1/2</item>
            <item>*</item>
            <item>*1/2</item>
            <item>**</item>
            <item>**1/2</item>
            <item>***</item>
            <item>***1/2</item>
            <item>****</item>
        </enumList>
    </columnDescriptor>
    <columnDescriptor>
        <columnName>STRING_sharpeCol</columnName>
        <columnClass>java.lang.Double</columnClass>
        <propertyName>sharpe</propertyName>
        <cellRenderer places="2">org.vizzini.ui.table.DecimalCellRenderer</cellRenderer>
    </columnDescriptor>
</root>

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson

Method Summary
static TableDescriptorParser getInstance()
          Return the singleton instance, creating it if necessary.
 ColumnDescriptor[] parse(Document xmlDocument)
          Complete parsing the given XML document into ColumnDescriptor instances.
 ColumnDescriptor[] parse(File file)
          Parse the given XML file into ColumnDescriptor instances.
 ColumnDescriptor[] parse(InputStream inputStream)
          Parse the given XML input stream into ColumnDescriptor instances.
 ColumnDescriptor[] parse(URL url)
          Parse the given XML URL into ColumnDescriptor instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TableDescriptorParser getInstance()
Return the singleton instance, creating it if necessary.

Since:
v0.2

parse

public ColumnDescriptor[] parse(InputStream inputStream)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Parse the given XML input stream into ColumnDescriptor instances.

Parameters:
inputStream - The XML input stream to parse.
Throws:
ParserConfigurationException
SAXException
IOException
Since:
v0.2

parse

public ColumnDescriptor[] parse(File file)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Parse the given XML file into ColumnDescriptor instances.

Parameters:
file - The XML file to parse.
Throws:
ParserConfigurationException
SAXException
IOException
Since:
v0.2

parse

public ColumnDescriptor[] parse(URL url)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Parse the given XML URL into ColumnDescriptor instances.

Parameters:
url - The XML URL to parse.
Throws:
ParserConfigurationException
SAXException
IOException
Since:
v0.2

parse

public ColumnDescriptor[] parse(Document xmlDocument)
                         throws ParserConfigurationException,
                                SAXException
Complete parsing the given XML document into ColumnDescriptor instances.

Parameters:
xmlDocument - The XML document to parse.
Throws:
ParserConfigurationException
SAXException
Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02