Common Lisp Interface Manager 2.0 User's Guide > Chapter 17 Formatted Output > 17.5 Advanced Topics

NextPrevUpTopContentsIndex

17.5.1 The Table Formatting Protocol

Any output record class that implements the following generic functions is said to support the table formatting protocol.

In the following subsections, the term "non-table output records" will be used to mean any output record that is not a table, row, column, cell, or item list output record. When CLIM "skips over intervening non-table output records," this means that it will bypass all the output records between two such table output records (such as a table and a row, or a row and a cell) that are not records of those classes (most notably, presentation output records). CLIM detects invalid nesting of table output records, such as a row within a row, a cell within a cell, or a row within a cell. Note that this does not prohibit the nesting of calls to formatting-table , it simply requires that programmers include the inner table within one of the cells of the outer table.

table-output-record [Protocol Class]	

Summary: The protocol class that represents tabular output records; a subclass of output-record . If you want to create a new class that behaves like a table output record, it should be a subclass of table-output-record . Subclasses of table-output-record must obey the table output record protocol.

table-output-record-p [Function]	

Arguments: object

Summary: Returns t if object is a table output record; otherwise, it returns nil .

:x-spacing

:y-spacing

:multiple-columns-x-spacing

:equalize-column-widths

Summary: All subclasses of table-output-record must handle these initargs, which are used to specify, respectively, the x and y spacing, the multiple column x spacing, and equal-width columns attributes of the table.

standard-table-output-record

Summary: The instantiable class of output record that represents tabular output. Its children will be a sequence of either rows or columns, with presentation output records possibly intervening. This is a subclass of table-output-record .

map-over-table-elements [Generic Function]

Arguments: function table-record type

Summary: Applies function to all the rows or columns of table-record that are of type type . type is either :row , :column , or :row-or-column . function is a function of one argument, an output record; it has dynamic extent. map-over-table-elements ensures that rows, columns, and cells are properly nested. It skips over intervening non-table output record structure, such as presentations.

adjust-table-cells [Generic Function]

Arguments: table-record stream

Summary: This function is called after the tabular output has been collected, but before it has been replayed. The method on standard-table-output-record implements the usual table layout constraint solver by moving the rows or columns of the table output record table-record and the cells within the rows or columns. stream is the stream on which the table is displayed.

adjust-multiple-columns [Generic Function]

Arguments: table-record stream

Summary: This is called after adjust-table-cells to account for the case where the programmer wants to break the entire table up into multiple columns. Each of those columns will have some of the rows of the "original" table, and those rows may each have several columns. For example:

Original table:

a 1 alpha

b 2 beta

c 3 gamma

d 4 delta

Multiple column version:

a 1 alpha c 3 gamma

b 2 beta d 4 delta

table-record and stream are as for adjust-table-cells .

17.5.1.1 The Row and Column Formatting Protocol

17.5.1.2 The Cell Formatting Protocol


Common Lisp Interface Manager 2.0 User's Guide - 22 Dec 2009

NextPrevUpTopContentsIndex