Class Grid

    • Constructor Detail

      • Grid

        public Grid​(GridCellDim dim,
                    IncludeSpec includeSpec)
        Create a grid of given size
        Parameters:
        dim - size of the grid
    • Method Detail

      • getNestedContents

        public Iterable<Content> getNestedContents()
        Specified by:
        getNestedContents in class Content
        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

        public Iterable<GridCell> getCells()
        Returns:
        a list of all cells. The list will not reflect any subsequent changes to the grid.
      • getContents

        public Iterable<Content> getContents()
        Returns:
        a list of all contents. The list will not reflect any subsequent changes to the grid.
      • setCell

        public void setCell​(GridCell cell)
        add a cell (single or multi) to the grid.
        Parameters:
        cell - the cell to be inserted.
      • validate

        public void validate()
                      throws AssertionError
        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
      • getCell

        public GridCell getCell​(GridCellPos pos)
        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

        public Content getContent​(GridCellPos pos)
        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

        public GridCell findCellSpanning​(GridCellPos pos)
        Parameters:
        pos - query position
        Returns:
        the cell (single or multi) containing the given position
      • toString

        public String toString​(String prefix)
        Description copied from class: Content
        This method is for debugging purposes.
        Overrides:
        toString in class Content
        Parameters:
        prefix - If the output has multiple lines, prefix specifies the indentation of the subsequent lines.
        Returns:
        a string representation of the content and it's internal structure.
        See Also:
        Content.toString(String)
      • 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 class Content
        Parameters:
        sb - HTML code result
        includeInfo - controls, which content to be rendered.
        ctx - render context
        useJavascript - if true, the generated HTML code will contain Javascript
        See Also:
        de.hsh.graja.util.comment.Content#renderHtml(StringBuilder, IncludeInfo, RenderContext)
      • hideRow

        public Action hideRow​(int row)
        Parameters:
        row - index of original row. When rendering, the original row will be mapped to a "printed" row.
        Returns:
      • showRow

        public Action showRow​(int row)
      • onHideRow

        public Grid onHideRow​(int row,
                              Action action)
      • onShowRow

        public Grid onShowRow​(int row,
                              Action action)