[483] | 1 | define(["./MatrixView", "dojo/text!./templates/ColumnViewSecondarySheet.html", |
---|
| 2 | "dojo/_base/html", "dojo/_base/declare", "dojo/_base/event", "dojo/_base/lang", |
---|
| 3 | "dojo/_base/sniff", "dojo/dom", "dojo/dom-class", "dojo/dom-geometry", "dojo/dom-construct", |
---|
| 4 | "dojo/date", "dojo/date/locale", "dojo/query", "dojox/html/metrics", "dojo/_base/fx", "dojo/on", |
---|
| 5 | "dojo/window"], |
---|
| 6 | |
---|
| 7 | function(MatrixView, template, html, declare, event, lang, has, dom, domClass, domGeometry, domConstruct, |
---|
| 8 | date, locale, query, metrics, fx, on, win){ |
---|
| 9 | |
---|
| 10 | return declare("dojox.calendar.ColumnViewSecondarySheet", MatrixView, { |
---|
| 11 | |
---|
| 12 | // summary: |
---|
| 13 | // This class defines a matrix view designed to be embedded in a column view, |
---|
| 14 | // usually to display long or all day events on one row. |
---|
| 15 | |
---|
| 16 | templateString: template, |
---|
| 17 | |
---|
| 18 | rowCount: 1, |
---|
| 19 | |
---|
| 20 | cellPaddingTop: 4, |
---|
| 21 | |
---|
| 22 | roundToDay: false, |
---|
| 23 | |
---|
| 24 | _defaultHeight: -1, |
---|
| 25 | |
---|
| 26 | layoutDuringResize: true, |
---|
| 27 | |
---|
| 28 | _defaultItemToRendererKindFunc: function(item){ |
---|
| 29 | // tags: |
---|
| 30 | // private |
---|
| 31 | return item.allDay ? "horizontal" : null; |
---|
| 32 | }, |
---|
| 33 | |
---|
| 34 | _formatGridCellLabel: function(){return null;}, |
---|
| 35 | |
---|
| 36 | _formatRowHeaderLabel: function(){return null;}, |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | // events redispatch |
---|
| 40 | __fixEvt:function(e){ |
---|
| 41 | e.sheet = "secondary"; |
---|
| 42 | e.source = this; |
---|
| 43 | return e; |
---|
| 44 | }, |
---|
| 45 | |
---|
| 46 | _dispatchCalendarEvt: function(e, name){ |
---|
| 47 | e = this.inherited(arguments); |
---|
| 48 | if(this.owner.owner){ // the calendar |
---|
| 49 | this.owner.owner[name](e); |
---|
| 50 | } |
---|
| 51 | }, |
---|
| 52 | |
---|
| 53 | _layoutExpandRenderers: function(index, hasHiddenItems, hiddenItems){ |
---|
| 54 | if(!this.expandRenderer){ |
---|
| 55 | return; |
---|
| 56 | } |
---|
| 57 | var h = domGeometry.getMarginBox(this.domNode).h; |
---|
| 58 | if(this._defaultHeight == -1){ |
---|
| 59 | this._defaultHeight = h; |
---|
| 60 | } |
---|
| 61 | if(this._defaultHeight != -1 && this._defaultHeight != h && h >= this._getExpandedHeight()){ |
---|
| 62 | this._layoutExpandRendererImpl(0, this._expandedRowCol, null, true); |
---|
| 63 | }else{ |
---|
| 64 | this.inherited(arguments); |
---|
| 65 | } |
---|
| 66 | }, |
---|
| 67 | |
---|
| 68 | expandRendererClickHandler: function(e, renderer){ |
---|
| 69 | // summary: |
---|
| 70 | // Default action when an expand renderer is clicked. |
---|
| 71 | // This method will expand the secondary sheet to show all the events. |
---|
| 72 | // e: Event |
---|
| 73 | // The mouse event. |
---|
| 74 | // renderer: Object |
---|
| 75 | // The renderer that was clicked. |
---|
| 76 | // tags: |
---|
| 77 | // callback |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | event.stop(e); |
---|
| 81 | var h = domGeometry.getMarginBox(this.domNode).h; |
---|
| 82 | if(this._defaultHeight == h || h < this._getExpandedHeight()){ |
---|
| 83 | this._expandedRowCol = renderer.columnIndex; |
---|
| 84 | this.owner.resizeSecondarySheet(this._getExpandedHeight()); |
---|
| 85 | }else{ |
---|
| 86 | this.owner.resizeSecondarySheet(this._defaultHeight); |
---|
| 87 | } |
---|
| 88 | }, |
---|
| 89 | |
---|
| 90 | _getExpandedHeight: function(){ |
---|
| 91 | // tags: |
---|
| 92 | // private |
---|
| 93 | |
---|
| 94 | return this.naturalRowsHeight[0] + this.expandRendererHeight + this.verticalGap + this.verticalGap; |
---|
| 95 | }, |
---|
| 96 | |
---|
| 97 | _layoutRenderers: function(renderData){ |
---|
| 98 | if(!this._domReady){ |
---|
| 99 | return; |
---|
| 100 | } |
---|
| 101 | this.inherited(arguments); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | }); |
---|
| 105 | }); |
---|