Package de.hsh.graja.util.comment.grid
Class Grid
java.lang.Object
de.hsh.graja.util.comment.Content
de.hsh.graja.util.comment.AbstractSequenceContent
de.hsh.graja.util.comment.grid.Grid
- All Implemented Interfaces:
Serializable
A grid represents a whole table that can have single and multi cells.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class de.hsh.graja.util.comment.Content
EXCLUSIVE, renderUuid
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
implements the contract ofObject.equals(Object)
.getCell
(GridCellPos pos) getCells()
int
getCols()
getContent
(GridCellPos pos) getDim()
int
getRows()
int
hashCode()
implements the contract ofObject.hashCode()
.hideRow
(int row) void
observeRowHidden
(int row, CallableAction<IfThenElseCompositeConditionedAction> action) void
observeRowShowing
(int row, CallableAction<IfThenElseCompositeConditionedAction> action) void
renderHtmlImpl
(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx, boolean useJavascript) render content to HTML.void
renderPlainImpl
(StringBuilder appender, IncludeInfo includeInfo, RenderContext ctx) render content to plain text.void
add a cell (single or multi) to the grid.void
setMultiCell
(GridCellPos pos, GridCellDim dim, Content content, GridCellType type, GridCellAlignment align, GridCellShowMode showMode, Double brightness, GridCellWidth width, GridCellPadding padding, String id) add a cell spanning multiple rows or columns to the gridvoid
setSingleCell
(GridCellPos pos, Content content, GridCellType type, GridCellAlignment align, GridCellShowMode showMode, Double brightness, GridCellWidth width, GridCellPadding padding, String id) add a single cell to the gridshowRow
(int row) This method is for debugging purposes.void
validate()
checks, that there are no overlapping cells and no duplicate ids.Methods inherited from class de.hsh.graja.util.comment.AbstractSequenceContent
isInlineContent
Methods inherited from class de.hsh.graja.util.comment.Content
click, dehighlight, disableCallerStacktraceRecording, enableCallerStacktraceRecording, excludeGlobally, getIncludeSpec, getRenderUuid, getStackdump, hide, highlight, include, isCallerStacktraceRecordingEnabled, isHidden, isShowing, onClick, onClick, onHide, onHide, onLoad, onLoad, onShow, onShow, registerCallable, renderHtml, renderHtml, renderIdAttribute, renderJavascriptOncePerClass, renderOnClickAttribute, renderPlain, renderPlain, setGlobalIncludeInfo, setHref, setIncludeSpec, show, toString
-
Constructor Details
-
Grid
Create a grid of given size- Parameters:
dim
- size of the grid
-
-
Method Details
-
getNestedContents
- Specified by:
getNestedContents
in classContent
- Returns:
- the set of contents nested in this content. Nested contents can be list items in a List, elements in a Sequence, elements in a Grid, elements in a Paragraph, and so on. If this is a leaf content, the returned set is empty.
-
getCells
- Returns:
- a list of all cells. The list will not reflect any subsequent changes to the grid.
-
getContents
- Returns:
- a list of all contents. The list will not reflect any subsequent changes to the grid.
-
setSingleCell
public void setSingleCell(GridCellPos pos, Content content, GridCellType type, GridCellAlignment align, GridCellShowMode showMode, Double brightness, GridCellWidth width, GridCellPadding padding, String id) add a single cell to the grid- Parameters:
pos
- positioncontent
- contenttype
- type (header or normal)align
- alignment (left, center, right)showMode
-brightness
-width
-padding
-id
-
-
setMultiCell
public void setMultiCell(GridCellPos pos, GridCellDim dim, Content content, GridCellType type, GridCellAlignment align, GridCellShowMode showMode, Double brightness, GridCellWidth width, GridCellPadding padding, String id) add a cell spanning multiple rows or columns to the grid- Parameters:
pos
- positiondim
- region of spanned cellscontent
- contenttype
- type (header or normal)align
- alignmentshowMode
-brightness
-width
-padding
-id
-
-
setCell
add a cell (single or multi) to the grid.- Parameters:
cell
- the cell to be inserted.
-
validate
checks, that there are no overlapping cells and no duplicate ids. Otherwise throws an AssertionError.- Throws:
AssertionError
-
getRows
public int getRows()- Returns:
- height
-
getCols
public int getCols()- Returns:
- width
-
getDim
- Returns:
- dim
-
getCell
- Parameters:
pos
- query position- Returns:
- cell at given position or null, if there is no cell. If the position is spanned by a multicell and pos is not the upper left corner of the multi cell, null is returned.
-
getContent
- Parameters:
pos
- query position- Returns:
- cell content at given position or null, if there is no cell or no content. If the position is spanned by a multicell and pos is not the upper left corner of the multi cell, null is returned.
-
findCellSpanning
- Parameters:
pos
- query position- Returns:
- the cell (single or multi) containing the given position
-
hashCode
public int hashCode()implements the contract ofObject.hashCode()
. -
equals
implements the contract ofObject.equals(Object)
. -
toString
Description copied from class:Content
This method is for debugging purposes. -
renderHtmlImpl
public void renderHtmlImpl(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx, boolean useJavascript) Description copied from class:Content
render content to HTML. This method is meant to be overriden by subclasses.- Specified by:
renderHtmlImpl
in classContent
- Parameters:
sb
- HTML code resultincludeInfo
- controls, which content to be rendered.ctx
- render contextuseJavascript
- if true, the generated HTML code will contain Javascript- See Also:
-
de.hsh.graja.util.comment.Content#renderHtml(StringBuilder, IncludeInfo, RenderContext)
-
hideRow
- Parameters:
row
- index of original row. When rendering, the original row will be mapped to a "printed" row.- Returns:
-
showRow
-
observeRowHidden
-
observeRowShowing
-
onHideRow
-
onShowRow
-
renderPlainImpl
Description copied from class:Content
render content to plain text. This method is meant to be overriden by subclasses.- Specified by:
renderPlainImpl
in classContent
- Parameters:
appender
- plain text resultincludeInfo
- controls, which content to be rendered.ctx
- render context (unused).- See Also:
-