jdbreport.design.model
Interface CellFunction

All Known Implementing Classes:
AbstractCellFunction

public interface CellFunction

Interface for function in Cell

Version:
2.0 28.05.2010
Author:
Andrey Kholmanskih

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 alias)
          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 run()
          Runs the current function
do not use this method directly
 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 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 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
 

Method Detail

run

void run()
         throws ReportException
Runs the current function
do not use this method directly

Throws:
ReportException

getText

String getText()
Returns value of the current cell. If cell's value is null, returns empty string

Returns:
value of the cell

getValue

Object getValue()
Returns value of the current cell

Returns:
value of the cell

setValue

void setValue(Object value)
Sets value to the current cell

Parameters:
value - new value

setImage

void setImage(Object value)
Sets value as Image to the current cell

Parameters:
value - Image, Icon, byte[], InputStream, File
Since:
2.0

setImage

void setImage(Object value,
              String format)
Sets value as Image to the current cell

Parameters:
value - Image, Icon, byte[], String, InputStream, File
format - image format
Since:
2.0

setFormula

void setFormula(Object value)
Sets value as MathML data to the current cell

Parameters:
value - String , File, Reader, InputStream
Since:
2.0

getCell

Cell getCell()
Returns the current cell

Returns:
the cell's object

getCell

Cell getCell(int row,
             int column)
Returns the Cell by row and column

Parameters:
row -
column -
Returns:
the cell's object

getRow

int getRow()
Returns a number of the current row

Returns:
a row's number

getColumn

int getColumn()
Returns a number of the current column

Returns:
a column's number

getDataSet

ReportDataSet getDataSet(Object alias)
Returns the ReportDataSet

Parameters:
alias - the ReportDataSet alias
Returns:
ReportDataSet
See Also:
ReportDataSet

setDataSet

void setDataSet(ReportDataSet ds)

setDataSet

void setDataSet(String alias,
                Iterable<?> ds)

setDataSet

void setDataSet(String alias,
                Iterator<?> ds)

setDataSet

void setDataSet(String alias,
                Object ds)

setDataSet

void setDataSet(String alias,
                Object[] ds)

getVarValue

Object getVarValue(Object name)
Returns a variable's value by name

Parameters:
name - the variable's name
Returns:
a variable's value

getVarValue

Integer getVarValue(Object name,
                    Integer def)
Returns the value of the variable as an Integer by name

Parameters:
name - the variable's name
def - default value
Returns:
the value of the variable

getVarValue

Double getVarValue(Object name,
                   Double def)
Returns the value of the variable as a Double by name

Parameters:
name - the variable's name
def - default value
Returns:
the value of the variable

getVarValue

Boolean getVarValue(Object name,
                    Boolean def)
Returns the value of the variable as a Boolean by name

Parameters:
name - the variable's name
def - default value
Returns:
the value of the variable

setVarValue

void setVarValue(Object name,
                 Object value)
Sets the variable's value

Parameters:
name - the variable's name
value - new variable's value

getFontName

String getFontName()
Returns the font's family name of the current cell.

Returns:
the font's family name of the current cell

getFontName

String getFontName(int row,
                   int column)
Returns the font's family name of the cell by row and column.

Parameters:
row - the cell's row
column - the cell's column
Returns:
the font's name

setFont

void setFont(String fontName,
             int style,
             int size)
Sets the font's name, style and size for the current cell.

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

setFont

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.

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

setBackground

void setBackground(Color color)
Sets background color for the current cell

Parameters:
color - the new background color for the current cell

setBackground

void setBackground(Color color,
                   int row,
                   int column)
Sets background color for the cell by row and column

Parameters:
color - the new background color for the cell
row - the cell's row
column - the cell's column

setForeground

void setForeground(Color color)
Sets foreground color for the current cell

Parameters:
color - the new foreground color for the current cell

setForeground

void setForeground(Color color,
                   int row,
                   int column)
Sets foreground color for the cell by row and column

Parameters:
color - the new foreground color for the cell
row - the cell's row
column - the cell's column

getRowHeight

int getRowHeight()
Returns the row's height for the current cell

Returns:
the row's height for the current cell

getRowHeight

int getRowHeight(int row)
Returns the row's height by the row's number

Parameters:
row - the row's number
Returns:
the row's height by the row's number

setRowHeight

void setRowHeight(int height)
Sets the row's height for the current cell

Parameters:
height - the new row's height

setRowHeight

void setRowHeight(int height,
                  int row)
Sets the row's height by the row

Parameters:
height - the new row's height
row - the row's number

getColumnWidth

int getColumnWidth()
Returns the column's width by the column's number

Returns:
the column's width by the column's number

getColumnWidth

int getColumnWidth(int column)
Returns the column's width by the column's number

Parameters:
column - the column's number
Returns:
the column's width by the column's number

setColumnWidth

void setColumnWidth(int width)
Sets the column's width for the current cell

Parameters:
width - the new column's width

setColumnWidth

void setColumnWidth(int width,
                    int column)
Sets the column's width by the column

Parameters:
width - the new column's width
column - the column's number

setVerticalAlignment

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

Parameters:
align - the new vertical alignment

setVerticalAlignment

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

Parameters:
align - the new vertical alignment
row - the cell's row
column - the cell's column

setHorizontalAlignment

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

Parameters:
align - the new horizontal alignment for the current cell

setHorizontalAlignment

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

Parameters:
align - the new horizontal alignment
row - the cell's row
column - the cell's column

addRows

void addRows(int count,
             int index)
Adds rows in the report

Parameters:
count - count rows
index - the specified position in this report

removeRows

void removeRows(int count,
                int index)
Removes rows from the report

Parameters:
count - count rows
index - the index of the first removing row

addColumns

void addColumns(int count,
                int index)
Adds columns in the report

Parameters:
count - count columns
index - the specified position in this report

removeColumns

void removeColumns(int count,
                   int index)
Removes columns from the report

Parameters:
count - count columns
index - the index of the first removing column

setDecimal

void setDecimal(int d)
Sets decimal position of the numeric value of the current cell.

Parameters:
d - the new decimal position of the numeric value.

setDecimal

void setDecimal(int d,
                int row,
                int column)
Sets decimal position of the numeric value of the cell's by row and column.

Parameters:
d - the new decimal position of the numeric value.
row - the cell's row
column - the cell's column

setRowBreak

void setRowBreak(int row,
                 boolean b)
Sets the horizontal break of the page after row

Parameters:
row - the row's number
b - a boolean value, where true sets the page break and false remove it

getReportTitle

String getReportTitle()
Returns the title of the sheet

Returns:
the title of the sheet

setReportTitle

void setReportTitle(String reportTitle)
Sets the sheet's title

Parameters:
reportTitle - new sheet's title

setBorder

void setBorder(Border line,
               boolean[] positions)
Sets the borders at specified positions for the current cell

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

setBorder

void setBorder(Border line,
               boolean[] positions,
               int row,
               int column)
Sets the borders at specified positions for the cell by row and column

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

deleteCell

void deleteCell(int row,
                int column)
Cleans the cell by row and column

Parameters:
row - the row's number
column - the column's number

getCellSize

Dimension getCellSize()
Returns the cell's sizes for the current cell, including spanned cells

Returns:
the cell's sizes

getCellSize

Dimension getCellSize(int row,
                      int column)
Returns the cell's sizes for the cell by row and column, including spanned cells

Parameters:
row - then row's number
column - the column's number
Returns:
the cell's sizes

getRowCount

int getRowCount()
Returns rows' count formed during the current time

Returns:
the rows count

getColumnCount

int getColumnCount()
Returns columns' count formed during the current time

Returns:
the columns count

unionCells

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

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

setStretchPage

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.

Parameters:
stretchPage - if true sets printing mode in FIT_WIDTH otherwise in NORMAL
See Also:
JTable.PrintMode

runFunction

void runFunction(String functionName)
                 throws ReportException
Runs function by functionName in current cell

Parameters:
functionName - function name
Throws:
ReportException

runFunction

void runFunction(String functionName,
                 int row,
                 int column)
                 throws ReportException
Runs function in cell by row and column by functionName
row and column must be less or equal current row and column

Parameters:
functionName - the function's name
row - the row's number
column - the column's number
Throws:
ReportException

getReportPage

ReportPage getReportPage()
Returns ReportPage

Returns:
ReportPage
Since:
2.0