Top Description Fields Constructors Methods
org.dom4j.swing

public Class XMLTableDefinition

extends Object
implements Serializable, VariableContext
Class Inheritance
All Implemented Interfaces
org.jaxen.VariableContext, java.io.Serializable
Imports
java.io.Serializable, java.util.ArrayList, .HashMap, .Iterator, .List, .Map, org.dom4j.Document, .DocumentHelper, .Element, .XPath, org.jaxen.VariableContext

XMLTableDefinition represents a table definition based on XPath expression evaluated on an XML document.

Author
James Strachan
Version
$Revision: 1.8 $

Field Summary

Modifier and TypeField and Description
private XMLTableColumnDefinition[]
columnArray

integer index array cache

private Map<String, XMLTableColumnDefinition>
columnNameIndex

name index cache

private List<XMLTableColumnDefinition>
columns

The columns to display in this table

private Object
rowValue

stores the current row value for the variableContext

private XPath
rowXPath

Holds value of property rowXPath.

private VariableContext
variableContext

for cross-row variables

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addColumn(String name, String expression)

public void
addColumn(String name, String expression, int type)

public void
public void
addColumnWithXPathName(String columnNameXPathExpression, String expression, int type)

public void
addNumberColumn(String name, String expression)

public void
addStringColumn(String name, String expression)

public void
protected void
protected XPath
protected XPath
createXPath(String expression)

public XMLTableColumnDefinition
getColumn(int index)

public XMLTableColumnDefinition
getColumn(String columnName)

public Class<?>
getColumnClass(int columnIndex)

public int
public String

Returns:

the static column name. This is used if there is no columnNameXPath
getColumnName
(int
DOCUMENT ME!
columnIndex
)

DOCUMENT ME!

public XPath

Returns:

the XPath expresssion used to create the column name, if there is one or null if there is no XPath expression to name the column.
getColumnNameXPath
(int
DOCUMENT ME!
columnIndex
)

DOCUMENT ME!

public XPath

Returns:

the XPath expression used to evaluate the value of cells in this column
getColumnXPath
(int
DOCUMENT ME!
columnIndex
)

DOCUMENT ME!

public XPath

Returns:

Value of property rowXPath.
getRowXPath
()

Getter for property rowXPath.

public synchronized Object
getValueAt(Object row, int columnIndex)

public Object
getVariableValue(String
the namespace URI to which the prefix parameter is bound in the XPath expression. If the variable reference expression had no prefix, the namespace URI is null.
namespaceURI
,
String
the prefix that was used in the variable reference expression; this value is ignored and has no effect
prefix
,
String
the local name of the variable-reference expression. If there is no prefix, then this is the whole name of the variable.
localName
)

Implements org.jaxen.VariableContext.getVariableValue.

An implementation should return the value of an XPath variable based on the namespace URI and local name of the variable-reference expression.
protected void
public static XMLTableDefinition

Returns:

DOCUMENT ME!
load
(Document
DOCUMENT ME!
definition
)

Loads an XML table definition from an XML definition document

public static XMLTableDefinition

Returns:

DOCUMENT ME!
load
(Element
DOCUMENT ME!
definition
)

Loads an XML table definition from an XML definition document

public void
public void
public void
setRowXPath(XPath
New value of property rowXPath.
rowXPath
)

Setter for property rowXPath.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnArrayback to summary
private XMLTableColumnDefinition[] columnArray

integer index array cache

columnNameIndexback to summary
private Map<String, XMLTableColumnDefinition> columnNameIndex

name index cache

columnsback to summary
private List<XMLTableColumnDefinition> columns

The columns to display in this table

rowValueback to summary
private Object rowValue

stores the current row value for the variableContext

rowXPathback to summary
private XPath rowXPath

Holds value of property rowXPath.

variableContextback to summary
private VariableContext variableContext

for cross-row variables

Constructor Detail

XMLTableDefinitionback to summary
public XMLTableDefinition()

Method Detail

addColumnback to summary
public void addColumn(String name, String expression)
addColumnback to summary
public void addColumn(String name, String expression, int type)
addColumnback to summary
public void addColumn(XMLTableColumnDefinition column)
addColumnWithXPathNameback to summary
public void addColumnWithXPathName(String columnNameXPathExpression, String expression, int type)
addNumberColumnback to summary
public void addNumberColumn(String name, String expression)
addStringColumnback to summary
public void addStringColumn(String name, String expression)
clearback to summary
public void clear()
clearCachesback to summary
protected void clearCaches()
createColumnXPathback to summary
protected XPath createColumnXPath(String expression)
createXPathback to summary
protected XPath createXPath(String expression)
getColumnback to summary
public XMLTableColumnDefinition getColumn(int index)
getColumnback to summary
public XMLTableColumnDefinition getColumn(String columnName)
getColumnClassback to summary
public Class<?> getColumnClass(int columnIndex)
getColumnCountback to summary
public int getColumnCount()
getColumnNameback to summary
public String getColumnName(int columnIndex)

DOCUMENT ME!

Parameters
columnIndex:int

DOCUMENT ME!

Returns:String

the static column name. This is used if there is no columnNameXPath

getColumnNameXPathback to summary
public XPath getColumnNameXPath(int columnIndex)

DOCUMENT ME!

Parameters
columnIndex:int

DOCUMENT ME!

Returns:XPath

the XPath expresssion used to create the column name, if there is one or null if there is no XPath expression to name the column.

getColumnXPathback to summary
public XPath getColumnXPath(int columnIndex)

DOCUMENT ME!

Parameters
columnIndex:int

DOCUMENT ME!

Returns:XPath

the XPath expression used to evaluate the value of cells in this column

getRowXPathback to summary
public XPath getRowXPath()

Getter for property rowXPath.

Returns:XPath

Value of property rowXPath.

getValueAtback to summary
public synchronized Object getValueAt(Object row, int columnIndex)
getVariableValueback to summary
public Object getVariableValue(String namespaceURI, String prefix, String localName)

Implements org.jaxen.VariableContext.getVariableValue.

Doc from org.jaxen.VariableContext.getVariableValue.

An implementation should return the value of an XPath variable based on the namespace URI and local name of the variable-reference expression.

It must not use the prefix parameter to select a variable, because a prefix could be bound to any namespace; the prefix parameter could be used in debugging output or other generated information. The prefix may otherwise be ignored.

Parameters
namespaceURI:String

the namespace URI to which the prefix parameter is bound in the XPath expression. If the variable reference expression had no prefix, the namespace URI is null.

prefix:String

the prefix that was used in the variable reference expression; this value is ignored and has no effect

localName:String

the local name of the variable-reference expression. If there is no prefix, then this is the whole name of the variable.

Returns:Object

the variable's value (which can be null)

handleExceptionback to summary
protected void handleException(Exception e)
loadback to summary
public static XMLTableDefinition load(Document definition)

Loads an XML table definition from an XML definition document

Parameters
definition:Document

DOCUMENT ME!

Returns:XMLTableDefinition

DOCUMENT ME!

loadback to summary
public static XMLTableDefinition load(Element definition)

Loads an XML table definition from an XML definition document

Parameters
definition:Element

DOCUMENT ME!

Returns:XMLTableDefinition

DOCUMENT ME!

removeColumnback to summary
public void removeColumn(XMLTableColumnDefinition column)
setRowExpressionback to summary
public void setRowExpression(String xpath)
setRowXPathback to summary
public void setRowXPath(XPath rowXPath)

Setter for property rowXPath.

Parameters
rowXPath:XPath

New value of property rowXPath.