Mercurial > pub > Impl
diff Lib/IMPL/Web/TT/Document.pm @ 107:0e72ad99eef7
Updated Web::TT
author | wizard |
---|---|
date | Thu, 13 May 2010 03:46:29 +0400 |
parents | 964587c5183c |
children | c6fb6964de4c |
line wrap: on
line diff
--- a/Lib/IMPL/Web/TT/Document.pm Wed May 12 17:52:12 2010 +0400 +++ b/Lib/IMPL/Web/TT/Document.pm Thu May 13 03:46:29 2010 +0400 @@ -8,18 +8,31 @@ use IMPL::Class::Property; use File::Spec; use Scalar::Util qw(blessed); +use IMPL::Web::TT::Collection; +use IMPL::Web::TT::Control; BEGIN { private property _provider => prop_all; private property _context => prop_all; public property template => prop_get | owner_set; public property presenter => prop_all, { validate => \&_validatePresenter }; + public property controls => { get => \&_getControls }; } our %CTOR = ( 'IMPL::DOM::Document' => sub { nodeName => 'document' } ); +sub CTOR { + my ($this) = @_; + + $this->appendChild( + $this->Create( + controls => 'IMPL::Web::TT::Collection' + ) + ) +} + sub provider { my ($this,%args) = @_; @@ -45,7 +58,8 @@ this => $this, render => sub { $this->_process(@_); - } + }, + controls => $this->controls }, TRIM => 1, RECURSION => 1, @@ -55,6 +69,20 @@ } } +sub createControl { + my ($this,$name,$args) = @_; + + my $node = $this->Create($name,'IMPL::Web::TT::Control',$args); + $this->controls->appendChild($node); +} + +sub _getControls { + my ($this) = @_; + + my ($node) = $this->selectNodes('controls'); + return $node; +} + sub _validatePresenter { my ($this,$value) = @_; @@ -122,7 +150,7 @@ } } - return join '',@items; + return join '',@result; } sub Dispose {