Class ViewAnchor

  • All Implemented Interfaces:
    Serializable

    public class ViewAnchor
    extends Object
    implements Serializable
    Represent a anchor position by its left-top cell index, width, height, x and y offset within the cell, or a right-bottom anchor position by its right-bottom cell index with 0 width and height.
    Since:
    3.5.0
    Author:
    dennis
    See Also:
    Serialized Form
    • Constructor Detail

      • ViewAnchor

        public ViewAnchor​(int rowIndex,
                          int columnIndex,
                          int width,
                          int height)
        Create a view anchor with indexes for left-top corner cell, width, and height.
      • ViewAnchor

        public ViewAnchor​(int rowIndex,
                          int columnIndex,
                          int xOffset,
                          int yOffset,
                          int width,
                          int height)
        Create a view anchor with indexes for left-top corner cell, x and y offset in the cell, width, and height.
      • ViewAnchor

        public ViewAnchor​(int rowIndex,
                          int columnIndex,
                          int xOffset,
                          int yOffset,
                          int width,
                          int height,
                          ViewAnchor.AnchorType anchorType)
        Create a view anchor with indexes for left-top corner cell, x and y offset in the cell, width, height, and ViewAnchor.AnchorType.
        Parameters:
        rowIndex -
        columnIndex -
        xOffset -
        yOffset -
        width -
        height -
        anchorType -
    • Method Detail

      • getRowIndex

        public int getRowIndex()
        Returns:
        the left-top cell's row index
      • setRowIndex

        public void setRowIndex​(int rowIndex)
        set the left-top cell's row index
      • getColumnIndex

        public int getColumnIndex()
        Returns:
        the left-top cell's column index
      • setColumnIndex

        public void setColumnIndex​(int columnIndex)
        set the left-top cell's column index
      • getXOffset

        public int getXOffset()
        The x offset to left border of the anchor's left-top cell. The offset is larger if the anchor's position is closer to the right of the cell.
        Returns:
        the x coordinate within the anchor's left-top cell.
      • setXOffset

        public void setXOffset​(int xOffset)
      • getYOffset

        public int getYOffset()
        The y offset to top border of the anchor's left-top cell. The offset is larger if the anchor's position is closer to the bottom of the cell.
        Returns:
        the y coordinate within the anchor's left-top cell.
      • setYOffset

        public void setYOffset​(int yOffset)
      • getWidth

        public int getWidth()
        Width of the anchor, in pixels.
        Returns:
        Width of the anchor
      • setWidth

        public void setWidth​(int width)
        Set width of the anchor in pixels.
        Parameters:
        width - the width of the anchor in pixels.
      • getHeight

        public int getHeight()
        Returns:
        height the height of the anchor in pixels.
      • setHeight

        public void setHeight​(int height)
        set the height of the anchor in pixels.
        Parameters:
        height - height of the anchor in pixels
      • getRightBottomAnchor

        public ViewAnchor getRightBottomAnchor​(SSheet sheet)
        Returns:
        Returns the right-bottom anchor with 0 height and width based on the anchor. Its offset is calculated depending on a sheet's row height and column width.
      • cloneViewAnchor

        public ViewAnchor cloneViewAnchor()
      • setAnchorType

        public void setAnchorType​(ViewAnchor.AnchorType anchorType)
        Sets the anchor type.
        Since:
        5.9.0