@sapui5/sap.ushell_abap 1.97.1 → 1.100.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 +1 -1
- package/src/main/js/sap/ushell_abap/.library +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +16 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +37 -4
- package/src/main/js/sap/ushell_abap/adapters/abap/MenuAdapter.js +65 -15
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +1577 -36
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-dev.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-loader.js +7 -0
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def.js +13 -10
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.backend.config.requestor.js +198 -0
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +6 -4
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +2 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +2 -17
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +10 -16
- package/src/main/js/sap/ushell_abap/library.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +1 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +172 -17
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +14 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +1 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +1 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/chipdefinition.xsd +0 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +48 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +1 -1
- package/src/main/js/sap/ushell_abap/support/plugins/app-infra/AppInfraOnSapNetWeaverSupportPlugin.js +1 -1
- package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +1 -1
- package/ui5.yaml +379 -32
- package/src/main/js/sap/ui2/srvc/ODataService.js +0 -267
- package/src/main/js/sap/ui2/srvc/ODataWrapper.js +0 -1283
- package/src/main/js/sap/ui2/srvc/PageBuildingService.js +0 -1508
- package/src/main/js/sap/ui2/srvc/RemoteCatalogService.js +0 -49
- package/src/main/js/sap/ui2/srvc/allcatalogs.js +0 -197
- package/src/main/js/sap/ui2/srvc/bag.js +0 -711
- package/src/main/js/sap/ui2/srvc/catalog.js +0 -946
- package/src/main/js/sap/ui2/srvc/chip.js +0 -1035
- package/src/main/js/sap/ui2/srvc/chipdefinition.js +0 -228
- package/src/main/js/sap/ui2/srvc/chipinstance.js +0 -944
- package/src/main/js/sap/ui2/srvc/contracts/actions.js +0 -239
- package/src/main/js/sap/ui2/srvc/contracts/bag.js +0 -145
- package/src/main/js/sap/ui2/srvc/contracts/configuration.js +0 -161
- package/src/main/js/sap/ui2/srvc/contracts/configurationUi.js +0 -326
- package/src/main/js/sap/ui2/srvc/contracts/fullscreen.js +0 -69
- package/src/main/js/sap/ui2/srvc/contracts/navigation.js +0 -48
- package/src/main/js/sap/ui2/srvc/contracts/preview.js +0 -289
- package/src/main/js/sap/ui2/srvc/contracts/refresh.js +0 -42
- package/src/main/js/sap/ui2/srvc/contracts/search.js +0 -109
- package/src/main/js/sap/ui2/srvc/contracts/searchProvider.js +0 -46
- package/src/main/js/sap/ui2/srvc/contracts/types.js +0 -9
- package/src/main/js/sap/ui2/srvc/contracts/url.js +0 -104
- package/src/main/js/sap/ui2/srvc/contracts/visible.js +0 -122
- package/src/main/js/sap/ui2/srvc/error.js +0 -54
- package/src/main/js/sap/ui2/srvc/factory.js +0 -656
- package/src/main/js/sap/ui2/srvc/page.js +0 -934
- package/src/main/js/sap/ui2/srvc/pageset.js +0 -466
- package/src/main/js/sap/ui2/srvc/utils.js +0 -923
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.js +0 -108
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.server.config.js +0 -69
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.validate.Url.js +0 -54
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +0 -50
|
@@ -1,934 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2009-2020 SAP SE, All Rights Reserved
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileOverview A wrapper for a page loaded from the page building service.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
this.sap = this.sap || {};
|
|
8
|
-
|
|
9
|
-
(function () {
|
|
10
|
-
"use strict";
|
|
11
|
-
|
|
12
|
-
// namespace "sap.ui2.srvc" **************************************************
|
|
13
|
-
sap.ui2 = sap.ui2 || {};
|
|
14
|
-
sap.ui2.srvc = sap.ui2.srvc || {};
|
|
15
|
-
|
|
16
|
-
// Only declare the module if jQuery.sap exists. Otherwise we do not even try to require assuming
|
|
17
|
-
// that the script has been loaded manually (before SAPUI5).
|
|
18
|
-
// Load time branching pattern
|
|
19
|
-
var fnRequire = String; // NOP (String exists and is free of side-effects)
|
|
20
|
-
if (typeof jQuery === "function" && jQuery.sap) {
|
|
21
|
-
jQuery.sap.declare("sap.ui2.srvc.page");
|
|
22
|
-
// avoid fnRequire = jQuery.sap.require as require cannot be spied on afterwards
|
|
23
|
-
fnRequire = function () {
|
|
24
|
-
jQuery.sap.require.apply(this, arguments);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// "public class" ************************************************************
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Constructs a new representation (wrapper) of the page with the given ID
|
|
32
|
-
* or the given page data to be loaded from the given factory's page building
|
|
33
|
-
* service. Associated CHIP instances (see {@link sap.ui2.srvc.ChipInstance}), catalogs (see
|
|
34
|
-
* {@link sap.ui2.srvc.Catalog} and {@link sap.ui2.srvc.AllCatalogs}), and bags (see
|
|
35
|
-
* {@link sap.ui2.srvc.Bag}) are also constructed.
|
|
36
|
-
* <p>
|
|
37
|
-
* Initially a stub is created, which can later load its properties and related objects
|
|
38
|
-
* asynchronously.
|
|
39
|
-
*<p>
|
|
40
|
-
* A page is a mutable object and changes can be persisted by the page building service.
|
|
41
|
-
*
|
|
42
|
-
* @param {sap.ui2.srvc.Factory} oFactory
|
|
43
|
-
* the factory
|
|
44
|
-
* @param {string|object} vPageData
|
|
45
|
-
* the page's ID or its page data as loaded via page building service
|
|
46
|
-
*
|
|
47
|
-
* @class
|
|
48
|
-
* @since 1.2.0
|
|
49
|
-
* @see sap.ui2.srvc.PageBuildingService
|
|
50
|
-
*/
|
|
51
|
-
sap.ui2.srvc.Page = function (oFactory, vPageData) {
|
|
52
|
-
var sId, // the page ID
|
|
53
|
-
oAllCatalogs, // {sap.ui2.srvc.AllCatalogs|undefined} the page's "allCatalogs" collection
|
|
54
|
-
oAlterEgo, // page's representation with all relations removed
|
|
55
|
-
mBags, // {sap.ui2.srvc.Map<string,sap.ui2.srvc.Bag|jQuery.Deferred>}
|
|
56
|
-
oCatalog, // created on demand
|
|
57
|
-
aChipInstances = [], // {sap.ui2.srvc.ChipInstance[]}
|
|
58
|
-
bIsLoadingBagsOnDemand = true,
|
|
59
|
-
bIsStub = true,
|
|
60
|
-
that = this;
|
|
61
|
-
|
|
62
|
-
// BEWARE: constructor code below!
|
|
63
|
-
|
|
64
|
-
// "private" methods ---------------------------------------------------------
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Makes sure the given page is not just a stub.
|
|
68
|
-
*
|
|
69
|
-
* @private
|
|
70
|
-
*/
|
|
71
|
-
function checkStub () {
|
|
72
|
-
if (bIsStub) {
|
|
73
|
-
throw new sap.ui2.srvc.Error(that + ": page is just a stub", "sap.ui2.srvc.Page");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Initializes the page when the alter ego is known
|
|
79
|
-
* @param {object} oNewAlterEgo
|
|
80
|
-
* the page data as loaded via page building service
|
|
81
|
-
*
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
function initialize (oNewAlterEgo) {
|
|
85
|
-
var i,
|
|
86
|
-
bBagsLoaded = !!(oNewAlterEgo.Bags && oNewAlterEgo.Bags.results),
|
|
87
|
-
aRawBags = bBagsLoaded ? oNewAlterEgo.Bags.results : [],
|
|
88
|
-
aRawChipInstances
|
|
89
|
-
= (oNewAlterEgo.PageChipInstances && oNewAlterEgo.PageChipInstances.results) || [],
|
|
90
|
-
iBagCount = aRawBags.length,
|
|
91
|
-
iChipInstanceCount = aRawChipInstances.length;
|
|
92
|
-
|
|
93
|
-
bIsLoadingBagsOnDemand = !bBagsLoaded;
|
|
94
|
-
// remove relations and store page representation
|
|
95
|
-
delete oNewAlterEgo.Bags;
|
|
96
|
-
delete oNewAlterEgo.Catalog;
|
|
97
|
-
delete oNewAlterEgo.PageChipInstances;
|
|
98
|
-
oAlterEgo = oNewAlterEgo;
|
|
99
|
-
bIsStub = false;
|
|
100
|
-
|
|
101
|
-
// create bag instances
|
|
102
|
-
if (iBagCount > 0) {
|
|
103
|
-
fnRequire("sap.ui2.srvc.bag");
|
|
104
|
-
}
|
|
105
|
-
for (i = 0; i < iBagCount; i += 1) {
|
|
106
|
-
// for each bag instance: create wrapper
|
|
107
|
-
mBags.put(aRawBags[i].id, new sap.ui2.srvc.Bag(oFactory, aRawBags[i]));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// create CHIP instances
|
|
111
|
-
for (i = 0; i < iChipInstanceCount; i += 1) {
|
|
112
|
-
// for each CHIP instance: create wrapper
|
|
113
|
-
aChipInstances[i] = oFactory.createChipInstance(aRawChipInstances[i], null, null, that);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Persists this page.
|
|
119
|
-
*
|
|
120
|
-
* @param {function ()} fnSuccess
|
|
121
|
-
* no-args success handler
|
|
122
|
-
* @param {function (string, object=)} [fnFailure]
|
|
123
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
124
|
-
* optional object containing the complete error information as delivered
|
|
125
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
126
|
-
* for more details.
|
|
127
|
-
* If not given
|
|
128
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
129
|
-
*
|
|
130
|
-
* @private
|
|
131
|
-
*/
|
|
132
|
-
function persist (fnSuccess, fnFailure) {
|
|
133
|
-
oFactory.getPageBuildingService().updatePage(oAlterEgo,
|
|
134
|
-
function (oRawPage) {
|
|
135
|
-
that.updateScope();
|
|
136
|
-
if (fnSuccess) {
|
|
137
|
-
fnSuccess(); // no-args!
|
|
138
|
-
}
|
|
139
|
-
}, fnFailure);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// "public" methods ----------------------------------------------------------
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Adds a new instance for the given CHIP to this page and loads that CHIP
|
|
146
|
-
* instance completely unless requested otherwise. Can only be called if the page is not a stub
|
|
147
|
-
* anymore.
|
|
148
|
-
* <p>
|
|
149
|
-
* Note: Does not affect this page's layout.
|
|
150
|
-
*
|
|
151
|
-
* @param {sap.ui2.srvc.Chip|sap.ui2.srvc.ChipInstance} vTemplate
|
|
152
|
-
* the CHIP (or stub) which is to be used; (since 1.11.0) alternatively a CHIP instance, in
|
|
153
|
-
* this case a new CHIP instance is created referring to the same CHIP and having the same
|
|
154
|
-
* title and configuration. The layout data will not be copied. It is up to the caller to
|
|
155
|
-
* update that value.
|
|
156
|
-
* No bags will be copied!
|
|
157
|
-
* @param {function (sap.ui2.srvc.ChipInstance)} fnSuccess
|
|
158
|
-
* success handler, taking the newly created CHIP instance which knows its page
|
|
159
|
-
* @param {function (string, object=)} [fnFailure]
|
|
160
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
161
|
-
* optional object containing the complete error information as delivered
|
|
162
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
163
|
-
* for more details.
|
|
164
|
-
* If not given
|
|
165
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
166
|
-
* @param {boolean} [bPartially=false]
|
|
167
|
-
* whether to create the new CHIP instance as a stub only
|
|
168
|
-
* @since 1.2.0
|
|
169
|
-
*
|
|
170
|
-
* @throws Error if the page is still a stub
|
|
171
|
-
* @see #isStub()
|
|
172
|
-
* @see sap.ui2.srvc.ChipInstance#getPage
|
|
173
|
-
*/
|
|
174
|
-
this.addChipInstance = function (vTemplate, fnSuccess, fnFailure, bPartially) {
|
|
175
|
-
var oPbs = oFactory.getPageBuildingService(),
|
|
176
|
-
oChip,
|
|
177
|
-
oChipInstance;
|
|
178
|
-
|
|
179
|
-
function update (oRawChipInstance) {
|
|
180
|
-
var oChipInstance = oFactory.createChipInstance(oRawChipInstance,
|
|
181
|
-
bPartially ? null : fnSuccess, fnFailure, that);
|
|
182
|
-
aChipInstances.push(oChipInstance);
|
|
183
|
-
that.updateScope();
|
|
184
|
-
|
|
185
|
-
if (bPartially) {
|
|
186
|
-
fnSuccess(oChipInstance);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
checkStub();
|
|
191
|
-
if (vTemplate.getChip) {
|
|
192
|
-
oChipInstance = vTemplate;
|
|
193
|
-
oChip = oChipInstance.getChip();
|
|
194
|
-
} else {
|
|
195
|
-
oChip = vTemplate;
|
|
196
|
-
}
|
|
197
|
-
if (oChip.getRemoteCatalog()) {
|
|
198
|
-
oPbs.createPageChipInstanceFromRawData({
|
|
199
|
-
pageId: oAlterEgo.id,
|
|
200
|
-
chipId: oChip.getId(),
|
|
201
|
-
configuration: (oChipInstance && oChipInstance.getConfiguration()) || "",
|
|
202
|
-
// layoutData will not be copied, it is up to the page builder to update that value
|
|
203
|
-
title: oChipInstance && oChipInstance.getTitle(),
|
|
204
|
-
remoteCatalogId: oChip.getRemoteCatalog().getId()
|
|
205
|
-
}, update, fnFailure);
|
|
206
|
-
} else {
|
|
207
|
-
oPbs.createPageChipInstance(oAlterEgo.id, /*sInstanceId*/null, oChip.getId(),
|
|
208
|
-
oChipInstance && oChipInstance.getTitle(),
|
|
209
|
-
(oChipInstance && oChipInstance.getConfiguration()) || "",
|
|
210
|
-
// layoutData will not be copied, it is up to the page builder to update that value
|
|
211
|
-
/*sLayoutData*/"",
|
|
212
|
-
update, fnFailure);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Adds a new CHIP instance to this page which refers to the given original CHIP instance and
|
|
218
|
-
* loads the reference completely if and only if the original is not a stub anymore.
|
|
219
|
-
* Can only be called if this page is not a stub anymore.
|
|
220
|
-
* <p>
|
|
221
|
-
* Note: Does not affect this page's layout.
|
|
222
|
-
*
|
|
223
|
-
* @param {sap.ui2.srvc.ChipInstance} oOriginal
|
|
224
|
-
* the CHIP instance (or stub) to refer to (which MUST know its page)
|
|
225
|
-
* @param {function (sap.ui2.srvc.ChipInstance)} fnSuccess
|
|
226
|
-
* success handler, taking the newly created reference which knows its page
|
|
227
|
-
* @param {function (string, object=)} [fnFailure]
|
|
228
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
229
|
-
* optional object containing the complete error information as delivered
|
|
230
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
231
|
-
* for more details.
|
|
232
|
-
* If not given
|
|
233
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
234
|
-
* @since 1.21.1
|
|
235
|
-
*
|
|
236
|
-
* @throws Error if the page is still a stub
|
|
237
|
-
* @see #isStub()
|
|
238
|
-
* @see sap.ui2.srvc.ChipInstance#getPage
|
|
239
|
-
*/
|
|
240
|
-
this.addChipInstanceReference = function (oOriginal, fnSuccess, fnFailure) {
|
|
241
|
-
var oPbs = oFactory.getPageBuildingService();
|
|
242
|
-
|
|
243
|
-
function update (oRawChipInstance) {
|
|
244
|
-
var oChipInstance = oFactory.createChipInstance(oRawChipInstance,
|
|
245
|
-
oOriginal.isStub() ? null : fnSuccess, fnFailure, that);
|
|
246
|
-
|
|
247
|
-
aChipInstances.push(oChipInstance);
|
|
248
|
-
// that.updateScope() is currently not necessary as this is a feature for catalog pages
|
|
249
|
-
// and they are not maintained on scope PERS.
|
|
250
|
-
// Scope changes from CONF -> CUST are not tracked
|
|
251
|
-
|
|
252
|
-
if (oOriginal.isStub()) {
|
|
253
|
-
fnSuccess(oChipInstance);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
checkStub();
|
|
258
|
-
oPbs.clonePageChipInstance(oOriginal.getPage().getId(), oOriginal.getId(), this.getId(),
|
|
259
|
-
update, fnFailure);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Releases all resources associated with this page. Call this method
|
|
264
|
-
* just before you stop using it.
|
|
265
|
-
*
|
|
266
|
-
* @since 1.2.0
|
|
267
|
-
*/
|
|
268
|
-
this.exit = function () {
|
|
269
|
-
var i, n;
|
|
270
|
-
|
|
271
|
-
jQuery.sap.log.debug("Exiting: " + this, null, "sap.ui2.srvc.Page");
|
|
272
|
-
// exit children
|
|
273
|
-
for (i = 0, n = aChipInstances.length; i < n; i += 1) {
|
|
274
|
-
aChipInstances[i].exit();
|
|
275
|
-
}
|
|
276
|
-
// reset to initial state
|
|
277
|
-
oAlterEgo = null; // page's representation with all relations removed
|
|
278
|
-
mBags = new sap.ui2.srvc.Map(); // all bags removed
|
|
279
|
-
oCatalog = null; // created on demand
|
|
280
|
-
aChipInstances = []; // {sap.ui2.srvc.ChipInstance[]}
|
|
281
|
-
bIsStub = true;
|
|
282
|
-
jQuery.sap.log.debug("Exited: " + this, null, "sap.ui2.srvc.Page");
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Returns this page's collection of all catalogs, which might still be a stub.
|
|
287
|
-
* <p>
|
|
288
|
-
* <b>Note:</b> Returns <code>undefined</code> in case the JavaScript file for
|
|
289
|
-
* <code>sap.ui2.srvc.AllCatalogs</code> has not been included!
|
|
290
|
-
*
|
|
291
|
-
* @returns {sap.ui2.srvc.AllCatalogs}
|
|
292
|
-
* this page's collection of all catalogs
|
|
293
|
-
* @since 1.7.0
|
|
294
|
-
*/
|
|
295
|
-
this.getAllCatalogs = function () {
|
|
296
|
-
if (!oAllCatalogs) {
|
|
297
|
-
try {
|
|
298
|
-
fnRequire("sap.ui2.srvc.allcatalogs");
|
|
299
|
-
} catch (e) {
|
|
300
|
-
//TODO this adds one 404 request?!
|
|
301
|
-
// old application without registerModulePath and without allcatalogs.js
|
|
302
|
-
}
|
|
303
|
-
if (sap.ui2.srvc.AllCatalogs) {
|
|
304
|
-
oAllCatalogs = new sap.ui2.srvc.AllCatalogs(oFactory, sId);
|
|
305
|
-
} else {
|
|
306
|
-
jQuery.sap.log.warning("sap.ui2.srvc.AllCatalogs is not available", null,
|
|
307
|
-
"sap.ui2.srvc.Page");
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return oAllCatalogs;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Returns an array of bag IDs attached to this page.
|
|
315
|
-
*
|
|
316
|
-
* @returns {string[]}
|
|
317
|
-
* array of bag IDs
|
|
318
|
-
* @since 1.3.0
|
|
319
|
-
*/
|
|
320
|
-
this.getBagIds = function () {
|
|
321
|
-
if (bIsLoadingBagsOnDemand) {
|
|
322
|
-
throw new sap.ui2.srvc.Error(that + ": page is just a stub, load bags on demand",
|
|
323
|
-
"sap.ui2.srvc.Page");
|
|
324
|
-
}
|
|
325
|
-
return mBags.keys();
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Returns the property bag with given ID attached to this page.
|
|
330
|
-
* <p>
|
|
331
|
-
* If there is no bag with that ID an empty bag is returned.
|
|
332
|
-
*
|
|
333
|
-
* @param {string} sBagId
|
|
334
|
-
* the bag ID
|
|
335
|
-
*
|
|
336
|
-
* @returns {sap.ui2.srvc.Bag}
|
|
337
|
-
* the page's bag for given ID
|
|
338
|
-
* @since 1.3.0
|
|
339
|
-
*/
|
|
340
|
-
this.getBag = function (sBagId) {
|
|
341
|
-
var oBag;
|
|
342
|
-
|
|
343
|
-
if (bIsLoadingBagsOnDemand) {
|
|
344
|
-
throw new sap.ui2.srvc.Error(that + ": page is just a stub, load bags on demand",
|
|
345
|
-
"sap.ui2.srvc.Page");
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (!sBagId) {
|
|
349
|
-
throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.Page");
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (mBags.containsKey(sBagId)) {
|
|
353
|
-
return mBags.get(sBagId);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
fnRequire("sap.ui2.srvc.bag");
|
|
357
|
-
oBag = new sap.ui2.srvc.Bag(oFactory, { pageId: this.getId(), id: sBagId, $tmp: true });
|
|
358
|
-
mBags.put(sBagId, oBag);
|
|
359
|
-
return oBag;
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Asynchronously get the property bag with given ID attached to this page. If that bag has not
|
|
364
|
-
* yet been loaded the bag is loaded first.
|
|
365
|
-
* <p>
|
|
366
|
-
* The <code>done</code> function will be called with a <code>sap.ui2.srvc.Bag</code> instance.
|
|
367
|
-
* If there was no such bag an empty <code>sap.ui2.srvc.Bag</code> is passed.
|
|
368
|
-
*
|
|
369
|
-
* @param {string} sBagId
|
|
370
|
-
* the bag ID
|
|
371
|
-
*
|
|
372
|
-
* @returns {object}
|
|
373
|
-
* jQuery.promise object
|
|
374
|
-
* @since 1.11.0
|
|
375
|
-
*/
|
|
376
|
-
this.loadBag = function (sBagId) {
|
|
377
|
-
var oDeferred;
|
|
378
|
-
|
|
379
|
-
if (!sBagId) {
|
|
380
|
-
throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.Page");
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (mBags.containsKey(sBagId)) {
|
|
384
|
-
oDeferred = mBags.get(sBagId);
|
|
385
|
-
} else {
|
|
386
|
-
fnRequire("sap.ui2.srvc.bag");
|
|
387
|
-
oDeferred = new jQuery.Deferred();
|
|
388
|
-
mBags.put(sBagId, oDeferred);
|
|
389
|
-
oFactory.getPageBuildingService().readBag(sId, sBagId, function (oRawBag) {
|
|
390
|
-
oDeferred.resolve(new sap.ui2.srvc.Bag(oFactory, oRawBag));
|
|
391
|
-
}, function () {
|
|
392
|
-
oDeferred.resolve(new sap.ui2.srvc.Bag(oFactory, { pageId: sId, id: sBagId, $tmp: true }));
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
return oDeferred.promise();
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Returns this page's catalog, which might still be a stub. Can only be called if the page
|
|
400
|
-
* itself is not a stub anymore.
|
|
401
|
-
*
|
|
402
|
-
* @returns {sap.ui2.srvc.Catalog}
|
|
403
|
-
* this page's catalog or <code>undefined</code> if the page has no catalog
|
|
404
|
-
* @since 1.2.0
|
|
405
|
-
*
|
|
406
|
-
* @throws Error if the page is still a stub
|
|
407
|
-
* @see #isStub()
|
|
408
|
-
*/
|
|
409
|
-
this.getCatalog = function () {
|
|
410
|
-
checkStub();
|
|
411
|
-
if (!oCatalog && oAlterEgo.catalogId) {
|
|
412
|
-
oCatalog = oFactory.createCatalog(oAlterEgo.catalogId);
|
|
413
|
-
}
|
|
414
|
-
return oCatalog;
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Returns this page's CHIP instances. Can only be called if the page is not a stub anymore.
|
|
419
|
-
*
|
|
420
|
-
* @returns {sap.ui2.srvc.ChipInstance[]}
|
|
421
|
-
* this page's CHIP instances
|
|
422
|
-
* @since 1.2.0
|
|
423
|
-
*
|
|
424
|
-
* @throws Error if the page is still a stub
|
|
425
|
-
* @see #isStub()
|
|
426
|
-
*/
|
|
427
|
-
this.getChipInstances = function () {
|
|
428
|
-
checkStub();
|
|
429
|
-
return aChipInstances.slice();
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Returns this page's ID.
|
|
434
|
-
*
|
|
435
|
-
* @returns {string}
|
|
436
|
-
* this page's ID
|
|
437
|
-
* @since 1.2.0
|
|
438
|
-
*/
|
|
439
|
-
this.getId = function () {
|
|
440
|
-
return sId;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Returns the layout for this page. Can only be called if the page is not a stub anymore.
|
|
445
|
-
*
|
|
446
|
-
* @returns {string}
|
|
447
|
-
* the layout for this page
|
|
448
|
-
* @since 1.2.0
|
|
449
|
-
*
|
|
450
|
-
* @throws Error if the page is still a stub
|
|
451
|
-
* @see #isStub()
|
|
452
|
-
*/
|
|
453
|
-
this.getLayout = function () {
|
|
454
|
-
checkStub();
|
|
455
|
-
return oAlterEgo.layout;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Sets the layout (encoded as a string, for example in JSON) for this page and persists it.
|
|
460
|
-
* Can only be called if the page is not a stub anymore.
|
|
461
|
-
*
|
|
462
|
-
* @param {string} sLayout
|
|
463
|
-
* the new layout
|
|
464
|
-
* @param {function ()} fnSuccess
|
|
465
|
-
* no-args success handler
|
|
466
|
-
* @param {function (string, object=)} [fnFailure]
|
|
467
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
468
|
-
* optional object containing the complete error information as delivered
|
|
469
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
470
|
-
* for more details.
|
|
471
|
-
* If not given
|
|
472
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
473
|
-
* @since 1.2.0
|
|
474
|
-
*
|
|
475
|
-
* @throws Error if the page is still a stub
|
|
476
|
-
* @see #isStub()
|
|
477
|
-
*/
|
|
478
|
-
this.setLayout = function (sLayout, fnSuccess, fnFailure) {
|
|
479
|
-
checkStub();
|
|
480
|
-
if (oAlterEgo.layout === sLayout) {
|
|
481
|
-
if (fnSuccess) {
|
|
482
|
-
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
483
|
-
sap.ui2.srvc.call(fnSuccess, fnFailure, true);
|
|
484
|
-
}
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
oAlterEgo.layout = sLayout;
|
|
488
|
-
persist(fnSuccess, fnFailure);
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Returns this page's original language (in which the page has been created) as BCP-47.
|
|
493
|
-
* If you are logged on in the same language or if the original language is empty, translatable
|
|
494
|
-
* texts can be created and modified on this page and its bags. The same is valid for the
|
|
495
|
-
* page's CHIP instances and their bags. See {@link sap.ui2.srvc.Bag#setText}.
|
|
496
|
-
* <p>
|
|
497
|
-
* Note: Handling of translatable texts depends on the layer used. In some layers the original
|
|
498
|
-
* language is important; in others it does not matter. In the latter case the empty string
|
|
499
|
-
* (<code>""</code>) is returned, which indicates that the user is allowed to edit the
|
|
500
|
-
* translatable texts in any language.
|
|
501
|
-
* <p>
|
|
502
|
-
* The following code is a flexible way of checking the current situation without knowing the
|
|
503
|
-
* current language or layer:
|
|
504
|
-
* <pre>
|
|
505
|
-
* if (oPage.getOriginalLanguage() === "" ||
|
|
506
|
-
* oPage.getOriginalLanguage() === sap.ui.getCore().getConfiguration().getLanguage()) {
|
|
507
|
-
* // create and modify the page's texts
|
|
508
|
-
* }
|
|
509
|
-
* </pre>
|
|
510
|
-
* <p>
|
|
511
|
-
* This method is intended to be only called in a design time use case.
|
|
512
|
-
* Can only be called if the page is not a stub anymore.
|
|
513
|
-
*
|
|
514
|
-
* @returns {string}
|
|
515
|
-
* this page's original language (BCP-47) or <code>""</code>
|
|
516
|
-
* @since 1.17.1
|
|
517
|
-
*
|
|
518
|
-
* @throws Error if the page is still a stub
|
|
519
|
-
* @see #isStub()
|
|
520
|
-
*/
|
|
521
|
-
this.getOriginalLanguage = function () {
|
|
522
|
-
checkStub();
|
|
523
|
-
return oAlterEgo.originalLanguage;
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Returns this page's scope. This method is intended to be only called on catalog pages (see
|
|
528
|
-
* {@link sap.ui2.srvc.Catalog#getCatalogPage}), so only in a design time use case.
|
|
529
|
-
* If you want to check if the page has been personalized (so in a runtime use case) you should
|
|
530
|
-
* rather use {@link #isPersonalized}.
|
|
531
|
-
* Can only be called if the page is not a stub anymore.
|
|
532
|
-
*
|
|
533
|
-
* @returns {string}
|
|
534
|
-
* returns "PERSONALIZATION", "CUSTOMIZATION" or "CONFIGURATION".
|
|
535
|
-
* @since 1.34.0
|
|
536
|
-
*
|
|
537
|
-
* @throws Error if the page is still a stub
|
|
538
|
-
* @see #isStub()
|
|
539
|
-
* @see #isPersonalized()
|
|
540
|
-
*/
|
|
541
|
-
this.getScope = function () {
|
|
542
|
-
checkStub();
|
|
543
|
-
return oAlterEgo.scope;
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Returns this page's title. Can only be called if the page is not a stub anymore.
|
|
548
|
-
*
|
|
549
|
-
* @returns {string}
|
|
550
|
-
* this page's title
|
|
551
|
-
* @since 1.2.0
|
|
552
|
-
*
|
|
553
|
-
* @throws Error if the page is still a stub
|
|
554
|
-
* @see #isStub()
|
|
555
|
-
*/
|
|
556
|
-
this.getTitle = function () {
|
|
557
|
-
checkStub();
|
|
558
|
-
return oAlterEgo.title;
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Sets the title for this page and persists it. Can only be called if the page is not a stub
|
|
563
|
-
* anymore.
|
|
564
|
-
*
|
|
565
|
-
* @param {string} sTitle
|
|
566
|
-
* the new title
|
|
567
|
-
* @param {function ()} fnSuccess
|
|
568
|
-
* no-args success handler
|
|
569
|
-
* @param {function (string, object=)} [fnFailure]
|
|
570
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
571
|
-
* optional object containing the complete error information as delivered
|
|
572
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
573
|
-
* for more details.
|
|
574
|
-
* If not given
|
|
575
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
576
|
-
* @since 1.2.0
|
|
577
|
-
*
|
|
578
|
-
* @throws Error if the page is still a stub
|
|
579
|
-
* @see #getOriginalLanguage()
|
|
580
|
-
* @see #isStub()
|
|
581
|
-
*/
|
|
582
|
-
this.setTitle = function (sTitle, fnSuccess, fnFailure) {
|
|
583
|
-
checkStub();
|
|
584
|
-
if (oAlterEgo.title === sTitle) {
|
|
585
|
-
if (fnSuccess) {
|
|
586
|
-
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
587
|
-
sap.ui2.srvc.call(fnSuccess, fnFailure, true);
|
|
588
|
-
}
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
oAlterEgo.title = sTitle;
|
|
592
|
-
persist(fnSuccess, fnFailure);
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* Tells whether this page is a catalog page (see {@link sap.ui2.srvc.Catalog#getCatalogPage}
|
|
597
|
-
* and {@link sap.ui2.srvc.Factory#createNewPageBasedCatalog}).
|
|
598
|
-
* This method is intended to be only called in a design time use case.
|
|
599
|
-
* Can only be called if the page is not a stub anymore (see {@link #isStub}).
|
|
600
|
-
*
|
|
601
|
-
* @returns {boolean}
|
|
602
|
-
* whether this page is a catalog page
|
|
603
|
-
* @since 1.19.1
|
|
604
|
-
|
|
605
|
-
* @throws Error if the page is still a stub
|
|
606
|
-
* @see #isStub()
|
|
607
|
-
*/
|
|
608
|
-
this.isCatalogPage = function () {
|
|
609
|
-
checkStub();
|
|
610
|
-
return oAlterEgo.isCatalogPage === "X";
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Tells whether this page can be altered on Personalization scope or not. Can only be called
|
|
615
|
-
* if the page is not a stub anymore.
|
|
616
|
-
*
|
|
617
|
-
* @returns {boolean}
|
|
618
|
-
* true if this page is locked and false if not
|
|
619
|
-
* @since 1.25.0
|
|
620
|
-
*
|
|
621
|
-
* @throws Error if the page is still a stub
|
|
622
|
-
* @see #isStub()
|
|
623
|
-
*/
|
|
624
|
-
this.isPersonalizationLocked = function () {
|
|
625
|
-
checkStub();
|
|
626
|
-
return oAlterEgo.isPersLocked === "X";
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* Determines and persists the locking status of a page which determines if
|
|
631
|
-
* a page can be altered on Personalization scope or not.
|
|
632
|
-
* This method is intended to be only called in a design time use case.
|
|
633
|
-
* Can only be called if the page is not a stub anymore.
|
|
634
|
-
*
|
|
635
|
-
* @param {boolean} bIsPersLocked
|
|
636
|
-
* Desired locking status
|
|
637
|
-
* @param {function ()} fnSuccess
|
|
638
|
-
* no-args success handler
|
|
639
|
-
* @param {function (string, object=)} [fnFailure]
|
|
640
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
641
|
-
* optional object containing the complete error information as delivered
|
|
642
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
643
|
-
* for more details.
|
|
644
|
-
* If not given
|
|
645
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
646
|
-
* @since 1.25.0
|
|
647
|
-
*
|
|
648
|
-
* @throws Error if the page is still a stub
|
|
649
|
-
* @see #isStub()
|
|
650
|
-
*/
|
|
651
|
-
this.setPersonalizationLocked = function (bIsPersLocked, fnSuccess, fnFailure) {
|
|
652
|
-
checkStub();
|
|
653
|
-
|
|
654
|
-
if (oFactory.getPageBuildingService().isPersonalization()) {
|
|
655
|
-
throw new sap.ui2.srvc.Error(
|
|
656
|
-
"Personalization locking cannot be changed at personalization scope",
|
|
657
|
-
"sap.ui2.srvc.Page"
|
|
658
|
-
);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
if ((oAlterEgo.isPersLocked === "X" && bIsPersLocked)
|
|
662
|
-
|| (oAlterEgo.isPersLocked !== "X" && !bIsPersLocked)) {
|
|
663
|
-
if (fnSuccess) {
|
|
664
|
-
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
665
|
-
sap.ui2.srvc.call(fnSuccess, fnFailure, true);
|
|
666
|
-
}
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
oAlterEgo.isPersLocked = bIsPersLocked ? "X" : " ";
|
|
671
|
-
|
|
672
|
-
persist(fnSuccess, fnFailure);
|
|
673
|
-
};
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Tells whether this page is marked as outdated.
|
|
677
|
-
* This method is intended to be only called in a design time use case.
|
|
678
|
-
* Can only be called if the page is not a stub anymore.
|
|
679
|
-
*
|
|
680
|
-
* @returns {boolean}
|
|
681
|
-
* whether this page is marked as outdated
|
|
682
|
-
* @since 1.7.0
|
|
683
|
-
*
|
|
684
|
-
* @throws Error if the page is still a stub
|
|
685
|
-
* @see #isStub()
|
|
686
|
-
*/
|
|
687
|
-
this.isOutdated = function () {
|
|
688
|
-
checkStub();
|
|
689
|
-
return oAlterEgo.outdated === "X";
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Tells whether this page is read-only. Can only be called if the page is not a stub anymore.
|
|
694
|
-
*
|
|
695
|
-
* @returns {boolean}
|
|
696
|
-
* true if this page is read-only
|
|
697
|
-
* @since 1.32.0
|
|
698
|
-
*
|
|
699
|
-
* @throws Error if the page is still a stub
|
|
700
|
-
* @see #isStub()
|
|
701
|
-
*/
|
|
702
|
-
this.isReadOnly = function () {
|
|
703
|
-
checkStub();
|
|
704
|
-
return oAlterEgo.isReadOnly === "X";
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Tells whether this page was originally read from 'PERSONALIZATION' scope or was modified in
|
|
709
|
-
* a way that had copied the page to that scope. Such modifications include changes of layout
|
|
710
|
-
* data and changes to CHIP instances, but not to property bags.
|
|
711
|
-
* This method is intended to be only called in a runtime use case.
|
|
712
|
-
* Can only be called if the page is not a stub anymore.
|
|
713
|
-
*
|
|
714
|
-
* @returns {boolean}
|
|
715
|
-
* whether this page is personalized
|
|
716
|
-
* @since 1.16.1
|
|
717
|
-
*
|
|
718
|
-
* @throws Error if the page is still a stub
|
|
719
|
-
* @see #isStub()
|
|
720
|
-
* @see #addChipInstance()
|
|
721
|
-
* @see #removeChipInstance()
|
|
722
|
-
* @see #setLayout()
|
|
723
|
-
* @see #setTitle()
|
|
724
|
-
*/
|
|
725
|
-
this.isPersonalized = function () {
|
|
726
|
-
checkStub();
|
|
727
|
-
return oAlterEgo.scope === "PERSONALIZATION";
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* Tells whether this page is still only a stub and does not yet know its properties or related
|
|
732
|
-
* objects, for example layout, title, catalog, or CHIP instances.
|
|
733
|
-
*
|
|
734
|
-
* @returns {boolean}
|
|
735
|
-
* whether this page is still only a stub
|
|
736
|
-
* @since 1.2.0
|
|
737
|
-
*
|
|
738
|
-
* @see #load()
|
|
739
|
-
*/
|
|
740
|
-
this.isStub = function () {
|
|
741
|
-
return bIsStub;
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Loads the current page including its layout, title, (stub) catalog, and CHIP instances (see
|
|
746
|
-
* <code>bPartially</code> parameter). Notifies one of the given handlers. All CHIP instances
|
|
747
|
-
* know their page, see {@link sap.ui2.srvc.ChipInstance#getPage}.
|
|
748
|
-
* <p>
|
|
749
|
-
* Note: Preferably, CHIP instances should be loaded individually as needed (e.g. as they
|
|
750
|
-
* become visible).
|
|
751
|
-
*
|
|
752
|
-
* @param {function ()} fnSuccess
|
|
753
|
-
* no-args success handler
|
|
754
|
-
* @param {function (string, object=)} [fnFailure]
|
|
755
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
756
|
-
* optional object containing the complete error information as delivered
|
|
757
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
758
|
-
* for more details.
|
|
759
|
-
* If not given
|
|
760
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
761
|
-
* @param {boolean} [bPartially=false]
|
|
762
|
-
* whether to load the page only partially (instead of completely, including its CHIP
|
|
763
|
-
* instances)
|
|
764
|
-
* @since 1.2.0
|
|
765
|
-
*/
|
|
766
|
-
this.load = function (fnSuccess, fnFailure, bPartially) {
|
|
767
|
-
var iAsyncCount;
|
|
768
|
-
|
|
769
|
-
if (!bIsStub) {
|
|
770
|
-
throw new sap.ui2.srvc.Error("Page is not a stub anymore", "sap.ui2.srvc.Page");
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
function checkDone () {
|
|
774
|
-
if (iAsyncCount === 0) {
|
|
775
|
-
// all async operations done, call success handler
|
|
776
|
-
jQuery.sap.log.debug("Initialized: " + that, null, "sap.ui2.srvc.Page");
|
|
777
|
-
fnSuccess();
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function onLoad () {
|
|
782
|
-
iAsyncCount -= 1;
|
|
783
|
-
checkDone();
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
oFactory.getPageBuildingService().readPage(sId,
|
|
787
|
-
function (oNewAlterEgo) {
|
|
788
|
-
var i,
|
|
789
|
-
aRawChipInstances
|
|
790
|
-
= (oNewAlterEgo.PageChipInstances && oNewAlterEgo.PageChipInstances.results) || [],
|
|
791
|
-
iChipInstanceCount = aRawChipInstances.length;
|
|
792
|
-
|
|
793
|
-
jQuery.sap.log.debug("Loaded: " + that, null, "sap.ui2.srvc.Page");
|
|
794
|
-
initialize(oNewAlterEgo);
|
|
795
|
-
|
|
796
|
-
iAsyncCount = bPartially ? 0 : iChipInstanceCount;
|
|
797
|
-
if (!bPartially) {
|
|
798
|
-
for (i = 0; i < iChipInstanceCount; i += 1) {
|
|
799
|
-
aChipInstances[i].load(onLoad, fnFailure);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
checkDone();
|
|
803
|
-
}, fnFailure);
|
|
804
|
-
};
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
* Removes (in other words, deletes) this page from the page building service.
|
|
808
|
-
*
|
|
809
|
-
* @param {function ()} fnSuccess
|
|
810
|
-
* no-args success handler
|
|
811
|
-
* @param {function (string, object=)} [fnFailure]
|
|
812
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
813
|
-
* optional object containing the complete error information as delivered
|
|
814
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
815
|
-
* for more details.
|
|
816
|
-
* If not given
|
|
817
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
818
|
-
* @since 1.2.0
|
|
819
|
-
*/
|
|
820
|
-
this.remove = function (fnSuccess, fnFailure) {
|
|
821
|
-
this.exit();
|
|
822
|
-
oFactory.getPageBuildingService().deletePage(sId, fnSuccess, fnFailure);
|
|
823
|
-
};
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* Removes the given page CHIP instance from this page's collection of CHIP instances, calls
|
|
827
|
-
* the instance's <code>remove()</code> method and returns <code>true</code>.
|
|
828
|
-
* If the given page CHIP instance does not belong to this page (any more), <code>false</code>
|
|
829
|
-
* is returned and nothing else happens.
|
|
830
|
-
* Can only be called if the page is not a stub anymore.
|
|
831
|
-
*
|
|
832
|
-
* @param {sap.ui2.srvc.ChipInstance} oChipInstance
|
|
833
|
-
* the CHIP instance to remove from this page
|
|
834
|
-
* @param {function ()} [fnSuccess]
|
|
835
|
-
* no-args success handler
|
|
836
|
-
* @param {function (string, object=)} [fnFailure]
|
|
837
|
-
* error handler taking an error message and, since version 1.28.6, an
|
|
838
|
-
* optional object containing the complete error information as delivered
|
|
839
|
-
* by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
|
|
840
|
-
* for more details.
|
|
841
|
-
* If not given
|
|
842
|
-
* <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
|
|
843
|
-
* @returns {boolean}
|
|
844
|
-
* <code>true</code> iff. the given CHIP instance's <code>remove()</code> method has been
|
|
845
|
-
* called
|
|
846
|
-
* @since 1.9.0
|
|
847
|
-
*
|
|
848
|
-
* @throws Error if the page is still a stub
|
|
849
|
-
* @see #isStub()
|
|
850
|
-
* @see sap.ui2.srvc.ChipInstance#getPage
|
|
851
|
-
* @see sap.ui2.srvc.ChipInstance#remove
|
|
852
|
-
*/
|
|
853
|
-
this.removeChipInstance = function (oChipInstance, fnSuccess, fnFailure) {
|
|
854
|
-
var i = aChipInstances.indexOf(oChipInstance);
|
|
855
|
-
|
|
856
|
-
checkStub();
|
|
857
|
-
if (i >= 0) {
|
|
858
|
-
// remove to avoid endless loops
|
|
859
|
-
aChipInstances.splice(i, 1);
|
|
860
|
-
|
|
861
|
-
oChipInstance.remove(function () {
|
|
862
|
-
that.updateScope();
|
|
863
|
-
if (fnSuccess) {
|
|
864
|
-
fnSuccess.apply(this, arguments);
|
|
865
|
-
}
|
|
866
|
-
}, function () {
|
|
867
|
-
// reinsert CHIP instance because backend call failed
|
|
868
|
-
aChipInstances.splice(i, 0, oChipInstance);
|
|
869
|
-
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
870
|
-
fnFailure.apply(this, arguments);
|
|
871
|
-
});
|
|
872
|
-
|
|
873
|
-
return true;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
return false;
|
|
877
|
-
};
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* Returns this page's string representation.
|
|
881
|
-
*
|
|
882
|
-
* @param {boolean} [bVerbose=false]
|
|
883
|
-
* flag whether to show all properties
|
|
884
|
-
* @returns {string}
|
|
885
|
-
* this page's string representation
|
|
886
|
-
* @since 1.2.0
|
|
887
|
-
*/
|
|
888
|
-
this.toString = function (bVerbose) {
|
|
889
|
-
var aResult = ['sap.ui2.srvc.Page({sId:"', sId, '",bIsStub:', bIsStub,
|
|
890
|
-
",bIsLoadingBagsOnDemand:", bIsLoadingBagsOnDemand];
|
|
891
|
-
if (bVerbose) {
|
|
892
|
-
aResult.push(",oAlterEgo:", JSON.stringify(oAlterEgo),
|
|
893
|
-
",oCatalog:", oCatalog ? oCatalog.toString(bVerbose) : oCatalog,
|
|
894
|
-
",oFactory:", oFactory.toString(bVerbose),
|
|
895
|
-
",aChipInstances:", JSON.stringify(aChipInstances)
|
|
896
|
-
);
|
|
897
|
-
}
|
|
898
|
-
aResult.push("})");
|
|
899
|
-
return aResult.join("");
|
|
900
|
-
};
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Changes to pages on CUSTOMIZING or CONFIGURATION scope will create a page copy on scope
|
|
904
|
-
* PERSONALIZATION automatically in the backend; thus we update the scope accordingly.
|
|
905
|
-
* Note: Can also be called by CHIP instances in case they are modified.
|
|
906
|
-
*
|
|
907
|
-
* @since 1.16.1
|
|
908
|
-
* @private
|
|
909
|
-
* @see #isPersonalized
|
|
910
|
-
*/
|
|
911
|
-
this.updateScope = function () {
|
|
912
|
-
if (oFactory.getPageBuildingService().isPersonalization()) {
|
|
913
|
-
oAlterEgo.scope = "PERSONALIZATION";
|
|
914
|
-
}
|
|
915
|
-
};
|
|
916
|
-
|
|
917
|
-
// constructor code -------------------------------------------------------
|
|
918
|
-
if (!sap.ui2.srvc.Map) {
|
|
919
|
-
fnRequire("sap.ui2.srvc.utils");
|
|
920
|
-
}
|
|
921
|
-
if (typeof vPageData === "object") {
|
|
922
|
-
// direct creation
|
|
923
|
-
sId = vPageData.id;
|
|
924
|
-
initialize(vPageData);
|
|
925
|
-
} else if (typeof vPageData === "string") {
|
|
926
|
-
sId = vPageData;
|
|
927
|
-
}
|
|
928
|
-
if (!sId) {
|
|
929
|
-
throw new sap.ui2.srvc.Error("Missing ID", "sap.ui2.srvc.Page");
|
|
930
|
-
}
|
|
931
|
-
mBags = new sap.ui2.srvc.Map();
|
|
932
|
-
jQuery.sap.log.debug("Created: " + this, null, "sap.ui2.srvc.Page");
|
|
933
|
-
};
|
|
934
|
-
}());
|