fixed layout path for ArrayRef type
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort.pm
index 03f915d..7d24efc 100644 (file)
@@ -1,6 +1,7 @@
 package Reaction::UI::ViewPort;
 
 use Reaction::Class;
+use Scalar::Util qw/blessed/;
 
 class ViewPort which {
 
@@ -15,7 +16,6 @@ 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 {
     '';
@@ -53,19 +53,25 @@ class ViewPort which {
 
   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) {
@@ -83,7 +89,8 @@ class ViewPort which {
     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});
       }
     }
@@ -234,7 +241,7 @@ ViewPorts classname.
 
 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
@@ -375,7 +382,7 @@ returns the location and the name, joined with a colon.
 
 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.