Debian Codegraph @

dojox/widget/_Invalidating.js

raw symbols SCIP
1 define(["dojo/_base/declare", "dojo/_base/lang", "dojo/Stateful"],
2 function(declare, lang, Stateful){
3
4 return declare("dojox.widget._Invalidating", Stateful, {
5 // summary:
6 // Base class for classes (usually widgets) that watch invalidated properties and delay the rendering
7 // after these properties modifications to the next execution frame.
8
9 // invalidatingPoperties: String[]
10 // The list of properties to watch for to trigger invalidation. This list must be initialized in the
11 // constructor. Default value is null.
12 invalidatingProperties: null,
13 // invalidRenderering: Boolean
14 // Whether the rendering is invalid or not. This is a readonly information, one must call
15 // invalidateRendering to modify this flag.
16 invalidRendering: false,
17 postscript: function(mixin){
18 this.inherited(arguments);
19 if(this.invalidatingProperties){
20 var props = this.invalidatingProperties;
21 for(var i = 0; i < props.length; i++){
22 this.watch(props[i], lang.hitch(this, this.invalidateRendering));
23 if(mixin && props[i] in mixin){
24 // if the prop happens to have been passed in the ctor mixin we are invalidated
25 this.invalidateRendering();
26 }
27 }
28 }
29 },
30 addInvalidatingProperties: function(/*String[]*/ properties){
31 // summary:
32 // Add properties to the watched properties to trigger invalidation. This method must be called in
33 // the constructor. It is typically used by subclasses of a _Invalidating class to add more properties
34 // to watch for.
35 // properties:
36 // The list of properties to watch for.
37 this.invalidatingProperties = this.invalidatingProperties?this.invalidatingProperties.concat(properties):properties;
38 },
39 invalidateRendering: function(){
40 // summary:
41 // Invalidating the rendering for the next executation frame.
42 if(!this.invalidRendering){
43 this.invalidRendering = true;
44 setTimeout(lang.hitch(this, this.validateRendering), 0);
45 }
46 },
47 validateRendering: function(){
48 // summary:
49 // Immediately validate the rendering if it has been invalidated. You generally do not call that method yourself.
50 // tags:
51 // protected
52 if(this.invalidRendering){
53 this.refreshRendering();
54 this.invalidRendering = false;
55 }
56 },
57 refreshRendering: function(){
58 // summary:
59 // Actually refresh the rendering. Implementation should implement that method.
60 }
61 });
62 });