jdbreport.model
Interface TableRowModel

All Superinterfaces:
Iterable<TableRow>
All Known Implementing Classes:
ReportRowModel, TemplateRowModel

public interface TableRowModel
extends Iterable<TableRow>

Defines the requirements for a report row model object suitable for use with ReportModel.

Version:
1.4 16.08.2009
Author:
Andrey Kholmanskih

Field Summary
static int maxHeight
           
static int minHeight
           
 
Method Summary
 void addColumn(int column)
          Adds column in the model
 TableRow addRow()
          Adds the new row
 TableRow addRow(int row)
          Adds the row at the specified position
 int addRow(int row, TableRow tableRow)
          Adds the row at the specified position
 int addRow(RowsGroup group, int indexInGroup)
          Adds the row to the group
 int addRow(RowsGroup group, int indexInGroup, TableRow tableRow)
          Adds the row to the group
 void addRowModelListener(TableRowModelListener x)
          Adds a listener for report row model events.
 int addRows(int count, int index)
          Adds rows' count to the index of the model.
 void clearUnion(int topRow, int leftColumn, int bottomRow, int rightColumn)
          Clears the unions of the selected cells
 TableRow createTableRow()
          Creates new default TableRow
 void disableSpan()
          Clears all cells unions before moving of rows or columns
 void enableSpan()
          Restores all cells unions after moving of rows or columns
 void endUpdate()
          Allows notification of listeners after updates of model
 int getColCount()
          Returns columns' count in the model
 int getFirstPageNumber()
          Returns number of the first page
 RowsGroup getGroup(int row)
          Returns the group which contains the TableRow by specified row index
 Group getGroup(int[] path)
           
 RowsGroup getGroup(TableRow tableRow)
          Returns the group which contains the tableRow
 int getGroupRowIndex(Group group)
          Returns the index of the first group's row in rowList
 Object getHeaderValue(int row)
          Returns value for row's header
 int getMaxRowHeight()
          Returns the maximum height of a report row, in pixels.
 int getMinRowHeight()
          Returns the minimum height of a report row, in pixels.
 int getPageCount()
          Returns count of pages
 Integer getPageNumber(int row, int column)
          Returns number of page for a cell on a row and a column
 int getPreferredRowHeight()
          Returns the preferred height of a report row, in pixels.
 RootGroup getRootGroup()
           
 TableRow getRow(int row)
          Returns the TableRow from the specified position
 int getRowCount()
          Returns rows' count in the model
 int getRowHeight(int row)
          Returns the height, in pixels, of the row.
 int getRowIndex(TableRow tableRow)
          Returns row's position in the model
 int getRowIndexAtY(int y)
          Returns the index of the row that lies on the vertical point, y; or -1 if it lies outside the any of the row's bounds.
 int getRowMargin()
          Returns the row between the cells in each row.
 int getTotalRowHeight()
          Returns the total height of all the rows.
 boolean isCanHideGroup()
           
 boolean isCanUpdatePages()
          Returns the possibility of calculation of pages' size
 boolean isPrintLeftToRight()
          Direction of an output of pages on the printer.
 void moveColumn(int columnIndex, int newIndex)
          Moves the column at columnIndex to newIndex.
 void moveDraggedRow(int rowIndex, int newIndex)
          Moves the dragged row and its header at rowIndex to newIndex.
 void moveRow(int rowIndex, int newIndex)
          Moves the row and its header at rowIndex to newIndex.
 void removeColumn(int column)
          Removes column from the model
 void removeRowModelListener(TableRowModelListener x)
          Removes a listener for report row model events.
 void removeRows()
          Removes all rows
 void removeRows(int count, int index)
          Removes rows' count begining with the index from the model.
 void setCanUpdatePages(boolean b)
          Sets canUpdatePages property
 void setColCount(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 setFirstPageNumber(int firstPageNumber)
          Sets number of the first page
 void setPreferredRowHeight(int preferredHeight)
          Sets the preferred height for row.
 void setPrintLeftToRight(boolean value)
          Direction of an output of pages on the printer.
 void setRowHeight(int row, double h)
          Sets the height for row to h.
 void setRowHeight(int row, int rowHeight)
          Sets the height for row to rowHeight.
 void setRowHeight(TableRow tableRow, int newHeight)
          Sets the height for tableRow to newHeight.
 void setShowPageNumber(boolean show)
           
 void setVisibleGroup(Group group, boolean b)
          If parameter b is true, sets the group that is visible in report, otherwise removes rows containing in the group from report
 void startUpdate()
          Bans notification of listeners before updates of model
 void unionCells(int topRow, int leftColumn, int bottomRow, int rightColumn)
          Unions the cells by coordinates
 void updatePages(int startRow, int pageHeight)
          Calculates pages' size
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

minHeight

static final int minHeight
See Also:
Constant Field Values

maxHeight

static final int maxHeight
See Also:
Constant Field Values
Method Detail

addRow

TableRow addRow(int row)
Adds the row at the specified position

Parameters:
row - index at which the row is to be inserted.
Returns:
the inserted TableRow

addRow

TableRow addRow()
Adds the new row

Returns:
the index of the inserted row

addRow

int addRow(int row,
           TableRow tableRow)
Adds the row at the specified position

Parameters:
row - the row's number
tableRow - the TableRow object
Returns:
the index of the inserted row

addRow

int addRow(RowsGroup group,
           int indexInGroup)
Adds the row to the group

Parameters:
group -
indexInGroup - index in group
Returns:
row's index in rows list

addRow

int addRow(RowsGroup group,
           int indexInGroup,
           TableRow tableRow)
Adds the row to the group

Parameters:
group -
indexInGroup -
tableRow -
Returns:
row's index in the list

addColumn

void addColumn(int column)
Adds column in the model

Parameters:
column - the specified position in this model

removeColumn

void removeColumn(int column)
Removes column from the model

Parameters:
column - the index of the removing column

getColCount

int getColCount()
Returns columns' count in the model

Returns:
the columns count

setColCount

void setColCount(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

getRowCount

int getRowCount()
Returns rows' count in the model

Returns:
the rows count

getRow

TableRow getRow(int row)
Returns the TableRow from the specified position

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

getRowIndex

int getRowIndex(TableRow tableRow)
Returns row's position in the model

Parameters:
tableRow - TableRow to search for.
Returns:
the index in this model of the first occurrence of the specified tableRow, or -1 if this model does not contain this tableRow.

getRowIndexAtY

int getRowIndexAtY(int y)
Returns the index of the row that lies on the vertical point, y; or -1 if it lies outside the any of the row's bounds.

Parameters:
y - y coordinate of point
Returns:
the index of the row; or -1 if no row is found

addRowModelListener

void addRowModelListener(TableRowModelListener x)
Adds a listener for report row model events.

Parameters:
x - a TableRowModelListener object

removeRowModelListener

void removeRowModelListener(TableRowModelListener x)
Removes a listener for report row model events.

Parameters:
x - a TableRowModelListener object

getTotalRowHeight

int getTotalRowHeight()
Returns the total height of all the rows.

Returns:
the total computed height of all rows

moveRow

void moveRow(int rowIndex,
             int newIndex)
Moves the row and its header at rowIndex to newIndex. The old row at rowIndex will now be found at newIndex. The row that used to be at newIndex is shifted top or bottom to make room. This will not move any rows if rowIndex equals newIndex. This method posts a rowMoved event to its listeners.

Parameters:
rowIndex - the index of row to be moved
newIndex - index of the row's new location

moveDraggedRow

void moveDraggedRow(int rowIndex,
                    int newIndex)
Moves the dragged row and its header at rowIndex to newIndex.

Parameters:
rowIndex - the index of row to be moved
newIndex - index of the row's new location

getRowMargin

int getRowMargin()
Returns the row between the cells in each row.

Returns:
the margin, in pixels, between the cells

getMinRowHeight

int getMinRowHeight()
Returns the minimum height of a report row, in pixels. The default minimum row height is 2.0.

Returns:
the mimimum height in pixels of a report row

getMaxRowHeight

int getMaxRowHeight()
Returns the maximum height of a report row, in pixels. The default maximum row height is 4096.0.

Returns:
the maximum height in pixels of a report row

getPreferredRowHeight

int getPreferredRowHeight()
Returns the preferred height of a report row, in pixels. The default row height is 17.0.

Returns:
the preferred height in pixels of a report row

setPreferredRowHeight

void setPreferredRowHeight(int preferredHeight)
Sets the preferred height for row.

Parameters:
preferredHeight - new preferred row height, in pixels

moveColumn

void moveColumn(int columnIndex,
                int newIndex)
Moves the column at columnIndex to newIndex.

Parameters:
columnIndex - the index of column to be moved
newIndex - index of the column's new location

getRowHeight

int getRowHeight(int row)
Returns the height, in pixels, of the row. The default row height is 17.0.

Parameters:
row - the row whose height is to be returned
Returns:
the height in pixels of a report row

setRowHeight

void setRowHeight(int row,
                  int rowHeight)
Sets the height for row to rowHeight. The height of the cells in this row will be equal to the row height minus the row margin.

Parameters:
row - the row whose height is being changed
rowHeight - new row height, in pixels

setRowHeight

void setRowHeight(TableRow tableRow,
                  int newHeight)
Sets the height for tableRow to newHeight. The height of the cells in this row will be equal to the row height minus the row margin.

Parameters:
tableRow - the row whose height is being changed
newHeight - new row height, in pixels

setRowHeight

void setRowHeight(int row,
                  double h)
Sets the height for row to h. The height of the cells in this row will be equal to the row height minus the row margin.

Parameters:
row - the row whose height is being changed
h - new row height, in 1/72 of inch

getRootGroup

RootGroup getRootGroup()
Returns:
the RootGroup of repoprt model

getGroup

RowsGroup getGroup(int row)
Returns the group which contains the TableRow by specified row index

Parameters:
row - the row's index in rowList
Returns:
the RowsGroup object

getGroup

RowsGroup getGroup(TableRow tableRow)
Returns the group which contains the tableRow

Parameters:
tableRow - the TableRow object
Returns:
the RowsGroup object

setVisibleGroup

void setVisibleGroup(Group group,
                     boolean b)
If parameter b is true, sets the group that is visible in report, otherwise removes rows containing in the group from report

Parameters:
group - Group object
b - visible property

getGroupRowIndex

int getGroupRowIndex(Group group)
Returns the index of the first group's row in rowList

Parameters:
group - the Group object
Returns:
index first group's row in rowList

getHeaderValue

Object getHeaderValue(int row)
Returns value for row's header

Parameters:
row - the row's number
Returns:
value for row's header

updatePages

void updatePages(int startRow,
                 int pageHeight)
Calculates pages' size

Parameters:
startRow - the first row for calculation
pageHeight - page height in pixels

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 topRow,
                int leftColumn,
                int bottomRow,
                int rightColumn)
Clears the unions of the selected cells

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

disableSpan

void disableSpan()
Clears all cells unions before moving of rows or columns


enableSpan

void enableSpan()
Restores all cells unions after moving of rows or columns


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()
Removes all rows


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

createTableRow

TableRow createTableRow()
Creates new default TableRow

Returns:
the TableRow object

startUpdate

void startUpdate()
Bans notification of listeners before updates of model


endUpdate

void endUpdate()
Allows notification of listeners after updates of model


isCanUpdatePages

boolean isCanUpdatePages()
Returns the possibility of calculation of pages' size

Returns:
if true, pages' size are calculated automatically

setCanUpdatePages

void setCanUpdatePages(boolean b)
Sets canUpdatePages property

Parameters:
b - the canUpdatePages property

isCanHideGroup

boolean isCanHideGroup()

getFirstPageNumber

int getFirstPageNumber()
Returns number of the first page

Returns:
number of the first page
Since:
1.4

setFirstPageNumber

void setFirstPageNumber(int firstPageNumber)
Sets number of the first page

Parameters:
firstPageNumber - number of the first page
Since:
1.4

getPageNumber

Integer getPageNumber(int row,
                      int column)
Returns number of page for a cell on a row and a column

Parameters:
row -
column -
Returns:
number of page

getPageCount

int getPageCount()
Returns count of pages

Returns:
count of pages

getGroup

Group getGroup(int[] path)

setShowPageNumber

void setShowPageNumber(boolean show)

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:
true if pages are printed from left to right, otherwise false
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