org.jfree.report.states
Class DataRowBackend

java.lang.Object
  extended byorg.jfree.report.states.DataRowBackend
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DataRowPreview

public class DataRowBackend
extends java.lang.Object
implements java.lang.Cloneable

The DataRow-Backend maintains the state of a datarow. Whenever the report state changes the backend of the datarow is updated and then reconnected with the DataRowConnector.

Author:
Thomas Morgner
See Also:
DataRowConnector

Constructor Summary
  DataRowBackend()
          Creates a new DataRowBackend.
protected DataRowBackend(DataRowBackend db)
          Creates a new DataRowBackend based on the given datarow backend.
 
Method Summary
 java.lang.Object clone()
          Clones this DataRowBackend.
 int findColumn(java.lang.String name)
          Looks up the position of the column with the name name.
 java.lang.Object get(int column)
          Returns the value of the function, expression or column in the tablemodel using the column number.
 java.lang.Object get(java.lang.String name)
          Returns the value of the function, expression or column using its specific name.
 int getColumnCount()
          Returns the count of columns in this datarow.
 java.lang.String getColumnName(int col)
          Returns the name of the column, expression or function.
 int getCurrentRow()
          Returns the current row in the tablemodel.
 DataRow getDataRow()
          Returns the public datarow instance used to query this datarow..
protected  DataRowConnector getDataRowConnector()
          Returns the datarow connector used to connect the functions and element with this datarow.
 LevelledExpressionList getFunctions()
          Returns the function collection used in this DataRowBackend.
 ReportPropertiesList getReportProperties()
          Returns the report properties.
 javax.swing.table.TableModel getTablemodel()
          Returns the tablemodel used in this DataRowBackend.
 boolean isBeforeFirstRow()
          Tests whether the current row is set before the first row in the tablemodel.
 boolean isLastRow()
          Tests whether the current row in the tablemodel is the last row in the tablemodel.
 void setCurrentRow(int currentRow)
          Sets the current row of the tablemodel.
 void setFunctions(LevelledExpressionList functions)
          Sets the function collection used in this DataRow.
 void setReportProperties(ReportPropertiesList properties)
          Sets the report properties.
 void setTablemodel(javax.swing.table.TableModel tablemodel)
          sets the tablemodel used in this DataRow.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataRowBackend

public DataRowBackend()
Creates a new DataRowBackend.


DataRowBackend

protected DataRowBackend(DataRowBackend db)
Creates a new DataRowBackend based on the given datarow backend. Both datarow backends will share the objects, no cloning is done. Functions will not be included in the copy...

Parameters:
db - the data row backend.
Method Detail

getDataRowConnector

protected DataRowConnector getDataRowConnector()
Returns the datarow connector used to connect the functions and element with this datarow.

Returns:
the datarow connector.

getDataRow

public DataRow getDataRow()
Returns the public datarow instance used to query this datarow..

Returns:
the datarow.

getFunctions

public LevelledExpressionList getFunctions()
Returns the function collection used in this DataRowBackend. The FunctionCollection is stateful and will be set to a new function collection when the ReportState advances.

Returns:
the currently set function collection

getTablemodel

public javax.swing.table.TableModel getTablemodel()
Returns the tablemodel used in this DataRowBackend.

Returns:
the TableModel of the Report.

getCurrentRow

public int getCurrentRow()
Returns the current row in the tablemodel. The row is advanced while the report is processed. If the row is negative, the DataRowBackend isBeforeFirstRow.

Returns:
the current row.

setCurrentRow

public void setCurrentRow(int currentRow)
Sets the current row of the tablemodel. The current row is advanced while the Report is being processed.

Parameters:
currentRow - the current row

setFunctions

public void setFunctions(LevelledExpressionList functions)
Sets the function collection used in this DataRow. This also updates the function's dataRow reference.

Parameters:
functions - the current function collection

setTablemodel

public void setTablemodel(javax.swing.table.TableModel tablemodel)
sets the tablemodel used in this DataRow. The tablemodel contains the base values for the report and the currentRow-property contains a pointer to the current row within the tablemodel.

Parameters:
tablemodel - the tablemodel used as base for the reporting

get

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

Parameters:
column - the item index.
Returns:
The item value.
Throws:
java.lang.IndexOutOfBoundsException - if the index is negative or greater than the number of columns in this row.
java.lang.IllegalStateException - if a deadlock is detected.

get

public java.lang.Object get(java.lang.String name)
Returns the value of the function, expression or column using its specific name. This method returns null if the named column was not found.

Parameters:
name - the item name.
Returns:
The item value.
Throws:
java.lang.IndexOutOfBoundsException - if the index is negative or greater than the number of columns in this row.
java.lang.IllegalStateException - if a deadlock is detected.

getColumnCount

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

Returns:
the number of accessible columns in this datarow.

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.

Parameters:
name - the item 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.

getColumnName

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

Parameters:
col - the column, expression or function index.
Returns:
The column, expression or function name.

isBeforeFirstRow

public boolean isBeforeFirstRow()
Tests whether the current row is set before the first row in the tablemodel.

Returns:
true, if the processing has not yet started and the currentRow is lesser than 0.

isLastRow

public boolean isLastRow()
Tests whether the current row in the tablemodel is the last row in the tablemodel.

Returns:
true, if the current row is the last row in the tablemodel.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones this DataRowBackend. Does also clone the functions contained in this datarow.

Returns:
the clone.
Throws:
java.lang.CloneNotSupportedException - should never happen.

getReportProperties

public ReportPropertiesList getReportProperties()
Returns the report properties.

Returns:
the report properties.

setReportProperties

public void setReportProperties(ReportPropertiesList properties)
Sets the report properties.

Parameters:
properties - the report properties.