annotate Lib/IMPL/Web/View/TTFactory.pm @ 319:d485467eca92

small fixes
author cin
date Wed, 15 May 2013 02:00:42 +0400
parents 75a78cbf7dcf
children 86336d451b82
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);
312
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
7 use IMPL::lang qw(:hash is);
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 {
309
cin
parents: 305
diff changeset
21 shift;
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,
312
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
26 activation => PROP_RW,
267
bbc0da7ef90e *IMPL::Web::View refactoring
cin
parents: 232
diff changeset
27 context => 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,
305
b5d5793f348e TTView refactoring, still experiencing memory leaks
sergey
parents: 301
diff changeset
30 registry => PROP_RO,
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
31 blocks => PROP_RO,
312
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
32 _instance => PROP_RW
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 {
309
cin
parents: 305
diff changeset
37 my ($this,$class,$template,$context,$path,$registry) = @_;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
38
309
cin
parents: 305
diff changeset
39 die ArgException->new("A control class must be specified")
cin
parents: 305
diff changeset
40 unless $class;
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
41 die ArgException->new("A template is required") unless $template;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
42
309
cin
parents: 305
diff changeset
43 Loader->safe->Require($class)
cin
parents: 305
diff changeset
44 unless ref $class ;
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
45
287
2d253e6e4a88 *TTView refactoring
cin
parents: 280
diff changeset
46 $context ||= new Template::Context();
305
b5d5793f348e TTView refactoring, still experiencing memory leaks
sergey
parents: 301
diff changeset
47 my $baseLocation = join( '/', splice( @{[split(/\//,$path)]}, 0, -1 ) );
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
48
312
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
49 $this->activation($template->activation || 'new');
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
50 $this->template($template);
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
51 $this->context($context);
300
cin
parents: 298
diff changeset
52 $this->baseLocation($baseLocation);
305
b5d5793f348e TTView refactoring, still experiencing memory leaks
sergey
parents: 301
diff changeset
53 $this->registry($registry);
301
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 if (my $baseTplName = $template->extends) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
56 $baseTplName =~ s{^\./}{$baseLocation/};
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
57
305
b5d5793f348e TTView refactoring, still experiencing memory leaks
sergey
parents: 301
diff changeset
58 my $base = $registry->Require($baseTplName)
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
59 or die OpException->new("The specified base template isn't found");
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
60
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
61 $this->base($base);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
62
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
63 $this->blocks(hashMerge($base->blocks, $template->blocks));
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 # блок BASE должен меняться в процессе выполнения, в зависимости от
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
66 # шаблона, который рендерится, по мере перехода в BASE
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
67
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
68 my @baseStack;
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 $this->blocks->{BASE} = sub {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
71 my $ctx = shift;
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 die OpException->new("This tamplate doesn't have a base template")
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
74 unless $base;
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 push @baseStack, $base;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
77 my $block = $base->template->block;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
78
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
79 $base = $base->base;
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 $result = eval {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
82 $ctx->process($block);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
83 };
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
84 my $e = $@;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
85
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
86 $base = pop @baseStack;
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 die $e if $e;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
89 return $result;
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 } else {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
92 $this->blocks( $template->blocks );
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
93 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
94
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
95 if(my $blocks = $this->blocks) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
96 while (my ($name,$block) = each %$blocks) {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
97 $context->define_block($name,$block);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
98 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
99 }
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 $context->stash->update({ require => sub {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
102 my ($module) = @_;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
103
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
104 $module =~ s/^\.\//$baseLocation\//;
305
b5d5793f348e TTView refactoring, still experiencing memory leaks
sergey
parents: 301
diff changeset
105 return $registry->Require($module);
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
106 }});
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
107 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
108
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
109 sub MergeParameters {
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
110 my $this = shift;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
111 my $refProps = shift || {};
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
112
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
113 unless (ref($refProps) eq 'HASH') {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
114 carp "Passing control name through the first parameter is deprecated";
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
115 my $name = $refProps;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
116 $refProps = shift;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
117 $refProps->{name} ||= $name;
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
118 }
291
5d14baa35790 *TTView: fixed template selectors mechanism
cin
parents: 290
diff changeset
119
298
78f767765706 TT view refactoring
cin
parents: 296
diff changeset
120 $refProps->{factory} = $this;
300
cin
parents: 298
diff changeset
121 my $ctx = $this->CloneContext();
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
122
300
cin
parents: 298
diff changeset
123 return ($this->template, $ctx, $refProps);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
124 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
125
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
126 sub CreateObject {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
127 my $this = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
128
312
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
129 $this->activation eq 'singleton' ?
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
130 $this->_instance || $this->_instance($this->next::method(@_)) :
75a78cbf7dcf View refactoring: INIT blocks are deprecated
cin
parents: 309
diff changeset
131 $this->next::method(@_);
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
132 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
133
300
cin
parents: 298
diff changeset
134 sub CloneContext {
cin
parents: 298
diff changeset
135 my ($this) = @_;
cin
parents: 298
diff changeset
136
cin
parents: 298
diff changeset
137 $this->context->localise();
cin
parents: 298
diff changeset
138
cin
parents: 298
diff changeset
139 my $args = { %{$this->context} };
289
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
140 delete $args->{CONFIG};
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
141
300
cin
parents: 298
diff changeset
142 $this->context->delocalise();
cin
parents: 298
diff changeset
143
289
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
144 return Template::Context->new($args);
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
145 }
85572f512abc *TTView refactoring
cin
parents: 288
diff changeset
146
301
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
147 sub Render {
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
148 my ($this, $args) = @_;
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 return $this->new()->Render($args);
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
151 }
aeeb57a12046 *IMPL::Web::View: templates inheritance support
cin
parents: 300
diff changeset
152
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
153 sub save {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
154 die new IMPL::NotImplementedException("This class doesn't support serialization");
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
155 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
156
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
157 sub restore {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
158 die new IMPL::NotImplementedException("This class doesn't support serialization");
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
159 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
160
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
161 1;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
162
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
163 __END__
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
164
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
165 =pod
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
166
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
167 =head1 NAME
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
168
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
169 C<IMPL::Web::View::TTFactory> - фабрика элементов управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
170
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
171 =head1 SYNOPSIS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
172
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
173 =begin code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
174
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
175 my $factory = new IMPL::Web::View::TTFactory(
280
c6d0f889ef87 +IMPL::declare now supports meta attributes
cin
parents: 267
diff changeset
176 'IMPL::Web::View::TTControl',
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
177 $doc,
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
178 $context,
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
179 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
180 TRIM => 1
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
181 },
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
182 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
183 myprop => 'my value'
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
184 },
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
185 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
186
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
187 my $input1 = $factory->new('login', { class => "required" } );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
188
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
189 my $propval = $input->nodeProperty('myprop'); # 'my value'
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
190
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
191 =end code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
192
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
193 =begin text
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
194
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
195 [%
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
196 this.appendChild(
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
197 my.org.input.new('login', class = this.errors('login') ? "invalid" : "" )
4d0e1962161c Replaced tabs with spaces
cin
parents: 192
diff changeset
198 );
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
199 %]
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
200
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
201 =end text
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
202
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
203 =head1 DESCRIPTION
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
204
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
205 C< Inherits L<IMPL::Object::Factory> >
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
206
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
207 =head1 MEMBERS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
208
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
209 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
210
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
211 =item C<[get,set]template>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
212
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
213 Документ C<Template::Document> который описывает элемент управления. См. C<IMPL::Web::View::TTControl>.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
214
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
215 =item C<[get,set]context>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
216
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
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
220 =item C<[get,set]opts>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
221
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
222 Параметры контекста элемента управления (ссылка на хеш). Каждый элемент управления при создании получает свой контекст,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
223 который создает с данными параметрами и хранилищем переменных, дочерним к контексту фабрики.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
224
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
225 =item C<[get,set]nodeProperties>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
226
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
227 Ссылка на хеш со значениями свойств по умолчанию для создаваемого элемента управления.
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]instances>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
230
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
231 Количество созданных элементов управления данной фабрикой
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
232
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
233 =item C<[override]MergeParameters($name,$nodeProps)>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
234
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
235 Превращает значения переданные методу C<new> фабрики в параметры для создания элемента управления.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
236
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
237 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
238
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
239 =item C<$name>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
240
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
241 Имя создаваемого узла (C<nodeName>).
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
242
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
243 =item C<$nodeProps>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
244
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
245 Ссылка на шех со значениями свойств узла. Данные значения будут совмещены со значениями из свойства C<nodeProperties>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
246
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
247 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
248
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
249 =item C<[override]CreateObject(@params)>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
250
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
251 Создает экземпляр элемента управления стандартным образом. Учитывает количество экземпляров и если это первый,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
252 то производит дополнительную инициализацию контекста выполнив блок шаблона C<INIT>.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
253
191
78a18a2b6266 IMPL::Web::View improvements (unstable)
cin
parents: 186
diff changeset
254 =item C<[inherited]new($name,$nodeProps)>
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
255
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
256 Создает элемент управления с указанным именем и набором свойств.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
257
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
258 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
259
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
260 =cut