Debian Codegraph @

dojox/calendar/ColumnView.js

raw symbols SCIP
1 define([
2 "dojo/_base/array",
3 "dojo/_base/declare",
4 "dojo/_base/event",
5 "dojo/_base/lang",
6 "dojo/_base/sniff",
7 "dojo/_base/fx",
8 "dojo/dom",
9 "dojo/dom-class",
10 "dojo/dom-style",
11 "dojo/dom-geometry",
12 "dojo/dom-construct",
13 "dojo/on",
14 "dojo/date",
15 "dojo/date/locale",
16 "dojo/query",
17 "./SimpleColumnView",
18 "dojo/text!./templates/ColumnView.html",
19 "./ColumnViewSecondarySheet"],
20
21 function(
22 arr,
23 declare,
24 event,
25 lang,
26 has,
27 fx,
28 dom,
29 domClass,
30 domStyle,
31 domGeometry,
32 domConstruct,
33 on,
34 date,
35 locale,
36 query,
37 SimpleColumnView,
38 template,
39 ColumnViewSecondarySheet){
40
41 return declare("dojox.calendar.ColumnView", SimpleColumnView, {
42
43 // summary:
44 // This class defines a simple column view that also uses a secondary
45 // sheet to display long or all day events.
46 // By default an dojox.calendar.ColumnViewSecondarySheet instance is created.
47 // Set the secondarySheetClass property to define the class to instantiate,
48 // for example to mix the default class with Mouse, Keyboard or Touch plugins.
49
50 templateString: template,
51
52 baseClass: "dojoxCalendarColumnView",
53
54 // secondarySheetClass: Class
55 // The secondary sheet class, by default dojox.calendar.ColumnViewSecondarySheet.
56 secondarySheetClass: ColumnViewSecondarySheet,
57
58 // secondarySheetProps: Object
59 // Secondary sheet constructor parameters.
60 secondarySheetProps: null,
61
62 // headerPadding: Integer
63 // Padding between the header (composed of the secondary sheet and the column header)
64 // and the primary sheet.
65 headerPadding: 3,
66
67 _showSecondarySheet: true,
68
69 buildRendering: function(){
70 this.inherited(arguments);
71 if(this.secondarySheetNode){
72 var args = lang.mixin({owner: this}, this.secondarySheetProps);
73 this.secondarySheet = new this.secondarySheetClass(args, this.secondarySheetNode);
74 this.secondarySheetNode = this.secondarySheet.domNode;
75 }
76 },
77
78 destroy: function(preserveDom){
79 if(this.secondarySheet){
80 this.secondarySheet.destroy(preserveDom);
81 }
82 this.inherited(arguments);
83 },
84
85 _setVisibility: function(value){
86 // tags:
87 // private
88
89 this.inherited(arguments);
90 if(this.secondarySheet){
91 this.secondarySheet._setVisibility(value);
92 }
93 },
94
95
96 resize: function(changedSize){
97 // tags:
98 // private
99
100 this.inherited(arguments);
101 if(this.secondarySheet){
102 // secondary sheet is sized by CSS
103 this.secondarySheet.resize();
104 }
105 },
106
107 invalidateLayout: function(){
108 // tags:
109 // private
110
111 this._layoutRenderers(this.renderData);
112 if(this.secondarySheet){
113 this.secondarySheet._layoutRenderers(this.secondarySheet.renderData);
114 }
115 },
116
117 onRowHeaderClick: function(e){
118 // summary:
119 // Event dispatched when the row header cell of the secondary sheet is clicked.
120 // tags:
121 // callback
122
123 },
124
125 _setSubColumnsAttr: function(value){
126 var old = this.get("subColumns");
127 if(old != value){
128 this._secondaryHeightInvalidated = true;
129 }
130 this._set("subColumns", value);
131 },
132
133 refreshRendering: function(recursive){
134 this.inherited(arguments);
135 if(this._secondaryHeightInvalidated){
136 this._secondaryHeightInvalidated = false;
137 var h = domGeometry.getMarginBox(this.secondarySheetNode).h;
138 this.resizeSecondarySheet(h);
139 }
140 if(recursive && this.secondarySheet){
141 this.secondarySheet.refreshRendering(true);
142 }
143 },
144
145 resizeSecondarySheet: function(height){
146 // summary:
147 // Resizes the secondary sheet header and relayout the other sub components according this new height.
148 // Warning: this method is only available for the default template and default CSS.
149 // height: Integer
150 // The new height in pixels.
151 if(this.secondarySheetNode){
152 var headerH = domGeometry.getMarginBox(this.header).h;
153 domStyle.set(this.secondarySheetNode, "height", height+"px");
154 this.secondarySheet._resizeHandler(null, true);
155 var top = (height + headerH + this.headerPadding);
156 if(this.subHeader && this.subColumns){
157 domStyle.set(this.subHeader, "top", top+"px");
158 top += domGeometry.getMarginBox(this.subHeader).h;
159 }
160 domStyle.set(this.scrollContainer, "top", top+"px");
161 if(this.vScrollBar){
162 domStyle.set(this.vScrollBar, "top", top+"px");
163 }
164 }
165 },
166
167 updateRenderers: function(obj, stateOnly){
168 this.inherited(arguments);
169 if(this.secondarySheet){
170 this.secondarySheet.updateRenderers(obj, stateOnly);
171 }
172 },
173
174 _setItemsAttr: function(value){
175 this.inherited(arguments);
176 if(this.secondarySheet){
177 this.secondarySheet.set("items", value);
178 }
179 },
180
181 _setDecorationItemsAttr: function(value){
182 this.inherited(arguments);
183 if(this.secondarySheet){
184 this.secondarySheet.set("decorationItems", value);
185 }
186 },
187
188 _setStartDateAttr: function(value){
189 this.inherited(arguments);
190 if(this.secondarySheet){
191 this.secondarySheet.set("startDate", value);
192 }
193 },
194
195 _setColumnCountAttr: function(value){
196 this.inherited(arguments);
197 if(this.secondarySheet){
198 this.secondarySheet.set("columnCount", value);
199 }
200 },
201
202 _setHorizontalRendererAttr: function(value){
203 if(this.secondarySheet){
204 this.secondarySheet.set("horizontalRenderer", value);
205 }
206 },
207
208 _getHorizontalRendererAttr: function(){
209 if(this.secondarySheet){
210 return this.secondarySheet.get("horizontalRenderer");
211 }
212 return null;
213 },
214
215 _setHorizontalDecorationRendererAttr: function(value){
216 this.inherited(arguments);
217 if(this.secondarySheet){
218 this.secondarySheet.set("horizontalDecorationRenderer", value);
219 }
220 },
221
222 _getHorizontalRendererAttr: function(){
223 if(this.secondarySheet){
224 return this.secondarySheet.get("horizontalDecorationRenderer");
225 }
226 return null;
227 },
228
229 _setExpandRendererAttr: function(value){
230 if(this.secondarySheet){
231 this.secondarySheet.set("expandRenderer", value);
232 }
233 },
234
235 _getExpandRendererAttr: function(){
236 if(this.secondarySheet){
237 return this.secondarySheet.get("expandRenderer");
238 }
239 return null;
240 },
241
242 _setTextDirAttr: function(value){
243 this.secondarySheet.set("textDir", value);
244 this._set("textDir", value);
245 },
246
247 _defaultItemToRendererKindFunc: function(item){
248 return item.allDay ? null : "vertical"; // String
249 },
250
251 getSecondarySheet: function(){
252 // summary:
253 // Returns the secondary sheet
254 // returns: dojox/calendar/MatrixView
255 return this.secondarySheet;
256 },
257
258 _onGridTouchStart: function(e){
259 this.inherited(arguments);
260 this._doEndItemEditing(this.secondarySheet, "touch");
261 },
262
263 _onGridMouseDown: function(e){
264 this.inherited(arguments);
265 this._doEndItemEditing(this.secondarySheet, "mouse");
266 },
267
268 _configureScrollBar: function(renderData){
269
270 this.inherited(arguments);
271 if(this.secondarySheetNode){
272 var atRight = this.isLeftToRight() ? true : this.scrollBarRTLPosition == "right";
273 domStyle.set(this.secondarySheetNode, atRight ? "right" : "left", renderData.scrollbarWidth + "px");
274 domStyle.set(this.secondarySheetNode, atRight ? "left" : "right", "0");
275
276 arr.forEach(this.secondarySheet._hScrollNodes, function(elt){
277 domClass[renderData.hScrollBarEnabled ? "add" : "remove"](elt.parentNode, "dojoxCalendarHorizontalScroll");
278 }, this);
279 }
280 },
281
282 _configureHScrollDomNodes: function(styleWidth){
283 this.inherited(arguments);
284 if(this.secondarySheet && this.secondarySheet._configureHScrollDomNodes){
285 this.secondarySheet._configureHScrollDomNodes(styleWidth);
286 }
287 },
288
289 _setHScrollPosition: function(pos){
290 this.inherited(arguments);
291 if(this.secondarySheet){
292 this.secondarySheet._setHScrollPosition(pos);
293 }
294 },
295
296 _refreshItemsRendering: function(){
297 this.inherited(arguments);
298 if(this.secondarySheet){
299 var rd = this.secondarySheet.renderData;
300 this.secondarySheet._computeVisibleItems(rd);
301 this.secondarySheet._layoutRenderers(rd);
302 }
303 },
304
305 _layoutRenderers: function(renderData){
306 if(!this.secondarySheet._domReady){
307 this.secondarySheet._domReady = true;
308 this.secondarySheet._layoutRenderers(this.secondarySheet.renderData);
309 }
310
311 this.inherited(arguments);
312 },
313
314 _layoutDecorationRenderers: function(renderData){
315 if(!this.secondarySheet._decDomReady){
316 this.secondarySheet._decDomReady = true;
317 this.secondarySheet._layoutDecorationRenderers(this.secondarySheet.renderData);
318 }
319
320 this.inherited(arguments);
321 },
322
323 invalidateRendering: function(){
324 if(this.secondarySheet){
325 this.secondarySheet.invalidateRendering();
326 }
327 this.inherited(arguments);
328 }
329
330 });
331 });