<?xml version="1.0" encoding="UTF-8"?>

<!--   
    Document Status     : DRAFT<p>
    Author     : Joseph Levin    <p>
    Description: Defines the WepsTable xml "standard". <p>
    <h2>Document History</h2>
    <b>Thursday, June 22, 2006</b>
    <ul>
        <li>Added a parent attribute to column, so I can enable column inheritence.</li>
        <li>Add a columnstyles element under table to contain the columns which may be inherited by other tables.  This allows us to avoid inheriting column structure.</li>
        <li>Moved the format attribute out of displayunits and made it it's own element under data.  This allows us to extend the format for strings or dates.</li>
    </ul>
    <b>Wednesday, June 21, 2006</b>
    <ul>
        <li>Backtracked and put columngroup back in.  They make the organization of a table easier to understand.</li>
        <li>Added lists of avaliable options for elements into the comments.</li>
        <li>Expanded the border element to include sides and color.</li>
        <li>Defined the column element and its children.</li>
    </ul>
    <b>Tuesday, June 20, 2006</b>
    <ul>
        <li><strike>Column group has been removed.  The columns tag now serves as a grouping element.</strike></li>
        <li>The cellstyle element has been shortended to style.</li>
        <li>Updated the label elements.</li>
    </ul>

    @title WEPS Table XML Definition
    @root table
-->

<!--
Root element of a WEPSTable.
-->
<!ELEMENT table (
    cellstyles?,
    columnstyles?,
    columns?,
    frozenrows?, 
    frozencolumns?, 
    defaultcellstyle?, 
    defaultlabelstyle?, 
    rowlabeldisplay?, 
    columnlabeldisplay?
)>    
<!--@attr parent The file name of a table to extend.-->
<!ATTLIST table parent CDATA #IMPLIED>

<!--The cellstyles element contains the styles referenced by the table.-->
<!ELEMENT cellstyles (style*)>

<!--The columnstyle elements contains the columns which may be inherited by other tables or columns.-->
<!ELEMENT columnstyles (column*)>

<!--The columns elements contains the columns.-->
<!ELEMENT columns ((columngroup | column)+)>

<!--Number of rows to freeze in the table.-->
<!ELEMENT frozenrows (#PCDATA)>

<!--Number of columns to freeze in the table.-->
<!ELEMENT frozencolumns (#PCDATA)>

<!--Id of the cellstyle to use as a default for data cells in the table.  -->
<!ELEMENT defaultcellstyle (#PCDATA)>

<!--Id of the cellstyle to use as a default for label cells in the table. -->
<!ELEMENT defaultlabelstyle (#PCDATA)>

<!--Boolean value indicates if the table should display labels for each row.-->
<!ELEMENT rowlabeldisplay (#PCDATA)>

<!--Boolean value indicates if the table should display labels for each column.-->
<!ELEMENT columnlabeldisplay (#PCDATA)>

<!--Defines the label for a column or columns grouping element.  
-->
<!ELEMENT label (    
    text?,
    image?,
    style?
)>

<!--Text data.-->
<!ELEMENT text (#PCDATA)>

<!--File name of an image.-->
<!ELEMENT image (#PCDATA)>

<!--
@attr rotate Degress to rotate the image.
-->
<!ATTLIST image
    rotate CDATA #IMPLIED    
>

<!--
@attr spanrows Override the default WepsTable spanning.
@attr spancolumns Override the default WepsTable spanning.
-->
<!ATTLIST label
    spanrows CDATA #IMPLIED
    spancolumns CDATA #IMPLIED
>


<!--CellStyle Element
-->
<!ELEMENT style (
    background*,
    foreground*,
    editable?,
    traversable?,
    horizontalalignment?,
    verticalalignment?,
    border?,
    font?,
    repeatbackground?,
    repeatforeground?,
    editor?,
    renderer?
)>

<!--Background color of the cell.  The value should be a hex code preceded with a # symbol.
If the repeatbackground element is used then multiple background elements may be 
included.
-->
<!ELEMENT background (#PCDATA)>

<!--Foreground color of the cell.  The value should be a hex code preceded with a # symbol.
If the repeatforeground element is used then multiple foreground elements may be 
included.
-->
<!ELEMENT foreground (#PCDATA)>

<!--Boolean value indicating if the cells can be traversed.-->
<!ELEMENT traversable (#PCDATA)>

<!--Boolean value indicating if the cells can be edited by the user--> 
<!ELEMENT editable (#PCDATA)>

<!--Specifies the horizontal alignment of the cells.
<p><b>Avaliable Horizontal Alignments</b>
<ul>
    <li>LEFT</li>    
    <li>CENTER</li>    
    <li>RIGHT</li>
</ul>
-->
<!ELEMENT horizontalalignment (#PCDATA)>

<!--Specifies the vertical alignment of the cells.
<p><b>Avaliable Vertical Alignments</b>
<ul>
    <li>TOP</li>    
    <li>MIDDLE</li>    
    <li>BOTTOM</li>
</ul>
-->
<!ELEMENT verticalalignment (#PCDATA)>

<!--Specifies the border style of the cells.
<p><b>Avaliable Border Styles</b>
<ul>
    <li>ETCHED_IN</li>    
    <li>ETCHED_OUT</li>    
    <li>FRAME_IN</li>
    <li>FRAME_OUT</li>
    <li>IN</li>
    <li>OUT</li>
    <li>PLAIN</li>
    <li>THIN</li>
    <li>NONE</li>
</ul>
-->
<!ELEMENT border (#PCDATA)>

<!--
@attr left Boolean, set to true to display a left border.
@attr right Boolean, set to true to display a right border.
@attr top Boolean, set to true to display a top border.
@attr bottom Boolean, set to true to display a bottom border.
@attr all Boolean, set to true to display a boder on all sides.
@attr none Boolean, set to true to not display a border.
@attr color Border color of the cell.  The value should be a hex code preceded with a # symbol.
-->
<!ATTLIST border    
    left (true | false) #IMPLIED
    right (true | false) #IMPLIED
    top (true | false) #IMPLIED
    bottom (true | false) #IMPLIED
    all (true | false) #IMPLIED
    none (true | false) #IMPLIED
    color CDATA #IMPLIED
>

<!--Specifies the font for the cells.  The value should be the name of the font.-->
<!ELEMENT font (#PCDATA)>

<!--
@attr size Point size for the font.
@attr bold Boolean, set to true if the font is bold.
@attr italic Boolean, set to true if the font is italic.
-->
<!ATTLIST font
    size CDATA #IMPLIED
    bold (true | false) #IMPLIED
    italic (true | false) #IMPLIED
>

<!--
Specifies how to repeat the background colors of the table.
<p><b>Avaliable Repeats</b>
<ul>
    <li>NONE</li>    
    <li>ROW</li>    
    <li>COLUMN</li>
</ul>
-->
<!ELEMENT repeatbackground (#PCDATA)>

<!--
Specifies how to repeat the foreground colors of the table.
<p><b>Avaliable Repeats</b>
<ul>
    <li>NONE</li>    
    <li>ROW</li>    
    <li>COLUMN</li>
</ul>
-->
<!ELEMENT repeatforeground (#PCDATA)>

<!--
The editor element is intended to be a last resort when the WepsTable does not know how to present data 
to the user for editing.  Include the full class path for the JCCellEditor.
@example %<editor>com.klg.jclass.cell.editors.JCStringCellEditor</editor>%
-->
<!ELEMENT editor (#PCDATA)>

<!--
The renderer element is intended to be a last resort when the WepsTable does not know how to present data 
to the user..  Include the full class path for the JCCellRenderer.
@example %<renderer>com.klg.jclass.cell.renderers.JCStringCellRenderer</renderer>%
-->
<!ELEMENT renderer (#PCDATA)>

<!--
@attr id Unique id for the cell style.  This allows cell styles or columns to extend the cell style.
@attr parent Id of a cell style to extend.  #cells or #labels will extend the default JCTable styles.    
-->
<!ATTLIST cellstyle 
    id ID #IMPLIED
    parent IDREF #IMPLIED
>

<!--
Columngroups allow for column spanning in the header of a WepsTable.
-->
<!ELEMENT columngroup (label*, (columngroup | column)+)>

<!--
Column Element
-->
<!ELEMENT column (
    label*,
    action*,
    data?,
    style?,
    width?
)>

<!--
@attr id Unique id for the column.  This allows the column to be referenced.
@attr parent Id of a column to inherit from.  This column may be a previously defined column, a column in the columnstyles collection or a column in the columnstyles collection of parent tables.
-->
<!ATTLIST column 
    id ID #IMPLIED
    parent IDREF #IMPLIED
>

<!--
Action code to return when an event is fired on the column.  More than one action may be added to a column.
-->
<!ELEMENT action (#PCDATA)>
    
<!--
@attr type The type of action to respond to.
<p><b>Avaliable Actions</b>
<ul>
    <li>SINGLECLICK</li>    
    <li>DOUBLECLICK</li>    
</ul>
-->
<!ATTLIST action 
    type CDATA #IMPLIED
>

<!--
Container element for the details of the data contained in the column.
-->
<!ELEMENT data(
    key?,
    value?,
    units?,
    displayunits*,
    adjust*,
    limit*,
    list?,
    format*
)>

<!--
@attr type The type of data this column contains.
<p><b>Avaliable Data Types</b>
<ul>
    <li>TEXT</li>    
    <li>MULTILINE</li>    
    <li>NUMERIC</li>    
    <li>BOOLEAN</li>    
    <li>LIST</li>
    <li>IMAGE</li>
</ul>
-->
<!ATTLIST data 
    type CDATA #IMPLIED
>

<!--
The key is a string used to link the column to the datasource.  It should be the label of column in the datasource.  If omitted then the column id is used as the key.
-->
<!ELEMENT key (#PCDATA)>

<!--
Static value.
-->
<!ELEMENT value (#PCDATA)>

<!--
Measurement units that the data is stored in.  NOTE: Only applies to NUMERIC columns.
-->
<!ELEMENT units (#PCDATA)>

<!--
Measurement units to display the data in for a given measurement system. NOTE: Only applies to NUMERIC columns.
-->
<!ELEMENT displayunits (#PCDATA)>

<!--
@attr system The measurement unit system.
<p><b>Possible Measurement Unit Systems</b>
<ul>
    <li>SI</li>    
    <li>US</li>    
</ul>
@attr format Format mask to apply when displaying the data.
-->
<!ATTLIST displayunits 
    system CDATA #IMPLIED
    format CDATA #IMPLIED    
>

<!--
format Format mask to apply when displaying the data. NOTE: Only applies to NUMERIC columns.
-->
<!ELEMENT format (#PCDATA)>

<!--
@attr system The measurement unit system.
<p><b>Possible Measurement Unit Systems</b>
<ul>
    <li>SI</li>    
    <li>US</li>    
</ul>
-->
<!ATTLIST format 
    system CDATA #IMPLIED  
>

<!--
Adjustment to apply to the data.  You may add more than one adjustment.  NOTE: Only applies to NUMERIC columns.
-->
<!ELEMENT adjust (#PCDATA)>

<!--
@attr operation The operation to use when applying the adjustment value.
<p><b>Avaliable Operations</b>
<ul>
    <li>ADD</li>    
    <li>SUBTRACT</li>    
    <li>MULTIPLY</li> 
    <li>DIVIDE</li> 
</ul>
@attr format Format mask to apply when displaying the data.
-->
<!ATTLIST adjust 
    operation CDATA #IMPLIED  
>

<!--
Limit to apply when displaying the data.  More than one limit may be applied.  NOTE: Only applies to NUMERIC columns.
-->
<!ELEMENT limit (#PCDATA)>

<!--
@attr type The measurement unit system.
<p><b>Possible Limit Types</b>
<ul>
    <li>LOWER</li>    
    <li>UPPER</li>    
</ul>
@attr inclusive Boolean indicating if the bound is inclusive.
@attr text String to display if the data is outside the limit.  If omitted then a string is created using the limit type, inclusivity and the boundry value.
@attr allowzero Boolean indicating if 0 will be displayed even if it is outside the limit boundry.  Default is true.
-->
<!ATTLIST limit 
    type CDATA #IMPLIED
    inclusive (true | false) #IMPLIED  
    text CDATA #IMPLIED      
    allowzero (true | false) #IMPLIED  
    
>

<!--
Defines the text to display for a given value.  NOTE: Only applies to LIST columns.
-->
<!ELEMENT list (listitem*)>

<!ELEMENT listitem (#PCDATA)>

<!--
@attr value The value to associate the listitem with.
-->
<!ATTLIST listitem 
    value CDATA #REQUIRED
>

<!--
Width element
-->
<!ELEMENT width (#PCDATA)>

<!--
@attr min The minimum width allowed.
@attr max The maximum width allowed.
-->
<!ATTLIST width 
    min CDATA #IMPLIED
    max CDATA #IMPLIED
>