78
|
1 package IMPL::Web::TT::Control;
|
|
2
|
|
3 use base qw(IMPL::DOM::Node);
|
|
4
|
|
5 use IMPL::Class::Property;
|
|
6
|
107
|
7 __PACKAGE__->PassThroughArgs;
|
78
|
8
|
|
9 BEGIN {
|
|
10 public property template => prop_all;
|
107
|
11 public property id => prop_all;
|
|
12 }
|
|
13
|
|
14 my $nextId = 1;
|
|
15
|
|
16 sub CTOR {
|
|
17 my ($this,%args) = @_;
|
|
18
|
|
19 $this->template($args{template}) if $args{template};
|
|
20 $this->id($this->nodeName . '-' . $nextId++);
|
78
|
21 }
|
|
22
|
|
23 sub Render {
|
|
24 my ($this) = @_;
|
|
25
|
|
26 if ($this->document) {
|
|
27 if ($this->template) {
|
|
28 return $this->document->context->include($this->template,{ this => $this });
|
|
29 } elsif ($this->document->presenter) {
|
|
30 return $this->document->presenter->print($this);
|
|
31 } else {
|
|
32 return $this->toString();
|
|
33 }
|
|
34 }
|
|
35 }
|
|
36
|
|
37 1; |