org.ujac.util.table
Class ReportFunction

java.lang.Object
  extended by org.ujac.util.table.ReportFunction
All Implemented Interfaces:
Serializable, Cloneable, TableConstants, UjacTypes

public class ReportFunction
extends Object
implements Cloneable, TableConstants, Serializable

Name: ReportFunction
Description: A class describing and managing report funtions.

Author:
lauerc
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.ujac.util.table.TableConstants
DEFAULT_DATE_FORMAT, DEFAULT_DOUBLE_FORMAT, DEFAULT_INTEGER_FORMAT, DEFAULT_TIME_FORMAT, DEFAULT_TIMESTAMP_FORMAT, ROW_TYPE_FOOTER, ROW_TYPE_GROUP, ROW_TYPE_GROUP_TITLE, ROW_TYPE_HEADER, ROW_TYPE_NORMAL
 
Fields inherited from interface org.ujac.util.UjacTypes
TYPE_BOOLEAN, TYPE_DATE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_LONG, TYPE_NAME_BOOLEAN, TYPE_NAME_DATE, TYPE_NAME_DOUBLE, TYPE_NAME_FLOAT, TYPE_NAME_INT, TYPE_NAME_LONG, TYPE_NAME_OBJECT, TYPE_NAME_SHORT, TYPE_NAME_STRING, TYPE_NAME_TABLE, TYPE_NAME_TIME, TYPE_NAME_TIMESTAMP, TYPE_OBJECT, TYPE_SHORT, TYPE_STRING, TYPE_TABLE, TYPE_TIME, TYPE_TIMESTAMP
 
Constructor Summary
ReportFunction(String columnName, FunctionExecutor executor, boolean calculateTotalResult)
          Constructs a ReportFunction instance with specific attributes.
ReportFunction(String columnName, FunctionExecutor executor, boolean calculateTotalResult, List groups)
          Constructs a ReportFunction instance with specific attributes.
ReportFunction(String columnName, FunctionExecutor executor, boolean calculateTotalResult, String[] groups)
          Constructs a ReportFunction instance with specific attributes.
 
Method Summary
 void addGroup(String groupName)
          Adds a column to group by.
 void apply(Object operand)
          Applies the function for the given operand on the given current value.
protected  Object clone()
           
 int getAlign()
          Getter method for the the property align.
 int getColumnIdx()
          Getter method for the the property columnIdx.
 String getColumnName()
          Gets the column name.
protected  FunctionExecutor getExecutor()
          Getter method for the the property executor.
 Format getFormat()
          Getter method for the the property format.
 double getTotalResult()
          Getter method for the the property totalResult.
protected  void init(ReportTable report, ReportGroup[] allGroups)
          Initializes the report function.
 boolean isCalculateTotalResult()
          Checks whether or not to calculate the total result.
 void setAlign(int align)
          Setter method for the the property align.
protected  void setColumnIdx(int columnIdx)
          Setter method for the the property columnIdx.
 void setFormat(Format format)
          Setter method for the the property format.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportFunction

public ReportFunction(String columnName,
                      FunctionExecutor executor,
                      boolean calculateTotalResult)
Constructs a ReportFunction instance with specific attributes.

Parameters:
executor - The function executor.
columnName - The column name.
calculateTotalResult - Tells whether or not to calculate the total result.

ReportFunction

public ReportFunction(String columnName,
                      FunctionExecutor executor,
                      boolean calculateTotalResult,
                      String[] groups)
Constructs a ReportFunction instance with specific attributes.

Parameters:
executor - The function executor.
columnName - The column name.
calculateTotalResult - Tells whether or not to calculate the total result.
groups - The report groups to apply the function on.

ReportFunction

public ReportFunction(String columnName,
                      FunctionExecutor executor,
                      boolean calculateTotalResult,
                      List groups)
Constructs a ReportFunction instance with specific attributes.

Parameters:
executor - The function executor.
columnName - The column name.
calculateTotalResult - Tells whether or not to calculate the total result.
groups - The report groups to apply the function on.
Method Detail

getColumnName

public String getColumnName()
Gets the column name.

Returns:
The name of the column to apply the function on.

isCalculateTotalResult

public boolean isCalculateTotalResult()
Checks whether or not to calculate the total result.

Returns:
true: calculate the global result, else don't calculate.

getColumnIdx

public int getColumnIdx()
Getter method for the the property columnIdx.

Returns:
The current value of property columnIdx.

setColumnIdx

protected void setColumnIdx(int columnIdx)
Setter method for the the property columnIdx.

Parameters:
columnIdx - The value to set for the property columnIdx.

getExecutor

protected FunctionExecutor getExecutor()
Getter method for the the property executor.

Returns:
The current value of property executor.

getTotalResult

public double getTotalResult()
Getter method for the the property totalResult.

Returns:
The current value of property totalResult.

addGroup

public void addGroup(String groupName)
Adds a column to group by.

Parameters:
groupName - The name of the column to group by.

getAlign

public int getAlign()
Getter method for the the property align.

Returns:
The current value of property align.

setAlign

public void setAlign(int align)
Setter method for the the property align.

Parameters:
align - The value to set for the property align.

getFormat

public Format getFormat()
Getter method for the the property format.

Returns:
The current value of property format.

setFormat

public void setFormat(Format format)
Setter method for the the property format.

Parameters:
format - The value to set for the property format.

init

protected void init(ReportTable report,
                    ReportGroup[] allGroups)
Initializes the report function.

Parameters:
report - The report to set.
allGroups - An array providing all available report groups.

apply

public void apply(Object operand)
           throws TypeMismatchException
Applies the function for the given operand on the given current value.

Parameters:
operand - The operand to apply.
Throws:
TypeMismatchException - In case the given operand type was invalid.

clone

protected Object clone()
Overrides:
clone in class Object
See Also:
Object.clone()


Copyright © 2003-2004 UJAC.org. All Rights Reserved.