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               my $l = $w-> insert( 'Prima::DetailedList',
13                       columns => 2,
14                       headers => [ 'Column 1', 'Column 2' ],
15                       items => [
16                               ['Row 1, Col 1', 'Row 1, Col 2'],
17                               ['Row 2, Col 1', 'Row 2, Col 2']
18                       ],
19               );
20               $l-> sort(1);
21

DESCRIPTION

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

API

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

AUTHOR

113       Dmitry Karasik, <dmitry@karasik.eu.org>.
114

SEE ALSO

116       Prima, Prima::Lists, Prima::Header, examples/sheet.pl
117
118
119
120perl v5.28.0                      2017-03-24            Prima::DetailedList(3)
Impressum