annotate Lib/IMPL/Web/View/TTFactory.pm @ 301:aeeb57a12046

*IMPL::Web::View: templates inheritance support
author cin
date Mon, 25 Mar 2013 02:04:18 +0400
parents bf3af33b9003
children b5d5793f348e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
1 package IMPL::Web::View::TTFactory;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
2 use strict;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
3
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
4 use Template::Context();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
5
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
6 use Carp qw(carp);
267
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
7 use IMPL::lang qw(:hash);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
8 use IMPL::Exception();
192
a9faf883cdce IMPL::Web::View refactoring
cin
parents: 191
diff changeset
9 use Scalar::Util qw(weaken);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
10
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
11
267
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
12 use IMPL::Const qw(:prop);
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
13 use IMPL::declare {
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
14 require => {
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
15 Loader => 'IMPL::Code::Loader',
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
16 OpException => '-IMPL::InvalidOperationException',
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
17 ArgException => '-IMPL::InvalidArgumentException'
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
18 },
267
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
19 base => [
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
20 'IMPL::Object::Factory' => sub {
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
21 shift->class || 'IMPL::Web::View::TTControl';
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
22 }
267
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
23 ],
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
24 props => [
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
25 template => PROP_RW,
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
26 context => PROP_RW,
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
27 instances => PROP_RW,
300
cin
parents: 298
diff changeset
28 baseLocation => PROP_RW,
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
29 base => PROP_RW,
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
30 require => PROP_RO,
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
31 blocks => PROP_RO,
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
32 initialized => PROP_RO
267
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
33 ]
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
34 };
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
35
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
36 sub CTOR {
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
37 my ($this,$template,$context,$baseLocation,$require) = @_;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
38
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
39 die ArgException->new("A template is required") unless $template;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
40
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
41 Loader->safe->Require($this->factory)
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
42 if $this->factory and not ref $this->factory;
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
43
287
2d253e6e4a88 *TTView refactoring
cin
parents: 280
diff changeset
44 $context ||= new Template::Context();
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
45
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
46 $this->template($template);
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
47 $this->context($context);
300
cin
parents: 298
diff changeset
48 $this->baseLocation($baseLocation);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
49 $this->instances(0);
288
3a9cfea098dd *TTView refactoring: removed RequireControl method, etc.
sergey
parents: 287
diff changeset
50 $this->require($require);
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
51
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
52 if (my $baseTplName = $template->extends) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
53 $baseTplName =~ s{^\./}{$baseLocation/};
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
54
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
55 my $base = &$require($baseTplName)
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
56 or die OpException->new("The specified base template isn't found");
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
57
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
58 $this->base($base);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
59
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
60 $this->blocks(hashMerge($base->blocks, $template->blocks));
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
61
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
62 # блок BASE должен меняться в процессе выполнения, в зависимости от
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
63 # шаблона, который рендерится, по мере перехода в BASE
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
64
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
65 my @baseStack;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
66
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
67 $this->blocks->{BASE} = sub {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
68 my $ctx = shift;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
69
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
70 die OpException->new("This tamplate doesn't have a base template")
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
71 unless $base;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
72
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
73 push @baseStack, $base;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
74 my $block = $base->template->block;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
75
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
76 $base = $base->base;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
77
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
78 my $result = eval {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
79 $ctx->process($block);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
80 };
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
81 my $e = $@;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
82
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
83 $base = pop @baseStack;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
84
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
85 die $e if $e;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
86 return $result;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
87 };
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
88 } else {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
89 $this->blocks( $template->blocks );
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
90 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
91
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
92 if(my $blocks = $this->blocks) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
93 while (my ($name,$block) = each %$blocks) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
94 $context->define_block($name,$block);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
95 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
96 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
97
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
98 $context->stash->update({ require => sub {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
99 my ($module) = @_;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
100
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
101 $module =~ s/^\.\//$baseLocation\//;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
102 return $require->($module);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
103 }});
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
104 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
105
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
106 sub MergeParameters {
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
107 my $this = shift;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
108 my $refProps = shift || {};
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
109
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
110 unless (ref($refProps) eq 'HASH') {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
111 carp "Passing control name through the first parameter is deprecated";
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
112 my $name = $refProps;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
113 $refProps = shift;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
114 $refProps->{name} ||= $name;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
115 }
291
5d14baa35790 *TTView: fixed template selectors mechanism
cin
parents: 290
diff changeset
116
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
117 $refProps->{factory} = $this;
300
cin
parents: 298
diff changeset
118 my $ctx = $this->CloneContext();
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
119
300
cin
parents: 298
diff changeset
120 return ($this->template, $ctx, $refProps);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
121 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
122
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
123 sub CreateObject {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
124 my $this = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
125
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
126 $this->InitOnDemand();
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
127
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
128 my $instance = $this->SUPER::CreateObject(@_);
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
129
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
130 my $count = $this->instances;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
131 $count++;
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
132 $this->instances($count);
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
133
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
134 return $instance;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
135 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
136
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
137 sub InitOnDemand {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
138 my ($this) = @_;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
139
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
140 unless ($this->initialized) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
141 $this->initialized(1);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
142
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
143 $this->base->InitOnDemand()
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
144 if $this->base;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
145
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
146 if (my $init = $this->template->blocks->{INIT}) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
147 $this->context->process($init);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
148 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
149 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
150 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
151
300
cin
parents: 298
diff changeset
152 sub CloneContext {
cin
parents: 298
diff changeset
153 my ($this) = @_;
cin
parents: 298
diff changeset
154
cin
parents: 298
diff changeset
155 $this->context->localise();
cin
parents: 298
diff changeset
156
cin
parents: 298
diff changeset
157 my $args = { %{$this->context} };
289
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
158 delete $args->{CONFIG};
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
159
300
cin
parents: 298
diff changeset
160 $this->context->delocalise();
cin
parents: 298
diff changeset
161
289
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
162 return Template::Context->new($args);
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
163 }
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
164
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
165 sub Render {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
166 my ($this, $args) = @_;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
167
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
168 return $this->new()->Render($args);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
169 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
170
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
171 sub save {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
172 die new IMPL::NotImplementedException("This class doesn't support serialization");
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
173 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
174
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
175 sub restore {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
176 die new IMPL::NotImplementedException("This class doesn't support serialization");
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
177 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
178
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
179 1;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
180
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
181 __END__
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
182
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
183 =pod
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
184
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
185 =head1 NAME
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
186
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
187 C<IMPL::Web::View::TTFactory> - фабрика элементов управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
188
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
189 =head1 SYNOPSIS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
190
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
191 =begin code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
192
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
193 my $factory = new IMPL::Web::View::TTFactory(
280
c6d0f889ef87 +IMPL::declare now supports meta attributes
cin
parents: 267
diff changeset
194 'IMPL::Web::View::TTControl',
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
195 $doc,
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
196 $context,
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
197 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
198 TRIM => 1
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
199 },
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
200 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
201 myprop => 'my value'
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
202 },
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
203 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
204
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
205 my $input1 = $factory->new('login', { class => "required" } );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
206
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
207 my $propval = $input->nodeProperty('myprop'); # 'my value'
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
208
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
209 =end code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
210
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
211 =begin text
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
212
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
213 [%
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
214 this.appendChild(
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
215 my.org.input.new('login', class = this.errors('login') ? "invalid" : "" )
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
216 );
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
217 %]
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
218
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
219 =end text
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
220
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
221 =head1 DESCRIPTION
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
222
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
223 C< Inherits L<IMPL::Object::Factory> >
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
224
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
225 =head1 MEMBERS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
226
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
227 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
228
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
229 =item C<[get,set]template>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
230
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
231 Документ C<Template::Document> который описывает элемент управления. См. C<IMPL::Web::View::TTControl>.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
232
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
233 =item C<[get,set]context>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
234
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
235 Контекст фабрики элементов управления, в этом контексте выполняет шаблон элемента управления при загрузке.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
236 Далее в этом контексте будет выполнен блок инициализации при создании первого элемента управления.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
237
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
238 =item C<[get,set]opts>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
239
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
240 Параметры контекста элемента управления (ссылка на хеш). Каждый элемент управления при создании получает свой контекст,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
241 который создает с данными параметрами и хранилищем переменных, дочерним к контексту фабрики.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
242
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
243 =item C<[get,set]nodeProperties>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
244
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
245 Ссылка на хеш со значениями свойств по умолчанию для создаваемого элемента управления.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
246
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
247 =item C<[get]instances>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
248
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
249 Количество созданных элементов управления данной фабрикой
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
250
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
251 =item C<[override]MergeParameters($name,$nodeProps)>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
252
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
253 Превращает значения переданные методу C<new> фабрики в параметры для создания элемента управления.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
254
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
255 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
256
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
257 =item C<$name>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
258
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
259 Имя создаваемого узла (C<nodeName>).
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
260
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
261 =item C<$nodeProps>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
262
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
263 Ссылка на шех со значениями свойств узла. Данные значения будут совмещены со значениями из свойства C<nodeProperties>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
264
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
265 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
266
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
267 =item C<[override]CreateObject(@params)>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
268
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
269 Создает экземпляр элемента управления стандартным образом. Учитывает количество экземпляров и если это первый,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
270 то производит дополнительную инициализацию контекста выполнив блок шаблона C<INIT>.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
271
191
78a18a2b6266 IMPL::Web::View improvements (unstable)
cin
parents: 186
diff changeset
272 =item C<[inherited]new($name,$nodeProps)>
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
273
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
274 Создает элемент управления с указанным именем и набором свойств.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
275
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
276 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
277
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
278 =cut