|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
jdbreport.model.JReportModel
public class JReportModel
Nested Class Summary | |
---|---|
static class |
JReportModel.ReportCellWrap
|
Field Summary | |
---|---|
static String |
VERSION
|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
JReportModel(int rowCount,
int columnCount,
Map<Object,CellStyle> styleList)
|
|
JReportModel(Map<Object,CellStyle> listStyle)
|
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. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
|
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 |
int |
calcRowWidths(StringMetrics metrics,
Cell cell,
int row,
int column)
|
void |
clearUnion(int row,
int column)
Clears the unions of the cell by row and column |
TableColumn |
createDefaultColumn(int column)
|
Cell |
createReportCell(int row,
int column)
Creates the Cell by row and column |
protected TableRowModel |
createRowModel()
Creates TableRowModel by default |
void |
delete(GridRect selectionRect)
Removes the selected cells |
void |
deleteCell(int row,
int column)
|
void |
endUpdate()
Allows notification of listeners |
int |
findRightColumn(int leftCol)
Searches for the right extreme column of page |
boolean |
findStyleID(Object styleId)
Checks use of style in model |
protected void |
firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
|
protected void |
firePropertyChange(String propertyName,
int oldValue,
int newValue)
|
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
|
int |
getCellHeight(Cell cell,
int row,
int column)
|
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)
|
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 |
int |
getColumnCount()
|
TableColumnModel |
getColumnModel()
|
String |
getColumnName(int column)
|
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. |
PropertyChangeListener[] |
getPropertyChangeListeners()
|
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
|
Cell |
getReportCell(int row,
int column)
Returns the Cell by row and column |
ReportPage |
getReportPage()
|
String |
getReportTitle()
|
int |
getRowCount()
|
int |
getRowHeight(int row)
Returns the height of the row |
TableRowModel |
getRowModel()
|
Iterator<Cell> |
getSelectedCells(GridRect rect)
Returns cells that do not have owner |
Map<Object,CellStyle> |
getStyleList()
|
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. |
String |
getToolTipText(Point point)
|
Object |
getValueAt(int rowIndex,
int columnIndex)
|
boolean |
isBold(int row,
int column)
|
boolean |
isCanUpdatePages()
Determines whether page's bounders will be calculated automatically |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
|
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 |
isItalic(int row,
int column)
|
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 |
isStrikethrough(int row,
int column)
|
boolean |
isUnderline(int row,
int column)
|
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 |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
|
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 |
replaceStyleID(Object oldStyleId,
Object newStyleId)
Replaces styles |
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 end)
Sets the vertical page break after column |
void |
setColumnCount(int value)
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 selRect,
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 |
setReportPage(ReportPage reportPage)
|
void |
setReportTitle(String reportTitle)
|
void |
setRowBreak(int row,
boolean end)
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> list)
|
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
|
void |
setVerticalAlignment(GridRect selRect,
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 |
updateCarryRows(HeighCalculator hCalc,
int row,
int column)
|
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 class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, getColumnClass, removeTableModelListener |
Field Detail |
---|
public static final String VERSION
Constructor Detail |
---|
public JReportModel(int rowCount, int columnCount, Map<Object,CellStyle> styleList)
public JReportModel(Map<Object,CellStyle> listStyle)
Method Detail |
---|
protected TableRowModel createRowModel()
public int addRows(int count, int index)
ReportModel
addRows
in interface ReportModel
count
- rows' countindex
- the row index of the rows to be inserted
public void removeRows(int count, int index)
ReportModel
removeRows
in interface ReportModel
count
- rows' countindex
- index of the first removed rowpublic int addColumns(int count)
ReportModel
addColumns
in interface ReportModel
count
- columns' count
public int addColumns(int count, int index)
ReportModel
addColumns
in interface ReportModel
count
- columns' countindex
- the column index of the columns to be inserted
public void removeColumns(int count, int index)
ReportModel
removeColumns
in interface ReportModel
count
- columns' countindex
- index of the first removed columnpublic int getColumnCount()
getColumnCount
in interface TableModel
public TableColumn createDefaultColumn(int column)
public void setColumnCount(int value)
ReportModel
setColumnCount
in interface ReportModel
value
- new columns' countpublic int getRowCount()
getRowCount
in interface TableModel
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface TableModel
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
public Cell getReportCell(int row, int column)
ReportModel
getReportCell
in interface ReportModel
row
- the row's numbercolumn
- the column's number
public Cell getOwnerReportCell(int row, int column)
ReportModel
getOwnerReportCell
in interface ReportModel
row
- the row's numbercolumn
- the column's number
public Cell createReportCell(int row, int column)
ReportModel
createReportCell
in interface ReportModel
row
- the row's numbercolumn
- the column's number
public int getOwnerRow(Cell cell, int row, int column)
ReportModel
getOwnerRow
in interface ReportModel
cell
- the cellrow
- the row's numbercolumn
- the column's number
public int getOwnerColumn(Cell cell, int row, int column)
ReportModel
getOwnerColumn
in interface ReportModel
cell
- the cellrow
- the row's numbercolumn
- the column's number
public Dimension getCellSize(Cell cell, int row, int column)
public Dimension getCellSize(Cell cell, int row, int column, boolean includeSpacing)
ReportModel
getCellSize
in interface ReportModel
cell
- the Cell for which size is returnsrow
- the row's numbercolumn
- the column's number
public int getCellHeight(Cell cell, int row, int column)
public TableRowModel getRowModel()
getRowModel
in interface ReportModel
public void removeRows()
ReportModel
removeRows
in interface ReportModel
public int getColumnWidth(int column)
ReportModel
getColumnWidth
in interface ReportModel
column
- the column's number
public int getRowHeight(int row)
ReportModel
getRowHeight
in interface ReportModel
row
- the row's number
public void setRowHeight(int row, int rowHeight)
ReportModel
setRowHeight
in interface ReportModel
row
- the row's numberrowHeight
- a new row's heightpublic TableColumnModel getColumnModel()
getColumnModel
in interface ReportModel
public void unionCells(int topRow, int leftColumn, int bottomRow, int rightColumn)
ReportModel
unionCells
in interface ReportModel
topRow
- the number of the top rowleftColumn
- the number of the left columnbottomRow
- the number of the bottom rowrightColumn
- the number of the right columnpublic void clearUnion(int row, int column)
ReportModel
clearUnion
in interface ReportModel
row
- the row's numbercolumn
- the column's numberpublic CellStyle getStyles(Object index)
ReportModel
getStyles
in interface ReportModel
index
- the id of the CellStyle
public Object addStyle(CellStyle style)
ReportModel
addStyle
in interface ReportModel
style
- adding style
public void addBorder(int topRow, int leftColumn, int bottomRow, int rightColumn, boolean[] positions, Border line)
ReportModel
addBorder
in interface ReportModel
topRow
- the number of the top rowleftColumn
- the number of the left columnbottomRow
- the number of the bottom rowrightColumn
- the number of the right columnpositions
- positions - boolean values, where true sets border, otherwise
does nothing. Position's index can be from Border.LINE_LEFT to
Border.LINE_HMIDDLEline
- the borderpublic void setHorizontalAlignment(GridRect selRect, int align)
ReportModel
setHorizontalAlignment
in interface ReportModel
selRect
- coordinates of the selected cellsalign
- the new horizontal alignment for the cellspublic void setVerticalAlignment(GridRect selRect, int align)
ReportModel
setVerticalAlignment
in interface ReportModel
selRect
- coordinates of the selected cellsalign
- the new vertical alignment for the cellspublic void setFontName(GridRect selRect, String fontName)
ReportModel
setFontName
in interface ReportModel
selRect
- coordinates for selected cellsfontName
- the font's namepublic void setFontSize(GridRect selRect, int fontSize)
ReportModel
setFontSize
in interface ReportModel
selRect
- coordinates for selected cellsfontSize
- the new font's sizepublic void setFontStyle(GridRect selRect, int fontStyle, boolean enable)
ReportModel
setFontStyle
in interface ReportModel
selRect
- coordinates of the selected cellsfontStyle
- the font's style The style argument is an integer bitmask that
may be PLAIN, or a bitwise union of BOLD, ITALIC, UNDERLINE,
STRIKETHROUGHenable
- if true, the style is determined, otherwise the style is
removed.public boolean isBold(int row, int column)
public boolean isItalic(int row, int column)
public boolean isUnderline(int row, int column)
public boolean isStrikethrough(int row, int column)
public boolean isFontStyle(int row, int column, int style)
ReportModel
isFontStyle
in interface ReportModel
row
- the row's numbercolumn
- the column's numberstyle
- the font's style
public void setBackground(GridRect selectionRect, Color color)
ReportModel
setBackground
in interface ReportModel
selectionRect
- coordinates of the selected cellscolor
- the new background color for the cellspublic void setForeground(GridRect selectionRect, Color color)
ReportModel
setForeground
in interface ReportModel
selectionRect
- coordinates of the selected cellscolor
- the new foreground color for the cellspublic void setDecimals(GridRect selectionRect, int d)
ReportModel
setDecimals
in interface ReportModel
selectionRect
- coordinates of the selected cellsd
- the decimal position of the numeric value.public void setReportTitle(String reportTitle)
setReportTitle
in interface ReportModel
reportTitle
- a new report's title.public String getReportTitle()
getReportTitle
in interface ReportModel
public void setStyleList(Map<Object,CellStyle> list)
setStyleList
in interface ReportModel
public Map<Object,CellStyle> getStyleList()
public void setDefaultColumnWidth(int defaultColumnWidth)
ReportModel
setDefaultColumnWidth
in interface ReportModel
defaultColumnWidth
- a new default column's widthpublic int getDefaultColumnWidth()
getDefaultColumnWidth
in interface ReportModel
public void setReportPage(ReportPage reportPage)
reportPage
- The reportPage to set.public ReportPage getReportPage()
getReportPage
in interface ReportModel
public void setRowSizing(boolean b)
ReportModel
setRowSizing
in interface ReportModel
b
- true if report view should allow resizingpublic boolean isRowSizing()
ReportModel
isRowSizing
in interface ReportModel
public void setColSizing(boolean b)
ReportModel
setColSizing
in interface ReportModel
b
- true if report view should allow resizingpublic boolean isColSizing()
ReportModel
isColSizing
in interface ReportModel
public void setRowMoving(boolean b)
ReportModel
setRowMoving
in interface ReportModel
b
- true if the report view should allow reordering; otherwise
falsepublic boolean isRowMoving()
ReportModel
isRowMoving
in interface ReportModel
public void setColMoving(boolean b)
ReportModel
setColMoving
in interface ReportModel
b
- true if the report view should allow reordering; otherwise
falsepublic boolean isColMoving()
ReportModel
isColMoving
in interface ReportModel
public void setEditable(boolean b)
ReportModel
setEditable
in interface ReportModel
b
- the boolean to be setpublic boolean isEditable()
ReportModel
isEditable
in interface ReportModel
public void addPropertyChangeListener(PropertyChangeListener listener)
ReportModel
addPropertyChangeListener
in interface ReportModel
listener
- the property change listener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
ReportModel
removePropertyChangeListener
in interface ReportModel
listener
- the PropertyChangeListener to be removedpublic PropertyChangeListener[] getPropertyChangeListeners()
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
protected void firePropertyChange(String propertyName, int oldValue, int newValue)
public boolean findStyleID(Object styleId)
styleId
- the identifier of style
public void replaceStyleID(Object oldStyleId, Object newStyleId)
oldStyleId
- old style's idnewStyleId
- new style's idpublic void setStretchPage(boolean stretchPage)
ReportModel
setStretchPage
in interface ReportModel
stretchPage
- if true sets printing mode in FIT_WIDTH otherwise in NORMALJTable.PrintMode
public boolean isStretchPage()
ReportModel
isStretchPage
in interface ReportModel
public boolean isRowBreak(int row)
ReportModel
isRowBreak
in interface ReportModel
row
- the row's number
public void setRowBreak(int row, boolean end)
ReportModel
setRowBreak
in interface ReportModel
row
- the row's numberend
- a boolean value, where true sets the end page and false remove
itpublic boolean isColumnBreak(int column)
ReportModel
isColumnBreak
in interface ReportModel
column
- the column's number
public void setColumnBreak(int column, boolean end)
ReportModel
setColumnBreak
in interface ReportModel
column
- the column's numberend
- a boolean value, where true sets the page break and false
remove itpublic Iterator<Cell> getSelectedCells(GridRect rect)
ReportModel
getSelectedCells
in interface ReportModel
rect
- the region where the cells are selected
public CellWrap getCellWrap(int row, int column)
ReportModel
getCellWrap
in interface ReportModel
row
- the row's numbercolumn
- the column's number
public String getToolTipText(Point point)
public String getToolTipText(int row, int column)
ReportModel
getToolTipText
in interface ReportModel
row
- the row's numbercolumn
- the column's number
public void deleteCell(int row, int column)
public void delete(GridRect selectionRect)
ReportModel
delete
in interface ReportModel
selectionRect
- coordinates of the selected cellspublic Rectangle getCellRect(int row, int column, boolean includeSpacing, boolean isLeftToRight)
ReportModel
getCellRect
in interface ReportModel
row
- the row's numbercolumn
- the column's numberincludeSpacing
- if false, return the true cell bounds - computed by
subtracting the intercell spacing from the height and widths
of the column and row models
public void updateCarryRows(HeighCalculator hCalc, int row, int column)
public void updateRowHeight(HeighCalculator hCalc, int row, int column)
ReportModel
updateRowHeight
in interface ReportModel
hCalc
- interface for calculation the cell's heightrow
- the row's numbercolumn
- the column's numberpublic boolean isVisible()
ReportModel
isVisible
in interface ReportModel
public void setVisible(boolean visible)
ReportModel
setVisible
in interface ReportModel
visible
- if true, shows this report; otherwise, hides this reportpublic boolean isCanUpdatePages()
ReportModel
isCanUpdatePages
in interface ReportModel
public void setCanUpdatePages(boolean b)
ReportModel
setCanUpdatePages
in interface ReportModel
b
- if true, page's bounders will be calculated automaticallypublic void updatePages(int startRow)
ReportModel
updatePages
in interface ReportModel
startRow
- the first row for calculationpublic CellCoord getCellPosition(Cell cell)
getCellPosition
in interface ReportModel
public void startUpdate()
ReportModel
startUpdate
in interface ReportModel
public void endUpdate()
ReportModel
endUpdate
in interface ReportModel
public boolean isUpdate()
isUpdate
in interface ReportModel
public int calcRowWidths(StringMetrics metrics, Cell cell, int row, int column)
public boolean isShowHeader()
isShowHeader
in interface ReportModel
public boolean isShowRowHeader()
isShowRowHeader
in interface ReportModel
public void setShowHeader(boolean b)
setShowHeader
in interface ReportModel
public void setShowRowHeader(boolean b)
setShowRowHeader
in interface ReportModel
public String getCellText(Cell cell)
getCellText
in interface ReportModel
public void setColumnWidths(int[] widths)
setColumnWidths
in interface ReportModel
public void updateRowAndPageHeight(HeighCalculator hCalc)
updateRowAndPageHeight
in interface ReportModel
public int findRightColumn(int leftCol)
ReportModel
findRightColumn
in interface ReportModel
leftCol
- the column with which starts search
public boolean isLastRowInPage(int row)
ReportModel
isLastRowInPage
in interface ReportModel
row
- the row's number
public boolean isPrintLeftToRight()
ReportModel
isPrintLeftToRight
in interface ReportModel
public void setPrintLeftToRight(boolean value)
ReportModel
setPrintLeftToRight
in interface ReportModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |