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
public class TableElement extends PrintElement
Table Print Element. Maintains a logical cross page table, which is "broken up" when printingThe 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALL
Header Row Indicatorstatic int
HEADER_ROW
Header Row Indicator-
Fields 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
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
calculateSize()
Layout and Calculate Size.Rectangle
getBounds(int pageNo)
Get relative Bounds of Element.MQuery
getDrillAcross(Point relativePoint, int pageNo)
Get Drill Across valueMQuery
getDrillDown(Point relativePoint, int pageNo)
Get Drill Down valuefloat
getHeight(int pageNo)
Get Calculated Height on pageint
getPageCount()
Get number of "real" pages.protected int
getPageIndex(int pageNo)
Get zero based Page Index within Layoutprotected int
getPageXCount()
Get X - Page Countprotected int
getPageXIndex(int pageIndex)
Get X - Page Index.protected int
getPageYCount()
Get Y | Page Countprotected int
getPageYIndex(int pageIndex)
Get Y | Page Index.float
getWidth(int pageNo)
Get Calculated Height on pagevoid
paint(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView)
Paint/Print.void
setHeightToLastPage()
For Multi-Page Tables, set Height to Height of last Pagevoid
setPageLogics(ArrayList<String> pageLogics)
void
setTablePrintData(PrintData printData)
-
Methods 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 Detail
-
HEADER_ROW
public static final int HEADER_ROW
Header Row Indicator- See Also:
- Constant Field Values
-
ALL
public static final int ALL
Header Row Indicator- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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=supress 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 colum 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 Detail
-
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
- layout page number- Returns:
- Height
-
getWidth
public float getWidth(int pageNo)
Get Calculated Height on page- Parameters:
pageNo
- page number- Returns:
- Height
-
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 NoThe 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 NoThe 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
public MQuery getDrillDown(Point relativePoint, int pageNo)
Get Drill Down value- Overrides:
getDrillDown
in classPrintElement
- Parameters:
relativePoint
- relative PointpageNo
- page number- Returns:
- if found Qyery or null
-
getDrillAcross
public MQuery getDrillAcross(Point relativePoint, int pageNo)
Get Drill Across value- Overrides:
getDrillAcross
in classPrintElement
- Parameters:
relativePoint
- relative PointpageNo
- page number- Returns:
- if found Query or null
-
getBounds
public Rectangle getBounds(int pageNo)
Get relative Bounds of Element. (entire page, not just used portion)- Parameters:
pageNo
- pageNo- Returns:
- bounds relative position on page
-
paint
public void paint(Graphics2D g2D, int pageNo, Point2D pageStart, Properties ctx, boolean isView)
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)
-
setTablePrintData
public void setTablePrintData(PrintData printData)
-
-