Package org.compiere.print.layout
Class TableElement
java.lang.Object
org.compiere.print.layout.PrintElement
org.compiere.print.layout.TableElement
- All Implemented Interfaces:
ImageObserver
,Serializable
Table Print Element.
Maintains a logical cross page table, which is "broken up" when printing.
Maintains a logical cross page table, which is "broken up" when printing.
The table is 3 pages wide, 2 pages high +-----+-----+-----+ | 1.1 | 1.2 | 1.3 | +-----+-----+-----+ | 2.1 | 2.2 | 2.3 | +-----+-----+-----+ Printed +-----+-----+-----+ | 1 | 2 | 3 | +-----+-----+-----+ | 4 | 5 | 6 | +-----+-----+-----+
- Version:
- $Id: TableElement.java,v 1.2 2006/07/30 00:53:02 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- FR [ 1803359 ] Migrate to barbecue 1.1
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Header Row Indicatorstatic final int
Header Row IndicatorFields inherited from class org.compiere.print.layout.PrintElement
LINK_COLOR, log, p_FieldAlignmentType, p_height, p_maxHeight, p_maxWidth, p_pageLocation, p_sizeCalculated, p_width
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionTableElement
(ValueNamePair[] columnHeader, int[] columnMaxWidth, int[] columnMaxHeight, String[] columnJustification, boolean[] fixedWidth, ArrayList<Integer> functionRows, boolean multiLineHeader, org.compiere.print.util.SerializableMatrix<Serializable> data, KeyNamePair[] pk, String pkColumnName, int pageNoStart, Rectangle firstPage, Rectangle nextPages, int repeatedColumns, HashMap<Integer, Integer> additionalLines, HashMap<Point, Font> rowColFont, HashMap<Point, Color> rowColColor, HashMap<Point, Color> rowColBackground, MPrintTableFormat tFormat, ArrayList<Integer> pageBreak, Boolean[] colSuppressRepeats, HashMap<Point, MReportLine> rowColReportLine, ArrayList<Integer> finReportSumRows) Constructor.
Created in LayoutEngine. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Layout and Calculate Size.
Set p_width and p_height.getBounds
(int pageNo) Get relative Bounds of Element.getDrillAcross
(Point relativePoint, int pageNo) Get Drill Across QuerygetDrillDown
(Point relativePoint, int pageNo) Get Drill Down Queryfloat
getHeight
(int pageNo) Get Calculated Height on pageint
Get number of "real" pages.protected int
getPageIndex
(int pageNo) Get zero based Page Index within Layoutprotected int
Get X - Page Countprotected int
getPageXIndex
(int pageIndex) Get X - Page Index.
Zero Based; Page No is the "real" page No.protected int
Get Y | Page Countprotected int
getPageYIndex
(int pageIndex) Get Y | Page Index.
Zero Based; Page No is the "real" page No.float
getWidth
(int pageNo) Get Calculated Width on pagevoid
paint
(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView) Paint/Print.void
For Multi-Page Tables, set Height to Height of last Pagevoid
setPageLogics
(ArrayList<String> pageLogics) Set page logic expressionvoid
setTablePrintData
(PrintData printData) Set print dataMethods inherited from class org.compiere.print.layout.PrintElement
getAbsoluteLocation, getBounds, getCurrentPage, getDetailInfo, getHeight, getLocation, getPageLogic, getPrintData, getRowIndex, getWidth, imageUpdate, isTranslated, layout, setCurrentPage, setLocation, setMaxHeight, setMaxWidth, setPageLogic, setPrintData, setRowIndex, toString, translate, waitForLoad
-
Field Details
-
HEADER_ROW
public static final int HEADER_ROWHeader Row Indicator- See Also:
-
ALL
public static final int ALLHeader Row Indicator- See Also:
-
-
Constructor Details
-
TableElement
public TableElement(ValueNamePair[] columnHeader, int[] columnMaxWidth, int[] columnMaxHeight, String[] columnJustification, boolean[] fixedWidth, ArrayList<Integer> functionRows, boolean multiLineHeader, org.compiere.print.util.SerializableMatrix<Serializable> data, KeyNamePair[] pk, String pkColumnName, int pageNoStart, Rectangle firstPage, Rectangle nextPages, int repeatedColumns, HashMap<Integer, Integer> additionalLines, HashMap<Point, Font> rowColFont, HashMap<Point, Color> rowColColor, HashMap<Point, Color> rowColBackground, MPrintTableFormat tFormat, ArrayList<Integer> pageBreak, Boolean[] colSuppressRepeats, HashMap<Point, MReportLine> rowColReportLine, ArrayList<Integer> finReportSumRows) Constructor.
Created in LayoutEngine.
The rowCol.. maps are organized as follows - Point (row,col) row - data if 0..m - if -1 for the entire column column - data if 0..n - if -1 for the entire row i.e. Point (-1, -1) is the default for the table
- Parameters:
columnHeader
- array with column headers (Key=ColumnName)columnMaxWidth
- array with column max width - 0=no restrictions - negative=suppress if nullcolumnMaxHeight
- array with row max height for a column - 0=no restrictions; -1=one row onlycolumnJustification
- field justification for columnfixedWidth
- array with column fixed widthfunctionRows
- list of function rowsmultiLineHeader
- if true, the header is not truncated at maxWidthdata
- 2D array with data to be printed [row][col]pk
- array of primary keyspkColumnName
- primary key namepageNoStart
- page number of starting pagefirstPage
- bounds on first pagenextPages
- bounds on following pagesrepeatedColumns
- repeat first x columns on - X Axis follow pagesadditionalLines
- map of old column to below printed columnrowColFont
- HashMap with Point as key with Font overwriterowColColor
- HashMap with Point as key with foreground Color overwriterowColBackground
- HashMap with Point as key with background Color overwritetFormat
- table formatpageBreak
- Arraylist of rows with page breakcolSuppressRepeats
-rowColReportLine
-finReportSumRows
-
-
-
Method Details
-
calculateSize
protected boolean calculateSize()Layout and Calculate Size.
Set p_width and p_height.- Specified by:
calculateSize
in classPrintElement
- Returns:
- true if calculated
-
setHeightToLastPage
public void setHeightToLastPage()For Multi-Page Tables, set Height to Height of last Page -
getHeight
public float getHeight(int pageNo) Get Calculated Height on page- Overrides:
getHeight
in classPrintElement
- Parameters:
pageNo
- page number- Returns:
- Height
-
getWidth
public float getWidth(int pageNo) Get Calculated Width on page- Parameters:
pageNo
- page number- Returns:
- Width
-
getPageCount
public int getPageCount()Get number of "real" pages.- Overrides:
getPageCount
in classPrintElement
- Returns:
- page count
-
getPageIndex
protected int getPageIndex(int pageNo) Get zero based Page Index within Layout- Parameters:
pageNo
- real page no- Returns:
- page index
-
getPageXIndex
protected int getPageXIndex(int pageIndex) Get X - Page Index.
Zero Based; Page No is the "real" page No.The table is 3 pages wide, 2 pages high - index +-----+-----+-----+ | 0.0 | 0.1 | 0.2 | +-----+-----+-----+ | 1.0 | 1.1 | 1.2 | +-----+-----+-----+ Page Index +-----+-----+-----+ | 0 | 1 | 2 | +-----+-----+-----+ | 3 | 4 | 5 | +-----+-----+-----+
- Parameters:
pageIndex
- zero based page index- Returns:
- page index on X axis
-
getPageXCount
protected int getPageXCount()Get X - Page Count- Returns:
- X page count
-
getPageYIndex
protected int getPageYIndex(int pageIndex) Get Y | Page Index.
Zero Based; Page No is the "real" page No.The table is 3 pages wide, 2 pages high - index +-----+-----+-----+ | 0.0 | 0.1 | 0.2 | +-----+-----+-----+ | 1.0 | 1.1 | 1.2 | +-----+-----+-----+ Page Index +-----+-----+-----+ | 0 | 1 | 2 | +-----+-----+-----+ | 3 | 4 | 5 | +-----+-----+-----+
- Parameters:
pageIndex
- zero based page index- Returns:
- page index on Y axis
-
getPageYCount
protected int getPageYCount()Get Y | Page Count- Returns:
- Y page count
-
getDrillDown
Get Drill Down Query- Overrides:
getDrillDown
in classPrintElement
- Parameters:
relativePoint
- point to find print elementpageNo
- page number- Returns:
- drill down query of print element or null
-
getDrillAcross
Get Drill Across Query- Overrides:
getDrillAcross
in classPrintElement
- Parameters:
relativePoint
- point to find print elementpageNo
- page number- Returns:
- drill across query of print element or null
-
getBounds
Get relative Bounds of Element. (entire page, not just used portion)- Parameters:
pageNo
- pageNo- Returns:
- bounds
-
paint
Paint/Print.- Specified by:
paint
in classPrintElement
- Parameters:
g2D
- GraphicspageNo
- page number for multi page support (0 = header/footer)pageStart
- top left Location of pagectx
- contextisView
- true if online view (IDs are links)
-
setPageLogics
Set page logic expression- Parameters:
pageLogics
-
-
setTablePrintData
Set print data- Parameters:
printData
-
-