@openui5/sap.ui.rta 1.106.0 → 1.107.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.
- package/package.json +6 -6
- package/src/sap/ui/rta/.library +1 -1
- package/src/sap/ui/rta/Client.js +1 -1
- package/src/sap/ui/rta/RuntimeAuthoring.js +641 -654
- package/src/sap/ui/rta/Utils.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantUtils.js +2 -0
- package/src/sap/ui/rta/command/AddIFrame.js +1 -1
- package/src/sap/ui/rta/command/AddProperty.js +1 -1
- package/src/sap/ui/rta/command/AddXML.js +1 -1
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
- package/src/sap/ui/rta/command/BaseCommand.js +1 -1
- package/src/sap/ui/rta/command/BindProperty.js +1 -1
- package/src/sap/ui/rta/command/Combine.js +1 -1
- package/src/sap/ui/rta/command/CommandFactory.js +6 -5
- package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/CreateContainer.js +1 -1
- package/src/sap/ui/rta/command/CustomAdd.js +1 -1
- package/src/sap/ui/rta/command/FlexCommand.js +2 -2
- package/src/sap/ui/rta/command/LREPSerializer.js +3 -2
- package/src/sap/ui/rta/command/LocalReset.js +1 -1
- package/src/sap/ui/rta/command/Move.js +1 -1
- package/src/sap/ui/rta/command/Property.js +1 -1
- package/src/sap/ui/rta/command/Remove.js +1 -1
- package/src/sap/ui/rta/command/Rename.js +1 -1
- package/src/sap/ui/rta/command/Resize.js +1 -1
- package/src/sap/ui/rta/command/Reveal.js +1 -1
- package/src/sap/ui/rta/command/Settings.js +1 -1
- package/src/sap/ui/rta/command/Split.js +1 -1
- package/src/sap/ui/rta/command/Stack.js +12 -3
- package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
- package/src/sap/ui/rta/enablement/elementActionTest.js +4 -4
- package/src/sap/ui/rta/library.js +2 -2
- package/src/sap/ui/rta/messagebundle_ar.properties +4 -1
- package/src/sap/ui/rta/messagebundle_bg.properties +4 -1
- package/src/sap/ui/rta/messagebundle_ca.properties +4 -1
- package/src/sap/ui/rta/messagebundle_cs.properties +4 -1
- package/src/sap/ui/rta/messagebundle_cy.properties +4 -1
- package/src/sap/ui/rta/messagebundle_da.properties +4 -1
- package/src/sap/ui/rta/messagebundle_de.properties +16 -13
- package/src/sap/ui/rta/messagebundle_el.properties +4 -1
- package/src/sap/ui/rta/messagebundle_en.properties +4 -1
- package/src/sap/ui/rta/messagebundle_en_GB.properties +4 -1
- package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +3 -0
- package/src/sap/ui/rta/messagebundle_es.properties +4 -1
- package/src/sap/ui/rta/messagebundle_es_MX.properties +4 -1
- package/src/sap/ui/rta/messagebundle_et.properties +4 -1
- package/src/sap/ui/rta/messagebundle_fi.properties +4 -1
- package/src/sap/ui/rta/messagebundle_fr.properties +4 -1
- package/src/sap/ui/rta/messagebundle_fr_CA.properties +4 -1
- package/src/sap/ui/rta/messagebundle_hi.properties +4 -1
- package/src/sap/ui/rta/messagebundle_hr.properties +4 -1
- package/src/sap/ui/rta/messagebundle_hu.properties +4 -1
- package/src/sap/ui/rta/messagebundle_id.properties +4 -1
- package/src/sap/ui/rta/messagebundle_it.properties +4 -1
- package/src/sap/ui/rta/messagebundle_iw.properties +4 -1
- package/src/sap/ui/rta/messagebundle_ja.properties +4 -1
- package/src/sap/ui/rta/messagebundle_kk.properties +4 -1
- package/src/sap/ui/rta/messagebundle_ko.properties +4 -1
- package/src/sap/ui/rta/messagebundle_lt.properties +4 -1
- package/src/sap/ui/rta/messagebundle_lv.properties +4 -1
- package/src/sap/ui/rta/messagebundle_ms.properties +4 -1
- package/src/sap/ui/rta/messagebundle_nl.properties +4 -1
- package/src/sap/ui/rta/messagebundle_no.properties +4 -1
- package/src/sap/ui/rta/messagebundle_pl.properties +4 -1
- package/src/sap/ui/rta/messagebundle_pt.properties +4 -1
- package/src/sap/ui/rta/messagebundle_pt_PT.properties +4 -1
- package/src/sap/ui/rta/messagebundle_ro.properties +4 -1
- package/src/sap/ui/rta/messagebundle_ru.properties +4 -1
- package/src/sap/ui/rta/messagebundle_sh.properties +4 -1
- package/src/sap/ui/rta/messagebundle_sk.properties +4 -1
- package/src/sap/ui/rta/messagebundle_sl.properties +4 -1
- package/src/sap/ui/rta/messagebundle_sv.properties +4 -1
- package/src/sap/ui/rta/messagebundle_th.properties +4 -1
- package/src/sap/ui/rta/messagebundle_tr.properties +4 -1
- package/src/sap/ui/rta/messagebundle_uk.properties +4 -1
- package/src/sap/ui/rta/messagebundle_vi.properties +4 -1
- package/src/sap/ui/rta/messagebundle_zh_CN.properties +4 -1
- package/src/sap/ui/rta/messagebundle_zh_TW.properties +4 -1
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +6 -4
- package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
- package/src/sap/ui/rta/plugin/Combine.js +1 -1
- package/src/sap/ui/rta/plugin/ControlVariant.js +1 -1
- package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
- package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
- package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
- package/src/sap/ui/rta/plugin/EasyAdd.js +1 -1
- package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
- package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
- package/src/sap/ui/rta/plugin/Plugin.js +1 -1
- package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
- package/src/sap/ui/rta/plugin/Remove.js +1 -1
- package/src/sap/ui/rta/plugin/Rename.js +1 -1
- package/src/sap/ui/rta/plugin/RenameHandler.js +1 -1
- package/src/sap/ui/rta/plugin/Resize.js +1 -1
- package/src/sap/ui/rta/plugin/Selection.js +1 -1
- package/src/sap/ui/rta/plugin/Settings.js +1 -1
- package/src/sap/ui/rta/plugin/Split.js +1 -1
- package/src/sap/ui/rta/plugin/Stretch.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
- package/src/sap/ui/rta/service/Action.js +1 -1
- package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
- package/src/sap/ui/rta/service/Outline.js +6 -4
- package/src/sap/ui/rta/service/Property.js +1 -1
- package/src/sap/ui/rta/service/Selection.js +1 -1
- package/src/sap/ui/rta/service/SupportTools.js +1 -1
- package/src/sap/ui/rta/toolbar/Adaptation.js +2 -1
- package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +3 -1
- package/src/sap/ui/rta/toolbar/Base.js +1 -1
- package/src/sap/ui/rta/toolbar/BaseRenderer.js +6 -4
- package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
- package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
- package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
- package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
- package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +27 -34
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptationDialog.fragment.xml +1 -1
- package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
- package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
- package/src/sap/ui/rta/util/BindingsExtractor.js +12 -3
- package/src/sap/ui/rta/util/PluginManager.js +1 -1
- package/src/sap/ui/rta/util/PopupManager.js +1 -1
- package/src/sap/ui/rta/util/ReloadManager.js +1 -1
- package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
- package/src/sap/ui/rta/util/StylesLoader.js +3 -3
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +9 -9
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +24 -17
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +6 -3
- package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/MoveVisualization.js +13 -12
- package/src/sap/ui/rta/util/changeVisualization/commands/RenameVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/SplitVisualization.js +1 -1
|
@@ -24,6 +24,7 @@ sap.ui.define([
|
|
|
24
24
|
"sap/ui/events/KeyCodes",
|
|
25
25
|
"sap/ui/fl/write/api/Version",
|
|
26
26
|
"sap/ui/fl/apply/api/SmartVariantManagementApplyAPI",
|
|
27
|
+
"sap/ui/fl/write/api/ContextBasedAdaptationsAPI",
|
|
27
28
|
"sap/ui/fl/write/api/ControlPersonalizationWriteAPI",
|
|
28
29
|
"sap/ui/fl/write/api/FeaturesAPI",
|
|
29
30
|
"sap/ui/fl/write/api/PersistenceWriteAPI",
|
|
@@ -71,6 +72,7 @@ sap.ui.define([
|
|
|
71
72
|
KeyCodes,
|
|
72
73
|
Version,
|
|
73
74
|
SmartVariantManagementApplyAPI,
|
|
75
|
+
ContextBasedAdaptationsAPI,
|
|
74
76
|
ControlPersonalizationWriteAPI,
|
|
75
77
|
FeaturesAPI,
|
|
76
78
|
PersistenceWriteAPI,
|
|
@@ -116,7 +118,7 @@ sap.ui.define([
|
|
|
116
118
|
* @class The runtime authoring allows to adapt the fields of a running application.
|
|
117
119
|
* @extends sap.ui.base.ManagedObject
|
|
118
120
|
* @author SAP SE
|
|
119
|
-
* @version 1.
|
|
121
|
+
* @version 1.107.0
|
|
120
122
|
* @constructor
|
|
121
123
|
* @private
|
|
122
124
|
* @since 1.30
|
|
@@ -134,12 +136,6 @@ sap.ui.define([
|
|
|
134
136
|
}
|
|
135
137
|
},
|
|
136
138
|
properties: {
|
|
137
|
-
/** The URL which is called when the custom field dialog is opened */
|
|
138
|
-
customFieldUrl: "string",
|
|
139
|
-
|
|
140
|
-
/** Whether the create custom field button should be shown */
|
|
141
|
-
showCreateCustomField: "boolean",
|
|
142
|
-
|
|
143
139
|
/** Whether the create custom field button should be shown */
|
|
144
140
|
showToolbars: {
|
|
145
141
|
type: "boolean",
|
|
@@ -247,8 +243,8 @@ sap.ui.define([
|
|
|
247
243
|
this.addDependent(new PopupManager(), "popupManager");
|
|
248
244
|
|
|
249
245
|
if (this.getShowToolbars()) {
|
|
250
|
-
this.getPopupManager().attachOpen(
|
|
251
|
-
this.getPopupManager().attachClose(
|
|
246
|
+
this.getPopupManager().attachOpen(onPopupOpen, this);
|
|
247
|
+
this.getPopupManager().attachClose(onPopupClose, this);
|
|
252
248
|
|
|
253
249
|
// Change visualization can only be triggered from the toolbar
|
|
254
250
|
this.addDependent(new ChangeVisualization(), "changeVisualization");
|
|
@@ -260,22 +256,50 @@ sap.ui.define([
|
|
|
260
256
|
this.startService("supportTools");
|
|
261
257
|
|
|
262
258
|
this._loadUShellServicesPromise = FlexUtils.getUShellServices(["URLParsing", "AppLifeCycle", "CrossApplicationNavigation"])
|
|
263
|
-
.then(function
|
|
259
|
+
.then(function(mUShellServices) {
|
|
264
260
|
this._mUShellServices = mUShellServices;
|
|
265
261
|
ReloadManager.setUShellServices(mUShellServices);
|
|
266
262
|
}.bind(this));
|
|
267
263
|
}
|
|
268
264
|
});
|
|
269
265
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
266
|
+
/**
|
|
267
|
+
* The RTA FLP plugin checks whether RTA needs to be restarted and restarts it if needed.
|
|
268
|
+
*
|
|
269
|
+
* @public
|
|
270
|
+
* @static
|
|
271
|
+
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
272
|
+
* @returns {boolean} Returns true if restart is needed
|
|
273
|
+
*/
|
|
274
|
+
RuntimeAuthoring.needsRestart = function(sLayer) {
|
|
275
|
+
return ReloadManager.needsAutomaticStart(sLayer);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Enable restart of RTA
|
|
280
|
+
* the RTA FLP plugin handles the restart
|
|
281
|
+
*
|
|
282
|
+
* @public
|
|
283
|
+
* @static
|
|
284
|
+
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
285
|
+
* @param {sap.ui.core.Control} oRootControl - Root control for which RTA was started
|
|
286
|
+
*/
|
|
287
|
+
RuntimeAuthoring.enableRestart = function(sLayer, oRootControl) {
|
|
288
|
+
ReloadManager.enableAutomaticStart(sLayer, oRootControl);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Disable restart of RTA
|
|
293
|
+
*
|
|
294
|
+
* @public
|
|
295
|
+
* @static
|
|
296
|
+
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
297
|
+
*/
|
|
298
|
+
RuntimeAuthoring.disableRestart = function(sLayer) {
|
|
299
|
+
ReloadManager.disableAutomaticStart(sLayer);
|
|
276
300
|
};
|
|
277
301
|
|
|
278
|
-
RuntimeAuthoring.prototype.addDependent = function
|
|
302
|
+
RuntimeAuthoring.prototype.addDependent = function(oObject, sName, bCreateGetter) {
|
|
279
303
|
bCreateGetter = typeof bCreateGetter === "undefined" ? true : !!bCreateGetter;
|
|
280
304
|
if (!(sName in this._dependents)) {
|
|
281
305
|
if (sName && bCreateGetter) {
|
|
@@ -295,35 +319,18 @@ sap.ui.define([
|
|
|
295
319
|
return this._dependents[sName];
|
|
296
320
|
};
|
|
297
321
|
|
|
298
|
-
RuntimeAuthoring.prototype.getDependents = function
|
|
322
|
+
RuntimeAuthoring.prototype.getDependents = function() {
|
|
299
323
|
return this._dependents;
|
|
300
324
|
};
|
|
301
325
|
|
|
302
|
-
RuntimeAuthoring.prototype.removeDependent = function
|
|
326
|
+
RuntimeAuthoring.prototype.removeDependent = function(sName) {
|
|
303
327
|
delete this._dependents[sName];
|
|
304
328
|
};
|
|
305
329
|
|
|
306
|
-
|
|
307
|
-
RuntimeAuthoring.prototype.onPopupOpen = function(oEvent) {
|
|
308
|
-
var oOpenedPopup = oEvent.getParameters().getSource();
|
|
309
|
-
if (
|
|
310
|
-
oOpenedPopup.isA("sap.m.Dialog")
|
|
311
|
-
&& this.getToolbar().type === "fiori"
|
|
312
|
-
) {
|
|
313
|
-
this.getToolbar().setColor("contrast");
|
|
314
|
-
}
|
|
315
|
-
this.getToolbar().bringToFront();
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
RuntimeAuthoring.prototype.onPopupClose = function(oEvent) {
|
|
319
|
-
if (oEvent.getParameters().isA("sap.m.Dialog")) {
|
|
320
|
-
this.getToolbar().setColor();
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
|
|
324
330
|
/**
|
|
325
331
|
* Setter method for plugins. Plugins can't be set when runtime authoring is started.
|
|
326
|
-
*
|
|
332
|
+
*
|
|
333
|
+
* @param {object} mPlugins - Map of plugins
|
|
327
334
|
*/
|
|
328
335
|
RuntimeAuthoring.prototype.setPlugins = function(mPlugins) {
|
|
329
336
|
if (this._sStatus !== STOPPED) {
|
|
@@ -334,9 +341,10 @@ sap.ui.define([
|
|
|
334
341
|
|
|
335
342
|
/**
|
|
336
343
|
* Getter method for plugins.
|
|
337
|
-
*
|
|
344
|
+
*
|
|
345
|
+
* @returns {Object<string, sap.ui.rta.plugin.Plugin>} Map with plugins
|
|
338
346
|
*/
|
|
339
|
-
RuntimeAuthoring.prototype.getPlugins = function
|
|
347
|
+
RuntimeAuthoring.prototype.getPlugins = function() {
|
|
340
348
|
return this.getPluginManager
|
|
341
349
|
&& this.getPluginManager()
|
|
342
350
|
&& this.getPluginManager().getPlugins();
|
|
@@ -352,9 +360,9 @@ sap.ui.define([
|
|
|
352
360
|
* always the same instances get returned.
|
|
353
361
|
*
|
|
354
362
|
* @public
|
|
355
|
-
* @
|
|
363
|
+
* @returns {Object<string,sap.ui.rta.plugin.Plugin>} Map with plugins
|
|
356
364
|
*/
|
|
357
|
-
RuntimeAuthoring.prototype.getDefaultPlugins = function
|
|
365
|
+
RuntimeAuthoring.prototype.getDefaultPlugins = function() {
|
|
358
366
|
return this.getPluginManager().getDefaultPlugins(this.getFlexSettings());
|
|
359
367
|
};
|
|
360
368
|
|
|
@@ -393,10 +401,10 @@ sap.ui.define([
|
|
|
393
401
|
/**
|
|
394
402
|
* Checks the uri parameters for "sap-ui-layer" and returns either the current layer or the layer from the uri parameter, if there is one
|
|
395
403
|
*
|
|
396
|
-
* @returns {string}
|
|
404
|
+
* @returns {string} The layer after checking the uri parameters
|
|
397
405
|
* @private
|
|
398
406
|
*/
|
|
399
|
-
RuntimeAuthoring.prototype.getLayer = function
|
|
407
|
+
RuntimeAuthoring.prototype.getLayer = function() {
|
|
400
408
|
return this.getFlexSettings().layer;
|
|
401
409
|
};
|
|
402
410
|
|
|
@@ -411,41 +419,13 @@ sap.ui.define([
|
|
|
411
419
|
return sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
|
|
412
420
|
};
|
|
413
421
|
|
|
414
|
-
RuntimeAuthoring.prototype._setVersionsModel = function(oModel) {
|
|
415
|
-
this._oVersionsModel = oModel;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
RuntimeAuthoring.prototype._initVersioning = function() {
|
|
419
|
-
return VersionsAPI.initialize({
|
|
420
|
-
control: this.getRootControlInstance(),
|
|
421
|
-
layer: this.getLayer()
|
|
422
|
-
}).then(this._setVersionsModel.bind(this));
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
RuntimeAuthoring.prototype._onPersonalizationChangeCreation = function() {
|
|
426
|
-
if (this.getMode() === "navigation" && !this._bNavigationModeWarningShown) {
|
|
427
|
-
this._showMessageToast("MSG_NAVIGATION_MODE_CHANGES_WARNING", {
|
|
428
|
-
duration: 5000
|
|
429
|
-
});
|
|
430
|
-
this._bNavigationModeWarningShown = true;
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
function addOrRemoveStyleClass(oRootControl, bAdd) {
|
|
435
|
-
if (oRootControl.isA("sap.ui.core.UIComponent")) {
|
|
436
|
-
oRootControl = oRootControl.getRootControl();
|
|
437
|
-
}
|
|
438
|
-
if (oRootControl) {
|
|
439
|
-
oRootControl[bAdd ? "addStyleClass" : "removeStyleClass"]("sapUiRtaRoot");
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
422
|
/**
|
|
444
423
|
* Start UI adaptation at runtime (RTA).
|
|
445
|
-
*
|
|
424
|
+
*
|
|
425
|
+
* @returns {Promise} Returns a Promise with the initialization of RTA
|
|
446
426
|
* @public
|
|
447
427
|
*/
|
|
448
|
-
RuntimeAuthoring.prototype.start = function
|
|
428
|
+
RuntimeAuthoring.prototype.start = function() {
|
|
449
429
|
var oDesignTimePromise;
|
|
450
430
|
var vError;
|
|
451
431
|
// Create DesignTime
|
|
@@ -459,7 +439,7 @@ sap.ui.define([
|
|
|
459
439
|
}
|
|
460
440
|
|
|
461
441
|
return this._loadUShellServicesPromise
|
|
462
|
-
.then(
|
|
442
|
+
.then(initVersioning.bind(this))
|
|
463
443
|
/*
|
|
464
444
|
Check if the application has personalized changes and reload without them;
|
|
465
445
|
Also Check if the application has an available draft and if yes, reload with those changes.
|
|
@@ -485,13 +465,13 @@ sap.ui.define([
|
|
|
485
465
|
|
|
486
466
|
this.getPluginManager().preparePlugins(
|
|
487
467
|
this.getFlexSettings(),
|
|
488
|
-
|
|
468
|
+
handleElementModified.bind(this),
|
|
489
469
|
this.getCommandStack()
|
|
490
470
|
);
|
|
491
471
|
|
|
492
472
|
var aPlugins = this.getPluginManager().getPluginList();
|
|
493
473
|
|
|
494
|
-
oDesignTimePromise = new Promise(function
|
|
474
|
+
oDesignTimePromise = new Promise(function(fnResolve, fnReject) {
|
|
495
475
|
Measurement.start("rta.dt.startup", "Measurement of RTA: DesignTime start up");
|
|
496
476
|
this._oDesignTime = new DesignTime({
|
|
497
477
|
scope: this.getMetadataScope(),
|
|
@@ -529,23 +509,23 @@ sap.ui.define([
|
|
|
529
509
|
window.onbeforeunload = this._onUnload.bind(this);
|
|
530
510
|
return undefined;
|
|
531
511
|
}.bind(this))
|
|
532
|
-
.then(function
|
|
512
|
+
.then(function() {
|
|
533
513
|
if (this.getShowToolbars()) {
|
|
534
514
|
// Create ToolsMenu
|
|
535
|
-
return this.
|
|
536
|
-
.then(
|
|
515
|
+
return getToolbarButtonsVisibility(this.getRootControlInstance(), this.getLayer(), this._oSerializer)
|
|
516
|
+
.then(createToolsMenu.bind(this));
|
|
537
517
|
}
|
|
538
518
|
return undefined;
|
|
539
519
|
}.bind(this))
|
|
540
520
|
// this is needed to initially check if undo is available, e.g. when the stack gets initialized with changes
|
|
541
|
-
.then(
|
|
542
|
-
.then(function
|
|
521
|
+
.then(onStackModified.bind(this))
|
|
522
|
+
.then(function() {
|
|
543
523
|
//Resolve the CSS variable set in themes/base/OverlayWithScrollbar.css
|
|
544
524
|
Overlay.getOverlayContainer().get(0).style.setProperty("--sap-ui-rta-scrollbar-scrollWidth", DOMUtil.getScrollbarWidth() + "px");
|
|
545
525
|
Overlay.getOverlayContainer().get(0).style.setProperty("--sap-ui-rta-scrollbar-scrollWidthPlusTwo", DOMUtil.getScrollbarWidth() + 2 + "px");
|
|
546
526
|
return oDesignTimePromise;
|
|
547
527
|
})
|
|
548
|
-
.then(function
|
|
528
|
+
.then(function() {
|
|
549
529
|
// PopupManager sets the toolbar to already open popups' autoCloseAreas
|
|
550
530
|
// Since at this point the toolbar is not available, it waits for RTA to start,
|
|
551
531
|
// before adding it to the autoCloseAreas of the open popups
|
|
@@ -556,24 +536,24 @@ sap.ui.define([
|
|
|
556
536
|
}
|
|
557
537
|
return undefined;
|
|
558
538
|
}.bind(this))
|
|
559
|
-
.then(function
|
|
539
|
+
.then(function() {
|
|
560
540
|
if (Device.browser.name === "ff") {
|
|
561
541
|
// in FF shift+f10 also opens a browser context menu.
|
|
562
542
|
// It seems that the only way to get rid of it is to completely turn off context menu in ff..
|
|
563
|
-
jQuery(document).on("contextmenu",
|
|
543
|
+
jQuery(document).on("contextmenu", ffContextMenuHandler);
|
|
564
544
|
}
|
|
565
545
|
})
|
|
566
546
|
.then(function() {
|
|
567
|
-
this.fnKeyDown =
|
|
547
|
+
this.fnKeyDown = onKeyDown.bind(this);
|
|
568
548
|
jQuery(document).on("keydown", this.fnKeyDown);
|
|
569
|
-
this.fnOnPersonalizationChangeCreation =
|
|
549
|
+
this.fnOnPersonalizationChangeCreation = onPersonalizationChangeCreation.bind(this);
|
|
570
550
|
ControlPersonalizationWriteAPI.attachChangeCreation(
|
|
571
551
|
this.getRootControlInstance(),
|
|
572
552
|
this.fnOnPersonalizationChangeCreation
|
|
573
553
|
);
|
|
574
554
|
}.bind(this))
|
|
575
|
-
.then(
|
|
576
|
-
.then(function
|
|
555
|
+
.then(shouldValidateFlexEnabled)
|
|
556
|
+
.then(function(bShouldValidateFlexEnabled) {
|
|
577
557
|
if (bShouldValidateFlexEnabled) {
|
|
578
558
|
validateFlexEnabled(this);
|
|
579
559
|
}
|
|
@@ -582,7 +562,7 @@ sap.ui.define([
|
|
|
582
562
|
editablePluginsCount: this.getPluginManager().getEditableOverlaysCount()
|
|
583
563
|
});
|
|
584
564
|
}.bind(this))
|
|
585
|
-
.catch(function
|
|
565
|
+
.catch(function(vError) {
|
|
586
566
|
if (vError === "Reload triggered") {
|
|
587
567
|
// destroy rta when reload is triggered - otherwise the consumer needs to take care of this
|
|
588
568
|
this.destroy();
|
|
@@ -596,68 +576,57 @@ sap.ui.define([
|
|
|
596
576
|
return Promise.reject("RuntimeAuthoring is already started");
|
|
597
577
|
};
|
|
598
578
|
|
|
599
|
-
function _ffContextMenuHandler() {
|
|
600
|
-
return false;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
579
|
/**
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
* @
|
|
607
|
-
* @
|
|
608
|
-
*
|
|
609
|
-
*
|
|
580
|
+
* Stops Runtime Authoring
|
|
581
|
+
*
|
|
582
|
+
* @public
|
|
583
|
+
* @param {boolean} bSkipSave - Stop RTA with or w/o saving changes
|
|
584
|
+
* @param {boolean} bSkipRestart - Stop RTA with or w/o checking if a reload is needed to apply e.g. personalization/app descriptor changes
|
|
585
|
+
* @returns {Promise} Resolves with undefined
|
|
610
586
|
*/
|
|
611
|
-
RuntimeAuthoring.prototype.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
587
|
+
RuntimeAuthoring.prototype.stop = function(bSkipSave, bSkipRestart) {
|
|
588
|
+
checkToolbarAndExecuteFunction.call(this, "setBusy", true);
|
|
589
|
+
var oReloadInfo;
|
|
590
|
+
return waitForPendingActions.call(this)
|
|
591
|
+
.then(function() {
|
|
592
|
+
if (bSkipRestart) {
|
|
593
|
+
return {};
|
|
594
|
+
}
|
|
595
|
+
return ReloadManager.checkReloadOnExit({
|
|
596
|
+
layer: this.getLayer(),
|
|
597
|
+
selector: this.getRootControlInstance(),
|
|
598
|
+
isDraftAvailable: this._oVersionsModel.getProperty("/draftAvailable"),
|
|
599
|
+
versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
|
|
600
|
+
activeVersion: this._oVersionsModel.getProperty("/activeVersion"),
|
|
601
|
+
changesNeedReloadPromise: this._bSavedChangesNeedReload ? Promise.resolve(true) : this._oSerializer.needsReload()
|
|
602
|
+
});
|
|
603
|
+
}.bind(this))
|
|
604
|
+
.then(function(oReturn) {
|
|
605
|
+
oReloadInfo = oReturn;
|
|
606
|
+
return bSkipSave ? Promise.resolve() : this._serializeToLrep();
|
|
607
|
+
}.bind(this))
|
|
608
|
+
.then(checkToolbarAndExecuteFunction.bind(this, "hide", bSkipSave))
|
|
609
|
+
.then(function() {
|
|
610
|
+
this.fireStop();
|
|
611
|
+
if (!bSkipRestart) {
|
|
612
|
+
ReloadManager.handleUrlParametersOnExit(oReloadInfo);
|
|
613
|
+
}
|
|
614
|
+
}.bind(this))
|
|
615
|
+
.catch(showTechnicalError)
|
|
616
|
+
.then(function() {
|
|
617
|
+
checkToolbarAndExecuteFunction.call(this, "setBusy", false);
|
|
618
|
+
this._sStatus = STOPPED;
|
|
619
|
+
jQuery("body").removeClass("sapUiRtaMode");
|
|
620
|
+
}.bind(this));
|
|
640
621
|
};
|
|
641
622
|
|
|
642
|
-
function showTechnicalError(vError) {
|
|
643
|
-
BusyIndicator.hide();
|
|
644
|
-
var sErrorMessage = vError.userMessage || vError.stack || vError.message || vError.status || vError;
|
|
645
|
-
var oTextResources = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
|
|
646
|
-
Log.error("Failed to transfer changes", sErrorMessage);
|
|
647
|
-
var sMsg = oTextResources.getText("MSG_LREP_TRANSFER_ERROR") + "\n"
|
|
648
|
-
+ oTextResources.getText("MSG_ERROR_REASON", sErrorMessage);
|
|
649
|
-
MessageBox.error(sMsg, {
|
|
650
|
-
styleClass: Utils.getRtaStyleClassName()
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
|
|
654
623
|
/**
|
|
655
624
|
* @override
|
|
656
625
|
*/
|
|
657
626
|
RuntimeAuthoring.prototype.setCommandStack = function(oCommandStack) {
|
|
658
627
|
var oOldCommandStack = this.getProperty("commandStack");
|
|
659
628
|
if (oOldCommandStack) {
|
|
660
|
-
oOldCommandStack.detachModified(
|
|
629
|
+
oOldCommandStack.detachModified(onStackModified, this);
|
|
661
630
|
}
|
|
662
631
|
|
|
663
632
|
if (this._oInternalCommandStack) {
|
|
@@ -668,7 +637,7 @@ sap.ui.define([
|
|
|
668
637
|
var oResult = this.setProperty("commandStack", oCommandStack);
|
|
669
638
|
|
|
670
639
|
if (oCommandStack) {
|
|
671
|
-
oCommandStack.attachModified(
|
|
640
|
+
oCommandStack.attachModified(onStackModified, this);
|
|
672
641
|
}
|
|
673
642
|
|
|
674
643
|
if (this.getPluginManager && this.getPluginManager()) {
|
|
@@ -679,7 +648,6 @@ sap.ui.define([
|
|
|
679
648
|
};
|
|
680
649
|
|
|
681
650
|
/**
|
|
682
|
-
*
|
|
683
651
|
* @override
|
|
684
652
|
*/
|
|
685
653
|
RuntimeAuthoring.prototype.getCommandStack = function() {
|
|
@@ -694,151 +662,210 @@ sap.ui.define([
|
|
|
694
662
|
};
|
|
695
663
|
|
|
696
664
|
/**
|
|
697
|
-
*
|
|
698
|
-
* @returns {Promise} Resolves as soon as the MessageBox is closed
|
|
699
|
-
* @private
|
|
665
|
+
* @override
|
|
700
666
|
*/
|
|
701
|
-
RuntimeAuthoring.prototype.
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
667
|
+
RuntimeAuthoring.prototype.setMode = function(sNewMode) {
|
|
668
|
+
var sCurrentMode = this.getMode();
|
|
669
|
+
if (sCurrentMode !== sNewMode) {
|
|
670
|
+
var oTabHandlingPlugin = this.getPluginManager().getPlugin("tabHandling");
|
|
671
|
+
var oSelectionPlugin = this.getPluginManager().getPlugin("selection");
|
|
706
672
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
!bBackEndDraftExists
|
|
713
|
-
) {
|
|
714
|
-
return this._modifyStack();
|
|
715
|
-
}
|
|
673
|
+
// Switch between another mode and navigation -> toggle overlay & App-TabIndex enablement
|
|
674
|
+
if (sCurrentMode === "navigation" || sNewMode === "navigation") {
|
|
675
|
+
this._oDesignTime.setEnabled(sNewMode !== "navigation");
|
|
676
|
+
oTabHandlingPlugin[(sNewMode === "navigation") ? "restoreTabIndex" : "removeTabIndex"]();
|
|
677
|
+
}
|
|
716
678
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
.then(function(sAction) {
|
|
724
|
-
if (sAction === MessageBox.Action.OK) {
|
|
725
|
-
this._discardDraftConfirmed();
|
|
726
|
-
} else {
|
|
727
|
-
this.undo();
|
|
679
|
+
var oChangeVisualization = this.getChangeVisualization && this.getChangeVisualization();
|
|
680
|
+
if (sNewMode === "visualization" || sCurrentMode === "visualization") {
|
|
681
|
+
DtUtil.waitForSynced(this._oDesignTime)()
|
|
682
|
+
.then(function() {
|
|
683
|
+
return oChangeVisualization.triggerModeChange(this.getRootControl(), this.getToolbar());
|
|
684
|
+
}.bind(this));
|
|
728
685
|
}
|
|
729
|
-
}.bind(this));
|
|
730
|
-
};
|
|
731
686
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
};
|
|
687
|
+
if (sCurrentMode === "adaptation") {
|
|
688
|
+
this.getPluginManager().handleStopCutPaste();
|
|
689
|
+
}
|
|
736
690
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
var oCommandStack = this.getCommandStack();
|
|
740
|
-
var bCanUndo = oCommandStack.canUndo();
|
|
741
|
-
var bCanRedo = oCommandStack.canRedo();
|
|
742
|
-
var bTranslationRelevantDirtyChange = this._oToolbarControlsModel.getProperty("/translationVisible") &&
|
|
743
|
-
TranslationAPI.hasTranslationRelevantDirtyChanges({layer: Layer.CUSTOMER, selector: this.getRootControlInstance()});
|
|
691
|
+
oTabHandlingPlugin[(sNewMode === "adaptation") ? "restoreOverlayTabIndex" : "removeOverlayTabIndex"]();
|
|
692
|
+
oSelectionPlugin.setIsActive(!(sNewMode === "visualization"));
|
|
744
693
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
this._oToolbarControlsModel.setProperty("/translationEnabled", this.bPersistedDataTranslatable || bTranslationRelevantDirtyChange);
|
|
752
|
-
}
|
|
753
|
-
this.fireUndoRedoStackModified();
|
|
754
|
-
return Promise.resolve();
|
|
755
|
-
};
|
|
694
|
+
Overlay.getOverlayContainer().toggleClass("sapUiRtaVisualizationMode", (sNewMode === "visualization"));
|
|
695
|
+
if (sNewMode === "visualization") {
|
|
696
|
+
jQuery(".sapUiDtOverlayMovable").css("cursor", "default");
|
|
697
|
+
} else {
|
|
698
|
+
jQuery(".sapUiDtOverlayMovable").css("cursor", "move");
|
|
699
|
+
}
|
|
756
700
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
701
|
+
this._oToolbarControlsModel.setProperty("/modeSwitcher", sNewMode);
|
|
702
|
+
this.setProperty("mode", sNewMode);
|
|
703
|
+
this.fireModeChanged({mode: sNewMode});
|
|
760
704
|
}
|
|
761
|
-
return undefined;
|
|
762
705
|
};
|
|
763
706
|
|
|
764
707
|
/**
|
|
765
|
-
*
|
|
766
|
-
* @return {sap.ui.dt.Overlay[]} selected overlays
|
|
767
|
-
* @public
|
|
708
|
+
* @override
|
|
768
709
|
*/
|
|
769
|
-
RuntimeAuthoring.prototype.
|
|
770
|
-
|
|
771
|
-
|
|
710
|
+
RuntimeAuthoring.prototype.setMetadataScope = function(sScope) {
|
|
711
|
+
// We do not support scope change after creation of DesignTime instance
|
|
712
|
+
// as this requires re-initialization of all overlays
|
|
713
|
+
if (this._sStatus !== STOPPED) {
|
|
714
|
+
Log.error("sap.ui.rta: Failed to set metadata scope on RTA instance after RTA is started");
|
|
715
|
+
return;
|
|
772
716
|
}
|
|
773
|
-
|
|
717
|
+
|
|
718
|
+
this.setProperty("metadataScope", sScope);
|
|
774
719
|
};
|
|
775
720
|
|
|
776
|
-
function waitForPendingActions() {
|
|
777
|
-
return Promise.resolve(this._oDesignTime && this._oDesignTime.waitForBusyPlugins())
|
|
778
|
-
.then(function() {
|
|
779
|
-
return this._pElementModified;
|
|
780
|
-
}.bind(this));
|
|
781
|
-
}
|
|
782
|
-
|
|
783
721
|
/**
|
|
784
|
-
*
|
|
722
|
+
* Exit Runtime Authoring - destroy all controls and plugins
|
|
785
723
|
*
|
|
724
|
+
* @protected
|
|
725
|
+
*/
|
|
726
|
+
RuntimeAuthoring.prototype.destroy = function() {
|
|
727
|
+
jQuery.map(this._dependents, function(oDependent, sName) {
|
|
728
|
+
this.removeDependent(sName);
|
|
729
|
+
// Destroy should be called with suppress invalidate = true here to prevent static UI Area invalidation
|
|
730
|
+
oDependent.destroy(true);
|
|
731
|
+
}.bind(this));
|
|
732
|
+
|
|
733
|
+
Object.keys(this._mServices).forEach(function(sServiceName) {
|
|
734
|
+
this.stopService(sServiceName);
|
|
735
|
+
}, this);
|
|
736
|
+
|
|
737
|
+
if (this._oDesignTime) {
|
|
738
|
+
this._oDesignTime.destroy();
|
|
739
|
+
this._oDesignTime = null;
|
|
740
|
+
|
|
741
|
+
// detach browser events
|
|
742
|
+
jQuery(document).off("keydown", this.fnKeyDown);
|
|
743
|
+
|
|
744
|
+
if (this.fnOnPersonalizationChangeCreation) {
|
|
745
|
+
ControlPersonalizationWriteAPI.detachChangeCreation(
|
|
746
|
+
this.getRootControlInstance(),
|
|
747
|
+
this.fnOnPersonalizationChangeCreation
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
if (this.getRootControlInstance()) {
|
|
753
|
+
addOrRemoveStyleClass(this.getRootControlInstance(), false);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
this.setCommandStack(null);
|
|
757
|
+
|
|
758
|
+
if (this._oServiceEventBus) {
|
|
759
|
+
this._oServiceEventBus.destroy();
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
if (Device.browser.name === "ff") {
|
|
763
|
+
jQuery(document).off("contextmenu", ffContextMenuHandler);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
window.onbeforeunload = this._oldUnloadHandler;
|
|
767
|
+
|
|
768
|
+
ManagedObject.prototype.destroy.apply(this, arguments);
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
// ---- API ----
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Returns the selected overlays from the DesignTime. Used by VisualEditor
|
|
775
|
+
* @returns {sap.ui.dt.Overlay[]} Selected overlays
|
|
786
776
|
* @public
|
|
787
|
-
* @param {boolean} bDontSaveChanges - Stop RTA with or w/o saving changes
|
|
788
|
-
* @param {boolean} bSkipRestart - Stop RTA with or w/o checking if a reload is needed to apply e.g. personalization/app descriptor changes
|
|
789
|
-
* @returns {Promise} Resolves with undefined
|
|
790
777
|
*/
|
|
791
|
-
|
|
792
|
-
this.
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
if (bSkipRestart) {
|
|
797
|
-
return {};
|
|
798
|
-
}
|
|
799
|
-
return ReloadManager.checkReloadOnExit({
|
|
800
|
-
layer: this.getLayer(),
|
|
801
|
-
selector: this.getRootControlInstance(),
|
|
802
|
-
isDraftAvailable: this._oVersionsModel.getProperty("/draftAvailable"),
|
|
803
|
-
versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
|
|
804
|
-
activeVersion: this._oVersionsModel.getProperty("/activeVersion"),
|
|
805
|
-
changesNeedReloadPromise: this._bSavedChangesNeedReload ? Promise.resolve(true) : this._oSerializer.needsReload()
|
|
806
|
-
});
|
|
807
|
-
}.bind(this))
|
|
808
|
-
.then(function(oReturn) {
|
|
809
|
-
oReloadInfo = oReturn;
|
|
810
|
-
return bDontSaveChanges ? Promise.resolve() : this._serializeToLrep(this);
|
|
811
|
-
}.bind(this))
|
|
812
|
-
.then(this._checkToolbarAndExecuteFunction.bind(this, "hide", bDontSaveChanges))
|
|
813
|
-
.then(function() {
|
|
814
|
-
this.fireStop();
|
|
815
|
-
if (!bSkipRestart) {
|
|
816
|
-
ReloadManager.handleUrlParametersOnExit(oReloadInfo);
|
|
817
|
-
}
|
|
818
|
-
}.bind(this))
|
|
819
|
-
.catch(showTechnicalError)
|
|
820
|
-
.then(function () {
|
|
821
|
-
this._checkToolbarAndExecuteFunction("setBusy", false);
|
|
822
|
-
this._sStatus = STOPPED;
|
|
823
|
-
jQuery("body").removeClass("sapUiRtaMode");
|
|
824
|
-
}.bind(this));
|
|
778
|
+
RuntimeAuthoring.prototype.getSelection = function() {
|
|
779
|
+
if (this._oDesignTime) {
|
|
780
|
+
return this._oDesignTime.getSelectionManager().get();
|
|
781
|
+
}
|
|
782
|
+
return [];
|
|
825
783
|
};
|
|
826
784
|
|
|
785
|
+
/**
|
|
786
|
+
* Discard all LREP changes and restores the default app state,
|
|
787
|
+
* opens a MessageBox where the user can confirm
|
|
788
|
+
* the restoring to the default app state
|
|
789
|
+
*
|
|
790
|
+
* @returns {Promise} Resolves when Message Box is closed.
|
|
791
|
+
*/
|
|
827
792
|
RuntimeAuthoring.prototype.restore = function() {
|
|
828
|
-
|
|
793
|
+
var sLayer = this.getLayer();
|
|
794
|
+
var sMessageKey = sLayer === Layer.USER
|
|
795
|
+
? "FORM_PERS_RESET_MESSAGE_PERSONALIZATION"
|
|
796
|
+
: "FORM_PERS_RESET_MESSAGE";
|
|
797
|
+
var sTitleKey = sLayer === Layer.USER
|
|
798
|
+
? "BTN_RESTORE"
|
|
799
|
+
: "FORM_PERS_RESET_TITLE";
|
|
800
|
+
|
|
801
|
+
this.getPluginManager().handleStopCutPaste();
|
|
802
|
+
|
|
803
|
+
return Utils.showMessageBox("warning", sMessageKey, {
|
|
804
|
+
titleKey: sTitleKey,
|
|
805
|
+
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
806
|
+
emphasizedAction: MessageBox.Action.OK
|
|
807
|
+
}).then(function(sAction) {
|
|
808
|
+
if (sAction === MessageBox.Action.OK) {
|
|
809
|
+
RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
|
|
810
|
+
return deleteChanges.call(this);
|
|
811
|
+
}
|
|
812
|
+
return undefined;
|
|
813
|
+
}.bind(this));
|
|
829
814
|
};
|
|
830
815
|
|
|
816
|
+
/**
|
|
817
|
+
* Function to handle ABAP transport of the changes
|
|
818
|
+
*
|
|
819
|
+
* @returns {Promise} Returns a Promise processing the transport of changes
|
|
820
|
+
*/
|
|
831
821
|
RuntimeAuthoring.prototype.transport = function() {
|
|
832
|
-
|
|
822
|
+
this.getPluginManager().handleStopCutPaste();
|
|
823
|
+
|
|
824
|
+
BusyIndicator.show(500);
|
|
825
|
+
return this._serializeToLrep().then(function() {
|
|
826
|
+
BusyIndicator.hide();
|
|
827
|
+
var bVariantByStartupParameter = FlexUtils.isVariantByStartupParameter(this._oRootControl);
|
|
828
|
+
var bAppVariantRunning = SmartVariantManagementApplyAPI.isApplicationVariant({control: this._oRootControl}) && !bVariantByStartupParameter;
|
|
829
|
+
return (bAppVariantRunning ? RtaAppVariantFeature.getAppVariantDescriptor(this._oRootControl) : Promise.resolve())
|
|
830
|
+
.then(function(oAppVariantDescriptor) {
|
|
831
|
+
var aAppVariantDescriptor = [];
|
|
832
|
+
if (oAppVariantDescriptor) {
|
|
833
|
+
aAppVariantDescriptor.push(oAppVariantDescriptor);
|
|
834
|
+
}
|
|
835
|
+
return PersistenceWriteAPI.publish({
|
|
836
|
+
selector: this.getRootControlInstance(),
|
|
837
|
+
styleClass: Utils.getRtaStyleClassName(),
|
|
838
|
+
layer: this.getLayer(),
|
|
839
|
+
appVariantDescriptors: aAppVariantDescriptor
|
|
840
|
+
})
|
|
841
|
+
.then(function(sMessage) {
|
|
842
|
+
if (sMessage !== "Error" && sMessage !== "Cancel") {
|
|
843
|
+
MessageToast.show(sMessage);
|
|
844
|
+
if (this.getShowToolbars()) {
|
|
845
|
+
PersistenceWriteAPI.getResetAndPublishInfo({
|
|
846
|
+
selector: this.getRootControlInstance(),
|
|
847
|
+
layer: this.getLayer()
|
|
848
|
+
})
|
|
849
|
+
.then(function(oPublishAndResetInfo) {
|
|
850
|
+
this._oToolbarControlsModel.setProperty("/publishEnabled", oPublishAndResetInfo.isPublishEnabled);
|
|
851
|
+
this._oToolbarControlsModel.setProperty("/restoreEnabled", oPublishAndResetInfo.isResetEnabled);
|
|
852
|
+
}.bind(this));
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}.bind(this));
|
|
856
|
+
}.bind(this));
|
|
857
|
+
}.bind(this))
|
|
858
|
+
.catch(showTechnicalError);
|
|
833
859
|
};
|
|
834
860
|
|
|
835
|
-
// ---- backward compatibility API
|
|
836
861
|
RuntimeAuthoring.prototype.undo = function() {
|
|
837
|
-
|
|
862
|
+
this.getPluginManager().handleStopCutPaste();
|
|
863
|
+
return this.getCommandStack().undo();
|
|
838
864
|
};
|
|
839
865
|
|
|
840
866
|
RuntimeAuthoring.prototype.redo = function() {
|
|
841
|
-
|
|
867
|
+
this.getPluginManager().handleStopCutPaste();
|
|
868
|
+
return this.getCommandStack().redo();
|
|
842
869
|
};
|
|
843
870
|
|
|
844
871
|
RuntimeAuthoring.prototype.canUndo = function() {
|
|
@@ -848,9 +875,207 @@ sap.ui.define([
|
|
|
848
875
|
RuntimeAuthoring.prototype.canRedo = function() {
|
|
849
876
|
return this.getCommandStack().canRedo();
|
|
850
877
|
};
|
|
851
|
-
// ---- backward compatibility API
|
|
852
878
|
|
|
853
|
-
RuntimeAuthoring.prototype.
|
|
879
|
+
RuntimeAuthoring.prototype.save = function() {
|
|
880
|
+
return waitForPendingActions.call(this)
|
|
881
|
+
.then(this._serializeToLrep.bind(this));
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
// ---- API ----
|
|
885
|
+
|
|
886
|
+
// this function is used to save in the Visual Editor
|
|
887
|
+
RuntimeAuthoring.prototype._serializeToLrep = function(bCondenseAnyLayer) {
|
|
888
|
+
// when saving a change that requires a reload, the information has to be cached
|
|
889
|
+
// to do the reload when exiting UI Adaptation as then the change will not be available anymore
|
|
890
|
+
if (!this._bSavedChangesNeedReload) {
|
|
891
|
+
return this._oSerializer.needsReload().then(function(bReloadNeeded) {
|
|
892
|
+
this._bSavedChangesNeedReload = bReloadNeeded;
|
|
893
|
+
return serializeAndSave.call(this, undefined, bCondenseAnyLayer);
|
|
894
|
+
}.bind(this));
|
|
895
|
+
}
|
|
896
|
+
return serializeAndSave.call(this, undefined, bCondenseAnyLayer);
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Check for unsaved changes before leaving UI adaptation at runtime
|
|
901
|
+
*
|
|
902
|
+
* @returns {string} Returns the message to be displayed in the unsaved changes dialog
|
|
903
|
+
* @private
|
|
904
|
+
*/
|
|
905
|
+
RuntimeAuthoring.prototype._onUnload = function() {
|
|
906
|
+
// this function is still in the prototype scope for easier testing
|
|
907
|
+
var oCommandStack = this.getCommandStack();
|
|
908
|
+
var bUnsaved = oCommandStack.canUndo();
|
|
909
|
+
if (bUnsaved && this.getShowWindowUnloadDialog()) {
|
|
910
|
+
return this._getTextResources().getText("MSG_UNSAVED_CHANGES");
|
|
911
|
+
}
|
|
912
|
+
window.onbeforeunload = this._oldUnloadHandler;
|
|
913
|
+
return undefined;
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
function shouldValidateFlexEnabled() {
|
|
917
|
+
var sUriParam = UriParameters.fromQuery(window.location.search).get("sap-ui-rta-skip-flex-validation");
|
|
918
|
+
return Settings.getInstance()
|
|
919
|
+
.then(function(oSettings) {
|
|
920
|
+
return !oSettings.isCustomerSystem() && sUriParam !== "true";
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
function onPopupOpen(oEvent) {
|
|
925
|
+
var oOpenedPopup = oEvent.getParameters().getSource();
|
|
926
|
+
if (
|
|
927
|
+
oOpenedPopup.isA("sap.m.Dialog")
|
|
928
|
+
&& this.getToolbar().type === "fiori"
|
|
929
|
+
) {
|
|
930
|
+
this.getToolbar().setColor("contrast");
|
|
931
|
+
}
|
|
932
|
+
this.getToolbar().bringToFront();
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
function onPopupClose(oEvent) {
|
|
936
|
+
if (oEvent.getParameters().isA("sap.m.Dialog")) {
|
|
937
|
+
this.getToolbar().setColor();
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
function onPersonalizationChangeCreation() {
|
|
942
|
+
if (this.getMode() === "navigation" && !this._bNavigationModeWarningShown) {
|
|
943
|
+
showMessageToast.call(this, "MSG_NAVIGATION_MODE_CHANGES_WARNING", {
|
|
944
|
+
duration: 5000
|
|
945
|
+
});
|
|
946
|
+
this._bNavigationModeWarningShown = true;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
function showMessageToast(sMessageKey, mOptions) {
|
|
951
|
+
var sMessage = this._getTextResources().getText(sMessageKey);
|
|
952
|
+
|
|
953
|
+
MessageToast.show(sMessage, mOptions || {});
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function addOrRemoveStyleClass(oRootControl, bAdd) {
|
|
957
|
+
if (oRootControl.isA("sap.ui.core.UIComponent")) {
|
|
958
|
+
oRootControl = oRootControl.getRootControl();
|
|
959
|
+
}
|
|
960
|
+
if (oRootControl) {
|
|
961
|
+
oRootControl[bAdd ? "addStyleClass" : "removeStyleClass"]("sapUiRtaRoot");
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
function ffContextMenuHandler() {
|
|
966
|
+
return false;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Checks the publish button, draft buttons(activate and delete) and app variant support (i.e. Save As and Overview of App Variants) availability
|
|
971
|
+
* The publish button shall not be available if the system is productive and if a merge error occurred during merging changes into the view on startup
|
|
972
|
+
* The app variant support shall not be available if the system is productive and if the platform is not enabled (See Feature.js) to show the app variant tooling
|
|
973
|
+
* isProductiveSystem should only return true if it is a test or development system with the provision of custom catalog extensions
|
|
974
|
+
*
|
|
975
|
+
* @param {object} oRootControl - Root control instance
|
|
976
|
+
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
977
|
+
* @param {sap.ui.rta.command.LREPSerializer} oSerializer - LREP Serializer
|
|
978
|
+
* @returns {Promise<map>} with publishAvailable, publishAppVariantSupported and draftAvailable values
|
|
979
|
+
*/
|
|
980
|
+
function getToolbarButtonsVisibility(oRootControl, sLayer, oSerializer) {
|
|
981
|
+
return Promise.all([
|
|
982
|
+
FeaturesAPI.isPublishAvailable(),
|
|
983
|
+
RtaAppVariantFeature.isSaveAsAvailable(oRootControl, sLayer, oSerializer),
|
|
984
|
+
FeaturesAPI.isContextBasedAdaptationAvailable(sLayer)
|
|
985
|
+
]).then(function(aRtaFeaturesAvailability) {
|
|
986
|
+
var bIsPublishAvailable = aRtaFeaturesAvailability[0];
|
|
987
|
+
var bIsSaveAsAvailable = aRtaFeaturesAvailability[1];
|
|
988
|
+
var bIsContextBasedAdaptationAvailable = aRtaFeaturesAvailability[2];
|
|
989
|
+
return {
|
|
990
|
+
publishAvailable: bIsPublishAvailable,
|
|
991
|
+
saveAsAvailable: bIsPublishAvailable && bIsSaveAsAvailable,
|
|
992
|
+
contextBasedAdaptationAvailable: bIsContextBasedAdaptationAvailable
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function showTechnicalError(vError) {
|
|
998
|
+
BusyIndicator.hide();
|
|
999
|
+
var sErrorMessage = vError.userMessage || vError.stack || vError.message || vError.status || vError;
|
|
1000
|
+
var oTextResources = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
|
|
1001
|
+
Log.error("Failed to transfer changes", sErrorMessage);
|
|
1002
|
+
var sMsg = oTextResources.getText("MSG_LREP_TRANSFER_ERROR") + "\n"
|
|
1003
|
+
+ oTextResources.getText("MSG_ERROR_REASON", sErrorMessage);
|
|
1004
|
+
MessageBox.error(sMsg, {
|
|
1005
|
+
styleClass: Utils.getRtaStyleClassName()
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Adapt the enablement of undo/redo/reset/transport button
|
|
1011
|
+
*
|
|
1012
|
+
* @returns {Promise} Resolves as soon as the MessageBox is closed
|
|
1013
|
+
*/
|
|
1014
|
+
function onStackModified() {
|
|
1015
|
+
var bBackEndDraftExists = this._oVersionsModel.getProperty("/backendDraft");
|
|
1016
|
+
var bDraftDisplayed = this._oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
|
|
1017
|
+
var oCommandStack = this.getCommandStack();
|
|
1018
|
+
var bCanUndo = oCommandStack.canUndo();
|
|
1019
|
+
|
|
1020
|
+
if (
|
|
1021
|
+
!this.getShowToolbars() ||
|
|
1022
|
+
!bCanUndo ||
|
|
1023
|
+
this._bUserDiscardedDraft ||
|
|
1024
|
+
bDraftDisplayed ||
|
|
1025
|
+
!bBackEndDraftExists
|
|
1026
|
+
) {
|
|
1027
|
+
return modifyStack.call(this);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// warn the user: the existing draft would be discarded in case the user saves
|
|
1031
|
+
return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
|
|
1032
|
+
titleKey: "TIT_DRAFT_DISCARD_DIALOG",
|
|
1033
|
+
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
1034
|
+
emphasizedAction: MessageBox.Action.OK
|
|
1035
|
+
})
|
|
1036
|
+
.then(function(sAction) {
|
|
1037
|
+
if (sAction === MessageBox.Action.OK) {
|
|
1038
|
+
discardDraftConfirmed.call(this);
|
|
1039
|
+
} else {
|
|
1040
|
+
this.undo();
|
|
1041
|
+
}
|
|
1042
|
+
}.bind(this));
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
function modifyStack() {
|
|
1046
|
+
if (this.getShowToolbars()) {
|
|
1047
|
+
var oCommandStack = this.getCommandStack();
|
|
1048
|
+
var bCanUndo = oCommandStack.canUndo();
|
|
1049
|
+
var bCanRedo = oCommandStack.canRedo();
|
|
1050
|
+
var bTranslationRelevantDirtyChange = this._oToolbarControlsModel.getProperty("/translationVisible") &&
|
|
1051
|
+
TranslationAPI.hasTranslationRelevantDirtyChanges({layer: Layer.CUSTOMER, selector: this.getRootControlInstance()});
|
|
1052
|
+
|
|
1053
|
+
// TODO: move to the setter to the ChangesState
|
|
1054
|
+
this._oVersionsModel.setDirtyChanges(bCanUndo);
|
|
1055
|
+
this._oToolbarControlsModel.setProperty("/undoEnabled", bCanUndo);
|
|
1056
|
+
this._oToolbarControlsModel.setProperty("/redoEnabled", bCanRedo);
|
|
1057
|
+
this._oToolbarControlsModel.setProperty("/publishEnabled", this.bInitialPublishEnabled || bCanUndo);
|
|
1058
|
+
this._oToolbarControlsModel.setProperty("/restoreEnabled", this.bInitialResetEnabled || bCanUndo);
|
|
1059
|
+
this._oToolbarControlsModel.setProperty("/translationEnabled", this.bPersistedDataTranslatable || bTranslationRelevantDirtyChange);
|
|
1060
|
+
}
|
|
1061
|
+
this.fireUndoRedoStackModified();
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
function checkToolbarAndExecuteFunction(sName, vValue) {
|
|
1065
|
+
if (this.getShowToolbars() && this.getToolbar && this.getToolbar()) {
|
|
1066
|
+
return this.getToolbar()[sName](vValue);
|
|
1067
|
+
}
|
|
1068
|
+
return undefined;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function waitForPendingActions() {
|
|
1072
|
+
return Promise.resolve(this._oDesignTime && this._oDesignTime.waitForBusyPlugins())
|
|
1073
|
+
.then(function() {
|
|
1074
|
+
return this._pElementModified;
|
|
1075
|
+
}.bind(this));
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
function onKeyDown(oEvent) {
|
|
854
1079
|
// if for example the addField Dialog/transport/reset Popup is open, we don't want the user to be able to undo/redo
|
|
855
1080
|
var bMacintosh = Device.os.macintosh;
|
|
856
1081
|
var bFocusInsideOverlayContainer = Overlay.getOverlayContainer().get(0).contains(document.activeElement);
|
|
@@ -874,7 +1099,7 @@ sap.ui.define([
|
|
|
874
1099
|
&& oEvent.altKey === false
|
|
875
1100
|
&& bCtrlKey === true
|
|
876
1101
|
) {
|
|
877
|
-
this.
|
|
1102
|
+
this.undo().then(oEvent.stopPropagation.bind(oEvent));
|
|
878
1103
|
} else if (
|
|
879
1104
|
((// OSX: CMD+SHIFT+Z
|
|
880
1105
|
bMacintosh
|
|
@@ -888,35 +1113,27 @@ sap.ui.define([
|
|
|
888
1113
|
&& oEvent.altKey === false
|
|
889
1114
|
&& bCtrlKey === true
|
|
890
1115
|
) {
|
|
891
|
-
this.
|
|
1116
|
+
this.redo().then(oEvent.stopPropagation.bind(oEvent));
|
|
892
1117
|
}
|
|
893
1118
|
}
|
|
894
|
-
}
|
|
1119
|
+
}
|
|
895
1120
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
var bUnsaved = oCommandStack.canUndo();
|
|
905
|
-
if (bUnsaved && this.getShowWindowUnloadDialog()) {
|
|
906
|
-
return this._getTextResources().getText("MSG_UNSAVED_CHANGES");
|
|
907
|
-
}
|
|
908
|
-
window.onbeforeunload = this._oldUnloadHandler;
|
|
909
|
-
return undefined;
|
|
910
|
-
};
|
|
1121
|
+
function onSaveAsContextBasedAdaptation(oEvent) {
|
|
1122
|
+
var mPropertyBag = {
|
|
1123
|
+
parameters: oEvent.mParameters,
|
|
1124
|
+
control: this.getRootControlInstance(),
|
|
1125
|
+
layer: this.getLayer()
|
|
1126
|
+
};
|
|
1127
|
+
return ContextBasedAdaptationsAPI.create(mPropertyBag);
|
|
1128
|
+
}
|
|
911
1129
|
|
|
912
|
-
|
|
1130
|
+
function saveOnly(oEvent) {
|
|
913
1131
|
var fnCallback = oEvent.getParameter("callback") || function() {};
|
|
914
|
-
return
|
|
915
|
-
.then(this._serializeToLrep.bind(this))
|
|
1132
|
+
return this.save()
|
|
916
1133
|
.then(fnCallback);
|
|
917
|
-
}
|
|
1134
|
+
}
|
|
918
1135
|
|
|
919
|
-
|
|
1136
|
+
function serializeAndSave(bActivateVersion, bCondenseAnyLayer) {
|
|
920
1137
|
if (this.getShowToolbars()) {
|
|
921
1138
|
this.bPersistedDataTranslatable = this._oToolbarControlsModel.getProperty("/translationEnabled");
|
|
922
1139
|
}
|
|
@@ -925,37 +1142,16 @@ sap.ui.define([
|
|
|
925
1142
|
saveAsDraft: this._oVersionsModel.getProperty("/versioningEnabled") && this.getLayer() === Layer.CUSTOMER,
|
|
926
1143
|
layer: this.getLayer(),
|
|
927
1144
|
removeOtherLayerChanges: true,
|
|
928
|
-
version: bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined
|
|
1145
|
+
version: bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined,
|
|
1146
|
+
condenseAnyLayer: bCondenseAnyLayer
|
|
929
1147
|
};
|
|
930
1148
|
|
|
931
1149
|
return this._oSerializer.saveCommands(mPropertyBag);
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
RuntimeAuthoring.prototype._serializeToLrep = function() {
|
|
935
|
-
// when saving a change that requires a reload, the information has to be cached
|
|
936
|
-
// to do the reload when exiting UI Adaptation as then the change will not be available anymore
|
|
937
|
-
if (!this._bSavedChangesNeedReload) {
|
|
938
|
-
return this._oSerializer.needsReload().then(function(bReloadNeeded) {
|
|
939
|
-
this._bSavedChangesNeedReload = bReloadNeeded;
|
|
940
|
-
return this._serializeAndSave();
|
|
941
|
-
}.bind(this));
|
|
942
|
-
}
|
|
943
|
-
return this._serializeAndSave();
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
RuntimeAuthoring.prototype._onUndo = function() {
|
|
947
|
-
this.getPluginManager().handleStopCutPaste();
|
|
948
|
-
return this.getCommandStack().undo();
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
RuntimeAuthoring.prototype._onRedo = function() {
|
|
952
|
-
this.getPluginManager().handleStopCutPaste();
|
|
953
|
-
return this.getCommandStack().redo();
|
|
954
|
-
};
|
|
1150
|
+
}
|
|
955
1151
|
|
|
956
|
-
|
|
1152
|
+
function onActivate(oEvent) {
|
|
957
1153
|
var sVersionTitle = oEvent.getParameter("versionTitle");
|
|
958
|
-
if (
|
|
1154
|
+
if (isOldVersionDisplayed.call(this) && isDraftAvailable.call(this)) {
|
|
959
1155
|
return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_ON_REACTIVATE_DIALOG", {
|
|
960
1156
|
titleKey: "TIT_DRAFT_DISCARD_ON_REACTIVATE_DIALOG",
|
|
961
1157
|
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
@@ -963,49 +1159,37 @@ sap.ui.define([
|
|
|
963
1159
|
})
|
|
964
1160
|
.then(function(sAction) {
|
|
965
1161
|
if (sAction === MessageBox.Action.OK) {
|
|
966
|
-
return
|
|
1162
|
+
return activate.call(this, sVersionTitle);
|
|
967
1163
|
}
|
|
968
1164
|
}.bind(this));
|
|
969
1165
|
}
|
|
970
|
-
return
|
|
971
|
-
}
|
|
1166
|
+
return activate.call(this, sVersionTitle);
|
|
1167
|
+
}
|
|
972
1168
|
|
|
973
|
-
|
|
1169
|
+
function activate(sVersionTitle) {
|
|
974
1170
|
var sLayer = this.getLayer();
|
|
975
1171
|
var oSelector = this.getRootControlInstance();
|
|
976
1172
|
var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
|
|
977
|
-
return
|
|
978
|
-
.then(function
|
|
1173
|
+
return serializeAndSave.call(this, true)
|
|
1174
|
+
.then(function() {
|
|
979
1175
|
return VersionsAPI.activate({
|
|
980
1176
|
layer: sLayer,
|
|
981
1177
|
control: oSelector,
|
|
982
1178
|
title: sVersionTitle,
|
|
983
1179
|
displayedVersion: sDisplayedVersion
|
|
984
1180
|
});
|
|
985
|
-
}).then(function
|
|
986
|
-
|
|
1181
|
+
}).then(function() {
|
|
1182
|
+
showMessageToast.call(this, "MSG_DRAFT_ACTIVATION_SUCCESS");
|
|
987
1183
|
this.bInitialResetEnabled = true;
|
|
988
1184
|
this._oToolbarControlsModel.setProperty("/restoreEnabled", true);
|
|
989
1185
|
this.getCommandStack().removeAllCommands();
|
|
990
1186
|
}.bind(this))
|
|
991
|
-
.catch(function
|
|
1187
|
+
.catch(function(oError) {
|
|
992
1188
|
Utils.showMessageBox("error", "MSG_DRAFT_ACTIVATION_FAILED", {error: oError});
|
|
993
1189
|
});
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
RuntimeAuthoring.prototype._handleDiscard = function() {
|
|
997
|
-
var sLayer = this.getLayer();
|
|
998
|
-
var oReloadInfo = {
|
|
999
|
-
layer: sLayer,
|
|
1000
|
-
removeDraft: true
|
|
1001
|
-
};
|
|
1002
|
-
RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
|
|
1003
|
-
this.getCommandStack().removeAllCommands();
|
|
1004
|
-
ReloadManager.triggerReload(oReloadInfo);
|
|
1005
|
-
return this.stop(true, true);
|
|
1006
|
-
};
|
|
1190
|
+
}
|
|
1007
1191
|
|
|
1008
|
-
|
|
1192
|
+
function onDiscardDraft() {
|
|
1009
1193
|
return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_DIALOG", {
|
|
1010
1194
|
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
1011
1195
|
emphasizedAction: MessageBox.Action.OK
|
|
@@ -1017,13 +1201,25 @@ sap.ui.define([
|
|
|
1017
1201
|
control: this.getRootControlInstance(),
|
|
1018
1202
|
updateState: true
|
|
1019
1203
|
})
|
|
1020
|
-
.then(
|
|
1204
|
+
.then(handleDiscard.bind(this));
|
|
1021
1205
|
}
|
|
1022
1206
|
return undefined;
|
|
1023
1207
|
}.bind(this));
|
|
1024
|
-
}
|
|
1208
|
+
}
|
|
1025
1209
|
|
|
1026
|
-
|
|
1210
|
+
function handleDiscard() {
|
|
1211
|
+
var sLayer = this.getLayer();
|
|
1212
|
+
var oReloadInfo = {
|
|
1213
|
+
layer: sLayer,
|
|
1214
|
+
removeDraft: true
|
|
1215
|
+
};
|
|
1216
|
+
RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
|
|
1217
|
+
this.getCommandStack().removeAllCommands();
|
|
1218
|
+
ReloadManager.triggerReload(oReloadInfo);
|
|
1219
|
+
return this.stop(true, true);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
function onSwitchVersion(oEvent) {
|
|
1027
1223
|
var sVersion = oEvent.getParameter("version");
|
|
1028
1224
|
var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
|
|
1029
1225
|
|
|
@@ -1038,23 +1234,23 @@ sap.ui.define([
|
|
|
1038
1234
|
titleKey: "TIT_SWITCH_VERSION_DIALOG",
|
|
1039
1235
|
actions: [MessageBox.Action.YES, MessageBox.Action.NO, MessageBox.Action.CANCEL],
|
|
1040
1236
|
emphasizedAction: MessageBox.Action.YES
|
|
1041
|
-
}).then(function
|
|
1237
|
+
}).then(function(sAction) {
|
|
1042
1238
|
if (sAction === MessageBox.Action.YES) {
|
|
1043
|
-
this._serializeToLrep(
|
|
1044
|
-
.then(
|
|
1239
|
+
this._serializeToLrep()
|
|
1240
|
+
.then(switchVersion.bind(this, this._sSwitchToVersion));
|
|
1045
1241
|
} else if (sAction === MessageBox.Action.NO) {
|
|
1046
1242
|
// avoids the data loss popup; a reload is triggered later and will destroy RTA & the command stack
|
|
1047
1243
|
this.getCommandStack().removeAllCommands(true);
|
|
1048
|
-
|
|
1244
|
+
switchVersion.call(this, this._sSwitchToVersion);
|
|
1049
1245
|
}
|
|
1050
1246
|
return undefined;
|
|
1051
1247
|
}.bind(this));
|
|
1052
1248
|
return;
|
|
1053
1249
|
}
|
|
1054
|
-
|
|
1055
|
-
}
|
|
1250
|
+
switchVersion.call(this, sVersion);
|
|
1251
|
+
}
|
|
1056
1252
|
|
|
1057
|
-
|
|
1253
|
+
function switchVersion(sVersion) {
|
|
1058
1254
|
RuntimeAuthoring.enableRestart(this.getLayer(), this.getRootControlInstance());
|
|
1059
1255
|
|
|
1060
1256
|
VersionsAPI.loadVersionForApplication({
|
|
@@ -1067,9 +1263,53 @@ sap.ui.define([
|
|
|
1067
1263
|
version: sVersion
|
|
1068
1264
|
};
|
|
1069
1265
|
ReloadManager.triggerReload(oReloadInfo);
|
|
1070
|
-
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
function onPublishVersion() {
|
|
1269
|
+
this.getPluginManager().handleStopCutPaste();
|
|
1270
|
+
|
|
1271
|
+
return VersionsAPI.publish({
|
|
1272
|
+
selector: this.getRootControlInstance(),
|
|
1273
|
+
styleClass: Utils.getRtaStyleClassName(),
|
|
1274
|
+
layer: this.getLayer(),
|
|
1275
|
+
version: this._oVersionsModel.getProperty("/displayedVersion")
|
|
1276
|
+
})
|
|
1277
|
+
.then(function(sMessage) {
|
|
1278
|
+
if (sMessage !== "Error" && sMessage !== "Cancel") {
|
|
1279
|
+
MessageToast.show(sMessage);
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
function discardDraftConfirmed() {
|
|
1285
|
+
this._bUserDiscardedDraft = true;
|
|
1286
|
+
modifyStack.call(this);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
function isOldVersionDisplayed() {
|
|
1290
|
+
return VersionsAPI.isOldVersionDisplayed({
|
|
1291
|
+
control: this.getRootControlInstance(),
|
|
1292
|
+
layer: this.getLayer()
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
function isDraftAvailable() {
|
|
1297
|
+
return VersionsAPI.isDraftAvailable({
|
|
1298
|
+
control: this.getRootControlInstance(),
|
|
1299
|
+
layer: this.getLayer()
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
function initVersioning() {
|
|
1304
|
+
return VersionsAPI.initialize({
|
|
1305
|
+
control: this.getRootControlInstance(),
|
|
1306
|
+
layer: this.getLayer()
|
|
1307
|
+
}).then(function(oModel) {
|
|
1308
|
+
this._oVersionsModel = oModel;
|
|
1309
|
+
}.bind(this));
|
|
1310
|
+
}
|
|
1071
1311
|
|
|
1072
|
-
|
|
1312
|
+
function createToolsMenu(aButtonsVisibility) {
|
|
1073
1313
|
if (!this.getDependent("toolbar")) {
|
|
1074
1314
|
var bUserLayer = this.getLayer() === Layer.USER;
|
|
1075
1315
|
var oProperties = {
|
|
@@ -1079,23 +1319,24 @@ sap.ui.define([
|
|
|
1079
1319
|
commandStack: this.getCommandStack()
|
|
1080
1320
|
},
|
|
1081
1321
|
textResources: this._getTextResources(),
|
|
1082
|
-
restore: this.
|
|
1083
|
-
exit: this.stop.bind(this, false, bUserLayer)
|
|
1084
|
-
save: this._saveOnly.bind(this)
|
|
1322
|
+
restore: this.restore.bind(this),
|
|
1323
|
+
exit: this.stop.bind(this, false, bUserLayer)
|
|
1085
1324
|
};
|
|
1086
1325
|
|
|
1087
1326
|
if (!bUserLayer) {
|
|
1088
|
-
oProperties.transport = this.
|
|
1089
|
-
oProperties.publishVersion =
|
|
1090
|
-
oProperties.undo = this.
|
|
1091
|
-
oProperties.redo = this.
|
|
1092
|
-
oProperties.modeChange =
|
|
1093
|
-
oProperties.activate =
|
|
1094
|
-
oProperties.discardDraft =
|
|
1095
|
-
oProperties.switchVersion =
|
|
1327
|
+
oProperties.transport = this.transport.bind(this);
|
|
1328
|
+
oProperties.publishVersion = onPublishVersion.bind(this);
|
|
1329
|
+
oProperties.undo = this.undo.bind(this);
|
|
1330
|
+
oProperties.redo = this.redo.bind(this);
|
|
1331
|
+
oProperties.modeChange = onModeChange.bind(this);
|
|
1332
|
+
oProperties.activate = onActivate.bind(this);
|
|
1333
|
+
oProperties.discardDraft = onDiscardDraft.bind(this);
|
|
1334
|
+
oProperties.switchVersion = onSwitchVersion.bind(this);
|
|
1335
|
+
oProperties.saveAsContextBasedAdaptation = onSaveAsContextBasedAdaptation.bind(this);
|
|
1096
1336
|
oProperties.openChangeCategorySelectionPopover = this.getChangeVisualization
|
|
1097
1337
|
? this.getChangeVisualization().openChangeCategorySelectionPopover.bind(this.getChangeVisualization())
|
|
1098
|
-
: function
|
|
1338
|
+
: function() {};
|
|
1339
|
+
oProperties.save = saveOnly.bind(this);
|
|
1099
1340
|
}
|
|
1100
1341
|
|
|
1101
1342
|
var oToolbar;
|
|
@@ -1140,26 +1381,26 @@ sap.ui.define([
|
|
|
1140
1381
|
visualizationButtonVisible: bVisualizationButtonVisible
|
|
1141
1382
|
});
|
|
1142
1383
|
|
|
1143
|
-
var oTranslationPromise = new Promise(function
|
|
1384
|
+
var oTranslationPromise = new Promise(function(resolve) {
|
|
1144
1385
|
if (!bTranslationAvailable) {
|
|
1145
1386
|
resolve();
|
|
1146
1387
|
return;
|
|
1147
1388
|
}
|
|
1148
1389
|
|
|
1149
1390
|
TranslationAPI.getSourceLanguages({selector: this.getRootControlInstance(), layer: this.getLayer()})
|
|
1150
|
-
.then(function
|
|
1391
|
+
.then(function(aSourceLanguages) {
|
|
1151
1392
|
this.bPersistedDataTranslatable = aSourceLanguages.length > 0;
|
|
1152
1393
|
this._oToolbarControlsModel.setProperty("/translationEnabled", this.bPersistedDataTranslatable);
|
|
1153
1394
|
}.bind(this)).finally(resolve);
|
|
1154
1395
|
}.bind(this));
|
|
1155
1396
|
|
|
1156
|
-
var oSaveAsPromise = new Promise(function
|
|
1397
|
+
var oSaveAsPromise = new Promise(function(resolve) {
|
|
1157
1398
|
if (!bSaveAsAvailable) {
|
|
1158
1399
|
resolve();
|
|
1159
1400
|
return;
|
|
1160
1401
|
}
|
|
1161
1402
|
|
|
1162
|
-
RtaAppVariantFeature.isManifestSupported().then(function
|
|
1403
|
+
RtaAppVariantFeature.isManifestSupported().then(function(bResult) {
|
|
1163
1404
|
this._oToolbarControlsModel.setProperty("/saveAsEnabled", bResult);
|
|
1164
1405
|
this._oToolbarControlsModel.setProperty("/appVariantsOverviewEnabled", bResult);
|
|
1165
1406
|
this._oToolbarControlsModel.setProperty("/manageAppsEnabled", bResult);
|
|
@@ -1173,134 +1414,22 @@ sap.ui.define([
|
|
|
1173
1414
|
}.bind(this));
|
|
1174
1415
|
}
|
|
1175
1416
|
return Promise.resolve();
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
/**
|
|
1179
|
-
* Exit Runtime Authoring - destroy all controls and plugins
|
|
1180
|
-
*
|
|
1181
|
-
* @protected
|
|
1182
|
-
*/
|
|
1183
|
-
RuntimeAuthoring.prototype.destroy = function () {
|
|
1184
|
-
jQuery.map(this._dependents, function (oDependent, sName) {
|
|
1185
|
-
this.removeDependent(sName);
|
|
1186
|
-
// Destroy should be called with suppress invalidate = true here to prevent static UI Area invalidation
|
|
1187
|
-
oDependent.destroy(true);
|
|
1188
|
-
}.bind(this));
|
|
1189
|
-
|
|
1190
|
-
Object.keys(this._mServices).forEach(function (sServiceName) {
|
|
1191
|
-
this.stopService(sServiceName);
|
|
1192
|
-
}, this);
|
|
1193
|
-
|
|
1194
|
-
if (this._oDesignTime) {
|
|
1195
|
-
this._oDesignTime.destroy();
|
|
1196
|
-
this._oDesignTime = null;
|
|
1197
|
-
|
|
1198
|
-
// detach browser events
|
|
1199
|
-
jQuery(document).off("keydown", this.fnKeyDown);
|
|
1200
|
-
|
|
1201
|
-
if (this.fnOnPersonalizationChangeCreation) {
|
|
1202
|
-
ControlPersonalizationWriteAPI.detachChangeCreation(
|
|
1203
|
-
this.getRootControlInstance(),
|
|
1204
|
-
this.fnOnPersonalizationChangeCreation
|
|
1205
|
-
);
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
if (this.getRootControlInstance()) {
|
|
1210
|
-
addOrRemoveStyleClass(this.getRootControlInstance(), false);
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
this.setCommandStack(null);
|
|
1214
|
-
|
|
1215
|
-
if (this._oServiceEventBus) {
|
|
1216
|
-
this._oServiceEventBus.destroy();
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
if (Device.browser.name === "ff") {
|
|
1220
|
-
jQuery(document).off("contextmenu", _ffContextMenuHandler);
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
window.onbeforeunload = this._oldUnloadHandler;
|
|
1224
|
-
|
|
1225
|
-
ManagedObject.prototype.destroy.apply(this, arguments);
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
RuntimeAuthoring.prototype._onPublishVersion = function() {
|
|
1229
|
-
this.getPluginManager().handleStopCutPaste();
|
|
1230
|
-
|
|
1231
|
-
return VersionsAPI.publish({
|
|
1232
|
-
selector: this.getRootControlInstance(),
|
|
1233
|
-
styleClass: Utils.getRtaStyleClassName(),
|
|
1234
|
-
layer: this.getLayer(),
|
|
1235
|
-
version: this._oVersionsModel.getProperty("/displayedVersion")
|
|
1236
|
-
})
|
|
1237
|
-
.then(function(sMessage) {
|
|
1238
|
-
if (sMessage !== "Error" && sMessage !== "Cancel") {
|
|
1239
|
-
MessageToast.show(sMessage);
|
|
1240
|
-
}
|
|
1241
|
-
});
|
|
1242
|
-
};
|
|
1243
|
-
|
|
1244
|
-
/**
|
|
1245
|
-
* Function to handle ABAP transport of the changes
|
|
1246
|
-
* @return {Promise} Returns a Promise processing the transport of changes
|
|
1247
|
-
*
|
|
1248
|
-
* @private
|
|
1249
|
-
*/
|
|
1250
|
-
RuntimeAuthoring.prototype._onTransport = function() {
|
|
1251
|
-
this.getPluginManager().handleStopCutPaste();
|
|
1252
|
-
|
|
1253
|
-
BusyIndicator.show(500);
|
|
1254
|
-
return this._serializeToLrep().then(function () {
|
|
1255
|
-
BusyIndicator.hide();
|
|
1256
|
-
var bVariantByStartupParameter = FlexUtils.isVariantByStartupParameter(this._oRootControl);
|
|
1257
|
-
var bAppVariantRunning = SmartVariantManagementApplyAPI.isApplicationVariant({control: this._oRootControl}) && !bVariantByStartupParameter;
|
|
1258
|
-
return (bAppVariantRunning ? RtaAppVariantFeature.getAppVariantDescriptor(this._oRootControl) : Promise.resolve())
|
|
1259
|
-
.then(function(oAppVariantDescriptor) {
|
|
1260
|
-
var aAppVariantDescriptor = [];
|
|
1261
|
-
if (oAppVariantDescriptor) {
|
|
1262
|
-
aAppVariantDescriptor.push(oAppVariantDescriptor);
|
|
1263
|
-
}
|
|
1264
|
-
return PersistenceWriteAPI.publish({
|
|
1265
|
-
selector: this.getRootControlInstance(),
|
|
1266
|
-
styleClass: Utils.getRtaStyleClassName(),
|
|
1267
|
-
layer: this.getLayer(),
|
|
1268
|
-
appVariantDescriptors: aAppVariantDescriptor
|
|
1269
|
-
})
|
|
1270
|
-
.then(function(sMessage) {
|
|
1271
|
-
if (sMessage !== "Error" && sMessage !== "Cancel") {
|
|
1272
|
-
MessageToast.show(sMessage);
|
|
1273
|
-
if (this.getShowToolbars()) {
|
|
1274
|
-
PersistenceWriteAPI.getResetAndPublishInfo({
|
|
1275
|
-
selector: this.getRootControlInstance(),
|
|
1276
|
-
layer: this.getLayer()
|
|
1277
|
-
})
|
|
1278
|
-
.then(function(oPublishAndResetInfo) {
|
|
1279
|
-
this._oToolbarControlsModel.setProperty("/publishEnabled", oPublishAndResetInfo.isPublishEnabled);
|
|
1280
|
-
this._oToolbarControlsModel.setProperty("/restoreEnabled", oPublishAndResetInfo.isResetEnabled);
|
|
1281
|
-
}.bind(this));
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
}.bind(this));
|
|
1285
|
-
}.bind(this));
|
|
1286
|
-
}.bind(this))["catch"](showTechnicalError);
|
|
1287
|
-
};
|
|
1417
|
+
}
|
|
1288
1418
|
|
|
1289
1419
|
/**
|
|
1290
1420
|
* Delete all changes for current layer and root control's component.
|
|
1291
1421
|
* In case of Base Applications (no App Variants) the App Descriptor Changes and UI Changes are saved in different Flex Persistence instances,
|
|
1292
1422
|
* the changes for both places will be deleted. For App Variants all the changes are saved in one place.
|
|
1293
1423
|
*
|
|
1294
|
-
* @private
|
|
1295
1424
|
* @returns {Promise} Resolves when change persistence is reset
|
|
1296
1425
|
*/
|
|
1297
|
-
|
|
1426
|
+
function deleteChanges() {
|
|
1298
1427
|
var sLayer = this.getLayer();
|
|
1299
1428
|
var oSelector = FlexUtils.getAppComponentForControl(this.getRootControlInstance());
|
|
1300
1429
|
return PersistenceWriteAPI.reset({
|
|
1301
1430
|
selector: oSelector,
|
|
1302
1431
|
layer: sLayer
|
|
1303
|
-
}).then(function
|
|
1432
|
+
}).then(function() {
|
|
1304
1433
|
// avoids the data loss popup; a reload is triggered later and will destroy RTA & the command stack
|
|
1305
1434
|
this.getCommandStack().removeAllCommands(true);
|
|
1306
1435
|
ReloadInfoAPI.removeInfoSessionStorage(oSelector);
|
|
@@ -1311,99 +1440,20 @@ sap.ui.define([
|
|
|
1311
1440
|
};
|
|
1312
1441
|
return ReloadManager.triggerReload(oReloadInfo);
|
|
1313
1442
|
}.bind(this))
|
|
1314
|
-
.catch(function
|
|
1443
|
+
.catch(function(oError) {
|
|
1315
1444
|
if (oError !== "cancel") {
|
|
1316
1445
|
Utils.showMessageBox("error", "MSG_RESTORE_FAILED", {error: oError});
|
|
1317
1446
|
}
|
|
1318
1447
|
});
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
/**
|
|
1322
|
-
* Shows a message toast.
|
|
1323
|
-
* @param {string} sMessageKey - The text key for the message
|
|
1324
|
-
* @param {object} mOptions - Options for message toast
|
|
1325
|
-
* @private
|
|
1326
|
-
*/
|
|
1327
|
-
RuntimeAuthoring.prototype._showMessageToast = function(sMessageKey, mOptions) {
|
|
1328
|
-
var sMessage = this._getTextResources().getText(sMessageKey);
|
|
1329
|
-
|
|
1330
|
-
MessageToast.show(sMessage, mOptions || {});
|
|
1331
|
-
};
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* The RTA FLP plugin checks whether RTA needs to be restarted and restarts it if needed.
|
|
1335
|
-
*
|
|
1336
|
-
* @public
|
|
1337
|
-
* @static
|
|
1338
|
-
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
1339
|
-
* @returns {boolean} Returns true if restart is needed
|
|
1340
|
-
*/
|
|
1341
|
-
RuntimeAuthoring.needsRestart = function(sLayer) {
|
|
1342
|
-
return ReloadManager.needsAutomaticStart(sLayer);
|
|
1343
|
-
};
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* Enable restart of RTA
|
|
1347
|
-
* the RTA FLP plugin handles the restart
|
|
1348
|
-
*
|
|
1349
|
-
* @public
|
|
1350
|
-
* @static
|
|
1351
|
-
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
1352
|
-
* @param {sap.ui.core.Control} oRootControl - Root control for which RTA was started
|
|
1353
|
-
*/
|
|
1354
|
-
RuntimeAuthoring.enableRestart = function(sLayer, oRootControl) {
|
|
1355
|
-
ReloadManager.enableAutomaticStart(sLayer, oRootControl);
|
|
1356
|
-
};
|
|
1357
|
-
|
|
1358
|
-
/**
|
|
1359
|
-
* Disable restart of RTA
|
|
1360
|
-
*
|
|
1361
|
-
* @public
|
|
1362
|
-
* @static
|
|
1363
|
-
* @param {sap.ui.fl.Layer} sLayer - Active layer
|
|
1364
|
-
*/
|
|
1365
|
-
RuntimeAuthoring.disableRestart = function(sLayer) {
|
|
1366
|
-
ReloadManager.disableAutomaticStart(sLayer);
|
|
1367
|
-
};
|
|
1368
|
-
|
|
1369
|
-
/**
|
|
1370
|
-
* Discard all LREP changes and restores the default app state,
|
|
1371
|
-
* opens a MessageBox where the user can confirm
|
|
1372
|
-
* the restoring to the default app state
|
|
1373
|
-
*
|
|
1374
|
-
* @private
|
|
1375
|
-
* @returns {Promise} Resolves when Message Box is closed.
|
|
1376
|
-
*/
|
|
1377
|
-
RuntimeAuthoring.prototype._onRestore = function() {
|
|
1378
|
-
var sLayer = this.getLayer();
|
|
1379
|
-
var sMessageKey = sLayer === Layer.USER
|
|
1380
|
-
? "FORM_PERS_RESET_MESSAGE_PERSONALIZATION"
|
|
1381
|
-
: "FORM_PERS_RESET_MESSAGE";
|
|
1382
|
-
var sTitleKey = sLayer === Layer.USER
|
|
1383
|
-
? "BTN_RESTORE"
|
|
1384
|
-
: "FORM_PERS_RESET_TITLE";
|
|
1385
|
-
|
|
1386
|
-
this.getPluginManager().handleStopCutPaste();
|
|
1387
|
-
|
|
1388
|
-
return Utils.showMessageBox("warning", sMessageKey, {
|
|
1389
|
-
titleKey: sTitleKey,
|
|
1390
|
-
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
1391
|
-
emphasizedAction: MessageBox.Action.OK
|
|
1392
|
-
}).then(function(sAction) {
|
|
1393
|
-
if (sAction === MessageBox.Action.OK) {
|
|
1394
|
-
RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
|
|
1395
|
-
return this._deleteChanges();
|
|
1396
|
-
}
|
|
1397
|
-
return undefined;
|
|
1398
|
-
}.bind(this));
|
|
1399
|
-
};
|
|
1448
|
+
}
|
|
1400
1449
|
|
|
1401
1450
|
/**
|
|
1402
1451
|
* Triggers a callback when a control gets created with its associated overlay.
|
|
1452
|
+
*
|
|
1403
1453
|
* @param {string} sNewControlID - ID of the newly created control
|
|
1404
1454
|
* @param {Function} fnCallback - Callback to execute when the conditions are met, the overlay is the only parameter
|
|
1405
1455
|
*/
|
|
1406
|
-
|
|
1456
|
+
function scheduleOnCreated(sNewControlID, fnCallback) {
|
|
1407
1457
|
function onElementOverlayCreated (oEvent) {
|
|
1408
1458
|
var oNewOverlay = oEvent.getParameter("elementOverlay");
|
|
1409
1459
|
if (oNewOverlay.getElement().getId() === sNewControlID) {
|
|
@@ -1413,14 +1463,15 @@ sap.ui.define([
|
|
|
1413
1463
|
}
|
|
1414
1464
|
|
|
1415
1465
|
this._oDesignTime.attachEvent("elementOverlayCreated", onElementOverlayCreated, this);
|
|
1416
|
-
}
|
|
1466
|
+
}
|
|
1417
1467
|
|
|
1418
1468
|
/**
|
|
1419
1469
|
* Triggers a callback when a control gets created and its associated overlay is visible.
|
|
1470
|
+
*
|
|
1420
1471
|
* @param {string} sNewControlID - ID of the newly created control
|
|
1421
1472
|
* @param {Function} fnCallback - Callback to execute when the conditions are met, the overlay is the only parameter
|
|
1422
1473
|
*/
|
|
1423
|
-
|
|
1474
|
+
function scheduleOnCreatedAndVisible(sNewControlID, fnCallback) {
|
|
1424
1475
|
function onGeometryChanged (oEvent) {
|
|
1425
1476
|
var oElementOverlay = oEvent.getSource();
|
|
1426
1477
|
if (oElementOverlay.getGeometry() && oElementOverlay.getGeometry().visible) {
|
|
@@ -1439,50 +1490,49 @@ sap.ui.define([
|
|
|
1439
1490
|
}
|
|
1440
1491
|
}
|
|
1441
1492
|
|
|
1442
|
-
|
|
1493
|
+
scheduleOnCreated.call(this, sNewControlID, function(oNewOverlay) {
|
|
1443
1494
|
// the overlay needs to be rendered
|
|
1444
1495
|
if (oNewOverlay.isRendered()) {
|
|
1445
1496
|
onGeometryCheck(oNewOverlay);
|
|
1446
1497
|
} else {
|
|
1447
|
-
oNewOverlay.attachEventOnce("afterRendering", function
|
|
1498
|
+
oNewOverlay.attachEventOnce("afterRendering", function(oEvent) {
|
|
1448
1499
|
onGeometryCheck(oEvent.getSource());
|
|
1449
1500
|
});
|
|
1450
1501
|
}
|
|
1451
1502
|
});
|
|
1452
|
-
}
|
|
1503
|
+
}
|
|
1453
1504
|
|
|
1454
1505
|
/**
|
|
1455
1506
|
* Function to automatically start the rename plugin on a container when it gets created
|
|
1456
1507
|
*
|
|
1457
|
-
* @param {object} vAction The create action from designtime metadata
|
|
1458
|
-
* @param {string} sNewControlID The id of the newly created container
|
|
1508
|
+
* @param {object} vAction - The create action from designtime metadata
|
|
1509
|
+
* @param {string} sNewControlID - The id of the newly created container
|
|
1459
1510
|
*/
|
|
1460
|
-
|
|
1461
|
-
var fnStartEdit = function
|
|
1511
|
+
function scheduleRenameOnCreatedContainer(vAction, sNewControlID) {
|
|
1512
|
+
var fnStartEdit = function(oElementOverlay) {
|
|
1462
1513
|
oElementOverlay.setSelected(true);
|
|
1463
1514
|
this.getPluginManager().getPlugin("rename").startEdit(oElementOverlay);
|
|
1464
1515
|
}.bind(this);
|
|
1465
1516
|
|
|
1466
|
-
|
|
1517
|
+
scheduleOnCreatedAndVisible.call(this, sNewControlID, function(oElementOverlay) {
|
|
1467
1518
|
// get container of the new control for rename
|
|
1468
1519
|
var sNewContainerID = this.getPluginManager().getPlugin("createContainer").getCreatedContainerId(vAction, oElementOverlay.getElement().getId());
|
|
1469
1520
|
var oContainerElementOverlay = OverlayRegistry.getOverlay(sNewContainerID);
|
|
1470
1521
|
if (oContainerElementOverlay) {
|
|
1471
1522
|
fnStartEdit(oContainerElementOverlay);
|
|
1472
1523
|
} else {
|
|
1473
|
-
|
|
1524
|
+
scheduleOnCreatedAndVisible.call(this, sNewContainerID, fnStartEdit);
|
|
1474
1525
|
}
|
|
1475
1526
|
}.bind(this));
|
|
1476
|
-
}
|
|
1527
|
+
}
|
|
1477
1528
|
|
|
1478
1529
|
/**
|
|
1479
1530
|
* Function to handle modification of an element
|
|
1480
1531
|
*
|
|
1481
1532
|
* @param {sap.ui.base.Event} oEvent Event object
|
|
1482
1533
|
* @returns {Promise} Returns promise that resolves after command was executed successfully
|
|
1483
|
-
* @private
|
|
1484
1534
|
*/
|
|
1485
|
-
|
|
1535
|
+
function handleElementModified(oEvent) {
|
|
1486
1536
|
// events are synchronously reset after the handlers are called
|
|
1487
1537
|
var oCommand = oEvent.getParameter("command");
|
|
1488
1538
|
var sNewControlID = oEvent.getParameter("newControlId");
|
|
@@ -1493,7 +1543,7 @@ sap.ui.define([
|
|
|
1493
1543
|
|
|
1494
1544
|
if (oCommand instanceof BaseCommand) {
|
|
1495
1545
|
if (sNewControlID) {
|
|
1496
|
-
|
|
1546
|
+
scheduleOnCreated.call(this, sNewControlID, function(oElementOverlay) {
|
|
1497
1547
|
var oDesignTimeMetadata = oElementOverlay.getDesignTimeMetadata();
|
|
1498
1548
|
var fnSelect = oDesignTimeMetadata.getData().select;
|
|
1499
1549
|
if (typeof fnSelect === "function") {
|
|
@@ -1501,7 +1551,7 @@ sap.ui.define([
|
|
|
1501
1551
|
}
|
|
1502
1552
|
});
|
|
1503
1553
|
if (vAction) {
|
|
1504
|
-
|
|
1554
|
+
scheduleRenameOnCreatedContainer.call(this, vAction, sNewControlID);
|
|
1505
1555
|
}
|
|
1506
1556
|
}
|
|
1507
1557
|
return this.getCommandStack().pushAndExecute(oCommand)
|
|
@@ -1515,70 +1565,11 @@ sap.ui.define([
|
|
|
1515
1565
|
}
|
|
1516
1566
|
}.bind(this));
|
|
1517
1567
|
return this._pElementModified;
|
|
1518
|
-
}
|
|
1568
|
+
}
|
|
1519
1569
|
|
|
1520
|
-
|
|
1570
|
+
function onModeChange(oEvent) {
|
|
1521
1571
|
this.setMode(oEvent.getParameter("item").getKey());
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* Setter for property 'mode'.
|
|
1526
|
-
* @param {string} sNewMode The new value for the 'mode' property
|
|
1527
|
-
*/
|
|
1528
|
-
RuntimeAuthoring.prototype.setMode = function (sNewMode) {
|
|
1529
|
-
var sCurrentMode = this.getMode();
|
|
1530
|
-
if (sCurrentMode !== sNewMode) {
|
|
1531
|
-
var oTabHandlingPlugin = this.getPluginManager().getPlugin("tabHandling");
|
|
1532
|
-
var oSelectionPlugin = this.getPluginManager().getPlugin("selection");
|
|
1533
|
-
|
|
1534
|
-
// Switch between another mode and navigation -> toggle overlay & App-TabIndex enablement
|
|
1535
|
-
if (sCurrentMode === "navigation" || sNewMode === "navigation") {
|
|
1536
|
-
this._oDesignTime.setEnabled(sNewMode !== "navigation");
|
|
1537
|
-
oTabHandlingPlugin[(sNewMode === "navigation") ? "restoreTabIndex" : "removeTabIndex"]();
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
var oChangeVisualization = this.getChangeVisualization && this.getChangeVisualization();
|
|
1541
|
-
if (sNewMode === "visualization" || sCurrentMode === "visualization") {
|
|
1542
|
-
DtUtil.waitForSynced(this._oDesignTime)()
|
|
1543
|
-
.then(function () {
|
|
1544
|
-
return oChangeVisualization.triggerModeChange(this.getRootControl(), this.getToolbar());
|
|
1545
|
-
}.bind(this));
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
if (sCurrentMode === "adaptation") {
|
|
1549
|
-
this.getPluginManager().handleStopCutPaste();
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
oTabHandlingPlugin[(sNewMode === "adaptation") ? "restoreOverlayTabIndex" : "removeOverlayTabIndex"]();
|
|
1553
|
-
oSelectionPlugin.setIsActive(!(sNewMode === "visualization"));
|
|
1554
|
-
|
|
1555
|
-
Overlay.getOverlayContainer().toggleClass("sapUiRtaVisualizationMode", (sNewMode === "visualization"));
|
|
1556
|
-
if (sNewMode === "visualization") {
|
|
1557
|
-
jQuery(".sapUiDtOverlayMovable").css("cursor", "default");
|
|
1558
|
-
} else {
|
|
1559
|
-
jQuery(".sapUiDtOverlayMovable").css("cursor", "move");
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
this._oToolbarControlsModel.setProperty("/modeSwitcher", sNewMode);
|
|
1563
|
-
this.setProperty("mode", sNewMode);
|
|
1564
|
-
this.fireModeChanged({mode: sNewMode});
|
|
1565
|
-
}
|
|
1566
|
-
};
|
|
1567
|
-
|
|
1568
|
-
/**
|
|
1569
|
-
* Setter for property 'metadataScope'.
|
|
1570
|
-
* @param {string} sScope The new value for the 'metadataScope' property
|
|
1571
|
-
*/
|
|
1572
|
-
RuntimeAuthoring.prototype.setMetadataScope = function (sScope) {
|
|
1573
|
-
// We do not support scope change after creation of DesignTime instance
|
|
1574
|
-
// as this requires re-initialization of all overlays
|
|
1575
|
-
if (this._sStatus !== STOPPED) {
|
|
1576
|
-
Log.error("sap.ui.rta: Failed to set metadata scope on RTA instance after RTA is started");
|
|
1577
|
-
return;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
this.setProperty("metadataScope", sScope);
|
|
1581
|
-
};
|
|
1572
|
+
}
|
|
1582
1573
|
|
|
1583
1574
|
function resolveServiceLocation(sName) {
|
|
1584
1575
|
if (ServicesIndex.hasOwnProperty(sName)) {
|
|
@@ -1590,19 +1581,19 @@ sap.ui.define([
|
|
|
1590
1581
|
/**
|
|
1591
1582
|
* Starts a service
|
|
1592
1583
|
* @param {string} sName - Registered service name
|
|
1593
|
-
* @
|
|
1584
|
+
* @returns {Promise} - Promise is resolved with service api or rejected in case of any error.
|
|
1594
1585
|
*/
|
|
1595
|
-
RuntimeAuthoring.prototype.startService = function
|
|
1586
|
+
RuntimeAuthoring.prototype.startService = function(sName) {
|
|
1596
1587
|
if (this._sStatus !== STARTED) {
|
|
1597
|
-
return new Promise(function
|
|
1588
|
+
return new Promise(function(fnResolve, fnReject) {
|
|
1598
1589
|
this.attachEventOnce("start", fnResolve);
|
|
1599
1590
|
this.attachEventOnce("failed", fnReject);
|
|
1600
1591
|
}.bind(this))
|
|
1601
1592
|
.then(
|
|
1602
|
-
function
|
|
1593
|
+
function() {
|
|
1603
1594
|
return this.startService(sName);
|
|
1604
1595
|
}.bind(this),
|
|
1605
|
-
function
|
|
1596
|
+
function() {
|
|
1606
1597
|
return Promise.reject(
|
|
1607
1598
|
DtUtil.createError(
|
|
1608
1599
|
"RuntimeAuthoring#startService",
|
|
@@ -1653,10 +1644,10 @@ sap.ui.define([
|
|
|
1653
1644
|
this._mServices[sName] = mService = {
|
|
1654
1645
|
status: SERVICE_STARTING,
|
|
1655
1646
|
location: sServiceLocation,
|
|
1656
|
-
initPromise: new Promise(function
|
|
1647
|
+
initPromise: new Promise(function(fnResolve, fnReject) {
|
|
1657
1648
|
sap.ui.require(
|
|
1658
1649
|
[sServiceLocation],
|
|
1659
|
-
function
|
|
1650
|
+
function(fnServiceFactory) {
|
|
1660
1651
|
mService.factory = fnServiceFactory;
|
|
1661
1652
|
|
|
1662
1653
|
if (!this._oServiceEventBus) {
|
|
@@ -1667,7 +1658,7 @@ sap.ui.define([
|
|
|
1667
1658
|
this,
|
|
1668
1659
|
this._oServiceEventBus.publish.bind(this._oServiceEventBus, sName)
|
|
1669
1660
|
)
|
|
1670
|
-
.then(function
|
|
1661
|
+
.then(function(oService) {
|
|
1671
1662
|
if (this.bIsDestroyed) {
|
|
1672
1663
|
throw DtUtil.createError(
|
|
1673
1664
|
"RuntimeAuthoring#startService",
|
|
@@ -1699,7 +1690,7 @@ sap.ui.define([
|
|
|
1699
1690
|
var mExports = oService.exports || {};
|
|
1700
1691
|
jQuery.extend(
|
|
1701
1692
|
mService.exports,
|
|
1702
|
-
Object.keys(mExports).reduce(function
|
|
1693
|
+
Object.keys(mExports).reduce(function(mResult, sKey) {
|
|
1703
1694
|
var vValue = mExports[sKey];
|
|
1704
1695
|
mResult[sKey] = typeof vValue === "function"
|
|
1705
1696
|
? DtUtil.waitForSynced(this._oDesignTime, vValue)
|
|
@@ -1713,7 +1704,7 @@ sap.ui.define([
|
|
|
1713
1704
|
}.bind(this))
|
|
1714
1705
|
.catch(fnReject);
|
|
1715
1706
|
}.bind(this),
|
|
1716
|
-
function
|
|
1707
|
+
function(vError) {
|
|
1717
1708
|
mService.status = SERVICE_FAILED;
|
|
1718
1709
|
fnReject(
|
|
1719
1710
|
DtUtil.propagateError(
|
|
@@ -1726,7 +1717,7 @@ sap.ui.define([
|
|
|
1726
1717
|
}
|
|
1727
1718
|
);
|
|
1728
1719
|
}.bind(this))
|
|
1729
|
-
.catch(function
|
|
1720
|
+
.catch(function(vError) {
|
|
1730
1721
|
mService.status = SERVICE_FAILED;
|
|
1731
1722
|
return Promise.reject(
|
|
1732
1723
|
DtUtil.propagateError(
|
|
@@ -1747,7 +1738,7 @@ sap.ui.define([
|
|
|
1747
1738
|
* Stops a service
|
|
1748
1739
|
* @param {string} sName - Started service name
|
|
1749
1740
|
*/
|
|
1750
|
-
RuntimeAuthoring.prototype.stopService = function
|
|
1741
|
+
RuntimeAuthoring.prototype.stopService = function(sName) {
|
|
1751
1742
|
var oService = this._mServices[sName];
|
|
1752
1743
|
|
|
1753
1744
|
if (oService) {
|
|
@@ -1769,15 +1760,11 @@ sap.ui.define([
|
|
|
1769
1760
|
/**
|
|
1770
1761
|
* Gets a service by name (and starts it if it's not running)
|
|
1771
1762
|
* @param {string} sName - Registered service name
|
|
1772
|
-
* @
|
|
1763
|
+
* @returns {Promise} - Promise is resolved with service api or rejected in case of any error.
|
|
1773
1764
|
*/
|
|
1774
|
-
RuntimeAuthoring.prototype.getService = function
|
|
1765
|
+
RuntimeAuthoring.prototype.getService = function(sName) {
|
|
1775
1766
|
return this.startService(sName);
|
|
1776
1767
|
};
|
|
1777
1768
|
|
|
1778
|
-
RuntimeAuthoring.prototype._getUShellService = function(sServiceName) {
|
|
1779
|
-
return FlexUtils.getUshellContainer() && this._mUShellServices[sServiceName];
|
|
1780
|
-
};
|
|
1781
|
-
|
|
1782
1769
|
return RuntimeAuthoring;
|
|
1783
1770
|
});
|