Class SheetLayout

    • Constructor Detail

      • SheetLayout

        public SheetLayout​(boolean strict,
                           boolean ellipseAsRectangle)
        Creates a new TableGrid-object. If strict mode is enabled, all cell bounds are used to create the table grid, resulting in a more complex layout.
        Parameters:
        strict - the strict mode for the layout.
        ellipseAsRectangle - a flag that defines whether ellipse-objects are translated into rectangles and therefore create backgrounds.
    • Method Detail

      • add

        public boolean add​(RenderBox element,
                           long offset,
                           long headerSize,
                           long maxHeight)
        Adds the bounds of the given TableCellData to the grid. The bounds given must be the same as the bounds of the element, or the layouting might produce surprising results.

        This method will do nothing, if the element has a width and height of zero and does not define any anchors.

        Parameters:
        element - the position that should be added to the grid (might be null).
        offset - the vertical shift which adjusts the visual position of the content.
        headerSize - the vertical shift which adjusts the visual position of the content.
        Returns:
        true, if the box has not changed and can be safely skipped.
        Throws:
        NullPointerException - if the bounds are null
      • addRenderableContent

        public void addRenderableContent​(RenderableReplacedContentBox element,
                                         long offset,
                                         long headerSize,
                                         long maxHeight)
      • ensureXMapping

        public void ensureXMapping​(long coordinate,
                                   Boolean aux)
      • ensureYMapping

        public void ensureYMapping​(long coordinate,
                                   Boolean aux)
      • isStrict

        public boolean isStrict()
        Gets the strict mode flag.
        Returns:
        true, if strict mode is enabled, false otherwise.
      • isEmpty

        public boolean isEmpty()
      • getTableBounds

        public TableRectangle getTableBounds​(long x,
                                             long y,
                                             long width,
                                             long height,
                                             TableRectangle rect)
        Returns the position of the given element within the table. The TableRectangle contains row and cell indices, no layout coordinates.
        Parameters:
        x - the element bounds for which the table bounds should be found.
        y - the element bounds for which the table bounds should be found.
        width - the element bounds for which the table bounds should be found.
        height - the element bounds for which the table bounds should be found.
        rect - the returned rectangle or null, if a new instance should be created
        Returns:
        the filled table rectangle.
      • getTableBoundsWithCache

        public TableRectangle getTableBoundsWithCache​(long x,
                                                      long y,
                                                      long width,
                                                      long height,
                                                      TableRectangle rect)
      • getColSpan

        public int getColSpan​(int x1,
                              long endPosition)
      • getRowSpan

        public int getRowSpan​(int y1,
                              long endPosition)
      • getTableBounds

        public TableRectangle getTableBounds​(StrictBounds bounds,
                                             TableRectangle rect)
        Returns the position of the given element within the table. The TableRectangle contains row and cell indices, no layout coordinates.
        Specified by:
        getTableBounds in interface SlimSheetLayout
        Parameters:
        bounds - the element bounds for which the table bounds should be found.
        rect - the returned rectangle or null, if a new instance should be created
        Returns:
        the filled table rectangle.
      • pageCompleted

        public void pageCompleted()
        A Callback method to inform the sheet layout, that the current page is complete, and no more content will be added.
      • removeAuxilaryBounds

        protected void removeAuxilaryBounds()
      • getRowHeight

        public long getRowHeight​(int row)
        Computes the height of the given row.
        Specified by:
        getRowHeight in interface SlimSheetLayout
        Parameters:
        row - the row, for which the height should be computed.
        Returns:
        the height of the row.
        Throws:
        IndexOutOfBoundsException - if the row is invalid.
      • getMaxHeight

        public long getMaxHeight()
      • getCellWidth

        public long getCellWidth​(int startCell,
                                 int endCell)
        Computes the height of the given row.
        Specified by:
        getCellWidth in interface SlimSheetLayout
        Parameters:
        startCell - the first cell in the range
        endCell - the last cell included in the cell range
        Returns:
        the height of the row.
        Throws:
        IndexOutOfBoundsException - if the row is invalid.
      • getRowHeight

        public long getRowHeight​(int startRow,
                                 int endRow)
      • getColumnCount

        public int getColumnCount()
        The current number of columns. Of course, this value begins to be reliable, once the number of columns is known (that is at the end of the layouting process).
        Specified by:
        getColumnCount in interface SlimSheetLayout
        Returns:
        the number columns.
      • getRowCount

        public int getRowCount()
        The current number of rows. Of course, this value begins to be reliable, once the number of rows is known (that is at the end of the layouting process).
        Returns:
        the number columns.
      • clear

        public void clear()
      • clearVerticalInfo

        public void clearVerticalInfo()