Next / Previous / Contents / TCC Help System / NM Tech homepage

45.5. PhysRow.fo(): Render as XSL-FO

The output is a table-row element. A number of the attributes of this row depend on its position within the set of physical rows in a logical row; these attributes are set up by Section 45.6, “PhysRow._rowAttributes(): Decorate a physical row” .

cbchistlib.py
# - - -   P h y s R o w . f o

    def fo(self, s, rowx, nRows):
        '''Render as XSL-FO.
        '''
        #-- 1
        #   row  :=  that element ]
        rowAttrs = self._rowAttributes(rowx, nRows)

        #-- 2
        row = s.start("table-row", rowAttrs)

In the first physical row, the label spans all the physical rows of the first column; see Section 33.3, “RowLabel.fo(). The remaining physical rows contain only the detail cells, so in those cases we don't even generate a label cell; generation starts with the first detail cell.

cbchistlib.py
        #-- 3
        # [ if self._span > 0 ->
        #     s  +:=  a table-cell representing self._rowLabel,
        #             spanned over (self._span) rows
        #   else -> I ]
        if self._span > 0:
            self._rowLabel.fo(s, self._span)

Each cell is rendered using the virtual interface defined in Section 37, “class Cell: Base class for table cells”. For cells whose left border are thickened for column group, we'll add an entry to the attrs dictionary to increase the border-left-width.

cbchistlib.py
        #-- 4
        # [ s  +:=  detail cells of self rendered as XSL-FO, with
        #           appropriate style for their physical column ]
        for colx, cell in enumerate(self._cellList):
            #-- 4 body
            # [ s  +:=  a detail cell made from (cell) with borders
            #       thickened according to the row's position within
            #       the group ]
            colAttrs = {}
            if (colx % COL_GROUPING) == 0:
                colAttrs.update(fo.dash(borderLeftWidth=FO_MED_DIM))
            if rowx == 0:
                colAttrs.update(fo.dash(borderTopWidth=FO_THICK_DIM))
            elif (rowx % ROW_GROUPING) == 0:
                colAttrs.update(fo.dash(borderTopWidth=FO_MED_DIM))
            if rowx == (nRows-1):
                colAttrs.update(fo.dash(borderBottomWidth=FO_THICK_DIM))

            cell.fo(s, **colAttrs)

        #-- 5
        row.end()