org.jfree.report.states
Class DataRowConnector

java.lang.Object
  extended byorg.jfree.report.states.DataRowConnector
All Implemented Interfaces:
DataRow

public class DataRowConnector
extends java.lang.Object
implements DataRow

This is the connection-proxy to the various data sources contained in the elements. During report processing the report states get cloned while the elements remain uncloned. The DataRowConnector connects the DataRowBackend (which contains the data) with the stateless elements.

Author:
Thomas Morgner
See Also:
DataRowBackend

Constructor Summary
DataRowConnector()
          Default constructor.
 
Method Summary
static void connectDataSources(Band band, DataRowConnector con)
          Connects the Band and all Elements within the band to this DataRow.
static void connectDataSources(ReportDefinition report, DataRowConnector con)
          Connects the Report and all contained bands and all Elements within the bands to this DataRow.
static void disconnectDataSources(Band band, DataRowConnector con)
          Removes the reference to this DataRow from the Band and all Elements contained in the Band.
static void disconnectDataSources(ReportDefinition report, DataRowConnector con)
          Removes the reference to this DataRow from the Report and all contained Bands and all Elements contained in the Bands.
 int findColumn(java.lang.String name)
          Looks up the position of the column with the name name.
 java.lang.Object get(int col)
          Return the value of the function, expression or column in the tablemodel using the column number.
 java.lang.Object get(java.lang.String col)
          Returns the value of the column, function or expression using its name.
 int getColumnCount()
          Returns the count of columns in this datarow.
 java.lang.String getColumnName(int col)
          Returns the name of the column, function or expression.
 DataRowBackend getDataRowBackend()
          Returns the assigned data row backend.
static DataSource getLastDatasource(DataTarget e)
          Queries the last datasource in the chain of targets and filters.
 void setDataRowBackend(DataRowBackend dataRow)
          Sets the data row backend for this DataRowConnector.
 java.lang.String toString()
          Returns a string describing the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataRowConnector

public DataRowConnector()
Default constructor.

Method Detail

getDataRowBackend

public DataRowBackend getDataRowBackend()
Returns the assigned data row backend.

Returns:
the currently assigned DataRowBackend for this DataRowConnector.

setDataRowBackend

public void setDataRowBackend(DataRowBackend dataRow)
Sets the data row backend for this DataRowConnector. The backend actually contains the data which will be queried, while this DataRowConnector is simply a proxy forwarding all requests to the backend.

Parameters:
dataRow - the data row backend

get

public java.lang.Object get(int col)
Return the value of the function, expression or column in the tablemodel using the column number.

Specified by:
get in interface DataRow
Parameters:
col - the column, function or expression index.
Returns:
the column, function or expression value.
Throws:
java.lang.IllegalStateException - if there is no backend connected.

get

public java.lang.Object get(java.lang.String col)
Returns the value of the column, function or expression using its name.

Specified by:
get in interface DataRow
Parameters:
col - the column, function or expression index.
Returns:
The column, function or expression value.
Throws:
java.lang.IllegalStateException - if there is no backend connected

getColumnName

public java.lang.String getColumnName(int col)
Returns the name of the column, function or expression.

Specified by:
getColumnName in interface DataRow
Parameters:
col - the column, function or expression index.
Returns:
the column, function or expression name.
Throws:
java.lang.IllegalStateException - if there is no backend connected.

findColumn

public int findColumn(java.lang.String name)
Looks up the position of the column with the name name. returns the position of the column or -1 if no columns could be retrieved.

Specified by:
findColumn in interface DataRow
Parameters:
name - the column, function or expression name.
Returns:
the column position of the column, expression or function with the given name or -1 if the given name does not exist in this DataRow.
Throws:
java.lang.IllegalStateException - if there is no backend connected.

getColumnCount

public int getColumnCount()
Returns the count of columns in this datarow. The columncount is the sum of all DataSource columns, all functions and all expressions.

Specified by:
getColumnCount in interface DataRow
Returns:
the number of accessible columns in this datarow.
Throws:
java.lang.IllegalStateException - if there is no backend connected.

connectDataSources

public static void connectDataSources(ReportDefinition report,
                                      DataRowConnector con)
Connects the Report and all contained bands and all Elements within the bands to this DataRow.

Parameters:
report - the report which will be connected
con - the data row connector.

connectDataSources

public static void connectDataSources(Band band,
                                      DataRowConnector con)
Connects the Band and all Elements within the band to this DataRow.

Parameters:
band - the band which will be connected.
con - the connector.

disconnectDataSources

public static void disconnectDataSources(ReportDefinition report,
                                         DataRowConnector con)
Removes the reference to this DataRow from the Report and all contained Bands and all Elements contained in the Bands.

Parameters:
report - the report which will be disconnected from this DataRow.
con - the connector.

disconnectDataSources

public static void disconnectDataSources(Band band,
                                         DataRowConnector con)
Removes the reference to this DataRow from the Band and all Elements contained in the Band.

Parameters:
band - the band which will be disconnected from this DataRow.
con - the connector.

getLastDatasource

public static DataSource getLastDatasource(DataTarget e)
Queries the last datasource in the chain of targets and filters.

The last datasource is used to feed data into the data processing chain. The result of this computation is retrieved by the element using the registered datasource to query the queue.

Parameters:
e - the data target.
Returns:
The last DataSource in the chain.

toString

public java.lang.String toString()
Returns a string describing the object.

Returns:
The string.