1Prima::DetailedList(3)User Contributed Perl DocumentationPrima::DetailedList(3)
2
3
4

NAME

6       Prima::DetailedList - a multi-column list viewer with controlling
7       header widget.
8

SYNOPSIS

10       use Prima::DetailedList;
11
12               use Prima qw(DetailedList Application);
13               my $l = Prima::DetailedList->new(
14                       columns => 2,
15                       headers => [ 'Column 1', 'Column 2' ],
16                       items => [
17                               ['Row 1, Col 1', 'Row 1, Col 2'],
18                               ['Row 2, Col 1', 'Row 2, Col 2']
19                       ],
20               );
21               $l-> sort(1);
22               run Prima;
23

DESCRIPTION

25       Prima::DetailedList is a descendant of Prima::ListViewer, and as such
26       provides a certain level of abstraction. It overloads format of items
27       in order to support multi-column ( 2D ) cell span. It also inserts
28       Prima::Header widget on top of the list, so the user can interactively
29       move, resize and sort the content of the list. The sorting mechanism is
30       realized inside the package; it is activated by the mouse click on a
31       header tab.
32
33       Since the class inherits Prima::ListViewer, some functionality, like
34       'item search by key', or "get_item_text" method can not operate on 2D
35       lists. Therefore, mainColumn property is introduced, that selects the
36       column representing all the data.
37

API

39   Events
40       Sort COLUMN, DIRECTION
41           Called inside sort method, to facilitate custom algorithms of
42           sorting.  If the callback procedure is willing to sort by COLUMN
43           index, then it must call "clear_event", to signal the event flow
44           stop. The DIRECTION is a boolean flag, specifying whether the
45           sorting must be performed is ascending ( 1 ) or descending ( 0 )
46           order.
47
48           The callback procedure must operate on the internal storage of
49           "{items}", which is an array of arrays of scalars.
50
51           The default action is the literal sorting algorithm, where
52           precedence is arbitrated by "cmp" operator ( see "Equality
53           Operators" in perlop ) .
54
55   Properties
56       aligns ARRAY
57           Array of "ta::" align constants, where each defined the column
58           alignment.  Where an item in the array is undef, it means that the
59           value of the "align" property must be used.
60
61       columns INTEGER
62           Governs the number of columns in items. If set-called, and the new
63           number is different from the old number, both items and headers are
64           restructured.
65
66           Default value: 0
67
68       headerClass
69           Assigns a header class.
70
71           Create-only property.
72
73           Default value: "Prima::Header"
74
75       headerProfile HASH
76           Assigns hash of properties, passed to the header widget during the
77           creation.
78
79           Create-only property.
80
81       headerDelegations ARRAY
82           Assigns a header widget list of delegated notifications.
83
84           Create-only property.
85
86       headers ARRAY
87           Array of strings, passed to the header widget as column titles.
88
89       items ARRAY
90           Array of arrays of scalars, of arbitrary kind. The default
91           behavior, however, assumes that the scalars are strings.  The data
92           direction is from left to right and from top to bottom.
93
94       mainColumn INTEGER
95           Selects the column, responsible for representation of all the data.
96           As the user clicks the header tab, "mainColumn" is automatically
97           changed to the corresponding column.
98
99           Default value: 0
100
101   Methods
102       sort [ COLUMN ]
103           Sorts items by the COLUMN index in ascending order. If COLUMN is
104           not specified, sorts by the last specified column, or by #0 if it
105           is the first "sort" invocation.
106
107           If COLUMN was specified, and the last specified column equals to
108           COLUMN, the sort direction is reversed.
109
110           The method does not perform sorting itself, but invokes Sort
111           notification, so the sorting algorithms can be overloaded, or be
112           applied differently to the columns.
113

AUTHOR

115       Dmitry Karasik, <dmitry@karasik.eu.org>.
116

SEE ALSO

118       Prima, Prima::Lists, Prima::Header, examples/sheet.pl
119
120
121
122perl v5.30.0                      2019-08-21            Prima::DetailedList(3)
Impressum