jdbreport.design.model
Class AbstractCellFunction

java.lang.Object
  extended by jdbreport.design.model.AbstractCellFunction
All Implemented Interfaces:
CellFunction

public abstract class AbstractCellFunction
extends Object
implements CellFunction

Version:
2.0 28.05.2010
Author:
Andrey Kholmanskih

Constructor Summary
AbstractCellFunction()
           
 
Method Summary
 void addColumns(int count, int index)
          Adds columns in the report
 void addRows(int count, int index)
          Adds rows in the report
 void deleteCell(int row, int column)
          Cleans the cell by row and column
 Cell getCell()
          Returns the current cell
 Cell getCell(int row, int column)
          Returns the Cell by row and column
 Dimension getCellSize()
          Returns the cell's sizes for the current cell, including spanned cells
 Dimension getCellSize(int row, int column)
          Returns the cell's sizes for the cell by row and column, including spanned cells
 int getColumn()
          Returns a number of the current column
 int getColumnCount()
          Returns columns' count formed during the current time
 int getColumnWidth()
          Returns the column's width by the column's number
 int getColumnWidth(int column)
          Returns the column's width by the column's number
 ReportDataSet getDataSet(Object key)
          Returns the ReportDataSet
 String getFontName()
          Returns the font's family name of the current cell.
 String getFontName(int row, int column)
          Returns the font's family name of the cell by row and column.
 ReportPage getReportPage()
          Returns ReportPage
 String getReportTitle()
          Returns the title of the sheet
 int getRow()
          Returns a number of the current row
 int getRowCount()
          Returns rows' count formed during the current time
 int getRowHeight()
          Returns the row's height for the current cell
 int getRowHeight(int row)
          Returns the row's height by the row's number
 String getText()
          Returns value of the current cell.
 Object getValue()
          Returns value of the current cell
 Object getVarValue(Object name)
          Returns a variable's value by name
 Boolean getVarValue(Object name, Boolean def)
          Returns the value of the variable as a Boolean by name
 Double getVarValue(Object name, Double def)
          Returns the value of the variable as a Double by name
 Integer getVarValue(Object name, Integer def)
          Returns the value of the variable as an Integer by name
 void removeColumns(int count, int index)
          Removes columns from the report
 void removeRows(int count, int index)
          Removes rows from the report
 void runFunction(String functionName)
          Runs function by functionName in current cell
 void runFunction(String functionName, int row, int column)
          Runs function in cell by row and column by functionName
row and column must be less or equal current row and column
 void setBackground(Color color)
          Sets background color for the current cell
 void setBackground(Color color, int row, int column)
          Sets background color for the cell by row and column
 void setBorder(Border line, boolean[] positions)
          Sets the borders at specified positions for the current cell
 void setBorder(Border line, boolean[] positions, int row, int column)
          Sets the borders at specified positions for the cell by row and column
 void setColumnWidth(int width)
          Sets the column's width for the current cell
 void setColumnWidth(int width, int column)
          Sets the column's width by the column
 void setDataSet(ReportDataSet ds)
           
 void setDataSet(String alias, Iterable<?> ds)
           
 void setDataSet(String alias, Iterator<?> ds)
           
 void setDataSet(String alias, Object ds)
           
 void setDataSet(String alias, Object[] ds)
           
 void setDecimal(int d)
          Sets decimal position of the numeric value of the current cell.
 void setDecimal(int d, int row, int column)
          Sets decimal position of the numeric value of the cell's by row and column.
 void setFont(String fontName, int style, int size)
          Sets the font's name, style and size for the current cell.
 void setFont(String fontName, int style, int size, int row, int column)
          Sets the font's name, style and size for the cell by row and column.
 void setForeground(Color color)
          Sets foreground color for the current cell
 void setForeground(Color color, int row, int column)
          Sets foreground color for the cell by row and column
 void setFormula(Object value)
          Sets value as MathML data to the current cell
 void setHorizontalAlignment(int align)
          Sets the horizontal alignment for the current cell The horizontal alignment is a constant that may be CellStyle.LEFT, CellStyle.RIGHT, CellStyle.CENTER or CellStyle.JUSTIFY
 void setHorizontalAlignment(int align, int row, int column)
          Sets the horizontal alignment for the cell by row and column The horizontal alignment is a constant that may be CellStyle.LEFT, CellStyle.RIGHT, CellStyle.CENTER or CellStyle.JUSTIFY
 void setImage(Object value)
          Sets value as Image to the current cell
 void setImage(Object value, String format)
          Sets value as Image to the current cell
 void setProvider(TemplateBook provider)
           
 void setProvider(TemplateBook provider, int row, int column)
           
 void setReportTitle(String reportTitle)
          Sets the sheet's title
 void setRowBreak(int row, boolean b)
          Sets the horizontal break of the page after row
 void setRowHeight(int height)
          Sets the row's height for the current cell
 void setRowHeight(int height, int row)
          Sets the row's height by the row
 void setSheetVisible(boolean visible)
           
 void setStretchPage(boolean stretchPage)
          Printing mode that scales the output smaller, if necessary, to fit the report's entire width (and thereby all columns) on each page; Rows are spread across multiple pages as necessary.
 void setValue(Object value)
          Sets value to the current cell
 void setVarValue(Object name, Object value)
          Sets the variable's value
 void setVerticalAlignment(int align)
          Sets the vertical alignment for the current cell The vertical alignment is a constant that may be CellStyle.TOP, CellStyle.BOTTOM or CellStyle.CENTER
 void setVerticalAlignment(int align, int row, int column)
          Sets the vertical alignment for the cell by row and column The vertical alignment is a constant that may be CellStyle.TOP, CellStyle.BOTTOM or CellStyle.CENTER
 void unionCells(int topRow, int leftColumn, int bottomRow, int rightColumn)
          Unions cells The first cell of the top-left corner is specified by topRow and leftColumn, the last cell of the bottom-right corner is specified by bottomRow and rightColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jdbreport.design.model.CellFunction
run
 

Constructor Detail

AbstractCellFunction

public AbstractCellFunction()
Method Detail

setProvider

public void setProvider(TemplateBook provider,
                        int row,
                        int column)

addColumns

public void addColumns(int count,
                       int index)
Description copied from interface: CellFunction
Adds columns in the report

Specified by:
addColumns in interface CellFunction
Parameters:
count - count columns
index - the specified position in this report

addRows

public void addRows(int count,
                    int index)
Description copied from interface: CellFunction
Adds rows in the report

Specified by:
addRows in interface CellFunction
Parameters:
count - count rows
index - the specified position in this report

deleteCell

public void deleteCell(int row,
                       int column)
Description copied from interface: CellFunction
Cleans the cell by row and column

Specified by:
deleteCell in interface CellFunction
Parameters:
row - the row's number
column - the column's number

getCellSize

public Dimension getCellSize()
Description copied from interface: CellFunction
Returns the cell's sizes for the current cell, including spanned cells

Specified by:
getCellSize in interface CellFunction
Returns:
the cell's sizes

getCellSize

public Dimension getCellSize(int row,
                             int column)
Description copied from interface: CellFunction
Returns the cell's sizes for the cell by row and column, including spanned cells

Specified by:
getCellSize in interface CellFunction
Parameters:
row - then row's number
column - the column's number
Returns:
the cell's sizes

getColumnCount

public int getColumnCount()
Description copied from interface: CellFunction
Returns columns' count formed during the current time

Specified by:
getColumnCount in interface CellFunction
Returns:
the columns count

getColumnWidth

public int getColumnWidth()
Description copied from interface: CellFunction
Returns the column's width by the column's number

Specified by:
getColumnWidth in interface CellFunction
Returns:
the column's width by the column's number

getColumnWidth

public int getColumnWidth(int column)
Description copied from interface: CellFunction
Returns the column's width by the column's number

Specified by:
getColumnWidth in interface CellFunction
Parameters:
column - the column's number
Returns:
the column's width by the column's number

getFontName

public String getFontName()
Description copied from interface: CellFunction
Returns the font's family name of the current cell.

Specified by:
getFontName in interface CellFunction
Returns:
the font's family name of the current cell

getFontName

public String getFontName(int row,
                          int column)
Description copied from interface: CellFunction
Returns the font's family name of the cell by row and column.

Specified by:
getFontName in interface CellFunction
Parameters:
row - the cell's row
column - the cell's column
Returns:
the font's name

getReportTitle

public String getReportTitle()
Description copied from interface: CellFunction
Returns the title of the sheet

Specified by:
getReportTitle in interface CellFunction
Returns:
the title of the sheet

getRowCount

public int getRowCount()
Description copied from interface: CellFunction
Returns rows' count formed during the current time

Specified by:
getRowCount in interface CellFunction
Returns:
the rows count

getRowHeight

public int getRowHeight()
Description copied from interface: CellFunction
Returns the row's height for the current cell

Specified by:
getRowHeight in interface CellFunction
Returns:
the row's height for the current cell

getRowHeight

public int getRowHeight(int row)
Description copied from interface: CellFunction
Returns the row's height by the row's number

Specified by:
getRowHeight in interface CellFunction
Parameters:
row - the row's number
Returns:
the row's height by the row's number

removeColumns

public void removeColumns(int count,
                          int index)
Description copied from interface: CellFunction
Removes columns from the report

Specified by:
removeColumns in interface CellFunction
Parameters:
count - count columns
index - the index of the first removing column

removeRows

public void removeRows(int count,
                       int index)
Description copied from interface: CellFunction
Removes rows from the report

Specified by:
removeRows in interface CellFunction
Parameters:
count - count rows
index - the index of the first removing row

setBackground

public void setBackground(Color color,
                          int row,
                          int column)
Description copied from interface: CellFunction
Sets background color for the cell by row and column

Specified by:
setBackground in interface CellFunction
Parameters:
color - the new background color for the cell
row - the cell's row
column - the cell's column

setBackground

public void setBackground(Color color)
Description copied from interface: CellFunction
Sets background color for the current cell

Specified by:
setBackground in interface CellFunction
Parameters:
color - the new background color for the current cell

setBorder

public void setBorder(Border line,
                      boolean[] positions,
                      int row,
                      int column)
Description copied from interface: CellFunction
Sets the borders at specified positions for the cell by row and column

Specified by:
setBorder in interface CellFunction
Parameters:
line - the border
positions - positions - boolean values, where true sets border, otherwise does nothing. Position's index can be from Border.LINE_LEFT to Border.LINE_HMIDDLE
row - the row's number
column - the column's number

setBorder

public void setBorder(Border line,
                      boolean[] positions)
Description copied from interface: CellFunction
Sets the borders at specified positions for the current cell

Specified by:
setBorder in interface CellFunction
Parameters:
line - the border
positions - boolean values, where true sets border, otherwise does nothing. Position's index can be from Border.LINE_LEFT to Border.LINE_HMIDDLE

setColumnWidth

public void setColumnWidth(int width,
                           int column)
Description copied from interface: CellFunction
Sets the column's width by the column

Specified by:
setColumnWidth in interface CellFunction
Parameters:
width - the new column's width
column - the column's number

setColumnWidth

public void setColumnWidth(int width)
Description copied from interface: CellFunction
Sets the column's width for the current cell

Specified by:
setColumnWidth in interface CellFunction
Parameters:
width - the new column's width

setDecimal

public void setDecimal(int d,
                       int row,
                       int column)
Description copied from interface: CellFunction
Sets decimal position of the numeric value of the cell's by row and column.

Specified by:
setDecimal in interface CellFunction
Parameters:
d - the new decimal position of the numeric value.
row - the cell's row
column - the cell's column

setDecimal

public void setDecimal(int d)
Description copied from interface: CellFunction
Sets decimal position of the numeric value of the current cell.

Specified by:
setDecimal in interface CellFunction
Parameters:
d - the new decimal position of the numeric value.

setFont

public void setFont(String fontName,
                    int style,
                    int size,
                    int row,
                    int column)
Description copied from interface: CellFunction
Sets the font's name, style and size for the cell by row and column.

Specified by:
setFont in interface CellFunction
Parameters:
fontName - the font's name
style - the font's style The style argument is an integer bitmask that may be CellStyle.PLAIN, or a bitwise union of CellStyle.BOLD, CellStyle.ITALIC, CellStyle.UNDERLINE, CellStyle.STRIKETHROUGH
size - the font's size
row - the cell's row
column - the cell's column

setFont

public void setFont(String fontName,
                    int style,
                    int size)
Description copied from interface: CellFunction
Sets the font's name, style and size for the current cell.

Specified by:
setFont in interface CellFunction
Parameters:
fontName - the font's name
style - the font's style The style argument is an integer bitmask that may be CellStyle.PLAIN, or a bitwise union of CellStyle.BOLD, CellStyle.ITALIC, CellStyle.UNDERLINE, CellStyle.STRIKETHROUGH
size - the font's size

setForeground

public void setForeground(Color color,
                          int row,
                          int column)
Description copied from interface: CellFunction
Sets foreground color for the cell by row and column

Specified by:
setForeground in interface CellFunction
Parameters:
color - the new foreground color for the cell
row - the cell's row
column - the cell's column

setForeground

public void setForeground(Color color)
Description copied from interface: CellFunction
Sets foreground color for the current cell

Specified by:
setForeground in interface CellFunction
Parameters:
color - the new foreground color for the current cell

setHorizontalAlignment

public void setHorizontalAlignment(int align,
                                   int row,
                                   int column)
Description copied from interface: CellFunction
Sets the horizontal alignment for the cell by row and column The horizontal alignment is a constant that may be CellStyle.LEFT, CellStyle.RIGHT, CellStyle.CENTER or CellStyle.JUSTIFY

Specified by:
setHorizontalAlignment in interface CellFunction
Parameters:
align - the new horizontal alignment
row - the cell's row
column - the cell's column

setHorizontalAlignment

public void setHorizontalAlignment(int align)
Description copied from interface: CellFunction
Sets the horizontal alignment for the current cell The horizontal alignment is a constant that may be CellStyle.LEFT, CellStyle.RIGHT, CellStyle.CENTER or CellStyle.JUSTIFY

Specified by:
setHorizontalAlignment in interface CellFunction
Parameters:
align - the new horizontal alignment for the current cell

setRowBreak

public void setRowBreak(int row,
                        boolean b)
Description copied from interface: CellFunction
Sets the horizontal break of the page after row

Specified by:
setRowBreak in interface CellFunction
Parameters:
row - the row's number
b - a boolean value, where true sets the page break and false remove it

setReportTitle

public void setReportTitle(String reportTitle)
Description copied from interface: CellFunction
Sets the sheet's title

Specified by:
setReportTitle in interface CellFunction
Parameters:
reportTitle - new sheet's title

setRowHeight

public void setRowHeight(int height,
                         int row)
Description copied from interface: CellFunction
Sets the row's height by the row

Specified by:
setRowHeight in interface CellFunction
Parameters:
height - the new row's height
row - the row's number

setRowHeight

public void setRowHeight(int height)
Description copied from interface: CellFunction
Sets the row's height for the current cell

Specified by:
setRowHeight in interface CellFunction
Parameters:
height - the new row's height

setSheetVisible

public void setSheetVisible(boolean visible)

setStretchPage

public void setStretchPage(boolean stretchPage)
Description copied from interface: CellFunction
Printing mode that scales the output smaller, if necessary, to fit the report's entire width (and thereby all columns) on each page; Rows are spread across multiple pages as necessary.

Specified by:
setStretchPage in interface CellFunction
Parameters:
stretchPage - if true sets printing mode in FIT_WIDTH otherwise in NORMAL
See Also:
JTable.PrintMode

setVerticalAlignment

public void setVerticalAlignment(int align,
                                 int row,
                                 int column)
Description copied from interface: CellFunction
Sets the vertical alignment for the cell by row and column The vertical alignment is a constant that may be CellStyle.TOP, CellStyle.BOTTOM or CellStyle.CENTER

Specified by:
setVerticalAlignment in interface CellFunction
Parameters:
align - the new vertical alignment
row - the cell's row
column - the cell's column

setVerticalAlignment

public void setVerticalAlignment(int align)
Description copied from interface: CellFunction
Sets the vertical alignment for the current cell The vertical alignment is a constant that may be CellStyle.TOP, CellStyle.BOTTOM or CellStyle.CENTER

Specified by:
setVerticalAlignment in interface CellFunction
Parameters:
align - the new vertical alignment

unionCells

public void unionCells(int topRow,
                       int leftColumn,
                       int bottomRow,
                       int rightColumn)
Description copied from interface: CellFunction
Unions cells The first cell of the top-left corner is specified by topRow and leftColumn, the last cell of the bottom-right corner is specified by bottomRow and rightColumn

Specified by:
unionCells in interface CellFunction
Parameters:
topRow - the top row of the union
leftColumn - the left column of the union
bottomRow - the bottom row of the union
rightColumn - the right column of the union

setProvider

public void setProvider(TemplateBook provider)

getCell

public Cell getCell()
Description copied from interface: CellFunction
Returns the current cell

Specified by:
getCell in interface CellFunction
Returns:
the cell's object

getCell

public Cell getCell(int row,
                    int column)
Description copied from interface: CellFunction
Returns the Cell by row and column

Specified by:
getCell in interface CellFunction
Returns:
the cell's object

getColumn

public int getColumn()
Description copied from interface: CellFunction
Returns a number of the current column

Specified by:
getColumn in interface CellFunction
Returns:
a column's number

getDataSet

public ReportDataSet getDataSet(Object key)
Description copied from interface: CellFunction
Returns the ReportDataSet

Specified by:
getDataSet in interface CellFunction
Parameters:
key - the ReportDataSet alias
Returns:
ReportDataSet
See Also:
ReportDataSet

setDataSet

public void setDataSet(ReportDataSet ds)
Specified by:
setDataSet in interface CellFunction

setDataSet

public void setDataSet(String alias,
                       Iterable<?> ds)
Specified by:
setDataSet in interface CellFunction

setDataSet

public void setDataSet(String alias,
                       Iterator<?> ds)
Specified by:
setDataSet in interface CellFunction

setDataSet

public void setDataSet(String alias,
                       Object ds)
Specified by:
setDataSet in interface CellFunction

setDataSet

public void setDataSet(String alias,
                       Object[] ds)
Specified by:
setDataSet in interface CellFunction

getRow

public int getRow()
Description copied from interface: CellFunction
Returns a number of the current row

Specified by:
getRow in interface CellFunction
Returns:
a row's number

getVarValue

public Object getVarValue(Object name)
Description copied from interface: CellFunction
Returns a variable's value by name

Specified by:
getVarValue in interface CellFunction
Parameters:
name - the variable's name
Returns:
a variable's value

getVarValue

public Integer getVarValue(Object name,
                           Integer def)
Description copied from interface: CellFunction
Returns the value of the variable as an Integer by name

Specified by:
getVarValue in interface CellFunction
Parameters:
name - the variable's name
def - default value
Returns:
the value of the variable

getVarValue

public Double getVarValue(Object name,
                          Double def)
Description copied from interface: CellFunction
Returns the value of the variable as a Double by name

Specified by:
getVarValue in interface CellFunction
Parameters:
name - the variable's name
def - default value
Returns:
the value of the variable

getVarValue

public Boolean getVarValue(Object name,
                           Boolean def)
Description copied from interface: CellFunction
Returns the value of the variable as a Boolean by name

Specified by:
getVarValue in interface CellFunction
Parameters:
name - the variable's name
def - default value
Returns:
the value of the variable

runFunction

public void runFunction(String functionName)
                 throws ReportException
Description copied from interface: CellFunction
Runs function by functionName in current cell

Specified by:
runFunction in interface CellFunction
Parameters:
functionName - function name
Throws:
ReportException

runFunction

public void runFunction(String functionName,
                        int row,
                        int column)
                 throws ReportException
Description copied from interface: CellFunction
Runs function in cell by row and column by functionName
row and column must be less or equal current row and column

Specified by:
runFunction in interface CellFunction
Parameters:
functionName - the function's name
row - the row's number
column - the column's number
Throws:
ReportException

setVarValue

public void setVarValue(Object name,
                        Object value)
Description copied from interface: CellFunction
Sets the variable's value

Specified by:
setVarValue in interface CellFunction
Parameters:
name - the variable's name
value - new variable's value

getText

public String getText()
Description copied from interface: CellFunction
Returns value of the current cell. If cell's value is null, returns empty string

Specified by:
getText in interface CellFunction
Returns:
value of the cell

getValue

public Object getValue()
Description copied from interface: CellFunction
Returns value of the current cell

Specified by:
getValue in interface CellFunction
Returns:
value of the cell

setValue

public void setValue(Object value)
Description copied from interface: CellFunction
Sets value to the current cell

Specified by:
setValue in interface CellFunction
Parameters:
value - new value

setImage

public void setImage(Object value)
Description copied from interface: CellFunction
Sets value as Image to the current cell

Specified by:
setImage in interface CellFunction
Parameters:
value - Image, Icon, byte[], InputStream, File

setImage

public void setImage(Object value,
                     String format)
Description copied from interface: CellFunction
Sets value as Image to the current cell

Specified by:
setImage in interface CellFunction
Parameters:
value - Image, Icon, byte[], String, InputStream, File
format - image format

getReportPage

public ReportPage getReportPage()
Description copied from interface: CellFunction
Returns ReportPage

Specified by:
getReportPage in interface CellFunction
Returns:
ReportPage

setFormula

public void setFormula(Object value)
Description copied from interface: CellFunction
Sets value as MathML data to the current cell

Specified by:
setFormula in interface CellFunction
Parameters:
value - String , File, Reader, InputStream