javax.swing.text.html
Class AccessibleHTML.TableElementInfo

java.lang.Object
  extended byjavax.swing.text.html.AccessibleHTML.ElementInfo
      extended byjavax.swing.text.html.AccessibleHTML.TableElementInfo
All Implemented Interfaces:
javax.accessibility.Accessible
Enclosing class:
AccessibleHTML

private class AccessibleHTML.TableElementInfo
extends AccessibleHTML.ElementInfo
implements javax.accessibility.Accessible

TableElementInfo encapsulates information about a HTML.Tag.TABLE. To make access fast it crates a grid containing the children to allow for access by row, column. TableElementInfo will contain TableRowElementInfos, which will contain TableCellElementInfos. Any time one of the rows or columns becomes invalid the table is invalidated. This is because any time one of the child attributes changes the size of the grid may have changed.


Nested Class Summary
 class AccessibleHTML.TableElementInfo.TableAccessibleContext
           
private  class AccessibleHTML.TableElementInfo.TableCellElementInfo
          TableCellElementInfo is used to represents the cells of the table.
private  class AccessibleHTML.TableElementInfo.TableRowElementInfo
           
 
Field Summary
private  javax.accessibility.AccessibleContext accessibleContext
           
protected  AccessibleHTML.ElementInfo caption
           
private  AccessibleHTML.TableElementInfo.TableCellElementInfo[][] grid
          Allocation of the table by row x column.
 
Constructor Summary
(package private) AccessibleHTML.TableElementInfo(Element e, AccessibleHTML.ElementInfo parent)
           
 
Method Summary
protected  void addChild(AccessibleHTML.ElementInfo child)
          Adds a new child to this ElementInfo.
 javax.accessibility.AccessibleContext getAccessibleContext()
           
protected  AttributeSet getAttributes()
          Returns the AttributeSet associated with the Element, this will return null if the ElementInfo can't be validated.
 Rectangle getBounds()
          Returns the Bounds for this ElementInfo, or null if the ElementInfo can't be validated.
 AccessibleHTML.ElementInfo getCaptionInfo()
           
 AccessibleHTML.TableElementInfo.TableCellElementInfo getCell(int r, int c)
          Returns the TableCellElementInfo by row and column.
 AccessibleHTML.ElementInfo getChild(int index)
          Returns the child ElementInfo at index, or null if index isn't a valid index.
 int getChildCount()
          Returns the number of children the ElementInfo contains.
 int getColumnCount()
          Returns the number of columns in the table.
 int getColumnExtentAt(int r, int c)
          Returns the colspan of the specified entry.
 Element getElement()
          Returns the Element this ElementInfo represents.
 int getIndexInParent()
          Returns the index of the child in the parent, or -1 for the root or if the parent isn't valid.
protected  int getIntAttr(AttributeSet attrs, Object key, int deflt)
          Convenience method for getting an integer attribute from the passed in AttributeSet.
 AccessibleHTML.ElementInfo getParent()
          Returns the parent of this Element, or null for the root.
 AccessibleHTML.TableElementInfo.TableRowElementInfo getRow(int index)
          Returns the TableCellElementInfo at the specified index.
 int getRowCount()
          Returns the number of rows in the table.
 int getRowExtentAt(int r, int c)
          Returns the rowspan of the specified entry.
protected  View getView()
          Returns the View corresponding to this ElementInfo, or null if the ElementInfo can't be validated.
protected  AttributeSet getViewAttributes()
          Returns the AttributeSet associated with the View that is representing this Element, this will return null if the ElementInfo can't be validated.
 int indexOf(AccessibleHTML.ElementInfo child)
          Returns the index of the specified child, or -1 if child isn't a valid child.
protected  void invalidate(boolean first)
          Invalidates the ElementInfo.
protected  boolean isValid()
          Returns true if this ElementInfo is valid.
protected  void loadChildren(Element e)
          Overriden to only alloc instances of TableRowElementInfos.
private  void updateGrid()
          Updates the grid.
protected  void validate()
          Overriden to update the grid when validating.
protected  boolean validateIfNecessary()
          Validates the ElementInfo if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caption

protected AccessibleHTML.ElementInfo caption

grid

private AccessibleHTML.TableElementInfo.TableCellElementInfo[][] grid
Allocation of the table by row x column. There may be holes (eg nulls) depending upon the html, any cell that has a rowspan/colspan > 1 will be contained multiple times in the grid.


accessibleContext

private javax.accessibility.AccessibleContext accessibleContext
Constructor Detail

AccessibleHTML.TableElementInfo

AccessibleHTML.TableElementInfo(Element e,
                                AccessibleHTML.ElementInfo parent)
Method Detail

getCaptionInfo

public AccessibleHTML.ElementInfo getCaptionInfo()

validate

protected void validate()
Overriden to update the grid when validating.

Overrides:
validate in class AccessibleHTML.ElementInfo

loadChildren

protected void loadChildren(Element e)
Overriden to only alloc instances of TableRowElementInfos.

Overrides:
loadChildren in class AccessibleHTML.ElementInfo

updateGrid

private void updateGrid()
Updates the grid.


getRow

public AccessibleHTML.TableElementInfo.TableRowElementInfo getRow(int index)
Returns the TableCellElementInfo at the specified index.


getCell

public AccessibleHTML.TableElementInfo.TableCellElementInfo getCell(int r,
                                                                    int c)
Returns the TableCellElementInfo by row and column.


getRowExtentAt

public int getRowExtentAt(int r,
                          int c)
Returns the rowspan of the specified entry.


getColumnExtentAt

public int getColumnExtentAt(int r,
                             int c)
Returns the colspan of the specified entry.


getRowCount

public int getRowCount()
Returns the number of rows in the table.


getColumnCount

public int getColumnCount()
Returns the number of columns in the table.


getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface javax.accessibility.Accessible

getIndexInParent

public int getIndexInParent()
Returns the index of the child in the parent, or -1 for the root or if the parent isn't valid.


getElement

public Element getElement()
Returns the Element this ElementInfo represents.


getParent

public AccessibleHTML.ElementInfo getParent()
Returns the parent of this Element, or null for the root.


indexOf

public int indexOf(AccessibleHTML.ElementInfo child)
Returns the index of the specified child, or -1 if child isn't a valid child.


getChild

public AccessibleHTML.ElementInfo getChild(int index)
Returns the child ElementInfo at index, or null if index isn't a valid index.


getChildCount

public int getChildCount()
Returns the number of children the ElementInfo contains.


addChild

protected void addChild(AccessibleHTML.ElementInfo child)
Adds a new child to this ElementInfo.


getView

protected View getView()
Returns the View corresponding to this ElementInfo, or null if the ElementInfo can't be validated.


getBounds

public Rectangle getBounds()
Returns the Bounds for this ElementInfo, or null if the ElementInfo can't be validated.


isValid

protected boolean isValid()
Returns true if this ElementInfo is valid.


getAttributes

protected AttributeSet getAttributes()
Returns the AttributeSet associated with the Element, this will return null if the ElementInfo can't be validated.


getViewAttributes

protected AttributeSet getViewAttributes()
Returns the AttributeSet associated with the View that is representing this Element, this will return null if the ElementInfo can't be validated.


getIntAttr

protected int getIntAttr(AttributeSet attrs,
                         Object key,
                         int deflt)
Convenience method for getting an integer attribute from the passed in AttributeSet.


validateIfNecessary

protected boolean validateIfNecessary()
Validates the ElementInfo if necessary. Some ElementInfos may never be valid again. You should check isValid before using one. This will reload the children and invoke validate if the ElementInfo is invalid and can become valid again. This will return true if the receiver is valid.


invalidate

protected void invalidate(boolean first)
Invalidates the ElementInfo. Subclasses should override this if they need to reset state once invalid.