|
1 | | - |
2 | 1 | define([ |
3 | | - "dojo/_base/declare", "mxui/widget/_WidgetBase", "dijit/_TemplatedMixin", |
4 | | - "mxui/dom", "dojo/dom", "dojo/query", "dojo/dom-prop", "dojo/dom-geometry", "dojo/dom-class", "dojo/dom-style", "dojo/dom-construct", "dojo/_base/array", "dojo/_base/lang", "dojo/text", "dojo/html", "dojo/_base/event", |
5 | | - "dojo/text!DynamicImage/widget/template/DynamicImage.html" |
6 | | -], function (declare, _WidgetBase, _TemplatedMixin, dom, dojoDom, domQuery, domProp, domGeom, domClass, domStyle, domConstruct, dojoArray, lang, text, html, event, widgetTemplate) { |
| 2 | + "dojo/_base/declare", "DynamicImage/widget/StaticImage" |
| 3 | +], function (declare, StaticImage) { |
7 | 4 | "use strict"; |
8 | 5 |
|
9 | | - return declare("DynamicImage.widget.MobileStaticImage", [_WidgetBase, _TemplatedMixin], { |
10 | | - |
11 | | - // _TemplatedMixin will create our dom node using this HTML template. |
12 | | - templateString: widgetTemplate, |
13 | | - |
14 | | - _handles: null, |
15 | | - _contextObj: null, |
16 | | - |
17 | | - constructor: function () { |
18 | | - this._handles = []; |
19 | | - }, |
20 | | - |
21 | | - postCreate: function () { |
22 | | - logger.debug(this.id + ".postCreate"); |
23 | | - }, |
24 | | - |
25 | | - update: function (obj, callback) { |
26 | | - logger.debug(this.id + ".update"); |
27 | | - |
28 | | - this._contextObj = obj; |
29 | | - this._resetSubscriptions(); |
30 | | - this._updateRendering(callback); |
31 | | - }, |
32 | | - |
33 | | - // Rerender the interface. |
34 | | - _updateRendering: function (callback) { |
35 | | - logger.debug(this.id + "._updateRendering"); |
36 | | - |
37 | | - if (this.imageurl !== "") { |
38 | | - this.imageNode.src = this.imageurl; |
39 | | - } else { |
40 | | - this.imageNode.src = this.defaultImage; |
41 | | - } |
42 | | - |
43 | | - mendix.lang.nullExec(callback); |
44 | | - }, |
45 | | - |
46 | | - // Reset subscriptions. |
47 | | - _resetSubscriptions: function () { |
48 | | - logger.debug(this.id + "._resetSubscriptions"); |
49 | | - var _objectHandle = null; |
50 | | - |
51 | | - // Release handles on previous object, if any. |
52 | | - if (this._handles) { |
53 | | - this._handles.forEach(function (handle, i) { |
54 | | - mx.data.unsubscribe(handle); |
55 | | - }); |
56 | | - this._handles = []; |
57 | | - } |
58 | | - |
59 | | - // When a mendix object exists create subscribtions. |
60 | | - if (this._contextObj) { |
61 | | - |
62 | | - _objectHandle = this.subscribe({ |
63 | | - guid: this._contextObj.getGuid(), |
64 | | - callback: lang.hitch(this, function (guid) { |
65 | | - this._updateRendering(); |
66 | | - }) |
67 | | - }); |
68 | | - |
69 | | - |
| 6 | + // Declare widget"s prototype. |
| 7 | + return declare("DynamicImage.widget.MobileStaticImage", [StaticImage]); |
70 | 8 |
|
71 | | - this._handles = [_objectHandle]; |
72 | | - } |
73 | | - } |
74 | | - }); |
75 | 9 | }); |
76 | 10 | require(["DynamicImage/widget/MobileStaticImage"], function () { |
77 | 11 | "use strict"; |
|
0 commit comments