class Tablo::RowGroup(T)

Overview

Each time the source is read, an instance of the RowGroup class is created to display Body and all other preceeding possible row types and rule types.

The main purpose of the RowGroup class is to manage the alternation of different row types and their separating rule types.

To do this, the previous and current row types are used to determine the rule type and deduce border position to be used (see ROWTYPE_POSITION below).

From one instance to the next, the RowGroup class has no memory: the Table.rowtype_memory class variable is therefore used to ensure the link: when a new instance of RowGroup is created, the previous_rowtype instance variable is initialized by Table.rowtype_memory, and on exit from RowGroup's run method, the current_rowtype instance variable is assigned to Table.rowtype_memory.

Linking conditions between table :main and table :summary is governed by the class variable Table.transition_footer, where we store the footer of :main or nil, depending of the last rowtype of :main. This info is then use on first row of :summary to properly link or not the two tables.

Defined in:

rowgroup.cr

Constant Summary

ROWTYPE_POSITION = { {RowType::Body, RowType::Body} => Position::BodyBody, {RowType::Body, :bottom} => Position::BodyBottom, {RowType::Body, :filler} => Position::BodyFiller, {RowType::Body, RowType::Group} => Position::BodyGroup, {RowType::Body, RowType::Header} => Position::BodyHeader, {RowType::Body, RowType::Footer} => Position::BodyTitle, {RowType::Body, RowType::Title} => Position::BodyTitle, {RowType::Body, :top} => Position::BodyTop, {RowType::Group, RowType::Header} => Position::GroupHeader, {RowType::Group, :top} => Position::GroupTop, {RowType::Header, RowType::Body} => Position::HeaderBody, {RowType::Header, :top} => Position::HeaderTop, {:summary, RowType::Body} => Position::SummaryBody, {:summary, RowType::Header} => Position::SummaryHeader, {RowType::Footer, RowType::Body} => Position::TitleBody, {RowType::Title, RowType::Body} => Position::TitleBody, {RowType::Footer, :bottom} => Position::TitleBottom, {RowType::SubTitle, :bottom} => Position::TitleBottom, {RowType::Title, :bottom} => Position::TitleBottom, {RowType::Footer, RowType::Group} => Position::TitleGroup, {RowType::SubTitle, RowType::Group} => Position::TitleGroup, {RowType::Title, RowType::Group} => Position::TitleGroup, {RowType::Footer, RowType::Header} => Position::TitleHeader, {RowType::SubTitle, RowType::Header} => Position::TitleHeader, {RowType::Title, RowType::Header} => Position::TitleHeader, {RowType::Footer, RowType::Title} => Position::TitleTitle, {RowType::Title, RowType::SubTitle} => Position::TitleTitle, {RowType::Title, RowType::Title} => Position::TitleTitle, {RowType::Footer, :top} => Position::TitleTop, {RowType::SubTitle, :top} => Position::TitleTop, {RowType::Title, :top} => Position::TitleTop}

Constructors

Instance Method Summary

Constructor Detail

def self.new(table : Table(T), source : T, row_divider : Bool | Nil, row_index : Int32) #

[View source]

Instance Method Detail

def add_row(rows, linenum = 0) #

[View source]
def add_rowtype #

[View source]
def add_rule(position, groups = nil, linenum = 0) #

[View source]
def close_table #

[View source]
def current_rowtype : RowType | Nil #

property previous_rowtype : RowType? = Table.previous_rowtype


[View source]
def current_rowtype=(current_rowtype : RowType | Nil) #

property previous_rowtype : RowType? = Table.previous_rowtype


[View source]
def framed?(rowtype) #

[View source]
def previous_rowtype : RowType | Nil #

Whenever we enter rowgroup, we retrieve the previous rowtype from the recorded value in class variable Table.rowtype_memory


[View source]
def previous_rowtype=(previous_rowtype : RowType | Nil) #

Whenever we enter rowgroup, we retrieve the previous rowtype from the recorded value in class variable Table.rowtype_memory


[View source]
def rows #

[View source]
def rows=(rows : Array(String)) #

[View source]
def run #

[View source]