Package io.keikai.model
Class ViewAnchor
- java.lang.Object
-
- io.keikai.model.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ViewAnchor.AnchorType
AnchorType
-
Constructor Summary
Constructors Constructor Description ViewAnchor(int rowIndex, int columnIndex, int width, int height)
Create a view anchor with indexes for left-top corner cell, width, and height.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(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, andViewAnchor.AnchorType
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewAnchor
cloneViewAnchor()
ViewAnchor.AnchorType
getAnchorType()
Returns the anchor type.int
getColumnIndex()
int
getHeight()
ViewAnchor
getRightBottomAnchor(SSheet sheet)
int
getRowIndex()
int
getWidth()
Width of the anchor, in pixels.int
getXOffset()
The x offset to left border of the anchor's left-top cell.int
getYOffset()
The y offset to top border of the anchor's left-top cell.void
setAnchorType(ViewAnchor.AnchorType anchorType)
Sets the anchor type.void
setColumnIndex(int columnIndex)
set the left-top cell's column indexvoid
setHeight(int height)
set the height of the anchor in pixels.void
setRowIndex(int rowIndex)
set the left-top cell's row indexvoid
setWidth(int width)
Set width of the anchor in pixels.void
setXOffset(int xOffset)
void
setYOffset(int yOffset)
String
toString()
-
-
-
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, andViewAnchor.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()
-
getAnchorType
public ViewAnchor.AnchorType getAnchorType()
Returns the anchor type. Default:ViewAnchor.AnchorType.MOVE_AND_RESIZE
- Since:
- 5.9.0
-
setAnchorType
public void setAnchorType(ViewAnchor.AnchorType anchorType)
Sets the anchor type.- Since:
- 5.9.0
-
-