com.vaadin.flow.component.spreadsheet.
Class SheetOverlayWrapper
- java.lang.Object
-
- com.vaadin.flow.component.spreadsheet.SheetOverlayWrapper
-
All Implemented Interfaces:
Direct Known Subclasses:
public abstract class SheetOverlayWrapper extends Object implements Serializable
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SheetOverlayWrapper.OverlayChangeListener
-
Constructor Summary
Constructors Constructor Description SheetOverlayWrapper(org.apache.poi.ss.usermodel.ClientAnchor anchor)
-
Method Summary
All Methods Modifier and Type Method Description boolean
equals(Object obj)
org.apache.poi.ss.usermodel.ClientAnchor
getAnchor()
Gets the anchor for this image within the sheet containing this image.
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.
String
getId()
Returns a unique ID of this overlay, used also as a resource key for images.
StreamResource
getResource()
abstract OverlayInfo.Type
getType()
float
getWidth(org.apache.poi.ss.usermodel.Sheet sheet, int[] colW, int defaultColumnWidthPX)
Calculates the width of the image.
int
hashCode()
boolean
isVisible()
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
setOverlayChangeListener(SheetOverlayWrapper.OverlayChangeListener listener)
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.
String
toString()
-
-
-
Method Detail
-
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-basedc1
- Column index of leftmost column, 1-basedr2
- Row index of bottom-most row, 1-basedc2
- Column index of rightmost column, 1-basedReturns:
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 tocolW
- Array of column widths in pixelsdefaultColumnWidthPX
- Default column width in pixelsReturns:
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 torowH
- Array of row heights in pointsReturns:
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
-
getResource
public StreamResource getResource()
-
getComponent
public 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()
-
-