comparison Lib/IMPL/DOM/Navigator/Builder.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 c8fe3f84feba
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
49 $this->Current->appendChild($node); 49 $this->Current->appendChild($node);
50 $this->internalNavigateNodeSet($node); 50 $this->internalNavigateNodeSet($node);
51 } 51 }
52 52
53 if (@errors) { 53 if (@errors) {
54 $this->BuildErrors->Append( 54 $this->BuildErrors->Append(
55 map { 55 map {
56 IMPL::DOM::Schema::ValidationError->new( 56 IMPL::DOM::Schema::ValidationError->new(
57 Node => $node, 57 Node => $node,
58 Source => $schemaSource, 58 Source => $schemaSource,
59 Schema => $schemaNode, 59 Schema => $schemaNode,
60 Message => $schemaNode->messageInflateError, 60 Message => $schemaNode->messageInflateError,
61 Error => $_ 61 Error => $_
62 ) 62 )
63 } @errors 63 } @errors
64 ); 64 );
65 } 65 }
66 66
67 return $node; 67 return $node;
68 } else { 68 } else {
69 die new IMPL::InvalidOperationException("The specified node is undefined", $nodeName); 69 die new IMPL::InvalidOperationException("The specified node is undefined", $nodeName);
70 } 70 }
71 } 71 }
72 72
73 sub inflateProperties { 73 sub inflateProperties {
74 my ($this,$schemaNode,$refProps) = @_; 74 my ($this,$schemaNode,$refProps) = @_;
75 my @errors; 75 my @errors;
76 foreach my $schemaProp ( $schemaNode->selectNodes('Property') ) { 76 foreach my $schemaProp ( $schemaNode->selectNodes('Property') ) {
77 next if not exists $refProps->{$schemaProp->name}; 77 next if not exists $refProps->{$schemaProp->name};
78 my $result = eval {$schemaProp->inflateValue($refProps->{$schemaProp->name}) }; 78 my $result = eval {$schemaProp->inflateValue($refProps->{$schemaProp->name}) };
79 if (my $e = $@) { 79 if (my $e = $@) {
80 push @errors, $e; 80 push @errors, $e;
81 } else { 81 } else {
82 $refProps->{$schemaProp->name} = $result; 82 $refProps->{$schemaProp->name} = $result;
83 } 83 }
84 } 84 }
85 return @errors; 85 return @errors;
86 } 86 }
87 87
88 sub inflateValue { 88 sub inflateValue {
89 my ($this,$value,$node) = @_; 89 my ($this,$value,$node) = @_;
90 90
91 $node ||= $this->Current; 91 $node ||= $this->Current;
92 92
93 my $nodeSchema = $this->{$_schemaNavi}->Current; 93 my $nodeSchema = $this->{$_schemaNavi}->Current;
94 94
95 my $result = eval { $nodeSchema->inflateValue($value) }; 95 my $result = eval { $nodeSchema->inflateValue($value) };
96 if (my $e=$@) { 96 if (my $e=$@) {
97 $this->BuildErrors->Append(new IMPL::DOM::Schema::ValidationError( 97 $this->BuildErrors->Append(new IMPL::DOM::Schema::ValidationError(
98 Schema => $nodeSchema, 98 Schema => $nodeSchema,
99 Node => $node, 99 Node => $node,
100 Error => $e, 100 Error => $e,
101 Message => $nodeSchema->messageInflateError, 101 Message => $nodeSchema->messageInflateError,
102 Source => $this->{$_schemaNavi}->SourceSchemaNode 102 Source => $this->{$_schemaNavi}->SourceSchemaNode
103 )); 103 ));
104 return $value; 104 return $value;
105 } else { 105 } else {
106 return $result; 106 return $result;
107 } 107 }
108 } 108 }
109 109
110 sub Back { 110 sub Back {
111 my ($this) = @_; 111 my ($this) = @_;
112 112
113 $this->{$_schemaNavi}->SchemaBack(); 113 $this->{$_schemaNavi}->SchemaBack();
114 $this->SUPER::Back(); 114 $this->SUPER::Back();
115 } 115 }
116 116
117 sub saveState { 117 sub saveState {
118 my ($this) = @_; 118 my ($this) = @_;
119 119
120 $this->{$_schemaNavi}->saveState; 120 $this->{$_schemaNavi}->saveState;
121 $this->SUPER::saveState; 121 $this->SUPER::saveState;
122 } 122 }
123 123
124 sub restoreState { 124 sub restoreState {
125 my ($this) = @_; 125 my ($this) = @_;
126 126
127 $this->{$_schemaNavi}->restoreState; 127 $this->{$_schemaNavi}->restoreState;
128 $this->SUPER::restoreState; 128 $this->SUPER::restoreState;
129 } 129 }
130 130
131 1; 131 1;
132 132
133 __END__ 133 __END__