@openui5/sap.ui.documentation 1.115.1 → 1.117.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.reuse/dep5 +0 -5
  2. package/THIRDPARTY.txt +1 -7
  3. package/package.json +7 -7
  4. package/src/sap/ui/documentation/.library +1 -1
  5. package/src/sap/ui/documentation/library.js +2 -2
  6. package/src/sap/ui/documentation/messagebundle.properties +6 -0
  7. package/src/sap/ui/documentation/messagebundle_ar.properties +3 -0
  8. package/src/sap/ui/documentation/messagebundle_bg.properties +3 -0
  9. package/src/sap/ui/documentation/messagebundle_ca.properties +3 -0
  10. package/src/sap/ui/documentation/messagebundle_cs.properties +3 -0
  11. package/src/sap/ui/documentation/messagebundle_cy.properties +3 -0
  12. package/src/sap/ui/documentation/messagebundle_da.properties +3 -0
  13. package/src/sap/ui/documentation/messagebundle_de.properties +3 -0
  14. package/src/sap/ui/documentation/messagebundle_el.properties +3 -0
  15. package/src/sap/ui/documentation/messagebundle_en.properties +3 -0
  16. package/src/sap/ui/documentation/messagebundle_en_GB.properties +3 -0
  17. package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +3 -0
  18. package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +3 -0
  19. package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +3 -0
  20. package/src/sap/ui/documentation/messagebundle_es.properties +3 -0
  21. package/src/sap/ui/documentation/messagebundle_es_MX.properties +3 -0
  22. package/src/sap/ui/documentation/messagebundle_et.properties +3 -0
  23. package/src/sap/ui/documentation/messagebundle_fi.properties +3 -0
  24. package/src/sap/ui/documentation/messagebundle_fr.properties +3 -0
  25. package/src/sap/ui/documentation/messagebundle_fr_CA.properties +3 -0
  26. package/src/sap/ui/documentation/messagebundle_hi.properties +3 -0
  27. package/src/sap/ui/documentation/messagebundle_hr.properties +3 -0
  28. package/src/sap/ui/documentation/messagebundle_hu.properties +3 -0
  29. package/src/sap/ui/documentation/messagebundle_id.properties +3 -0
  30. package/src/sap/ui/documentation/messagebundle_it.properties +3 -0
  31. package/src/sap/ui/documentation/messagebundle_iw.properties +3 -0
  32. package/src/sap/ui/documentation/messagebundle_ja.properties +3 -0
  33. package/src/sap/ui/documentation/messagebundle_kk.properties +3 -0
  34. package/src/sap/ui/documentation/messagebundle_ko.properties +3 -0
  35. package/src/sap/ui/documentation/messagebundle_lt.properties +3 -0
  36. package/src/sap/ui/documentation/messagebundle_lv.properties +3 -0
  37. package/src/sap/ui/documentation/messagebundle_ms.properties +3 -0
  38. package/src/sap/ui/documentation/messagebundle_nl.properties +3 -0
  39. package/src/sap/ui/documentation/messagebundle_no.properties +3 -0
  40. package/src/sap/ui/documentation/messagebundle_pl.properties +3 -0
  41. package/src/sap/ui/documentation/messagebundle_pt.properties +4 -1
  42. package/src/sap/ui/documentation/messagebundle_pt_PT.properties +3 -0
  43. package/src/sap/ui/documentation/messagebundle_ro.properties +3 -0
  44. package/src/sap/ui/documentation/messagebundle_ru.properties +3 -0
  45. package/src/sap/ui/documentation/messagebundle_sh.properties +3 -0
  46. package/src/sap/ui/documentation/messagebundle_sk.properties +3 -0
  47. package/src/sap/ui/documentation/messagebundle_sl.properties +3 -0
  48. package/src/sap/ui/documentation/messagebundle_sv.properties +3 -0
  49. package/src/sap/ui/documentation/messagebundle_th.properties +3 -0
  50. package/src/sap/ui/documentation/messagebundle_tr.properties +3 -0
  51. package/src/sap/ui/documentation/messagebundle_uk.properties +3 -0
  52. package/src/sap/ui/documentation/messagebundle_vi.properties +3 -0
  53. package/src/sap/ui/documentation/messagebundle_zh_CN.properties +3 -0
  54. package/src/sap/ui/documentation/messagebundle_zh_TW.properties +3 -0
  55. package/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js +25 -2
  56. package/src/sap/ui/documentation/sdk/controller/App.controller.js +11 -4
  57. package/src/sap/ui/documentation/sdk/controller/Code.controller.js +226 -196
  58. package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +1 -1
  59. package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +76 -30
  60. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +3 -2
  61. package/src/sap/ui/documentation/sdk/controller/util/ResourceDownloadUtil.js +2 -2
  62. package/src/sap/ui/documentation/sdk/controls/FileEditor.js +447 -0
  63. package/src/sap/ui/documentation/sdk/css/style.css +17 -0
  64. package/src/sap/ui/documentation/sdk/model/ExploreSettingsModel.js +18 -0
  65. package/src/sap/ui/documentation/sdk/util/FileUtils.js +96 -0
  66. package/src/sap/ui/documentation/sdk/view/Code.view.xml +144 -58
  67. package/src/sap/ui/documentation/sdk/view/Sample.view.xml +7 -0
  68. package/src/sap/ui/documentation/sdk/view/samplesWarning.fragment.xml +14 -0
  69. package/ui5.yaml +1 -1
@@ -4,277 +4,307 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
 
7
- sap.ui.define([
8
- "sap/ui/documentation/sdk/controller/SampleBaseController",
9
- "sap/ui/documentation/sdk/controller/util/ControlsInfo",
10
- "sap/ui/documentation/sdk/model/formatter",
11
- "sap/ui/model/json/JSONModel",
12
- "sap/base/util/merge",
13
- "sap/ui/core/Component",
14
- "sap/ui/core/Core"
15
- ], function(SampleBaseController, ControlsInfo, formatter, JSONModel, merge, Component, Core) {
7
+ sap.ui.define(
8
+ [
9
+ "sap/ui/documentation/sdk/controller/Sample.controller",
10
+ "../model/ExploreSettingsModel",
11
+ "sap/ui/core/Component",
12
+ "sap/ui/core/HTML",
13
+ "sap/ui/Device",
14
+ "sap/base/util/restricted/_debounce",
15
+ "sap/ui/model/odata/v4/lib/_MetadataRequestor",
16
+ "sap/ui/documentation/sdk/controller/util/ControlsInfo",
17
+ "sap/ui/documentation/sdk/model/formatter"
18
+ ],
19
+ function (
20
+ SampleController,
21
+ ExploreSettingsModel,
22
+ Component,
23
+ HTML,
24
+ Device,
25
+ _debounce,
26
+ _MetadataRequestor,
27
+ ControlsInfo,
28
+ formatter
29
+ ) {
16
30
  "use strict";
17
31
 
18
- return SampleBaseController.extend("sap.ui.documentation.sdk.controller.Code", {
32
+ return SampleController.extend("sap.ui.documentation.sdk.controller.Code", {
33
+ constructor: function () {
34
+ this.onFileEditorFileChangeDebounced = _debounce(this.onFileEditorFileChangeDebounced, 500);
35
+ },
19
36
 
20
37
  /**
21
38
  * Called when the controller is instantiated.
22
- * @public
23
39
  */
24
- onInit : function () {
25
- SampleBaseController.prototype.onInit.call(this);
40
+ onInit: function () {
41
+ SampleController.prototype.onInit.call(this);
42
+
43
+ this.getView().setModel(ExploreSettingsModel, "settings");
44
+
45
+ this._fileEditor = this.byId("fileEditor");
46
+ this._fileEditor.attachBeforeFileChange(this.onBeforeFileChanged.bind(this));
47
+ this._fileEditor.attachFileChange(this.onFileEditorFileChangeDebounced.bind(this));
26
48
 
27
- this.oModel = new JSONModel();
28
- this.getView().setModel(this.oModel);
49
+ this._registerResize();
50
+ },
29
51
 
30
- this.router = this.getRouter();
31
- this.router.getRoute("code").attachPatternMatched(this.onRouteMatched, this);
32
- this.router.getRoute("codeFile").attachPatternMatched(this.onRouteMatched, this);
52
+ onExit: function () {
53
+ this._deregisterResize();
54
+ },
33
55
 
34
- this._aFilesAvailable = [];
56
+ onBeforeFileChanged: function (oEvent) {
57
+ var sFile = oEvent.getParameter("sFile");
58
+ this._oChangedFile = {
59
+ sFile: sFile
60
+ };
61
+ },
62
+
63
+ onFileEditorFileChangeDebounced: function () {
64
+ var oModelData = this.oModel.getData();
65
+
66
+ if (this._oChangedFile) {
67
+ var sRef = sap.ui.require.toUrl((this._sId).replace(/\./g, "/"));
68
+ var sLocalStorageDKSamples = this._getChangedSamplesLocalStorage();
69
+ if (!sLocalStorageDKSamples) {
70
+ this._setChangedSamplesLocalStorage(JSON.stringify([this._sId]));
71
+ } else {
72
+ var aChangedDKSamples = JSON.parse(sLocalStorageDKSamples);
73
+
74
+ if (aChangedDKSamples.indexOf(this._sId) < 0) {
75
+ aChangedDKSamples.push(this._sId);
76
+ this._setChangedSamplesLocalStorage(JSON.stringify(aChangedDKSamples));
77
+ }
78
+ }
79
+ oModelData.showWarning = true;
80
+ this.oModel.setData(oModelData);
35
81
 
36
- this._bFirstLoad = true;
82
+ this._updateFileContent(sRef, this._oChangedFile.sFile, true);
83
+ this._oChangedFile = null;
84
+ }
85
+ if (ExploreSettingsModel.getProperty("/autoRun")) {
86
+ this._updateSample();
87
+ }
88
+ },
37
89
 
38
- this.bus = Core.getEventBus();
39
- this.bus.subscribe("themeChanged", "onDemoKitThemeChanged", this.onDemoKitThemeChanged, this);
90
+ onFileSwitch: function (oEvent) {
91
+ ExploreSettingsModel.setProperty("/editable", oEvent.getParameter("editable"));
40
92
  },
41
93
 
42
- onDemoKitThemeChanged: function (sChannelId, sEventId, oData) {
43
- this._updateCodeEditorTheme(oData.sThemeActive);
94
+ onRunPressed: function (oEvent) {
95
+ this._updateSample();
44
96
  },
45
97
 
46
- onRouteMatched: function (oEvt) {
47
- var oArguments = oEvt.getParameter("arguments");
98
+ onClearButtonPressed: function (oEvent) {
99
+ var oFrame = document.getElementById("sampleFrameEdit"),
100
+ sLocalStorageDKSamples = this._getChangedSamplesLocalStorage(),
101
+ oModelData = this.oModel.getData(),
102
+ sRef = sap.ui.require.toUrl((this._sId).replace(/\./g, "/"));
103
+
104
+ if (sLocalStorageDKSamples) {
105
+ var aChangedDKSamples = JSON.parse(sLocalStorageDKSamples);
106
+ aChangedDKSamples.splice(aChangedDKSamples.indexOf(this._sId), 1);
107
+ this._setChangedSamplesLocalStorage(JSON.stringify(aChangedDKSamples));
108
+ }
109
+
110
+ oModelData.showWarning = false;
111
+ this.oModel.setData(oModelData);
48
112
 
49
- this.showMasterSide();
113
+ this._getPage().setBusy(true);
114
+ oFrame.addEventListener("load", function() {
115
+ this._getPage().setBusy(false);
116
+ }.bind(this), {
117
+ once: true
118
+ });
119
+
120
+ Promise.allSettled(this._oData.files.map(function(file) {
121
+ return fetch(file.url, { method: "DELETE" });
122
+ }))
123
+ .then(function() {
124
+ this._fileEditor._setClearButtonPressed(true);
125
+ this._updateSample();
126
+ this._fileEditor._fetchContents();
127
+ this._oData.files.forEach(function (oFile) {
128
+ this._updateFileContent(sRef, oFile.name, true);
129
+ }, this);
130
+ }.bind(this));
131
+ },
132
+
133
+ onChangeSplitterOrientation: function (oEvent) {
134
+ //Toggles the value of splitter orientation
135
+ ExploreSettingsModel.setProperty("/splitViewVertically", !ExploreSettingsModel.getProperty("/splitViewVertically"));
136
+ var isOrientationVertical = ExploreSettingsModel.getProperty("/splitViewVertically");
137
+ this.getView()
138
+ .byId("splitView")
139
+ .getRootPaneContainer()
140
+ .setOrientation(isOrientationVertical ? "Vertical" : "Horizontal");
141
+ },
142
+
143
+ _attachPaternMatched: function () {
144
+ this.oRouter.getRoute("code").attachPatternMatched(this._onRouteMatched, this);
145
+ this.oRouter.getRoute("codeFile").attachPatternMatched(this._onRouteMatched, this);
146
+ },
147
+
148
+ _deregisterResize: function () {
149
+ Device.media.detachHandler(this._onResize, this);
150
+ },
151
+
152
+ _registerResize: function () {
153
+ Device.media.attachHandler(this._onResize, this);
154
+ this._onResize();
155
+ },
156
+
157
+ _onResize: function () {
158
+ var isOrientationVertical = ExploreSettingsModel.getProperty("/splitViewVertically"),
159
+ sRangeName = Device.media.getCurrentRange("StdExt").name;
160
+
161
+ if (sRangeName == "Tablet" || (sRangeName == "Phone" && !isOrientationVertical)) {
162
+ ExploreSettingsModel.setProperty("/splitViewVertically", true);
163
+ this.getView().byId("splitView").getRootPaneContainer().setOrientation("Vertical");
164
+ }
165
+ },
166
+
167
+ _onRouteMatched: function (oEvent) {
168
+ var oArguments = oEvent.getParameter("arguments");
50
169
 
51
170
  this._sId = oArguments.sampleId;
52
171
  this._sEntityId = oArguments.entityId;
53
172
  this._sFileName = formatter.routeParamsToFilePath(oArguments);
54
-
55
- ControlsInfo.loadData().then(this._loadCode.bind(this));
173
+ this.byId("splitView").setBusy(true);
174
+
175
+ ControlsInfo.loadData()
176
+ .then(function(oData) {
177
+ return Promise.all([
178
+ this._loadCode(oData),
179
+ this._loadSample(oData)
180
+ ]);
181
+ }.bind(this))
182
+ .then(function(aResults) {
183
+ this._showCode(aResults[0]);
184
+ }.bind(this));
56
185
  },
57
186
 
58
187
  _loadCode: function (oData) {
59
- var sFileName = this._sFileName,
60
- oSample = oData.samples[this._sId]; // retrieve sample object
188
+ var sFileName = this._sFileName;
189
+ var oSample = oData.samples[this._sId]; // retrieve sample object
61
190
 
62
191
  // If there is no sample or the context from the URL is for the wrong sample we redirect to not found page
63
192
  // If you modify this expression please check with both class and tutorial which won't have a context.
64
193
  if (!oSample || (oSample.contexts && !oSample.contexts[this._sEntityId])) {
65
194
  this.onRouteNotFound();
66
- return;
195
+ return Promise.reject();
67
196
  }
68
197
 
69
198
  // cache the data to be reused
70
199
  if (!this._oData || oSample.id !== this._oData.id) {
71
200
  // get component and data when sample is changed or nothing exists so far
72
- this._createComponent().then(function (oComponent) {
201
+ return this._createComponent().then(function (oComponent) {
73
202
  // create data object
74
- var aPromises = [];
75
203
  var oConfig = oComponent.getManifestEntry("/sap.ui5/config") || {};
76
204
  this._oData = {
77
205
  id: oSample.id,
78
206
  title: "Code: " + oSample.name,
79
207
  name: oSample.name,
80
208
  stretch: oConfig.sample ? oConfig.sample.stretch : false,
81
- files: [],
209
+ files: oConfig.sample.files.map(function(sFile) {
210
+ return {
211
+ key: sFile,
212
+ name: sFile,
213
+ url: sap.ui.require.toUrl((oSample.id).replace(/\./g, "/")) + "/" + sFile
214
+ };
215
+ }),
82
216
  iframe: oConfig.sample.iframe,
83
217
  fileName: sFileName,
84
218
  includeInDownload: oConfig.sample.additionalDownloadFiles,
85
219
  customIndexHTML: oConfig.sample.customIndexHTML
86
220
  };
87
221
 
88
- // retrieve files
89
- // (via the 'Orcish maneuver': Use XHR to retrieve and cache code)
90
- if (oConfig.sample && oConfig.sample.files) {
91
- var sRef = sap.ui.require.toUrl((oSample.id).replace(/\./g, "/"));
92
- for (var i = 0; i < oConfig.sample.files.length; i++) {
93
- var sFile = oConfig.sample.files[i];
94
- aPromises.push(this._updateFileContent(sRef, sFile));
95
-
96
- this._oData.files.push({
97
- name: sFile
98
- });
99
- this._aFilesAvailable.push(sFile);
100
- }
101
- }
102
- return Promise.all(aPromises);
103
- }.bind(this)).then(this._showCode.bind(this, sFileName));
222
+ return this._oData;
223
+ }.bind(this));
104
224
  } else {
105
225
  this._oData.fileName = sFileName;
106
- this._showCode(sFileName);
226
+ return Promise.resolve(this._oData);
107
227
  }
108
-
109
228
  },
110
229
 
111
- _showCode: function(sFileName){
112
- this.getAPIReferenceCheckPromise(this._sEntityId).then(function (bHasAPIReference) {
113
- this.getView().byId("apiRefButton").setVisible(bHasAPIReference);
114
- }.bind(this));
115
-
116
- // set model data
117
- this.oModel.setData(this._oData);
118
-
119
- if (sFileName === undefined) {
120
- sFileName = this._getInitialFileName();
121
- }
122
-
123
- if (this._aFilesAvailable.indexOf(sFileName) === -1) {
124
- this.onRouteNotFound();
125
- return;
230
+ _showCode: function (oCurrentSample) {
231
+ var bUseIFrame = !!oCurrentSample.useIFrame;
232
+ this._oCurrSample = oCurrentSample;
233
+ if (oCurrentSample.files) {
234
+ this._fileEditor.setFiles(oCurrentSample.files);
235
+ } else {
236
+ this.byId("splitView").setBusy(false);
126
237
  }
127
238
 
128
- // update <code>CodeEditor</code> content and the selected tab
129
- this._updateCodeEditor(sFileName);
130
-
131
- this._getTabHeader().setSelectedKey(sFileName);
132
-
133
- // scroll to the top of the page
134
- var page = this.byId("page");
135
- page.scrollTo(0);
136
-
137
- this.appendPageTitle(this.getModel().getProperty("/title"));
138
- },
239
+ ExploreSettingsModel.setProperty("/useIFrame", bUseIFrame);
240
+ this.oModel.setProperty("/sample", oCurrentSample);
139
241
 
140
- _updateFileContent: function(sRef, sFile) {
141
- return this.fetchSourceFile(sRef + "/" + sFile).then(function(vContent) {
142
- this._oData.files.some(function(oFile) {
143
- if (oFile.name === sFile) {
144
- oFile.raw = vContent;
145
- oFile.code = this._convertCodeToHtml(vContent);
146
- return true;
147
- }
148
- }, this);
149
- this.oModel.setData(this._oData);
242
+ window.addEventListener("message", function (event) {
243
+ if (event.data === "sampleLoaded") {
244
+ this.byId("splitView").setBusy(false);
245
+ }
150
246
  }.bind(this));
151
247
  },
152
248
 
153
- onAPIRefPress: function () {
154
- this.getRouter().navTo("apiId", {id: this._sEntityId});
155
- },
156
-
157
- onNavBack : function () {
158
- this.router.navTo("sample", {
159
- sampleId: this._sId,
160
- entityId: this._sEntityId
249
+ _createHTMLControl: function () {
250
+ return new HTML({
251
+ id : "sampleFrameEdit",
252
+ content : '<iframe src="' + this.sIFrameUrl + '" frameBorder="0" width="100%" height="100%"></iframe>'
161
253
  });
162
254
  },
163
255
 
164
- _convertCodeToHtml : function (code) {
165
- code = code.toString();
166
-
167
- // Get rid of function around code
168
- code = code.replace(/^function.+{/, "");
169
-
170
- code = code.replace(/}[!}]*$/, "");
171
-
172
- // Get rid of unwanted code if CODESNIP tags are used
173
- code = code.replace(/^[\n\s\S]*\/\/\s*CODESNIP_START\n/, "");
174
- code = code.replace(/\/\/\s*CODESNIP_END[\n\s\S]*$/, "");
175
-
176
- // Improve indentation for display
177
- code = code.replace(/\t/g, " ");
178
-
179
- return code;
180
- },
181
-
182
- handleTabSelectEvent: function(oEvent) {
183
- var sFileName = oEvent.getParameter("selectedKey"),
184
- oRouteParams = merge(formatter.filePathToRouteParams(sFileName), {
185
- entityId: this._sEntityId,
186
- sampleId: this._sId
187
- });
188
-
189
- this._bFirstLoad = false;
190
- this.router.navTo("codeFile", oRouteParams, false);
256
+ _getPage: function () {
257
+ return this.byId("samplePageEdit");
191
258
  },
192
259
 
193
- _updateCodeEditor : function(sFileName) {
194
- var oCodeEditor = this._getCodeEditor(),
195
- oAceInstance = oCodeEditor.getInternalEditorInstance(),
196
- oAceRenderer = oAceInstance.renderer;
197
-
198
- // set the <code>CodeEditor</code> new code base and its type - xml, js, json or css.
199
- oCodeEditor.setValue(this._getCode(sFileName));
200
- oCodeEditor.setType(this._getFileType(sFileName));
201
-
202
- // set the <code>CodeEditor</code> scroll pos to line 0
203
- oAceInstance.gotoLine(/*line*/0, /*column*/0, /*animate*/false);
204
-
205
- if (this._bFirstLoad) {
206
- setTimeout(function(){
207
- oAceRenderer.onResize();
208
- }, 0);
260
+ onMessage: function(eMessage) {
261
+ if (eMessage.origin !== this.getOwnerComponent()._sSampleIframeOrigin) {
262
+ return;
263
+ }
264
+ if (eMessage.source !== (this._oHtmlControl.getDomRef() && this._oHtmlControl.getDomRef().contentWindow)) {
265
+ return;
209
266
  }
210
267
 
211
- this._updateCodeEditorTheme(Core.getConfiguration().getTheme().toLowerCase());
212
- },
213
-
214
- _updateCodeEditorTheme : function(sTheme) {
215
- // coppied from the original CodeEditor file
216
- var sEditorTheme = "tomorrow";
217
- if (sTheme.indexOf("hcb") > -1) {
218
- sEditorTheme = "chaos";
219
- } else if (sTheme.indexOf("hcw") > -1) {
220
- sEditorTheme = "github";
221
- } else if (sTheme === "sap_fiori_3") {
222
- sEditorTheme = "crimson_editor";
223
- } else if (sTheme === "sap_fiori_3_dark" || sTheme === "sap_horizon_dark") {
224
- sEditorTheme = "clouds_midnight";
268
+ if (eMessage.data.type === "INIT") {
269
+ this.fnMessageInit(eMessage);
270
+ } else if (eMessage.data.type === "ERR") {
271
+ this.fnMessageError(eMessage);
272
+ } else if (eMessage.data.type === "LOAD") {
273
+ this.fnMessageLoad(eMessage);
225
274
  }
226
- this._getCodeEditor().setColorTheme(sEditorTheme);
227
275
  },
228
276
 
229
- _getCode : function (sFileName) {
230
- var aFiles = this.getModel().getData().files,
231
- sCode = "";
232
-
233
- aFiles.forEach(function(oFile) {
234
- if (oFile.name === sFileName) {
235
- sCode = oFile.raw;
236
- return true;
237
- }
238
- });
239
-
240
- return sCode;
277
+ onNavBack: function () {
278
+ this.oRouter.navTo("sample", {
279
+ entityId: this.entityId,
280
+ sampleId: this._sId
281
+ }, false);
241
282
  },
242
283
 
243
- _getFileType : function (sFileName) {
244
- var sFileExtension = sFileName.split('.').pop();
245
- switch (sFileExtension) {
246
- case "js":
247
- return "javascript";
248
- case "ts":
249
- return "typescript";
250
- case "feature":
251
- return "text";
252
- default:
253
- return sFileExtension;
254
- }
284
+ onPreviousSample: function (oEvent) {
285
+ this.oRouter.navTo("code", {
286
+ entityId: this.entityId,
287
+ sampleId: this.oModel.getProperty("/previousSampleId")
288
+ });
255
289
  },
256
290
 
257
- _getInitialFileName : function() {
258
- return (this._oData
259
- && this._oData.files
260
- && this._oData.files.length > 0
261
- && this._oData.files[0].name) || null;
291
+ onNextSample: function (oEvent) {
292
+ this.oRouter.navTo("code", {
293
+ entityId: this.entityId,
294
+ sampleId: this.oModel.getProperty("/nextSampleId")
295
+ });
262
296
  },
263
297
 
264
- _getCodeEditor : function() {
265
- if (!this.oCodeEditor) {
266
- this.oCodeEditor = this.byId("codeEditor");
267
- }
268
-
269
- return this.oCodeEditor;
270
- },
298
+ /**
299
+ * Reflects changes in the code editor to the sample.
300
+ * @param {string} sValue The value of the manifest.json file.
301
+ */
302
+ _updateSample: function () {
303
+ var oFrame = document.getElementById("sampleFrameEdit");
271
304
 
272
- _getTabHeader : function() {
273
- if (!this.oTabHeader) {
274
- this.oTabHeader = this.byId("tabHeader");
305
+ if (oFrame.contentWindow && oFrame.contentWindow.sap) {
306
+ oFrame.contentWindow.location.reload();
275
307
  }
276
-
277
- return this.oTabHeader;
278
308
  },
279
309
 
280
310
  _createComponent : function () {
@@ -480,7 +480,7 @@ sap.ui.define([
480
480
 
481
481
  // open
482
482
  oDialog.open();
483
- });
483
+ }.bind(this));
484
484
  },
485
485
 
486
486
  handleListFilter: function (oEvent) {