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 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 Details

    • 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 null
        columnMaxHeight - array with row max height for a column - 0=no restrictions; -1=one row only
        columnJustification - field justification for column
        fixedWidth - array with column fixed width
        functionRows - list of function rows
        multiLineHeader - if true, the header is not truncated at maxWidth
        data - 2D array with data to be printed [row][col]
        pk - array of primary keys
        pkColumnName - primary key name
        pageNoStart - page number of starting page
        firstPage - bounds on first page
        nextPages - bounds on following pages
        repeatedColumns - repeat first x columns on - X Axis follow pages
        additionalLines - map of old column to below printed column
        rowColFont - HashMap with Point as key with Font overwrite
        rowColColor - HashMap with Point as key with foreground Color overwrite
        rowColBackground - HashMap with Point as key with background Color overwrite
        tFormat - table format
        pageBreak - Arraylist of rows with page break
        colSuppressRepeats -
        rowColReportLine -
        finReportSumRows -
    • Method Details

      • calculateSize

        protected boolean calculateSize()
        Layout and Calculate Size. Set p_width and p_height
        Specified by:
        calculateSize in class PrintElement
        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 class PrintElement
        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 class PrintElement
        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

        public MQuery getDrillDown(Point relativePoint, int pageNo)
        Get Drill Down value
        Overrides:
        getDrillDown in class PrintElement
        Parameters:
        relativePoint - relative Point
        pageNo - page number
        Returns:
        if found Qyery or null
      • getDrillAcross

        public MQuery getDrillAcross(Point relativePoint, int pageNo)
        Get Drill Across value
        Overrides:
        getDrillAcross in class PrintElement
        Parameters:
        relativePoint - relative Point
        pageNo - 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 class PrintElement
        Parameters:
        g2D - Graphics
        pageNo - page number for multi page support (0 = header/footer)
        pageStart - top left Location of page
        ctx - context
        isView - true if online view (IDs are links)
      • setPageLogics

        public void setPageLogics(ArrayList<String> pageLogics)
      • setTablePrintData

        public void setTablePrintData(PrintData printData)