@openui5/sap.ui.rta 1.103.1 → 1.106.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 (167) hide show
  1. package/.reuse/dep5 +35 -15
  2. package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +5 -0
  3. package/THIRDPARTY.txt +64 -21
  4. package/package.json +6 -6
  5. package/src/sap/ui/rta/.library +1 -1
  6. package/src/sap/ui/rta/Client.js +1 -1
  7. package/src/sap/ui/rta/RuntimeAuthoring.js +107 -418
  8. package/src/sap/ui/rta/Utils.js +2 -2
  9. package/src/sap/ui/rta/api/startAdaptation.js +2 -2
  10. package/src/sap/ui/rta/api/startKeyUserAdaptation.js +2 -2
  11. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  12. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +6 -22
  13. package/src/sap/ui/rta/appVariant/Feature.js +4 -12
  14. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +5 -3
  15. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  16. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  17. package/src/sap/ui/rta/command/AddXML.js +1 -1
  18. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  19. package/src/sap/ui/rta/command/AppDescriptorCommand.js +8 -3
  20. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  21. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  22. package/src/sap/ui/rta/command/Combine.js +1 -1
  23. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  24. package/src/sap/ui/rta/command/CompositeCommand.js +7 -5
  25. package/src/sap/ui/rta/command/ControlVariantConfigure.js +4 -2
  26. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  27. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +5 -3
  28. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +5 -4
  29. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  30. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  31. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  32. package/src/sap/ui/rta/command/FlexCommand.js +5 -3
  33. package/src/sap/ui/rta/command/LREPSerializer.js +11 -8
  34. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  35. package/src/sap/ui/rta/command/Move.js +1 -1
  36. package/src/sap/ui/rta/command/Property.js +1 -1
  37. package/src/sap/ui/rta/command/Remove.js +1 -1
  38. package/src/sap/ui/rta/command/Rename.js +1 -1
  39. package/src/sap/ui/rta/command/Resize.js +1 -1
  40. package/src/sap/ui/rta/command/Reveal.js +1 -1
  41. package/src/sap/ui/rta/command/Settings.js +1 -1
  42. package/src/sap/ui/rta/command/Split.js +1 -1
  43. package/src/sap/ui/rta/command/Stack.js +17 -7
  44. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  45. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  46. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +6 -4
  47. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  48. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +6 -4
  49. package/src/sap/ui/rta/enablement/elementActionTest.js +89 -15
  50. package/src/sap/ui/rta/library.js +2 -2
  51. package/src/sap/ui/rta/messagebundle.properties +46 -11
  52. package/src/sap/ui/rta/messagebundle_ar.properties +24 -8
  53. package/src/sap/ui/rta/messagebundle_bg.properties +25 -9
  54. package/src/sap/ui/rta/messagebundle_ca.properties +25 -9
  55. package/src/sap/ui/rta/messagebundle_cs.properties +24 -8
  56. package/src/sap/ui/rta/messagebundle_cy.properties +22 -6
  57. package/src/sap/ui/rta/messagebundle_da.properties +26 -10
  58. package/src/sap/ui/rta/messagebundle_de.properties +27 -11
  59. package/src/sap/ui/rta/messagebundle_el.properties +25 -9
  60. package/src/sap/ui/rta/messagebundle_en.properties +26 -10
  61. package/src/sap/ui/rta/messagebundle_en_GB.properties +26 -10
  62. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +30 -11
  63. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +18 -1
  64. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +27 -11
  65. package/src/sap/ui/rta/messagebundle_es.properties +22 -6
  66. package/src/sap/ui/rta/messagebundle_es_MX.properties +20 -4
  67. package/src/sap/ui/rta/messagebundle_et.properties +22 -6
  68. package/src/sap/ui/rta/messagebundle_fi.properties +26 -10
  69. package/src/sap/ui/rta/messagebundle_fr.properties +23 -7
  70. package/src/sap/ui/rta/messagebundle_fr_CA.properties +25 -9
  71. package/src/sap/ui/rta/messagebundle_hi.properties +25 -9
  72. package/src/sap/ui/rta/messagebundle_hr.properties +25 -9
  73. package/src/sap/ui/rta/messagebundle_hu.properties +18 -2
  74. package/src/sap/ui/rta/messagebundle_id.properties +24 -8
  75. package/src/sap/ui/rta/messagebundle_it.properties +25 -9
  76. package/src/sap/ui/rta/messagebundle_iw.properties +25 -9
  77. package/src/sap/ui/rta/messagebundle_ja.properties +25 -9
  78. package/src/sap/ui/rta/messagebundle_kk.properties +25 -9
  79. package/src/sap/ui/rta/messagebundle_ko.properties +25 -9
  80. package/src/sap/ui/rta/messagebundle_lt.properties +24 -8
  81. package/src/sap/ui/rta/messagebundle_lv.properties +22 -6
  82. package/src/sap/ui/rta/messagebundle_ms.properties +26 -10
  83. package/src/sap/ui/rta/messagebundle_nl.properties +26 -10
  84. package/src/sap/ui/rta/messagebundle_no.properties +25 -9
  85. package/src/sap/ui/rta/messagebundle_pl.properties +24 -8
  86. package/src/sap/ui/rta/messagebundle_pt.properties +25 -9
  87. package/src/sap/ui/rta/messagebundle_pt_PT.properties +24 -8
  88. package/src/sap/ui/rta/messagebundle_ro.properties +24 -8
  89. package/src/sap/ui/rta/messagebundle_ru.properties +25 -9
  90. package/src/sap/ui/rta/messagebundle_sh.properties +26 -10
  91. package/src/sap/ui/rta/messagebundle_sk.properties +24 -8
  92. package/src/sap/ui/rta/messagebundle_sl.properties +22 -6
  93. package/src/sap/ui/rta/messagebundle_sv.properties +26 -10
  94. package/src/sap/ui/rta/messagebundle_th.properties +28 -12
  95. package/src/sap/ui/rta/messagebundle_tr.properties +25 -9
  96. package/src/sap/ui/rta/messagebundle_uk.properties +26 -10
  97. package/src/sap/ui/rta/messagebundle_vi.properties +25 -9
  98. package/src/sap/ui/rta/messagebundle_zh_CN.properties +25 -9
  99. package/src/sap/ui/rta/messagebundle_zh_TW.properties +24 -8
  100. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
  101. package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
  102. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  103. package/src/sap/ui/rta/plugin/CompVariant.js +10 -8
  104. package/src/sap/ui/rta/plugin/ControlVariant.js +21 -15
  105. package/src/sap/ui/rta/plugin/CreateContainer.js +9 -4
  106. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  107. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  108. package/src/sap/ui/rta/plugin/EasyAdd.js +3 -1
  109. package/src/sap/ui/rta/plugin/EasyRemove.js +3 -1
  110. package/src/sap/ui/rta/plugin/LocalReset.js +2 -2
  111. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  112. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  113. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  114. package/src/sap/ui/rta/plugin/Rename.js +3 -3
  115. package/src/sap/ui/rta/plugin/RenameHandler.js +23 -5
  116. package/src/sap/ui/rta/plugin/Resize.js +3 -3
  117. package/src/sap/ui/rta/plugin/Selection.js +12 -1
  118. package/src/sap/ui/rta/plugin/Settings.js +2 -2
  119. package/src/sap/ui/rta/plugin/Split.js +2 -2
  120. package/src/sap/ui/rta/plugin/Stretch.js +7 -3
  121. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  122. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  123. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +14 -11
  124. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +9 -9
  125. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  126. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
  127. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +3 -3
  128. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  129. package/src/sap/ui/rta/service/Action.js +1 -1
  130. package/src/sap/ui/rta/service/ControllerExtension.js +8 -9
  131. package/src/sap/ui/rta/service/Outline.js +1 -1
  132. package/src/sap/ui/rta/service/Property.js +1 -1
  133. package/src/sap/ui/rta/service/Selection.js +1 -1
  134. package/src/sap/ui/rta/service/SupportTools.js +189 -0
  135. package/src/sap/ui/rta/service/index.js +7 -6
  136. package/src/sap/ui/rta/themes/base/Toolbar.adaptation.less +19 -4
  137. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +11 -1
  138. package/src/sap/ui/rta/toolbar/Adaptation.js +13 -4
  139. package/src/sap/ui/rta/toolbar/Base.js +8 -4
  140. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  141. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  142. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  143. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  144. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  145. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +132 -0
  146. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptationDialog.fragment.xml +79 -0
  147. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -5
  148. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  149. package/src/sap/ui/rta/util/BindingsExtractor.js +89 -42
  150. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  151. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  152. package/src/sap/ui/rta/util/ReloadManager.js +331 -0
  153. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  154. package/src/sap/ui/rta/util/adaptationStarter.js +27 -12
  155. package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +50 -0
  156. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +115 -63
  157. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +2 -2
  158. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorPopover.fragment.xml +2 -1
  159. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +143 -79
  160. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +86 -180
  161. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +2 -2
  162. package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +87 -0
  163. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/MoveVisualization.js +6 -4
  164. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/RenameVisualization.js +2 -2
  165. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/SplitVisualization.js +6 -4
  166. package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +37 -0
  167. package/src/sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory.js +0 -27
@@ -7,6 +7,7 @@
7
7
  // Provides class sap.ui.rta.RuntimeAuthoring.
8
8
  sap.ui.define([
9
9
  "sap/base/strings/capitalize",
10
+ "sap/base/util/isPlainObject",
10
11
  "sap/base/util/UriParameters",
11
12
  "sap/base/Log",
12
13
  "sap/m/MessageBox",
@@ -22,7 +23,6 @@ sap.ui.define([
22
23
  "sap/ui/dt/Util",
23
24
  "sap/ui/events/KeyCodes",
24
25
  "sap/ui/fl/write/api/Version",
25
- "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
26
26
  "sap/ui/fl/apply/api/SmartVariantManagementApplyAPI",
27
27
  "sap/ui/fl/write/api/ControlPersonalizationWriteAPI",
28
28
  "sap/ui/fl/write/api/FeaturesAPI",
@@ -31,7 +31,6 @@ sap.ui.define([
31
31
  "sap/ui/fl/write/api/VersionsAPI",
32
32
  "sap/ui/fl/write/api/TranslationAPI",
33
33
  "sap/ui/fl/Layer",
34
- "sap/ui/fl/LayerUtils",
35
34
  "sap/ui/fl/registry/Settings",
36
35
  "sap/ui/fl/Utils",
37
36
  "sap/ui/model/json/JSONModel",
@@ -48,12 +47,14 @@ sap.ui.define([
48
47
  "sap/ui/rta/util/changeVisualization/ChangeVisualization",
49
48
  "sap/ui/rta/util/PluginManager",
50
49
  "sap/ui/rta/util/PopupManager",
50
+ "sap/ui/rta/util/ReloadManager",
51
51
  "sap/ui/rta/util/ServiceEventBus",
52
52
  "sap/ui/rta/util/validateFlexEnabled",
53
53
  "sap/ui/rta/Utils",
54
54
  "sap/ui/Device"
55
55
  ], function(
56
56
  capitalize,
57
+ isPlainObject,
57
58
  UriParameters,
58
59
  Log,
59
60
  MessageBox,
@@ -69,7 +70,6 @@ sap.ui.define([
69
70
  DtUtil,
70
71
  KeyCodes,
71
72
  Version,
72
- FlexRuntimeInfoAPI,
73
73
  SmartVariantManagementApplyAPI,
74
74
  ControlPersonalizationWriteAPI,
75
75
  FeaturesAPI,
@@ -78,7 +78,6 @@ sap.ui.define([
78
78
  VersionsAPI,
79
79
  TranslationAPI,
80
80
  Layer,
81
- LayerUtils,
82
81
  Settings,
83
82
  FlexUtils,
84
83
  JSONModel,
@@ -95,6 +94,7 @@ sap.ui.define([
95
94
  ChangeVisualization,
96
95
  PluginManager,
97
96
  PopupManager,
97
+ ReloadManager,
98
98
  ServiceEventBus,
99
99
  validateFlexEnabled,
100
100
  Utils,
@@ -116,7 +116,7 @@ sap.ui.define([
116
116
  * @class The runtime authoring allows to adapt the fields of a running application.
117
117
  * @extends sap.ui.base.ManagedObject
118
118
  * @author SAP SE
119
- * @version 1.103.1
119
+ * @version 1.106.0
120
120
  * @constructor
121
121
  * @private
122
122
  * @since 1.30
@@ -240,7 +240,6 @@ sap.ui.define([
240
240
 
241
241
  this._dependents = {};
242
242
  this._mServices = {};
243
- this._mCustomServicesDictinary = {};
244
243
  this._mUShellServices = {};
245
244
  this._pElementModified = Promise.resolve();
246
245
 
@@ -258,16 +257,13 @@ sap.ui.define([
258
257
  if (window.parent !== window) {
259
258
  this.startService("receiver");
260
259
  }
260
+ this.startService("supportTools");
261
261
 
262
262
  this._loadUShellServicesPromise = FlexUtils.getUShellServices(["URLParsing", "AppLifeCycle", "CrossApplicationNavigation"])
263
263
  .then(function (mUShellServices) {
264
264
  this._mUShellServices = mUShellServices;
265
+ ReloadManager.setUShellServices(mUShellServices);
265
266
  }.bind(this));
266
- },
267
- _RELOAD: {
268
- NOT_NEEDED: "NO_RELOAD",
269
- VIA_HASH: "CROSS_APP_NAVIGATION",
270
- RELOAD_PAGE: "HARD_RELOAD"
271
267
  }
272
268
  });
273
269
 
@@ -465,15 +461,25 @@ sap.ui.define([
465
461
  return this._loadUShellServicesPromise
466
462
  .then(this._initVersioning.bind(this))
467
463
  /*
468
- Check if the application has personalized changes and reload without them;
469
- Also Check if the application has an available draft and if yes, reload with those changes.
464
+ Check if the application has personalized changes and reload without them;
465
+ Also Check if the application has an available draft and if yes, reload with those changes.
470
466
  */
471
- .then(this._determineReload.bind(this))
467
+ .then(function() {
468
+ return ReloadManager.handleReloadOnStart({
469
+ layer: this.getLayer(),
470
+ selector: this.getRootControlInstance(),
471
+ versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
472
+ developerMode: this.getFlexSettings().developerMode
473
+ });
474
+ }.bind(this))
472
475
  .then(function(bReloadTriggered) {
473
476
  if (bReloadTriggered) {
474
477
  // FLP Plugin reacts on this error string and doesn't pass the error on the UI
475
478
  return Promise.reject("Reload triggered");
476
479
  }
480
+ var oFlexInfoSession = PersistenceWriteAPI.getResetAndPublishInfoFromSession(this.getRootControlInstance());
481
+ this.bInitialResetEnabled = !!oFlexInfoSession.isResetEnabled;
482
+ this.bInitialPublishEnabled = !!oFlexInfoSession.isPublishEnabled;
477
483
 
478
484
  this._oSerializer = new LREPSerializer({commandStack: this.getCommandStack(), rootControl: this.getRootControl()});
479
485
 
@@ -603,14 +609,20 @@ sap.ui.define([
603
609
  * isProductiveSystem should only return true if it is a test or development system with the provision of custom catalog extensions
604
610
  */
605
611
  RuntimeAuthoring.prototype._getToolbarButtonsVisibility = function() {
606
- return FeaturesAPI.isPublishAvailable().then(function(bIsPublishAvailable) {
607
- return RtaAppVariantFeature.isSaveAsAvailable(this.getRootControlInstance(), this.getLayer(), this._oSerializer).then(function(bIsSaveAsAvailable) {
608
- return {
609
- publishAvailable: bIsPublishAvailable,
610
- saveAsAvailable: bIsPublishAvailable && bIsSaveAsAvailable
611
- };
612
- });
613
- }.bind(this));
612
+ return Promise.all([
613
+ FeaturesAPI.isPublishAvailable(),
614
+ RtaAppVariantFeature.isSaveAsAvailable(this.getRootControlInstance(), this.getLayer(), this._oSerializer),
615
+ FeaturesAPI.isContextBasedAdaptationAvailable(this.getLayer())
616
+ ]).then(function(aRtaFeaturesAvailability) {
617
+ var bIsPublishAvailable = aRtaFeaturesAvailability[0];
618
+ var bIsSaveAsAvailable = aRtaFeaturesAvailability[1];
619
+ var bIsContextBasedAdaptationAvailable = aRtaFeaturesAvailability[2];
620
+ return {
621
+ publishAvailable: bIsPublishAvailable,
622
+ saveAsAvailable: bIsPublishAvailable && bIsSaveAsAvailable,
623
+ contextBasedAdaptationAvailable: bIsContextBasedAdaptationAvailable
624
+ };
625
+ });
614
626
  };
615
627
 
616
628
  RuntimeAuthoring.prototype._isOldVersionDisplayed = function() {
@@ -778,21 +790,31 @@ sap.ui.define([
778
790
  */
779
791
  RuntimeAuthoring.prototype.stop = function(bDontSaveChanges, bSkipRestart) {
780
792
  this._checkToolbarAndExecuteFunction("setBusy", true);
793
+ var oReloadInfo;
781
794
  return waitForPendingActions.call(this)
782
- .then(this._handleReloadOnExit.bind(this, bSkipRestart))
783
- .then(function(oReloadInfo) {
784
- return ((bDontSaveChanges) ? Promise.resolve() : this._serializeToLrep(this))
785
- .then(this._checkToolbarAndExecuteFunction.bind(this, "hide", bDontSaveChanges))
786
- .then(function() {
787
- this.fireStop();
788
- if (oReloadInfo.reloadMethod && (oReloadInfo.reloadMethod !== this._RELOAD.NOT_NEEDED)) {
789
- oReloadInfo.deleteMaxLayer = true; // true for normal exit, false for reset
790
- oReloadInfo.onExit = true;
791
- oReloadInfo.triggerHardReload = (oReloadInfo.reloadMethod === this._RELOAD.RELOAD_PAGE); // StandAlone or AppDescriptorChanges case
792
- return this._handleUrlParameterOnExit(oReloadInfo);
793
- }
794
- return undefined;
795
- }.bind(this));
795
+ .then(function() {
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
+ }
796
818
  }.bind(this))
797
819
  .catch(showTechnicalError)
798
820
  .then(function () {
@@ -879,7 +901,7 @@ sap.ui.define([
879
901
  */
880
902
  RuntimeAuthoring.prototype._onUnload = function() {
881
903
  var oCommandStack = this.getCommandStack();
882
- var bUnsaved = oCommandStack.canUndo() || oCommandStack.canRedo();
904
+ var bUnsaved = oCommandStack.canUndo();
883
905
  if (bUnsaved && this.getShowWindowUnloadDialog()) {
884
906
  return this._getTextResources().getText("MSG_UNSAVED_CHANGES");
885
907
  }
@@ -894,19 +916,27 @@ sap.ui.define([
894
916
  .then(fnCallback);
895
917
  };
896
918
 
897
- RuntimeAuthoring.prototype._serializeAndSave = function() {
919
+ RuntimeAuthoring.prototype._serializeAndSave = function(bActivateVersion) {
898
920
  if (this.getShowToolbars()) {
899
921
  this.bPersistedDataTranslatable = this._oToolbarControlsModel.getProperty("/translationEnabled");
900
922
  }
901
- // Save changes on the current layer and discard dirty changes on other layers
902
- var bSaveAsDraft = this._oVersionsModel.getProperty("/versioningEnabled") && this.getLayer() === Layer.CUSTOMER;
903
- return this._oSerializer.saveCommands(bSaveAsDraft, this.getLayer(), true);
923
+ var mPropertyBag = {
924
+ // Save changes on the current layer and discard dirty changes on other layers
925
+ saveAsDraft: this._oVersionsModel.getProperty("/versioningEnabled") && this.getLayer() === Layer.CUSTOMER,
926
+ layer: this.getLayer(),
927
+ removeOtherLayerChanges: true,
928
+ version: bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined
929
+ };
930
+
931
+ return this._oSerializer.saveCommands(mPropertyBag);
904
932
  };
905
933
 
906
934
  RuntimeAuthoring.prototype._serializeToLrep = function() {
907
- if (!this._bReloadNeeded) {
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) {
908
938
  return this._oSerializer.needsReload().then(function(bReloadNeeded) {
909
- this._bReloadNeeded = bReloadNeeded;
939
+ this._bSavedChangesNeedReload = bReloadNeeded;
910
940
  return this._serializeAndSave();
911
941
  }.bind(this));
912
942
  }
@@ -943,12 +973,14 @@ sap.ui.define([
943
973
  RuntimeAuthoring.prototype._activate = function(sVersionTitle) {
944
974
  var sLayer = this.getLayer();
945
975
  var oSelector = this.getRootControlInstance();
946
- return this._serializeAndSave()
976
+ var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
977
+ return this._serializeAndSave(true)
947
978
  .then(function () {
948
979
  return VersionsAPI.activate({
949
980
  layer: sLayer,
950
981
  control: oSelector,
951
- title: sVersionTitle
982
+ title: sVersionTitle,
983
+ displayedVersion: sDisplayedVersion
952
984
  });
953
985
  }).then(function () {
954
986
  this._showMessageToast("MSG_DRAFT_ACTIVATION_SUCCESS");
@@ -964,18 +996,12 @@ sap.ui.define([
964
996
  RuntimeAuthoring.prototype._handleDiscard = function() {
965
997
  var sLayer = this.getLayer();
966
998
  var oReloadInfo = {
967
- isDraftAvailable: false, // draft was just discarded
968
- layer: sLayer
999
+ layer: sLayer,
1000
+ removeDraft: true
969
1001
  };
970
1002
  RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
971
- if (!FlexUtils.getUshellContainer()) {
972
- this.getCommandStack().removeAllCommands();
973
- return this._triggerHardReload(oReloadInfo);
974
- }
975
- var bTriggerReload = true;
976
1003
  this.getCommandStack().removeAllCommands();
977
- var mParsedHash = this._removeVersionParameterForFLP(oReloadInfo, FlexUtils.getParsedURLHash(this._getUShellService("URLParsing")), bTriggerReload);
978
- this._triggerCrossAppNavigation(mParsedHash);
1004
+ ReloadManager.triggerReload(oReloadInfo);
979
1005
  return this.stop(true, true);
980
1006
  };
981
1007
 
@@ -1031,39 +1057,16 @@ sap.ui.define([
1031
1057
  RuntimeAuthoring.prototype._switchVersion = function (sVersion) {
1032
1058
  RuntimeAuthoring.enableRestart(this.getLayer(), this.getRootControlInstance());
1033
1059
 
1034
- if (!FlexUtils.getUshellContainer()) {
1035
- if (!ReloadInfoAPI.hasVersionParameterWithValue({value: sVersion}, this._getUShellService("URLParsing"))) {
1036
- var oReloadInfo = {
1037
- versionSwitch: true,
1038
- version: sVersion
1039
- };
1040
- return this._triggerHardReload(oReloadInfo);
1041
- }
1042
- return this._reloadPage();
1043
- }
1044
- var mParsedHash = FlexUtils.getParsedURLHash(this._getUShellService("URLParsing"));
1045
1060
  VersionsAPI.loadVersionForApplication({
1046
1061
  control: this.getRootControlInstance(),
1047
1062
  layer: this.getLayer(),
1048
1063
  version: sVersion
1049
1064
  });
1050
- var aVersionsParameter = mParsedHash.params[Version.UrlParameter];
1051
- if (
1052
- aVersionsParameter &&
1053
- aVersionsParameter[0] === sVersion &&
1054
- this._getUShellService("AppLifeCycle")
1055
- ) {
1056
- // RTA was started with a version parameter, the displayed version has changed and the key user switches back
1057
- this._getUShellService("AppLifeCycle").reloadCurrentApp();
1058
- } else {
1059
- mParsedHash.params[Version.UrlParameter] = sVersion;
1060
- this._triggerCrossAppNavigation(mParsedHash);
1061
- }
1062
- return undefined;
1063
- };
1064
-
1065
- RuntimeAuthoring.prototype._setUriParameter = function (sParameters) {
1066
- document.location.search = sParameters;
1065
+ var oReloadInfo = {
1066
+ versionSwitch: true,
1067
+ version: sVersion
1068
+ };
1069
+ ReloadManager.triggerReload(oReloadInfo);
1067
1070
  };
1068
1071
 
1069
1072
  RuntimeAuthoring.prototype._createToolsMenu = function(aButtonsVisibility) {
@@ -1129,6 +1132,7 @@ sap.ui.define([
1129
1132
  appVariantsOverviewVisible: bSaveAsAvailable && bExtendedOverview,
1130
1133
  appVariantsOverviewEnabled: bSaveAsAvailable && bExtendedOverview,
1131
1134
  saveAsVisible: bSaveAsAvailable,
1135
+ contextBasedAdaptationVisible: aButtonsVisibility.contextBasedAdaptationAvailable,
1132
1136
  saveAsEnabled: false,
1133
1137
  manageAppsVisible: bSaveAsAvailable && !bExtendedOverview,
1134
1138
  manageAppsEnabled: bSaveAsAvailable && !bExtendedOverview,
@@ -1288,7 +1292,7 @@ sap.ui.define([
1288
1292
  * the changes for both places will be deleted. For App Variants all the changes are saved in one place.
1289
1293
  *
1290
1294
  * @private
1291
- * @returns {Promise} Resolves when change persistence is resetted
1295
+ * @returns {Promise} Resolves when change persistence is reset
1292
1296
  */
1293
1297
  RuntimeAuthoring.prototype._deleteChanges = function() {
1294
1298
  var sLayer = this.getLayer();
@@ -1301,12 +1305,11 @@ sap.ui.define([
1301
1305
  this.getCommandStack().removeAllCommands(true);
1302
1306
  ReloadInfoAPI.removeInfoSessionStorage(oSelector);
1303
1307
  var oReloadInfo = {
1304
- isDraftAvailable: ReloadInfoAPI.hasVersionParameterWithValue({value: sLayer}, this._getUShellService("URLParsing")),
1305
1308
  layer: sLayer,
1306
- deleteMaxLayer: false,
1309
+ ignoreMaxLayerParameter: true,
1307
1310
  triggerHardReload: true
1308
1311
  };
1309
- return this._handleUrlParameterOnExit(oReloadInfo);
1312
+ return ReloadManager.triggerReload(oReloadInfo);
1310
1313
  }.bind(this))
1311
1314
  .catch(function (oError) {
1312
1315
  if (oError !== "cancel") {
@@ -1315,14 +1318,6 @@ sap.ui.define([
1315
1318
  });
1316
1319
  };
1317
1320
 
1318
- /**
1319
- * Reloads the page.
1320
- * @private
1321
- */
1322
- RuntimeAuthoring.prototype._reloadPage = function() {
1323
- window.location.reload();
1324
- };
1325
-
1326
1321
  /**
1327
1322
  * Shows a message toast.
1328
1323
  * @param {string} sMessageKey - The text key for the message
@@ -1344,7 +1339,7 @@ sap.ui.define([
1344
1339
  * @returns {boolean} Returns true if restart is needed
1345
1340
  */
1346
1341
  RuntimeAuthoring.needsRestart = function(sLayer) {
1347
- return !!window.sessionStorage.getItem("sap.ui.rta.restart." + sLayer);
1342
+ return ReloadManager.needsAutomaticStart(sLayer);
1348
1343
  };
1349
1344
 
1350
1345
  /**
@@ -1357,9 +1352,7 @@ sap.ui.define([
1357
1352
  * @param {sap.ui.core.Control} oRootControl - Root control for which RTA was started
1358
1353
  */
1359
1354
  RuntimeAuthoring.enableRestart = function(sLayer, oRootControl) {
1360
- var sFlexReference = FlexRuntimeInfoAPI.getFlexReference({element: oRootControl});
1361
- var vParameter = sFlexReference || true;
1362
- window.sessionStorage.setItem("sap.ui.rta.restart." + sLayer, vParameter);
1355
+ ReloadManager.enableAutomaticStart(sLayer, oRootControl);
1363
1356
  };
1364
1357
 
1365
1358
  /**
@@ -1370,7 +1363,7 @@ sap.ui.define([
1370
1363
  * @param {sap.ui.fl.Layer} sLayer - Active layer
1371
1364
  */
1372
1365
  RuntimeAuthoring.disableRestart = function(sLayer) {
1373
- window.sessionStorage.removeItem("sap.ui.rta.restart." + sLayer);
1366
+ ReloadManager.disableAutomaticStart(sLayer);
1374
1367
  };
1375
1368
 
1376
1369
  /**
@@ -1486,7 +1479,7 @@ sap.ui.define([
1486
1479
  * Function to handle modification of an element
1487
1480
  *
1488
1481
  * @param {sap.ui.base.Event} oEvent Event object
1489
- * @returns {Promise} Returns promise that resolves after command was executed sucessfully
1482
+ * @returns {Promise} Returns promise that resolves after command was executed successfully
1490
1483
  * @private
1491
1484
  */
1492
1485
  RuntimeAuthoring.prototype._handleElementModified = function(oEvent) {
@@ -1524,314 +1517,6 @@ sap.ui.define([
1524
1517
  return this._pElementModified;
1525
1518
  };
1526
1519
 
1527
- /**
1528
- * Build the navigation arguments object required to trigger the navigation
1529
- * using the CrossApplicationNavigation ushell service.
1530
- *
1531
- * @param {Object} mParsedHash Parsed URL hash
1532
- * @return {Object} Returns argument map ("oArg" parameter of the "toExternal" function)
1533
- */
1534
- RuntimeAuthoring.prototype._buildNavigationArguments = function(mParsedHash) {
1535
- return {
1536
- target: {
1537
- semanticObject: mParsedHash.semanticObject,
1538
- action: mParsedHash.action,
1539
- context: mParsedHash.contextRaw
1540
- },
1541
- params: mParsedHash.params,
1542
- appSpecificRoute: mParsedHash.appSpecificRoute,
1543
- writeHistory: false
1544
- };
1545
- };
1546
-
1547
- RuntimeAuthoring.prototype._triggerCrossAppNavigation = function(mParsedHash) {
1548
- if (
1549
- (this.getLayer() !== Layer.USER) &&
1550
- this._getUShellService("CrossApplicationNavigation")
1551
- ) {
1552
- this._getUShellService("CrossApplicationNavigation")
1553
- .toExternal(this._buildNavigationArguments(mParsedHash));
1554
- return true;
1555
- }
1556
- return false;
1557
- };
1558
-
1559
- RuntimeAuthoring.prototype._removeVersionParameterForFLP = function(oReloadInfo, mParsedHash, bTriggerReload) {
1560
- var sLayer = this.getLayer();
1561
- if (sLayer === Layer.USER) {
1562
- return mParsedHash;
1563
- }
1564
-
1565
- var sVersionParameter = FlexUtils.getParameter(Version.UrlParameter, this._getUShellService("URLParsing"));
1566
- if (sVersionParameter) {
1567
- delete mParsedHash.params[Version.UrlParameter];
1568
- } else if (
1569
- (this._isDraftAvailable() || bTriggerReload /* for discarding of dirty changes */) &&
1570
- !oReloadInfo.hasHigherLayerChanges &&
1571
- this._getUShellService("AppLifeCycle")
1572
- ) {
1573
- // reloading this way only works when we dont have to remove max-layer parameter, see _removeMaxLayerParameterForFLP
1574
- this._getUShellService("AppLifeCycle").reloadCurrentApp();
1575
- }
1576
- return mParsedHash;
1577
- };
1578
-
1579
- RuntimeAuthoring.prototype._removeMaxLayerParameterForFLP = function(oReloadInfo, mParsedHash) {
1580
- // keep max layer parameter when reset was called, remove it on save & exit
1581
- if (oReloadInfo.deleteMaxLayer && oReloadInfo.hasHigherLayerChanges) {
1582
- delete mParsedHash.params[LayerUtils.FL_MAX_LAYER_PARAM];
1583
- }
1584
- return mParsedHash;
1585
- };
1586
-
1587
- /**
1588
- * Reload the app inside FLP or Standalone by removing max layer / draft parameter;
1589
- *
1590
- * @param {boolean} oReloadInfo - Information needed to
1591
- * @param {boolean} oReloadInfo.deleteMaxLayer - Indicates if the <code>sap-ui-fl-max-layer</code> parameter should be removed or not (reset / exit)
1592
- * @param {sap.ui.fl.Layer} oReloadInfo.layer - Current layer
1593
- * @param {boolean} oReloadInfo.hasHigherLayerChanges - Indicates if higher layer changes exist
1594
- *
1595
- * @return {map} parsedHash
1596
- */
1597
- RuntimeAuthoring.prototype._handleUrlParameterOnExit = function(oReloadInfo) {
1598
- if (!FlexUtils.getUshellContainer()) {
1599
- return this._triggerHardReload(oReloadInfo);
1600
- }
1601
-
1602
- var mParsedHash = FlexUtils.getParsedURLHash(this._getUShellService("URLParsing"));
1603
- if (!mParsedHash) {
1604
- return undefined;
1605
- }
1606
-
1607
- if (oReloadInfo.hasHigherLayerChanges || oReloadInfo.hasVersionUrlParameter) {
1608
- mParsedHash = this._removeMaxLayerParameterForFLP(oReloadInfo, mParsedHash);
1609
- mParsedHash = this._removeVersionParameterForFLP(oReloadInfo, mParsedHash, false);
1610
- this._triggerCrossAppNavigation(mParsedHash);
1611
- } else {
1612
- this._getUShellService("AppLifeCycle").reloadCurrentApp();
1613
- }
1614
- // In FLP scenario we need to remove all parameters and also trigger an hard reload on reset
1615
- if (oReloadInfo.triggerHardReload) {
1616
- this._reloadPage();
1617
- }
1618
- return undefined;
1619
- };
1620
-
1621
- /**
1622
- * Returns the correct message - why a reload is needed.
1623
- *
1624
- * @param {object} oReloadInfo - Contains the information needed to return the correct reload message
1625
- * @param {boolean} oReloadInfo.hasHigherLayerChanges - Indicates if higher layer changes exist
1626
- * @param {boolean} oReloadInfo.isDraftAvailable - Indicates if a draft is available
1627
- * @param {boolean} oReloadInfo.allContexts - Indicates if a all contexts is visible
1628
- * @param {sap.ui.fl.Layer} oReloadInfo.layer - Current layer
1629
- *
1630
- * @return {string} sReason Reload message
1631
- */
1632
- RuntimeAuthoring.prototype._getReloadMessageOnStart = function(oReloadInfo) {
1633
- var sReason;
1634
- var bIsCustomerLayer = oReloadInfo.layer === Layer.CUSTOMER;
1635
-
1636
- if (oReloadInfo.hasHigherLayerChanges && oReloadInfo.isDraftAvailable) {
1637
- sReason = bIsCustomerLayer ? "MSG_VIEWS_OR_PERSONALIZATION_AND_DRAFT_EXISTS" : "MSG_HIGHER_LAYER_CHANGES_AND_DRAFT_EXISTS";
1638
- } else if (oReloadInfo.hasHigherLayerChanges && oReloadInfo.allContexts) {
1639
- sReason = "MSG_RESTRICTED_CONTEXT_EXIST_AND_PERSONALIZATION";
1640
- } else if (oReloadInfo.hasHigherLayerChanges) {
1641
- sReason = bIsCustomerLayer ? "MSG_PERSONALIZATION_OR_PUBLIC_VIEWS_EXISTS" : "MSG_HIGHER_LAYER_CHANGES_EXIST";
1642
- } else if (oReloadInfo.isDraftAvailable) {
1643
- sReason = "MSG_DRAFT_EXISTS";
1644
- } else if (oReloadInfo.allContexts) {
1645
- sReason = "MSG_RESTRICTED_CONTEXT_EXIST";
1646
- } // TODO add app descr changes case for start?
1647
- return sReason;
1648
- };
1649
-
1650
- /**
1651
- * Returns the correct message - why a reload is needed.
1652
- *
1653
- * @param {object} oReloadInfo - Contains the information needed to return the correct reload message
1654
- * @param {boolean} oReloadInfo.hasHigherLayerChanges - Indicates if sap-ui-fl-max-layer parameter is present in the url
1655
- * @param {boolean} oReloadInfo.isDraftAvailable - Indicates if a draft is available
1656
- * @param {boolean} oReloadInfo.changesNeedReload - Indicates if app descriptor changes need hard reload
1657
- * @param {boolean} oReloadInfo.initialDraftGotActivated - Indicates if a draft got activated and had a draft initially when entering UI adaptation
1658
- * @param {boolean} oReloadInfo.allContexts - Indicates if restricted contexts is visible
1659
- * @param {sap.ui.fl.Layer} oReloadInfo.layer - Current layer
1660
- *
1661
- * @returns {string} sReason Reload message
1662
- */
1663
- RuntimeAuthoring.prototype._getReloadMessageOnExit = function(oReloadInfo) {
1664
- var bIsCustomerLayer = oReloadInfo.layer === Layer.CUSTOMER;
1665
-
1666
- if (oReloadInfo.hasHigherLayerChanges) {
1667
- if (!bIsCustomerLayer) {
1668
- return "MSG_RELOAD_WITH_ALL_CHANGES";
1669
- }
1670
- if (oReloadInfo.isDraftAvailable) {
1671
- return "MSG_RELOAD_WITH_VIEWS_PERSONALIZATION_AND_WITHOUT_DRAFT";
1672
- }
1673
- if (oReloadInfo.allContexts) {
1674
- return "MSG_RELOAD_WITH_PERSONALIZATION_AND_RESTRICTED_CONTEXT";
1675
- }
1676
- return "MSG_RELOAD_WITH_PERSONALIZATION_AND_VIEWS";
1677
- }
1678
-
1679
- if (oReloadInfo.initialDraftGotActivated) {
1680
- return "MSG_RELOAD_ACTIVATED_DRAFT";
1681
- }
1682
-
1683
- if (oReloadInfo.isDraftAvailable) {
1684
- return "MSG_RELOAD_WITHOUT_DRAFT";
1685
- }
1686
-
1687
- if (oReloadInfo.changesNeedReload) {
1688
- return "MSG_RELOAD_NEEDED";
1689
- }
1690
-
1691
- if (oReloadInfo.allContexts) {
1692
- return "MSG_RELOAD_WITHOUT_ALL_CONTEXT";
1693
- }
1694
- return undefined;
1695
- };
1696
-
1697
- /**
1698
- * Handler for the message box warning the user that personalization changes exist
1699
- * and the app will be reloaded
1700
- *
1701
- * @param {Object} oReloadReasons Information to determine which message to show
1702
- * @returns {Promise} Resolving when the user clicks on OK
1703
- */
1704
- RuntimeAuthoring.prototype._handleReloadMessageBoxOnExit = function(oReloadReasons) {
1705
- var sReason = this._getReloadMessageOnExit(oReloadReasons);
1706
-
1707
- if (sReason) {
1708
- return Utils.showMessageBox("information", sReason, {
1709
- titleKey: "HEADER_RELOAD_NEEDED"
1710
- });
1711
- }
1712
- return Promise.resolve();
1713
- };
1714
-
1715
- RuntimeAuthoring.prototype._triggerReloadOnStart = function(oReloadInfo) {
1716
- if (this._getUShellService("CrossApplicationNavigation") && this._oVersionsModel.getProperty("/versioningEnabled")) {
1717
- if (oReloadInfo.isDraftAvailable) {
1718
- // clears FlexState and triggers reloading of the flex data without blocking
1719
- VersionsAPI.loadDraftForApplication({
1720
- control: oReloadInfo.selector,
1721
- layer: oReloadInfo.layer
1722
- });
1723
- } else {
1724
- VersionsAPI.loadVersionForApplication({
1725
- control: oReloadInfo.selector,
1726
- layer: oReloadInfo.layer,
1727
- allContexts: oReloadInfo.allContexts
1728
- });
1729
- }
1730
- }
1731
- var sReason = this._getReloadMessageOnStart(oReloadInfo);
1732
- if (!sReason) {
1733
- return Promise.resolve();
1734
- }
1735
- // showing messages in visual editor is leading to blocked screen. In this case we should reload without message
1736
- return (this.getFlexSettings().developerMode ? Promise.resolve() : Utils.showMessageBox("information", sReason))
1737
- .then(function() {
1738
- RuntimeAuthoring.enableRestart(oReloadInfo.layer, this.getRootControlInstance());
1739
- // allContexts do not change the url parameter to trigger a reload
1740
- if (
1741
- oReloadInfo.allContexts &&
1742
- !oReloadInfo.hasHigherLayerChanges &&
1743
- !oReloadInfo.isDraftAvailable &&
1744
- this._getUShellService("AppLifeCycle")
1745
- ) {
1746
- this._getUShellService("AppLifeCycle").reloadCurrentApp();
1747
- }
1748
- if (FlexUtils.getUshellContainer()) {
1749
- // clears FlexState and triggers reloading of the flex data without blocking
1750
- var oParsedHash = ReloadInfoAPI.handleParametersOnStart(oReloadInfo);
1751
- return this._triggerCrossAppNavigation(oParsedHash);
1752
- }
1753
- return this._triggerHardReload(oReloadInfo);
1754
- }.bind(this));
1755
- };
1756
-
1757
- /**
1758
- * Check if there are personalization changes/draft changes and restart the application without/with them;
1759
- * Warn the user that the application will be restarted without personalization / with draft changes;
1760
- * Check if it is neccessary to load all contexts
1761
- * This is only valid when a UShell is present;
1762
- *
1763
- * @return {Promise<boolean>} Resolving to false means that reload is not necessary
1764
- */
1765
- RuntimeAuthoring.prototype._determineReload = function() {
1766
- var oReloadInfo = {
1767
- hasHigherLayerChanges: false,
1768
- isDraftAvailable: false,
1769
- layer: this.getLayer(),
1770
- selector: this.getRootControlInstance(),
1771
- ignoreMaxLayerParameter: false,
1772
- includeCtrlVariants: true,
1773
- URLParsingService: this._getUShellService("URLParsing")
1774
- };
1775
- return ReloadInfoAPI.getReloadReasonsForStart(oReloadInfo)
1776
- .then(function (oReloadInfo) {
1777
- var oFlexInfoSession = PersistenceWriteAPI.getResetAndPublishInfoFromSession(oReloadInfo.selector);
1778
- this.bInitialResetEnabled = !!oFlexInfoSession.isResetEnabled;
1779
- this.bInitialPublishEnabled = !!oFlexInfoSession.isPublishEnabled;
1780
- if (oReloadInfo.hasHigherLayerChanges || oReloadInfo.isDraftAvailable || oReloadInfo.allContexts) {
1781
- return this._triggerReloadOnStart(oReloadInfo);
1782
- }
1783
- return undefined;
1784
- }.bind(this));
1785
- };
1786
-
1787
- /**
1788
- * Change URL parameters if necessary, which will trigger an reload;
1789
- * This function must only be called outside of the ushell.
1790
- *
1791
- * @param {Object} oReloadInfo - Information to determine reload is needed
1792
- * @returns {Promise} Resolves when page reload is triggered
1793
- */
1794
- RuntimeAuthoring.prototype._triggerHardReload = function(oReloadInfo) {
1795
- oReloadInfo.parameters = document.location.search;
1796
- oReloadInfo.URLParsingService = this._getUShellService("URLParsing");
1797
- var sParameters = ReloadInfoAPI.handleUrlParametersForStandalone(oReloadInfo);
1798
- if (document.location.search !== sParameters) {
1799
- this._setUriParameter(sParameters);
1800
- return Promise.resolve();
1801
- }
1802
- return this._reloadPage();
1803
- };
1804
-
1805
- /**
1806
- * When exiting RTA and personalization changes exist, the user can choose to
1807
- * reload the app with personalization or stay in the app without the personalization
1808
- * @param {boolean} bSkipRestart - Stop RTA without reloading the app in any way
1809
- *
1810
- * @return {Promise<object>} Resolving to an object containing information about if an reload is needed and how to handle it
1811
- */
1812
- RuntimeAuthoring.prototype._handleReloadOnExit = function(bSkipRestart) {
1813
- if (bSkipRestart) {
1814
- return Promise.resolve({reloadMethod: this._RELOAD.NOT_NEEDED});
1815
- }
1816
-
1817
- var oReloadPromise = this._bReloadNeeded ? Promise.resolve(this._bReloadNeeded) : this._oSerializer.needsReload();
1818
- return oReloadPromise.then(function (bChangesNeedReload) {
1819
- var oReloadInfo = {
1820
- layer: this.getLayer(),
1821
- selector: this.getRootControlInstance(),
1822
- changesNeedReload: bChangesNeedReload,
1823
- isDraftAvailable: this._oVersionsModel.getProperty("/draftAvailable"),
1824
- versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
1825
- activeVersion: this._oVersionsModel.getProperty("/activeVersion"),
1826
- URLParsingService: this._getUShellService("URLParsing")
1827
- };
1828
- oReloadInfo = ReloadInfoAPI.getReloadMethod(oReloadInfo);
1829
- return this._handleReloadMessageBoxOnExit(oReloadInfo).then(function () {
1830
- return oReloadInfo;
1831
- });
1832
- }.bind(this));
1833
- };
1834
-
1835
1520
  RuntimeAuthoring.prototype._onModeChange = function(oEvent) {
1836
1521
  this.setMode(oEvent.getParameter("item").getKey());
1837
1522
  };
@@ -1843,19 +1528,23 @@ sap.ui.define([
1843
1528
  RuntimeAuthoring.prototype.setMode = function (sNewMode) {
1844
1529
  var sCurrentMode = this.getMode();
1845
1530
  if (sCurrentMode !== sNewMode) {
1846
- var oChangeVisualization = this.getChangeVisualization && this.getChangeVisualization();
1847
- if (sNewMode === "visualization" || sCurrentMode === "visualization") {
1848
- oChangeVisualization.triggerModeChange(this.getRootControl(), this.getToolbar());
1849
- }
1850
1531
  var oTabHandlingPlugin = this.getPluginManager().getPlugin("tabHandling");
1851
1532
  var oSelectionPlugin = this.getPluginManager().getPlugin("selection");
1852
1533
 
1853
- // Switch between another mode and navigation -> toggle overlay & App-Tabindex enablement
1534
+ // Switch between another mode and navigation -> toggle overlay & App-TabIndex enablement
1854
1535
  if (sCurrentMode === "navigation" || sNewMode === "navigation") {
1855
1536
  this._oDesignTime.setEnabled(sNewMode !== "navigation");
1856
1537
  oTabHandlingPlugin[(sNewMode === "navigation") ? "restoreTabIndex" : "removeTabIndex"]();
1857
1538
  }
1858
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
+
1859
1548
  if (sCurrentMode === "adaptation") {
1860
1549
  this.getPluginManager().handleStopCutPaste();
1861
1550
  }
@@ -1882,7 +1571,7 @@ sap.ui.define([
1882
1571
  */
1883
1572
  RuntimeAuthoring.prototype.setMetadataScope = function (sScope) {
1884
1573
  // We do not support scope change after creation of DesignTime instance
1885
- // as this requires reinitialization of all overlays
1574
+ // as this requires re-initialization of all overlays
1886
1575
  if (this._sStatus !== STOPPED) {
1887
1576
  Log.error("sap.ui.rta: Failed to set metadata scope on RTA instance after RTA is started");
1888
1577
  return;
@@ -1982,14 +1671,14 @@ sap.ui.define([
1982
1671
  if (this.bIsDestroyed) {
1983
1672
  throw DtUtil.createError(
1984
1673
  "RuntimeAuthoring#startService",
1985
- DtUtil.printf("RuntimeAuthoring instance is destroyed while initialising the service '{0}'", sName),
1674
+ DtUtil.printf("RuntimeAuthoring instance is destroyed while initializing the service '{0}'", sName),
1986
1675
  "sap.ui.rta"
1987
1676
  );
1988
1677
  }
1989
- if (!jQuery.isPlainObject(oService)) {
1678
+ if (!isPlainObject(oService)) {
1990
1679
  throw DtUtil.createError(
1991
1680
  "RuntimeAuthoring#startService",
1992
- DtUtil.printf("Invalid service format. Service should return simple javascript object after initialisation. Service name = '{0}'", sName),
1681
+ DtUtil.printf("Invalid service format. Service should return simple javascript object after initialization. Service name = '{0}'", sName),
1993
1682
  "sap.ui.rta"
1994
1683
  );
1995
1684
  }
@@ -2043,7 +1732,7 @@ sap.ui.define([
2043
1732
  DtUtil.propagateError(
2044
1733
  vError,
2045
1734
  "RuntimeAuthoring#startService",
2046
- DtUtil.printf("Error during service '{0}' initialisation.", sName),
1735
+ DtUtil.printf("Error during service '{0}' initialization.", sName),
2047
1736
  "sap.ui.rta"
2048
1737
  )
2049
1738
  );