jdbreport.model
Interface ReportModel

All Superinterfaces:
TableModel
All Known Implementing Classes:
JReportModel, TemplateModel

public interface ReportModel
extends TableModel

The ReportModel interface specifies the methods of the report will use to interrogate a grid data model.

Version:
2.0 15.11.2010
Author:
Andrey Kholmanskih

Method Summary
 void addBorder(int topRow, int leftColumn, int bottomRow, int rightColumn, boolean[] positions, Border line)
          Sets the borders at the specified positions for the cells by coordinates
 int addColumns(int count)
          Adds columns' count to the model
 int addColumns(int count, int index)
          Adds columns' count to the index of the model.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 int addRows(int count, int index)
          Adds rows' count to the index of the model.
 Object addStyle(CellStyle style)
          Looks for style in the list of styles if doesn't find, adds it to the list otherwise returns the id of the founded style If style's id is null, a new id is appropriated to the style
 void clearUnion(int row, int column)
          Clears the unions of the cell by row and column
 Cell createReportCell(int row, int column)
          Creates the Cell by row and column
 void delete(GridRect selectionRect)
          Removes the selected cells
 void endUpdate()
          Allows notification of listeners
 int findRightColumn(int leftCol)
          Searches for the right extreme column of page
 CellCoord getCellPosition(Cell cell)
           
 Rectangle getCellRect(int row, int column, boolean includeSpacing, boolean isLeftToRight)
          Returns a rectangle for the cell that lies at the intersection of row and column.
 Dimension getCellSize(Cell cell, int row, int column, boolean includeSpacing)
          Returns a size for the cell that lies at the intersection of row and column.
 String getCellText(Cell cell)
           
 CellWrap getCellWrap(int row, int column)
          Returns the CellWrap object for the cell by row and column
 TableColumnModel getColumnModel()
           
 int getColumnWidth(int column)
          Returns the width of the column
 int getDefaultColumnWidth()
           
 int getOwnerColumn(Cell cell, int row, int column)
          Returns the column's number of the cell's owner If there is no owner, the column's number of the cell is returned.
 Cell getOwnerReportCell(int row, int column)
          Returns the Cell's owner by row and column If there is no owner, the Cell returns by itself.
 int getOwnerRow(Cell cell, int row, int column)
          Returns the row's number of the cell's owner If there is no owner, the row's number of the cell is returned.
 Cell getReportCell(int row, int column)
          Returns the Cell by row and column
 ReportPage getReportPage()
           
 String getReportTitle()
           
 int getRowHeight(int row)
          Returns the height of the row
 TableRowModel getRowModel()
           
 Iterator<Cell> getSelectedCells(GridRect rect)
          Returns cells that do not have owner
 CellStyle getStyles(Object index)
          Returns the CellStyle by the index
 String getToolTipText(int row, int column)
          Returns the string to be used as the tooltip for the cell by row and column.
 boolean isCanUpdatePages()
          Determines whether page's bounders will be calculated automatically
 boolean isColMoving()
          Returns true if the user is allowed to rearrange columns by dragging their headers, false otherwise.
 boolean isColSizing()
          Returns true if the user is allowed to resize columns by dragging between their headers,false otherwise.
 boolean isColumnBreak(int column)
          Returns true if the sets vertical page break after column
 boolean isEditable()
          Returns the boolean indicating whether this ReportModel is editable or not.
 boolean isFontStyle(int row, int column, int style)
          Determines whether font's style is in the cell
 boolean isLastRowInPage(int row)
          Returns true if the row is last on page
 boolean isPrintLeftToRight()
          Direction of an output of pages on the printer.
 boolean isRowBreak(int row)
          Returns the flag of the page's break by the row's number
 boolean isRowMoving()
          Returns true if the user is allowed to rearrange rows by dragging their headers, false otherwise.
 boolean isRowSizing()
          Returns true if the user is allowed to resize rows by dragging between their headers,false otherwise.
 boolean isShowHeader()
           
 boolean isShowRowHeader()
           
 boolean isStretchPage()
          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.
 boolean isUpdate()
           
 boolean isVisible()
          Determines whether report should be visible
 void removeColumns(int count, int index)
          Removes columns' count begining with the index from the model.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removeRows()
          Removes all rows from the model.
 void removeRows(int count, int index)
          Removes rows' count begining with the index from the model.
 void setBackground(GridRect selectionRect, Color color)
          Sets background color for the selected cells
 void setCanUpdatePages(boolean b)
          Sets the property that determines whether page's bounders will be calculated automatically
 void setColMoving(boolean b)
          Sets whether the user can drag column headers to reorder columns.
 void setColSizing(boolean b)
          Sets whether the user can resize columns by dragging between headers.
 void setColumnBreak(int column, boolean b)
          Sets the vertical page break after column
 void setColumnCount(int count)
          Sets the columns' count in the model If the columns' count is bigger than parameter, the columns are removed from the model If the columns' count is smaller than parameter, the columns are added to the model
 void setColumnWidths(int[] widths)
           
 void setDecimals(GridRect selectionRect, int d)
          Sets new decimal position of the numeric value for selected cells.
 void setDefaultColumnWidth(int defaultColumnWidth)
          Sets a default column's width
 void setEditable(boolean b)
          Sets the specified boolean to indicate whether or not this ReportModel should be editable.
 void setFontName(GridRect selRect, String fontName)
          Sets the font's name for the cells by the selRect.
 void setFontSize(GridRect selRect, int fontSize)
          Sets the font's size for the cells by the selRect
 void setFontStyle(GridRect selRect, int fontStyle, boolean enable)
          Sets the font's style for the cells by coordinates selRect
 void setForeground(GridRect selectionRect, Color color)
          Sets foreground color for the selected cells
 void setHorizontalAlignment(GridRect selectionRect, int align)
          Sets the horizontal alignment for the selected cells The horizontal alignment is a constant that may be LEFT, RIGHT, CENTER or JUSTIFY
 void setPrintLeftToRight(boolean value)
          Direction of an output of pages on the printer.
 void setReportTitle(String reportTitle)
           
 void setRowBreak(int row, boolean b)
          Sets the horizontal page break after row
 void setRowHeight(int row, int rowHeight)
          Sets the row's height by row
 void setRowMoving(boolean b)
          Sets whether the user can drag row headers to reorder rows.
 void setRowSizing(boolean b)
          Sets whether the user can resize rows by dragging between headers.
 void setShowHeader(boolean b)
           
 void setShowRowHeader(boolean b)
           
 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 setStyleList(Map<Object,CellStyle> map)
           
 void setVerticalAlignment(GridRect selectionRect, int align)
          Sets the vertical alignment for the selected cells The vertical alignment is a constant that may be TOP, BOTTOM or CENTER
 void setVisible(boolean visible)
          Shows or hides report depending on the value of parameter visible.
 void startUpdate()
          Bans notification of listeners
 void unionCells(int topRow, int leftColumn, int bottomRow, int rightColumn)
          Unions the cells by coordinates
 void updatePages(int startRow)
          Calculates pages' size
 void updateRowAndPageHeight(HeighCalculator hCalc)
           
 void updateRowHeight(HeighCalculator hCalc, int row, int column)
          Sets row's height by the content of the cell
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Method Detail

addRows

int addRows(int count,
            int index)
Adds rows' count to the index of the model. The new rows will contain null values. Notification of the row being added will be generated.

Parameters:
count - rows' count
index - the row index of the rows to be inserted
Returns:
rows' count in the model

removeRows

void removeRows(int count,
                int index)
Removes rows' count begining with the index from the model.

Parameters:
count - rows' count
index - index of the first removed row

removeRows

void removeRows()
Removes all rows from the model.


addColumns

int addColumns(int count)
Adds columns' count to the model

Parameters:
count - columns' count
Returns:
the columns' count in the model

addColumns

int addColumns(int count,
               int index)
Adds columns' count to the index of the model. The new columns will contain null values. Notification of the column being added will be generated.

Parameters:
count - columns' count
index - the column index of the columns to be inserted
Returns:
columns' count in the model

removeColumns

void removeColumns(int count,
                   int index)
Removes columns' count begining with the index from the model.

Parameters:
count - columns' count
index - index of the first removed column

setColumnCount

void setColumnCount(int count)
Sets the columns' count in the model If the columns' count is bigger than parameter, the columns are removed from the model If the columns' count is smaller than parameter, the columns are added to the model

Parameters:
count - new columns' count

getReportCell

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

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

getOwnerReportCell

Cell getOwnerReportCell(int row,
                        int column)
Returns the Cell's owner by row and column If there is no owner, the Cell returns by itself.

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

createReportCell

Cell createReportCell(int row,
                      int column)
Creates the Cell by row and column

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

getOwnerRow

int getOwnerRow(Cell cell,
                int row,
                int column)
Returns the row's number of the cell's owner If there is no owner, the row's number of the cell is returned.

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

getOwnerColumn

int getOwnerColumn(Cell cell,
                   int row,
                   int column)
Returns the column's number of the cell's owner If there is no owner, the column's number of the cell is returned.

Parameters:
cell - the cell
row - the row's number
column - the column's number
Returns:
the owner column's number

getColumnWidth

int getColumnWidth(int column)
Returns the width of the column

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

getRowHeight

int getRowHeight(int row)
Returns the height of the row

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

setRowHeight

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

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

unionCells

void unionCells(int topRow,
                int leftColumn,
                int bottomRow,
                int rightColumn)
Unions the cells by coordinates

Parameters:
topRow - the number of the top row
leftColumn - the number of the left column
bottomRow - the number of the bottom row
rightColumn - the number of the right column

clearUnion

void clearUnion(int row,
                int column)
Clears the unions of the cell by row and column

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

addBorder

void addBorder(int topRow,
               int leftColumn,
               int bottomRow,
               int rightColumn,
               boolean[] positions,
               Border line)
Sets the borders at the specified positions for the cells by coordinates

Parameters:
topRow - the number of the top row
leftColumn - the number of the left column
bottomRow - the number of the bottom row
rightColumn - the number of the right column
positions - positions - boolean values, where true sets border, otherwise does nothing. Position's index can be from Border.LINE_LEFT to Border.LINE_HMIDDLE
line - the border

getReportTitle

String getReportTitle()
Returns:
the report's title.

setReportTitle

void setReportTitle(String reportTitle)
Parameters:
reportTitle - a new report's title.

getDefaultColumnWidth

int getDefaultColumnWidth()
Returns:
the default column's width

setDefaultColumnWidth

void setDefaultColumnWidth(int defaultColumnWidth)
Sets a default column's width

Parameters:
defaultColumnWidth - a new default column's width

getReportPage

ReportPage getReportPage()
Returns:
the reportPage.

isRowSizing

boolean isRowSizing()
Returns true if the user is allowed to resize rows by dragging between their headers,false otherwise. The default is true. You can resize rows programmatically regardless of this setting.

Returns:
true if rows can resizing

setRowSizing

void setRowSizing(boolean b)
Sets whether the user can resize rows by dragging between headers.

Parameters:
b - true if report view should allow resizing

isColSizing

boolean isColSizing()
Returns true if the user is allowed to resize columns by dragging between their headers,false otherwise. The default is true. You can resize columns programmatically regardless of this setting.

Returns:
true if columns can resizing

setColSizing

void setColSizing(boolean b)
Sets whether the user can resize columns by dragging between headers.

Parameters:
b - true if report view should allow resizing

isRowMoving

boolean isRowMoving()
Returns true if the user is allowed to rearrange rows by dragging their headers, false otherwise. The default is true. You can rearrange rows programmatically regardless of this setting.

Returns:
the rowMoving property

setRowMoving

void setRowMoving(boolean b)
Sets whether the user can drag row headers to reorder rows.

Parameters:
b - true if the report view should allow reordering; otherwise false

isColMoving

boolean isColMoving()
Returns true if the user is allowed to rearrange columns by dragging their headers, false otherwise. The default is true. You can rearrange columns programmatically regardless of this setting.

Returns:
the colMoving property

setColMoving

void setColMoving(boolean b)
Sets whether the user can drag column headers to reorder columns.

Parameters:
b - true if the report view should allow reordering; otherwise false

isEditable

boolean isEditable()
Returns the boolean indicating whether this ReportModel is editable or not.

Returns:
the boolean value

setEditable

void setEditable(boolean b)
Sets the specified boolean to indicate whether or not this ReportModel should be editable.

Parameters:
b - the boolean to be set

isStretchPage

boolean isStretchPage()
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.

Returns:
if true sets printing mode in FIT_WIDTH otherwise in NORMAL.

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

isRowBreak

boolean isRowBreak(int row)
Returns the flag of the page's break by the row's number

Parameters:
row - the row's number
Returns:
the flag of the page's end

isLastRowInPage

boolean isLastRowInPage(int row)
Returns true if the row is last on page

Parameters:
row - the row's number
Returns:
true if the row is last on page
Since:
1.3

setRowBreak

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

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

isColumnBreak

boolean isColumnBreak(int column)
Returns true if the sets vertical page break after column

Parameters:
column - the column's number
Returns:
columnBreak property

setColumnBreak

void setColumnBreak(int column,
                    boolean b)
Sets the vertical page break after column

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

getRowModel

TableRowModel getRowModel()
Returns:
TableRowModel

getColumnModel

TableColumnModel getColumnModel()
Returns:
TableColumnModel

getSelectedCells

Iterator<Cell> getSelectedCells(GridRect rect)
Returns cells that do not have owner

Parameters:
rect - the region where the cells are selected
Returns:
iterator

getStyles

CellStyle getStyles(Object index)
Returns the CellStyle by the index

Parameters:
index - the id of the CellStyle
Returns:
the CellStyle

addStyle

Object addStyle(CellStyle style)
Looks for style in the list of styles if doesn't find, adds it to the list otherwise returns the id of the founded style If style's id is null, a new id is appropriated to the style

Parameters:
style - adding style
Returns:
the style's id

getCellRect

Rectangle getCellRect(int row,
                      int column,
                      boolean includeSpacing,
                      boolean isLeftToRight)
Returns a rectangle for the cell that lies at the intersection of row and column. If the cell's are spaned, rectangle is returned for all the spaned cells

Parameters:
row - the row's number
column - the column's number
includeSpacing - if false, return the true cell bounds - computed by subtracting the intercell spacing from the height and widths of the column and row models
isLeftToRight -
Returns:
the rectangle containing the cell at location row,column

getCellSize

Dimension getCellSize(Cell cell,
                      int row,
                      int column,
                      boolean includeSpacing)
Returns a size for the cell that lies at the intersection of row and column. If the cell's are spaned, size is returned for all the spaned cells

Parameters:
cell - the Cell for which size is returns
row - the row's number
column - the column's number
includeSpacing -
Returns:
the cell's size

updateRowHeight

void updateRowHeight(HeighCalculator hCalc,
                     int row,
                     int column)
Sets row's height by the content of the cell

Parameters:
hCalc - interface for calculation the cell's height
row - the row's number
column - the column's number

isVisible

boolean isVisible()
Determines whether report should be visible

Returns:
true if the report is visible, false otherwise

setVisible

void setVisible(boolean visible)
Shows or hides report depending on the value of parameter visible.

Parameters:
visible - if true, shows this report; otherwise, hides this report

isCanUpdatePages

boolean isCanUpdatePages()
Determines whether page's bounders will be calculated automatically

Returns:
canUpdatePages property

setCanUpdatePages

void setCanUpdatePages(boolean b)
Sets the property that determines whether page's bounders will be calculated automatically

Parameters:
b - if true, page's bounders will be calculated automatically

updatePages

void updatePages(int startRow)
Calculates pages' size

Parameters:
startRow - the first row for calculation

updateRowAndPageHeight

void updateRowAndPageHeight(HeighCalculator hCalc)

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class

Parameters:
listener - the property change listener to be added

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the PropertyChangeListener to be removed

setFontName

void setFontName(GridRect selRect,
                 String fontName)
Sets the font's name for the cells by the selRect.

Parameters:
selRect - coordinates for selected cells
fontName - the font's name

setFontSize

void setFontSize(GridRect selRect,
                 int fontSize)
Sets the font's size for the cells by the selRect

Parameters:
selRect - coordinates for selected cells
fontSize - the new font's size

isFontStyle

boolean isFontStyle(int row,
                    int column,
                    int style)
Determines whether font's style is in the cell

Parameters:
row - the row's number
column - the column's number
style - the font's style
Returns:
true, if font's style in the cell is determined

setFontStyle

void setFontStyle(GridRect selRect,
                  int fontStyle,
                  boolean enable)
Sets the font's style for the cells by coordinates selRect

Parameters:
selRect - coordinates of the selected cells
fontStyle - the font's style The style argument is an integer bitmask that may be PLAIN, or a bitwise union of BOLD, ITALIC, UNDERLINE, STRIKETHROUGH
enable - if true, the style is determined, otherwise the style is removed.

setBackground

void setBackground(GridRect selectionRect,
                   Color color)
Sets background color for the selected cells

Parameters:
selectionRect - coordinates of the selected cells
color - the new background color for the cells

setForeground

void setForeground(GridRect selectionRect,
                   Color color)
Sets foreground color for the selected cells

Parameters:
selectionRect - coordinates of the selected cells
color - the new foreground color for the cells

setDecimals

void setDecimals(GridRect selectionRect,
                 int d)
Sets new decimal position of the numeric value for selected cells.

Parameters:
selectionRect - coordinates of the selected cells
d - the decimal position of the numeric value.

setHorizontalAlignment

void setHorizontalAlignment(GridRect selectionRect,
                            int align)
Sets the horizontal alignment for the selected cells The horizontal alignment is a constant that may be LEFT, RIGHT, CENTER or JUSTIFY

Parameters:
selectionRect - coordinates of the selected cells
align - the new horizontal alignment for the cells

setVerticalAlignment

void setVerticalAlignment(GridRect selectionRect,
                          int align)
Sets the vertical alignment for the selected cells The vertical alignment is a constant that may be TOP, BOTTOM or CENTER

Parameters:
selectionRect - coordinates of the selected cells
align - the new vertical alignment for the cells

delete

void delete(GridRect selectionRect)
Removes the selected cells

Parameters:
selectionRect - coordinates of the selected cells

getCellWrap

CellWrap getCellWrap(int row,
                     int column)
Returns the CellWrap object for the cell by row and column

Parameters:
row - the row's number
column - the column's number
Returns:
the CellWrap object

startUpdate

void startUpdate()
Bans notification of listeners


getCellPosition

CellCoord getCellPosition(Cell cell)

endUpdate

void endUpdate()
Allows notification of listeners


isUpdate

boolean isUpdate()
Returns:
if true, all notification are locked

getToolTipText

String getToolTipText(int row,
                      int column)
Returns the string to be used as the tooltip for the cell by row and column.

Parameters:
row - the row's number
column - the column's number
Returns:
the tooltip string

isShowHeader

boolean isShowHeader()

setShowHeader

void setShowHeader(boolean b)

isShowRowHeader

boolean isShowRowHeader()

setShowRowHeader

void setShowRowHeader(boolean b)

getCellText

String getCellText(Cell cell)

setColumnWidths

void setColumnWidths(int[] widths)

findRightColumn

int findRightColumn(int leftCol)
Searches for the right extreme column of page

Parameters:
leftCol - the column with which starts search
Returns:
column number
Since:
1.3

setStyleList

void setStyleList(Map<Object,CellStyle> map)
Parameters:
map -
Since:
2.0

isPrintLeftToRight

boolean isPrintLeftToRight()
Direction of an output of pages on the printer. If true that pages are printed from left to right, from top to down, differently pages are printed from top to down, from left to right.

Returns:
if true that pages are printed from left to right, otherwise from top to down
Since:
2.0

setPrintLeftToRight

void setPrintLeftToRight(boolean value)
Direction of an output of pages on the printer. If true that pages are printed from left to right, from top to down, differently pages are printed from top to down, from left to right.

Parameters:
value -
Since:
2.0