@@ -141,14 +141,38 @@ DocumentFrame.prototype.filterFrame = function(loadRenderer){
141
141
frame . compare = rule . compare ( ) ;
142
142
}
143
143
if ( rule . errors ( ) ) {
144
- frame . errors = rule . errors ( ) ;
145
- }
144
+ frame . errors = frame . errors ? frame . errors . concat ( rule . errors ( ) ) : rule . errors ( ) ;
145
+ }
146
+ else if ( rule . errors ( ) === false ) delete frame . errors
146
147
}
147
148
this . applyRules ( false , false , myfilt ) ;
148
149
}
149
150
151
+ DocumentFrame . prototype . setErrors = function ( errors ) {
152
+ this . clearErrors ( )
153
+ let frameconf = TerminusClient . View . document ( )
154
+ for ( var i = 0 ; i < errors . length ; i ++ ) {
155
+ addRuleForVio ( frameconf , errors [ i ] )
156
+ }
157
+ this . applyRules ( false , frameconf ) ;
158
+ }
159
+
160
+ DocumentFrame . prototype . clearErrors = function ( ) {
161
+ frameconf . all ( ) . errors ( false )
162
+ this . applyRules ( false , frameconf )
163
+ }
164
+
165
+ function addRuleForVio ( docview , error ) {
166
+ let prop = ( error [ 'api:property' ] ? error [ 'api:property' ] [ "@value" ] : false )
167
+ let subj = ( error [ 'api:subject' ] ? error [ 'api:subject' ] [ "@value" ] : false )
168
+ let val = ( error [ 'api:value' ] ? error [ 'api:value' ] [ "@value" ] : false )
169
+ let type = ( error [ 'api:type' ] ? error [ 'api:type' ] [ "@value" ] : false )
170
+ if ( type && val ) { //api:BadCast
171
+ frameconf . data ( ) . value ( val ) . range ( type ) . errors ( [ error ] )
172
+ }
173
+ }
150
174
151
- /*
175
+ /*"
152
176
* adds render and compare functions to object frames
153
177
*/
154
178
DocumentFrame . prototype . applyRules = function ( doc , config , mymatch ) {
0 commit comments