comparison Lib/IMPL/DOM/Document.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents d1676be8afcc
children c6d0f889ef87
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
12 12
13 sub Create { 13 sub Create {
14 my ($this,$nodeName,$class,$refProps) = @_; 14 my ($this,$nodeName,$class,$refProps) = @_;
15 15
16 if ( ref $class eq 'HASH' ) { 16 if ( ref $class eq 'HASH' ) {
17 $refProps = $class; 17 $refProps = $class;
18 $class = undef; 18 $class = undef;
19 } 19 }
20 20
21 $class ||= typeof IMPL::DOM::Node; 21 $class ||= typeof IMPL::DOM::Node;
22 $refProps ||= {}; 22 $refProps ||= {};
23 23
30 %$refProps 30 %$refProps
31 ); 31 );
32 } 32 }
33 33
34 sub save { 34 sub save {
35 my ($this,$writer) = @_; 35 my ($this,$writer) = @_;
36 36
37 $writer->xmlDecl(undef,'yes'); 37 $writer->xmlDecl(undef,'yes');
38 $this->SUPER::save($writer); 38 $this->SUPER::save($writer);
39 $writer->end(); 39 $writer->end();
40 } 40 }
41 41
42 { 42 {
43 my $empty; 43 my $empty;
44 sub Empty() { 44 sub Empty() {
67 67
68 package MyDocument; 68 package MyDocument;
69 use parent qw(IMPL::DOM::Document); 69 use parent qw(IMPL::DOM::Document);
70 70
71 sub Create { 71 sub Create {
72 my $this = shift; 72 my $this = shift;
73 my ($name,$class,$hashProps) = @_; 73 my ($name,$class,$hashProps) = @_;
74 74
75 if ($class eq 'Info') { 75 if ($class eq 'Info') {
76 return MyInfo->new($name,$hashProps->{date},$hashProps->{description}); 76 return MyInfo->new($name,$hashProps->{date},$hashProps->{description});
77 } else { 77 } else {
78 # leave as it is 78 # leave as it is
79 return $this->SUPER::Create(@_); 79 return $this->SUPER::Create(@_);
80 } 80 }
81 } 81 }
82 82
83 =end code 83 =end code
84 84
85 =head1 METHODS 85 =head1 METHODS
91 Реализация по умолчанию. Создает узел определеннго типа с определенным именем и свойствами. 91 Реализация по умолчанию. Создает узел определеннго типа с определенным именем и свойствами.
92 92
93 =begin code 93 =begin code
94 94
95 sub Create { 95 sub Create {
96 my ($this,$nodeName,$class,$hashProps) = @_; 96 my ($this,$nodeName,$class,$hashProps) = @_;
97 97
98 return $class->new ( 98 return $class->new (
99 nodeName => $nodeName, 99 nodeName => $nodeName,
100 document => $this, 100 document => $this,
101 %$hashProps 101 %$hashProps
102 ); 102 );
103 } 103 }
104 104
105 =end code 105 =end code
106 106
107 =item C< save($writer) > 107 =item C< save($writer) >