Debian Codegraph @

dojox/calendar/ExpandRenderer.js

raw symbols SCIP
1 define([
2 "dojo/_base/declare",
3 "dojo/_base/lang",
4 "dojo/_base/event",
5 "dojo/_base/window",
6 "dojo/on",
7 "dojo/dom-class",
8 "dojo/dom-style",
9 "dijit/_WidgetBase",
10 "dijit/_TemplatedMixin",
11 "dojo/text!./templates/ExpandRenderer.html"],
12
13 function(
14 declare,
15 lang,
16 event,
17 win,
18 on,
19 domClass,
20 domStyle,
21 _WidgetBase,
22 _TemplatedMixin,
23 template){
24
25 return declare("dojox.calendar.ExpandRenderer", [_WidgetBase, _TemplatedMixin], {
26
27 // summary:
28 // The default renderer display in MatrixView cells where some item renderers cannot be displayed because of size constraints.
29
30 templateString: template,
31
32 baseClass: "dojoxCalendarExpand",
33
34 // owner: dojox/calendar/_ViewBase
35 // The view that contains this renderer.
36 owner: null,
37
38 // focused: Boolean
39 // Indicates that the renderer is focused.
40 focused: false,
41
42 // up: Boolean
43 // Indicates that the mouse cursor is over renderer.
44 up: false,
45
46 // down: Boolean
47 // Indicates that the renderer is pressed.
48 down: false,
49
50 // date: Date
51 // The date displayed by the cell where this renderer is used.
52 date: null,
53
54 // items: Object[]
55 // List of items that are not displayed in the cell because of the size constraints.
56 items: null,
57
58 // rowIndex: Integer
59 // Row index where this renderer is used.
60 rowIndex: -1,
61
62 // columnIndex: Integer
63 // Column index where this renderer is used.
64 columnIndex: -1,
65
66 _setExpandedAttr: function(value){
67 domStyle.set(this.expand, "display", value ? "none" : "inline-block");
68 domStyle.set(this.collapse, "display", value ? "inline-block" : "none");
69 this._set("expanded", value);
70 },
71
72 _setDownAttr: function(value){
73 this._setState("down", value, "Down");
74 },
75
76 _setUpAttr: function(value){
77 this._setState("up", value, "Up");
78 },
79
80 _setFocusedAttr: function(value){
81 this._setState("focused", value, "Focused");
82 },
83
84 _setState: function(prop, value, cssClass){
85 if (this[prop] != value){
86 var tn = this.stateNode || this.domNode;
87 domClass[value ? "add" : "remove"](tn, cssClass);
88 this._set(prop, value);
89 }
90 },
91
92 _onClick: function(e){
93 // tags:
94 // private
95
96 if(this.owner && this.owner.expandRendererClickHandler){
97 this.owner.expandRendererClickHandler(e, this);
98 }
99 },
100
101 _onMouseDown: function(e){
102 // tags:
103 // private
104
105 event.stop(e);
106 this.set("down", true);
107 },
108
109 _onMouseUp: function(e){
110 // tags:
111 // private
112
113 this.set("down", false);
114 },
115
116 _onMouseOver: function(e){
117 // tags:
118 // private
119
120 if(!this.up){
121 var buttonDown = e.button == 1;
122 this.set("up", !buttonDown);
123 this.set("down", buttonDown);
124 }
125 },
126
127 _onMouseOut: function(e){
128 // tags:
129 // private
130
131 var node = e.relatedTarget;
132 while(node != e.currentTarget && node != win.doc.body && node != null){
133 node = node.parentNode;
134 }
135 if(node == e.currentTarget){
136 return;
137 }
138 this.set("up", false);
139 this.set("down", false);
140 }
141
142 });
143
144 });