d24b96eb6d244fee4756f0350dc32b89ddadc20c
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Collection / Grid.pm
1 package Reaction::UI::ViewPort::Collection::Grid;
2
3 use Reaction::Class;
4
5 use aliased 'Reaction::InterfaceModel::Collection' => 'IM_Collection';
6 use aliased 'Reaction::UI::ViewPort::Collection::Grid::Member';
7
8 use namespace::clean -except => [ qw(meta) ];
9 use MooseX::Types::Moose qw/ArrayRef HashRef Int/;
10 extends 'Reaction::UI::ViewPort::Collection';
11
12 with 'Reaction::UI::ViewPort::Role::FieldArgs';
13
14 has member_action_count => (
15   is => 'rw',
16   isa => Int,
17   required => 1,
18   lazy => 1,
19   default => sub {
20     my $self = shift;
21     for (@{ $self->members }) {
22       my $protos = $_->action_prototypes;
23       return scalar(keys(%$protos));
24     }
25     return 1;
26   },
27 );
28
29 sub _build_member_class { Member };
30
31 __PACKAGE__->meta->make_immutable;
32
33
34 1;
35
36 __END__;
37
38 =head1 NAME
39
40 Reaction::UI::ViewPort::Collection
41
42 =head1 DESCRIPTION
43
44 This subclass of L<Reaction::UI::ViewPort::Collection> allows you to display a
45 homogenous collection of Reaction::InterfaceModel::Objects as a grid.
46
47 =head1 ATTRIBUTES
48
49 =head2 field_order
50
51 =head2 excluded_fields
52
53 List of field names to exclude.
54
55 =head2 included_fields
56
57 List of field names to include. If both C<included_fields> and
58 C<excluded_fields> are specified the result is those fields which
59 are in C<included_fields> and not in C<excluded_fields>.
60
61 =head2 included_fields
62
63 List of field names to include. If both C<included_fields> and
64 C<excluded_fields> are specified the result is those fields which
65 are in C<included_fields> and not in C<excluded_fields>.
66
67
68 =head2 field_labels
69
70 =head2 _raw_field_labels
71
72 =head2 computed_field_order
73
74 =head2 member_action_count
75
76 =head1 INTERNAL METHODS
77
78 These methods, although stable, are subject to change without notice. These are meant
79 to be used only by developers. End users should refrain from using these methods to
80 avoid potential breakages.
81
82 =head1 SEE ALSO
83
84 L<Reaction::UI::ViewPort::Collection>
85
86 =head1 AUTHORS
87
88 See L<Reaction::Class> for authors.
89
90 =head1 LICENSE
91
92 See L<Reaction::Class> for the license.
93
94 =cut