table_widget1 (library)

Author(s): Isabel Martín García.

In addition to the features explained in the introduction, the predicates exported by this module depict tables in which the font weight for the table elements is bold.

If the arguments are not in a correct format the exception error8 will be thrown.


Usage and interface

Documentation on exports

PREDICATE
tablewidget1(Title,Header,ElementTable,Footer)

Shows a regular table in a window. The user does not choose a background image.

Example:

tablewidget1('This is the title',
	     'Header text',
	     [['Number of processors','8'],['Average processors','95'],
	         ['Average Tasks per fork','7.5']],
	     'Footer text').

Usage:

  • The following properties should hold at call time:
    (genbar1:title/1)Title is a text (an atom) to be used as label, usually not very long.
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (table_widget1:table/1)table_widget1:table(ElementTable)
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.

PREDICATE
tablewidget1(Title,Header,ElementTable,Footer,BackgroundImage)

Shows a regular table in a window. The user must set a background image. See the image/1 type definition.

Example:

tablewidget1('This is the title',
	     'Header text',
	     [['Number of processors','8'],['Average processors','95'],
	         ['Average Tasks per fork','7.5']],
	     'Footer text',
	     './images/rain.gif')

Usage:

  • The following properties should hold at call time:
    (genbar1:title/1)Title is a text (an atom) to be used as label, usually not very long.
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (table_widget1:table/1)table_widget1:table(ElementTable)
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.
    (table_widget1:image/1)table_widget1:image(BackgroundImage)

REGTYPE
A table is a list of rows, each row must contain the same number of elements, otherwise the table wouldn't be regular and an exception will be thrown by the library. The rows list may not be empty.
table([X]) :-
        row(X).
table([X|Xs]) :-
        row(X),
        table(Xs).

REGTYPE
Some predicates allow the user to set the widget background image, whose is what this type is intended for. The user has to take into account the following restrictions:

  • The image must be in gif format.

  • The file path must be absolute.

Documentation on internals

REGTYPE
row([X]) :-
        cell_value(X).
row([X|Xs]) :-
        cell_value(X),
        row(Xs).
Each row is a list of elements whose type is cell_value/1. A row cannot be an empty list, as you can see in the definition type.

REGTYPE
row([X]) :-
        cell_value(X).
row([X|Xs]) :-
        cell_value(X),
        row(Xs).
Each row is a list of elements whose type is cell_value/1. A row cannot be an empty list, as you can see in the definition type.

REGTYPE
This type defines the possible values that a table element have. If any cell value is , the cell will be displayed empty.
cell_value(X) :-
        atomic(X).