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