0
|
1 package Schema::Form::Container;
|
|
2 use Form::Container;
|
|
3 use Common;
|
|
4 use base qw(Schema::Form::Item);
|
|
5
|
|
6 BEGIN {
|
|
7 DeclareProperty Children => ACCESS_READ;
|
|
8 }
|
|
9
|
|
10 sub CTOR {
|
|
11 my ($this,%args) = @_;
|
|
12
|
|
13 $this->SUPER::CTOR(@args{qw(Name isMulti Filters)});
|
|
14
|
|
15 $this->{$Children} = [];
|
|
16
|
|
17 }
|
|
18
|
|
19 sub AddChild {
|
|
20 my ($this,$child) = @_;
|
|
21
|
|
22 not grep { $_->Name eq $child->Name } $this->Children or die new Exception("The item already exists",$child->Name);
|
|
23
|
|
24 push @{$this->{$Children}},$child;
|
|
25 }
|
|
26
|
|
27 sub FindChild {
|
|
28 my ($this,$name) = @_;
|
|
29
|
|
30 my @result = grep { $_->Name eq $name} $this->Children;
|
|
31 return $result[0];
|
|
32 }
|
|
33
|
|
34 sub Dispose {
|
|
35 my ($this) = @_;
|
|
36
|
|
37 delete $this->{$Children};
|
|
38
|
|
39 $this->SUPER::Dispose;
|
|
40 }
|
|
41 1; |