fi.iki.hsivonen.xml.checker.table
Class Table

java.lang.Object
  extended by fi.iki.hsivonen.xml.checker.table.Table

final class Table
extends Object

Represents an XHTML table for table integrity checking. Handles table-significant parse events and keeps track of columns.

Version:
$Id: Table.java,v 1.7 2006/12/01 12:34:30 hsivonen Exp $
Author:
hsivonen

Nested Class Summary
private static class Table.State
          An enumeration for keeping track of the parsing state of a table.
 
Field Summary
private  List<Cell> cellsReferringToHeaders
          A list of cells that refer to headers (in the document order).
private  int columnCount
          The column count established by column markup or by the first row.
private  RowGroup current
          The current row group (also implicit groups have an explicit object).
private  ColumnRange currentColRange
          The range under inspection.
private  ColumnRange first
          The head of the column range list.
private  boolean hardWidth
          Indicates whether the width of the table was established by column markup.
private  Set<String> headerIds
          A set of the IDs of header cells.
private  ColumnRange last
          The tail of the column range list.
private  TableChecker owner
          The owning checker.
private  int pendingColGroupSpan
          A colgroup span that hasn't been actuated yet in case the element has col children.
private  ColumnRange previousColRange
          The previous range that was inspected.
private  int realColumnCount
          The actual column count as stretched by the widest row.
private  Table.State state
          Keeps track of the handler state between SAX events.
private  int suppressedStarts
          The number of suppressed element starts.
 
Constructor Summary
Table(TableChecker owner)
          Constructor.
 
Method Summary
private  void appendColumnRange(ColumnRange colRange)
          Appends a column range to the linked list of column ranges.
(package private)  void cell(Cell cell)
          Reports a cell whose positioning has been decided back to the table so that column bookkeeping can be done.
(package private)  void end()
           
(package private)  void endCell()
           
(package private)  void endCol()
           
(package private)  void endColGroup()
           
(package private)  void endRow()
           
(package private)  void endRowGroup()
           
(package private)  void err(String message)
           
(package private)  int getColumnCount()
          Returns the columnCount.
(package private)  boolean isHardWidth()
          Returns the hardWidth.
private  boolean needSuppressEnd()
           
private  boolean needSuppressStart()
           
(package private)  void setColumnCount(int columnCount)
          Sets the columnCount.
(package private)  void startCell(boolean header, Attributes attributes)
           
(package private)  void startCol(int span)
           
(package private)  void startColGroup(int span)
           
(package private)  void startRow()
           
(package private)  void startRowGroup(String type)
           
(package private)  void warn(String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

state

private Table.State state
Keeps track of the handler state between SAX events.


suppressedStarts

private int suppressedStarts
The number of suppressed element starts.


hardWidth

private boolean hardWidth
Indicates whether the width of the table was established by column markup.


columnCount

private int columnCount
The column count established by column markup or by the first row.


realColumnCount

private int realColumnCount
The actual column count as stretched by the widest row.


pendingColGroupSpan

private int pendingColGroupSpan
A colgroup span that hasn't been actuated yet in case the element has col children. The absolute value counts. The negative sign means that the value was implied.


headerIds

private final Set<String> headerIds
A set of the IDs of header cells.


cellsReferringToHeaders

private final List<Cell> cellsReferringToHeaders
A list of cells that refer to headers (in the document order).


owner

private final TableChecker owner
The owning checker.


current

private RowGroup current
The current row group (also implicit groups have an explicit object).


first

private ColumnRange first
The head of the column range list.


last

private ColumnRange last
The tail of the column range list.


currentColRange

private ColumnRange currentColRange
The range under inspection.


previousColRange

private ColumnRange previousColRange
The previous range that was inspected.

Constructor Detail

Table

public Table(TableChecker owner)
Constructor.

Parameters:
owner - reference back to the checker
Method Detail

needSuppressStart

private boolean needSuppressStart()

needSuppressEnd

private boolean needSuppressEnd()

startRowGroup

void startRowGroup(String type)
             throws SAXException
Throws:
SAXException

endRowGroup

void endRowGroup()
           throws SAXException
Throws:
SAXException

startRow

void startRow()

endRow

void endRow()
      throws SAXException
Throws:
SAXException

startCell

void startCell(boolean header,
               Attributes attributes)
         throws SAXException
Throws:
SAXException

endCell

void endCell()

startColGroup

void startColGroup(int span)

endColGroup

void endColGroup()

startCol

void startCol(int span)
        throws SAXException
Throws:
SAXException

appendColumnRange

private void appendColumnRange(ColumnRange colRange)
Appends a column range to the linked list of column ranges.

Parameters:
colRange - the range to append

warn

void warn(String message)
    throws SAXException
Throws:
SAXException

err

void err(String message)
   throws SAXException
Throws:
SAXException

endCol

void endCol()

end

void end()
   throws SAXException
Throws:
SAXException

getColumnCount

int getColumnCount()
Returns the columnCount.

Returns:
the columnCount

setColumnCount

void setColumnCount(int columnCount)
Sets the columnCount.

Parameters:
columnCount - the columnCount to set

isHardWidth

boolean isHardWidth()
Returns the hardWidth.

Returns:
the hardWidth

cell

void cell(Cell cell)
Reports a cell whose positioning has been decided back to the table so that column bookkeeping can be done. (Called from RowGroup--not TableChecker.)

Parameters:
cell - a cell whose position has been calculated