Package de.hsh.graja.util.comment.grid
Class GridCell
java.lang.Object
de.hsh.graja.util.comment.grid.GridCell
- All Implemented Interfaces:
Serializable
,Comparable<GridCell>
- Direct Known Subclasses:
GridCellMulti
,GridCellSingle
A cell of a grid.
Columns and rows, that consist of empty cells only, are hidden automatically.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A helper interface to execute a method for each position of the cell. -
Constructor Summary
ConstructorsConstructorDescriptionGridCell
(GridCellPos pos, Content content, GridCellType type, GridCellAlignment align, GridCellShowMode showMode, Double brightness, GridCellWidth width, GridCellPadding padding, String id) Create a cell of the grid. -
Method Summary
Modifier and TypeMethodDescriptioncolsSet
(IntPredicate filter) int
boolean
implements the contract ofObject.equals(Object)
.abstract void
Execute a method for each positiongetAlign()
abstract GridCellDim
getDim()
getId()
getPos()
getType()
boolean
hasColsInExcept
(Collection<Integer> inCollection, int except) boolean
hasColsPassing
(IntPredicate filter) int
hashCode()
implements the contract ofObject.hashCode()
.boolean
hasRowsInExcept
(Collection<Integer> inCollection, int except) boolean
hasRowsPassing
(IntPredicate filter) rowsSet
(IntPredicate filter) void
setBrightness
(Double brightness) Set the background brightnessvoid
Set the idvoid
setShrinkWidthMode
(GridCellWidth width) Set the width of the cell.
-
Constructor Details
-
GridCell
public GridCell(GridCellPos pos, Content content, GridCellType type, GridCellAlignment align, GridCellShowMode showMode, Double brightness, GridCellWidth width, GridCellPadding padding, String id) Create a cell of the grid.- Parameters:
pos
- the upper left corner (0-based index)content
- the cell content (may be null, if there is no content)type
- header or notalign
- alignmentshowMode
- show modebrightness
- background brightness. 1 means white, 0 means black. null means: transparent.width
- the widthpadding
- paddingid
- id (used as postfix of CSS id)
-
-
Method Details
-
toString
- See Also:
-
getPos
- Returns:
- the upper left corner (0-based index)
-
getContent
- Returns:
- the content
-
getType
- Returns:
- the type of the cell (header, normal).
-
getAlign
- Returns:
- the alignment of the cell (left, center, ...)
-
getDim
- Returns:
- the dimensions (width and height). Single cells always return (1,1).
-
colsSet
- Parameters:
filter
- if null, nothing is filtered- Returns:
- a set of integers with the range of columns spanned by this cell
-
hasColsPassing
- Parameters:
filter
- if null, nothing is filtered- Returns:
- true, if this cell spans at least one column whose index passes the given filter. If filter is null, the answer is always true.
-
rowsSet
- Parameters:
filter
- if null, nothing is filtered- Returns:
- a set of integers with the range of rows spanned by this cell
-
hasRowsPassing
- Parameters:
filter
- if null, nothing is filtered- Returns:
- true, if this cell spans at least one row whose index passes the given filter. If filter is null, the answer is always true.
-
hasColsInExcept
- Returns:
- true, if this cell spans at least one column whose index is contained in
inCollection
but is not equal toexcept
.
-
hasRowsInExcept
- Returns:
- true, if this cell spans at least one row whose index is contained in
inCollection
but is not equal toexcept
.
-
getShowMode
- Returns:
- the show mode of the cell (empty? defensive?)
-
getBrightness
- Returns:
- the background brightness. 1 means white, 0 means black, null means transparent.
-
setBrightness
Set the background brightness- Parameters:
brightness
- 1 means white, 0 means black, 0 means transparent.
-
getShrinkWidthMode
- Returns:
- the width of the cell
-
setShrinkWidthMode
Set the width of the cell.- Parameters:
width
- The new value.
-
getPadding
- Returns:
- the padding of the cell
-
getId
- Returns:
- the CSS id of the cell
-
setId
Set the id- Parameters:
id
- id
-
forEach
Execute a method for each position- Parameters:
p
- the processor
-
compareTo
- Specified by:
compareTo
in interfaceComparable<GridCell>
-
hashCode
public int hashCode()implements the contract ofObject.hashCode()
. -
equals
implements the contract ofObject.equals(Object)
.
-