Class SheetOverlayWrapper

java.lang.Object
com.vaadin.flow.component.spreadsheet.SheetOverlayWrapper
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SheetChartWrapper, SheetImageWrapper

public abstract class SheetOverlayWrapper extends Object implements Serializable
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SheetOverlayWrapper(org.apache.poi.ss.usermodel.ClientAnchor anchor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    org.apache.poi.ss.usermodel.ClientAnchor
    Gets the anchor for this image within the sheet containing this image.
    com.vaadin.flow.component.Component
    getComponent(boolean init)
    Returns the component contained in this wrapper if there is one.
    float
    getHeight(org.apache.poi.ss.usermodel.Sheet sheet, float[] rowH)
    Calculates the height of the image.
    Returns a unique ID of this overlay, used also as a resource key for images.
    com.vaadin.flow.server.streams.DownloadHandler
    Gets the handler serving this image
     
    float
    getWidth(org.apache.poi.ss.usermodel.Sheet sheet, int[] colW, int defaultColumnWidthPX)
    Calculates the width of the image.
    int
     
    boolean
    Gets the visibility state of this overlay in the current spreadsheet view.
    boolean
    isVisible(int r1, int c1, int r2, int c2)
    Determines if this image should be visible within the given visible area.
    void
    If this overlay's state can be dynamically changed (like minimizing), this method can inform the spreadsheet.
    void
    setVisible(boolean visible)
    Marks this as image visible or hidden in the current spreadsheet view.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SheetOverlayWrapper

      public SheetOverlayWrapper(org.apache.poi.ss.usermodel.ClientAnchor anchor)
  • Method Details

    • setOverlayChangeListener

      public void setOverlayChangeListener(SheetOverlayWrapper.OverlayChangeListener listener)
      If this overlay's state can be dynamically changed (like minimizing), this method can inform the spreadsheet.
      Parameters:
      listener -
    • isVisible

      public boolean isVisible(int r1, int c1, int r2, int c2)
      Determines if this image should be visible within the given visible area.
      Parameters:
      r1 - Row index of topmost row, 1-based
      c1 - Column index of leftmost column, 1-based
      r2 - Row index of bottom-most row, 1-based
      c2 - Column index of rightmost column, 1-based
      Returns:
      true if the image should be visible inside the range, false otherwise
    • getWidth

      public float getWidth(org.apache.poi.ss.usermodel.Sheet sheet, int[] colW, int defaultColumnWidthPX)
      Calculates the width of the image. Might not be 100% correct because of bugs in POI (returns inconsistent values for Dx and Dy).

      If the image doesn't have a specified width and should be sized to image file size, -1 is returned.

      Parameters:
      sheet - The sheet this image belongs to
      colW - Array of column widths in pixels
      defaultColumnWidthPX - Default column width in pixels
      Returns:
      Width of the image in pixels, or -1 if image file width should be used
    • getHeight

      public float getHeight(org.apache.poi.ss.usermodel.Sheet sheet, float[] rowH)
      Calculates the height of the image. Might not be 100% correct because of bugs in POI (returns inconsistent values for Dx and Dy).

      If the image doesn't have a specified height and should be sized to image file size, -1 is returned.

      Parameters:
      sheet - The sheet this image belongs to
      rowH - Array of row heights in points
      Returns:
      Image height in points, or -1 if image file height should be used.
    • getId

      public String getId()
      Returns a unique ID of this overlay, used also as a resource key for images.
    • isVisible

      public boolean isVisible()
      Gets the visibility state of this overlay in the current spreadsheet view.
      Returns:
      true if overlay is visible, false otherwise
    • setVisible

      public void setVisible(boolean visible)
      Marks this as image visible or hidden in the current spreadsheet view. Only used for the spreadsheet to remember if data needs to be removed, doesn't affect real visibility.
      Parameters:
      visible - true to set visible, false to set hidden
    • getAnchor

      public org.apache.poi.ss.usermodel.ClientAnchor getAnchor()
      Gets the anchor for this image within the sheet containing this image.
      Returns:
      Anchor for this image
    • getResourceHandler

      public com.vaadin.flow.server.streams.DownloadHandler getResourceHandler()
      Gets the handler serving this image
      Returns:
      Image resource
    • getComponent

      public com.vaadin.flow.component.Component getComponent(boolean init)
      Returns the component contained in this wrapper if there is one.
      Parameters:
      init - false if you don't want to initialize the component, calling with true after the first time has no effect.
    • getType

      public abstract OverlayInfo.Type getType()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object