EspressReport 6.6

quadbase.reportdesigner.util
Class ColInfo

java.lang.Object
  extended by quadbase.reportdesigner.util.ColInfo
All Implemented Interfaces:
IAggregateConstants

public class ColInfo
extends java.lang.Object
implements IAggregateConstants

When calling the QbReport Constructor with a ColInfo[] parameter, the data mapping from a data source to a report layout is set using this ColInfo class. The ColInfo class not only defines what columns from the data source is mapped to what columns in the report tables, it also control other layout information such as how to group data in the columns and rows of the report layout tables.

The most simple use of the ColInfo is to map the same columns from the data source to the report. This is done using the following short piece of code:

    ColInfo[] colInfo = new ColInfo[3]; //3 columns
    colInfo[0] = new ColInfo(0); //column 0 of the QbReport is mapped to column 0 of the data source.
    colInfo[0].setName("Product Type"); //sets table header name of the column 0 of the QbReport.
    colInfo[1] = new ColInfo(1); //column 1 of the QbReport is mapped to column 1 of the data source.
    colInfo[1].setName("Product Name"); //sets table header name of the column 1 of the QbReport.
    colInfo[2] = new ColInfo(2); //column 2 of the QbReport is mapped to column 2 of the data source.
    colInfo[2].setName("Product Price"); //sets table header name of the column 2 of the QbReport.

However, sometimes you may want to map a column from the data source to a different column in the report layout table. To map column 0 from the data source to column 1 of a report layout table, simply do the following:

    colInfo[1] = new ColInfo(0); //column 1 of the QbReport is mapped to column 0 of the data source.

Sometimes more formatting is desired in the report, the following is a summary of methods that must be set before generation of each corresponding report types using QbReport:

Summary Break Report: setRowBreak(), setAggregation().
Crosstab Report: setRowBreak(), setColumnBreak(), setColumnBreakValue(), setAggregation().
Master and Details Report: setPrimaryKey(), setMaster().


Field Summary
 int ASC
           
 int DESC
           
 int NOT_SORTED
           
static java.lang.String XMLTAG
           
 
Fields inherited from interface quadbase.reportdesigner.util.IAggregateConstants
AGGR, AVG, COUNT, COUNTDISTINCT, FIRST, LAST, MAX, MEDIAN, MIN, NONE, STDDEV, SUM, SUMSQUARE, VARIANCE
 
Constructor Summary
ColInfo(Formula formulaObj, java.lang.String colName, int sqlType)
          Create a new report column using the specified formula, column name and SQL type.
ColInfo(int colMappedIndex)
          Creates a new report column using the specified column from the data source
ColInfo(IObject object, java.lang.String colName)
          Creates a new report column using the specified formula and column name
ColInfo(IObject object, java.lang.String colName, int sqlType)
          Create a new report column using the specified formula, column name and SQL type.
ColInfo(java.lang.String formula, java.lang.String colName, int sqlType)
          Create a new report column using the specified formula, column name and SQL type.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this object.
 boolean equals(ColInfo cInfo)
          Returns true if and only if this ColInfo is identical to cInfo.
 boolean equals(ColInfo cInfo, boolean checkRepeatField)
          Internal Use only
 short getAggregation()
          Returns the aggregation on the column.
 int getDataType()
          Returns the SQL type of the column
 java.lang.String getDBTableName()
          Gets the name of the Database table.
 java.lang.String getDrillDownName()
          Gets the drill down report name from this column
 java.lang.String getFormula()
          Returns the formula of the column
 java.lang.String getFormulaName()
          Gets the Formula name.
 Formula getFormulaObj()
          Gets the Formula Object.
 int getMapping()
          Get the mapping for the report
 java.lang.String getName()
          Returns the name of the column
 int getOrderInfo()
          Gets what type of crosstab ordering is used: NOT_SORTED, ASC, DESC.
 boolean isAggregatedColumn()
          Returns whether this is an aggregated column.
 boolean isAsc()
          Returns whether the ColInfo is sorted in ascending order.
 boolean isColumnBreak()
          Returns whether column is used as column break
 boolean isColumnBreakValue()
          Returns whether column is used as column break value
 boolean isDsc()
          Returns whether the ColInfo is sorted in descending order.
 boolean isFitGroupOnPage()
          True iff groups are to be fitted on the same page.
 boolean isMaster()
          Returns whether column is used as master field
 boolean isPrimaryKey()
          Returns whether column is used as primary key
 boolean isRepeatBreakField()
          Returns whether this is a repeated break field.
 boolean isRowBreak()
          Returns whether column is used as row break
 boolean isSorted()
          Returns whether the ColInfo is sorted
 boolean isTopN()
          Returns whether this column is used to order rows in a topN Report.
 boolean isVisible()
          Returns whether column is visible
static ColInfo read(java.io.DataInput in, int version)
          Internal Use only
static ColInfo readXML(org.w3c.dom.Node dnode, int version)
          Reads in a XML node with corresponding version and return data as a ColInfo.
 void setAggregation(boolean aggregateColumn, short agg)
          Similar to setAggregation(short agg), aggregateColumn sets whether to do column aggregation or not, if and only if agg != NONE.
 void setAggregation(short agg)
          Sets the aggregation method for the column.
 void setColumnBreak(boolean breakOnThisColumn)
          Sets the column as column break.
 void setColumnBreakValue(boolean breakOnThisColumn)
          Each distinct value in this specified column will be a report column in the table body.
 void setDBTableName(java.lang.String tableName)
          Sets the name of the Database table.
 void setDrillDownName(java.lang.String name)
          Sets the drill down report name (if applicable) to this column
 void setFitGroupOnPage(boolean isFitGroupOnPage)
          Set whether to fit groups on the same page.
 void setFormula(java.lang.String txt, int type)
          Sets the formula of the column.
 void setFormulaName(java.lang.String name)
          Sets the Formula name.
 void setFormulaObj(Formula formula)
          Sets the Formula Object
 void setMapping(int colMappedIndex)
          Sets the mapping for the report
 void setMaster(boolean isMasterField)
          Sets the column as the master field for a Masters and Detail Type Report.
 void setName(java.lang.String colName)
          Sets the name of the column
 void setOrderInfo(int i)
          Sets crosstab ordering this allows user to sort the column break values in a crosstab report
 void setPrimaryKey(boolean isPrimaryKey)
          Sets the column as the primary key in a Master and Details Type Report.
 void setRepeatBreakField(boolean isRepeatBreakField)
          sets this column to be a repeated break field.
 void setRowBreak(boolean breakOnThisColumn)
          Sets the column as row break.
 void setSkipFirstValueForFitGroup(boolean s)
          Specify if the first group should be tested rather it can fit on the current page.
 void setTopN(boolean isTopN)
          Sets this column to be used to order rows in a topN Report.
 void setVisible(boolean b)
          Sets the column invisible
 boolean skipFirstValueForFitGroup()
          If this method returns true, then the first group is not tested if it will fit on the current page.
 void write(java.io.DataOutput out)
          Internal Use only
 void writeXML(java.io.Writer out)
          Internal Use only
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLTAG

public static final java.lang.String XMLTAG
See Also:
Constant Field Values

NOT_SORTED

public final int NOT_SORTED
See Also:
Constant Field Values

ASC

public final int ASC
See Also:
Constant Field Values

DESC

public final int DESC
See Also:
Constant Field Values
Constructor Detail

ColInfo

public ColInfo(int colMappedIndex)
Creates a new report column using the specified column from the data source


ColInfo

public ColInfo(IObject object,
               java.lang.String colName)
Creates a new report column using the specified formula and column name


ColInfo

public ColInfo(IObject object,
               java.lang.String colName,
               int sqlType)
Create a new report column using the specified formula, column name and SQL type. The SQL type passed is from java.sql.Types


ColInfo

public ColInfo(java.lang.String formula,
               java.lang.String colName,
               int sqlType)
Create a new report column using the specified formula, column name and SQL type. The SQL type passed is from java.sql.Types


ColInfo

public ColInfo(Formula formulaObj,
               java.lang.String colName,
               int sqlType)
Create a new report column using the specified formula, column name and SQL type. The SQL type passed is from java.sql.Types

Method Detail

getMapping

public int getMapping()
Get the mapping for the report


setMapping

public void setMapping(int colMappedIndex)
Sets the mapping for the report


isPrimaryKey

public boolean isPrimaryKey()
Returns whether column is used as primary key


setPrimaryKey

public void setPrimaryKey(boolean isPrimaryKey)
Sets the column as the primary key in a Master and Details Type Report. To create a Master and Details Type Report, you must define a Primary Key column. The primary key column determines the grouping of the report. A new group will be created every time the value in the selected column changes(i.e. the Primary Key column). Only one column may serve as the Primary Key.


isRowBreak

public boolean isRowBreak()
Returns whether column is used as row break


setRowBreak

public void setRowBreak(boolean breakOnThisColumn)
Sets the column as row break. The number of new groups would be equal to the number of unique values in this column.

This is especially useful when setting up a Summary Break Report or a Crosstab Report. If this column is setup to be a row break (by invoking setRowBreak(true);), then a grouping of other columns will be created for each unique value of this column. The report essentially gets "broken" every time the data in this "break" column changes. In addition, an aggregation must be specified (using the setAggregation() method, for the columns (even if columns are non-numeric. In such cases, Aggregation should be set to NONE) not specified as Row Breaks, so that column summaries can be generated based on aggregation.


isColumnBreak

public boolean isColumnBreak()
Returns whether column is used as column break


setColumnBreak

public void setColumnBreak(boolean breakOnThisColumn)
Sets the column as column break. This is for CrossTab reports only


isColumnBreakValue

public boolean isColumnBreakValue()
Returns whether column is used as column break value


setColumnBreakValue

public void setColumnBreakValue(boolean breakOnThisColumn)
Each distinct value in this specified column will be a report column in the table body. This is for CrossTab reports only.


setMaster

public void setMaster(boolean isMasterField)
Sets the column as the master field for a Masters and Detail Type Report. In contrary to the Primary Key column, more than column can be set as master. If a column is set as a master, then the column value will appear in the group header instead of the data section of the report. In addition, the Primary Key value must be unique for each grouping of the Master field columns.


isMaster

public boolean isMaster()
Returns whether column is used as master field


isTopN

public boolean isTopN()
Returns whether this column is used to order rows in a topN Report.


setTopN

public void setTopN(boolean isTopN)
Sets this column to be used to order rows in a topN Report.


getAggregation

public short getAggregation()
Returns the aggregation on the column. The different values for aggregation are available under quadbase.reportdesigner.util.IAggregateConstants


setAggregation

public void setAggregation(short agg)
Sets the aggregation method for the column. The different values for aggregation are available under quadbase.reportdesigner.util.IAggregateConstants. In particular, an aggregation of this column is generated whenever a summary of the column values is needed (for Summary Break Report, Crosstab Report, etc.).

For example, if a column with name "Order#" contains information about a customer's order and a column with name "Quantity" contains information about the customer order's quantity for each product (chair, table, etc.). Then setting the "Order#" column to be a row break and setting the "Quantity" column to be an aggregation by sum (ColInfo.SUM) would result in a table that groups the data by "Order#", and the TOTAL SUM quantity of products associated with that "Order#" will be shown at the row break.


setAggregation

public void setAggregation(boolean aggregateColumn,
                           short agg)
Similar to setAggregation(short agg), aggregateColumn sets whether to do column aggregation or not, if and only if agg != NONE.


isAggregatedColumn

public boolean isAggregatedColumn()
Returns whether this is an aggregated column.


isRepeatBreakField

public boolean isRepeatBreakField()
Returns whether this is a repeated break field.


setRepeatBreakField

public void setRepeatBreakField(boolean isRepeatBreakField)
sets this column to be a repeated break field.


isFitGroupOnPage

public boolean isFitGroupOnPage()
True iff groups are to be fitted on the same page. If the group splits a page, make the group appear on a new page.


setFitGroupOnPage

public void setFitGroupOnPage(boolean isFitGroupOnPage)
Set whether to fit groups on the same page. isFitGroupOnPage = true means if the group splits a page, make the group appear on a new page. False means never make a splitted group appear on a new page.


getName

public java.lang.String getName()
Returns the name of the column


setName

public void setName(java.lang.String colName)
Sets the name of the column


getDBTableName

public java.lang.String getDBTableName()
Gets the name of the Database table.


setDBTableName

public void setDBTableName(java.lang.String tableName)
Sets the name of the Database table.


getFormula

public java.lang.String getFormula()
Returns the formula of the column


setFormula

public void setFormula(java.lang.String txt,
                       int type)
Sets the formula of the column. The text of the formula and its SQL type is passed. The SQL type passed is from java.sql.Types


getFormulaObj

public Formula getFormulaObj()
Gets the Formula Object.


setFormulaObj

public void setFormulaObj(Formula formula)
Sets the Formula Object


getFormulaName

public java.lang.String getFormulaName()
Gets the Formula name.


setFormulaName

public void setFormulaName(java.lang.String name)
Sets the Formula name.


getDataType

public int getDataType()
Returns the SQL type of the column


isVisible

public boolean isVisible()
Returns whether column is visible


setVisible

public void setVisible(boolean b)
Sets the column invisible


clone

public java.lang.Object clone()
Returns a clone of this object.

Overrides:
clone in class java.lang.Object

equals

public boolean equals(ColInfo cInfo)
Returns true if and only if this ColInfo is identical to cInfo.


equals

public boolean equals(ColInfo cInfo,
                      boolean checkRepeatField)
Internal Use only


write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Internal Use only

Throws:
java.io.IOException

read

public static ColInfo read(java.io.DataInput in,
                           int version)
                    throws java.lang.Exception
Internal Use only

Throws:
java.lang.Exception

writeXML

public void writeXML(java.io.Writer out)
              throws java.io.IOException
Internal Use only

Throws:
java.io.IOException

readXML

public static ColInfo readXML(org.w3c.dom.Node dnode,
                              int version)
                       throws java.lang.Exception
Reads in a XML node with corresponding version and return data as a ColInfo.

Throws:
java.lang.Exception

skipFirstValueForFitGroup

public boolean skipFirstValueForFitGroup()
If this method returns true, then the first group is not tested if it will fit on the current page. If the first group is skipped, it will not trigger a page break even if it does not fit. The default value is true.


setSkipFirstValueForFitGroup

public void setSkipFirstValueForFitGroup(boolean s)
Specify if the first group should be tested rather it can fit on the current page. This value is only used for summary break and crosstab reports. The data is grouped on row breaks.


setOrderInfo

public void setOrderInfo(int i)
Sets crosstab ordering this allows user to sort the column break values in a crosstab report

Parameters:
int - i: NOT_SORTED, ASC, DESC.

getOrderInfo

public int getOrderInfo()
Gets what type of crosstab ordering is used: NOT_SORTED, ASC, DESC.


isSorted

public boolean isSorted()
Returns whether the ColInfo is sorted


isAsc

public boolean isAsc()
Returns whether the ColInfo is sorted in ascending order.


isDsc

public boolean isDsc()
Returns whether the ColInfo is sorted in descending order.


setDrillDownName

public void setDrillDownName(java.lang.String name)
Sets the drill down report name (if applicable) to this column

Parameters:
name -

getDrillDownName

public java.lang.String getDrillDownName()
Gets the drill down report name from this column

Returns:

EspressReport 6.6