package Reaction::UI::ViewPort;
use Reaction::Class;
+use Scalar::Util qw/blessed/;
class ViewPort which {
isa => 'HashRef', is => 'ro', default => sub { {} }
);
has ctx => (isa => 'Catalyst', is => 'ro', required => 1);
- has column_order => (is => 'rw');
implements _build_layout => as {
'';
implements apply_events => as {
my ($self, $ctx, $events) = @_;
+ return unless keys %$events;
$self->apply_child_events($ctx, $events);
$self->apply_our_events($ctx, $events);
};
implements apply_child_events => as {
my ($self, $ctx, $events) = @_;
+ return unless keys %$events;
foreach my $child ($self->child_event_sinks) {
+ confess blessed($child) ."($child) is not a valid object"
+ unless blessed($child) && $child->can('apply_events');
$child->apply_events($ctx, $events);
}
};
implements apply_our_events => as {
my ($self, $ctx, $events) = @_;
+ my @keys = keys %$events;
+ return unless @keys;
my $loc = $self->location;
my %our_events;
foreach my $key (keys %$events) {
my ($self, $events) = @_;
foreach my $event ($self->accept_events) {
if (exists $events->{$event}) {
- $self->ctx->log->debug("Applying Event: $event with value: ". $events->{$event});
+ #my $name = eval{$self->name};
+ #$self->ctx->log->debug("Applying Event: $event on $name with value: ". $events->{$event});
$self->$event($events->{$event});
}
}
This is generally used by more specialised ViewPorts such as the
L<ListView|Reaction::UI::ViewPort::ListView> or
-L<ActionForm|Reaction::UI::ViewPort::ActionForm>. It can be either a
+L<Action|Reaction::UI::ViewPort::Action>. It can be either a
space separated list of column names, or an arrayref of column names.
=back
Sorts the given list of items such that the ones that also appear in
the spec are at the beginning. This is called by
-L<Reaction::UI::ViewPort::ActionForm> and
+L<Reaction::UI::ViewPort::Action> and
L<Reaction::UI::ViewPort::ListView>, and gets passed L<column_order>
as the spec argument.