@openui5/sap.ui.fl 1.102.2 → 1.104.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/.reuse/dep5 +17 -0
- package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +5 -0
- package/THIRDPARTY.txt +35 -2
- package/package.json +3 -3
- package/src/sap/ui/fl/.library +1 -1
- package/src/sap/ui/fl/Cache.js +1 -1
- package/src/sap/ui/fl/Change.js +1 -1
- package/src/sap/ui/fl/ChangePersistence.js +1 -1
- package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
- package/src/sap/ui/fl/FlexController.js +1 -1
- package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
- package/src/sap/ui/fl/LayerUtils.js +1 -1
- package/src/sap/ui/fl/Utils.js +2 -6
- package/src/sap/ui/fl/Variant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Applier.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
- package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +133 -206
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +38 -14
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +109 -10
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +123 -0
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +3 -2
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +16 -13
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +13 -6
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/EventHistory.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
- package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/fl/changeHandler/Base.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
- package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
- package/src/sap/ui/fl/codeExt/CodeExtManager.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
- package/src/sap/ui/fl/designtime/variants/VariantManagement.designtime.js +3 -0
- package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +8 -39
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeRegistryItem.js +1 -1
- package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
- package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
- package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
- package/src/sap/ui/fl/library.js +9 -9
- package/src/sap/ui/fl/support/Flexibility.js +1 -1
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
- package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
- package/src/sap/ui/fl/support/diagnostics/Flexibility.controller.js +1 -1
- package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/util/IFrame.js +4 -4
- package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
- package/src/sap/ui/fl/util/resolveBinding.js +1 -1
- package/src/sap/ui/fl/variants/VariantManagement.js +577 -2098
- package/src/sap/ui/fl/variants/VariantModel.js +1 -1
- package/src/sap/ui/fl/write/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/write/_internal/StorageFeaturesMerger.js +1 -1
- package/src/sap/ui/fl/write/_internal/Versions.js +14 -8
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +11 -3
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +9 -2
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/write/_internal/extensionPoint/Registry.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/FlexObjectState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +120 -134
- package/src/sap/ui/fl/write/_internal/transport/TransportDialog.js +4 -4
- package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +101 -69
- package/src/sap/ui/fl/write/api/Version.js +6 -1
- package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +14 -1
|
@@ -7,111 +7,27 @@
|
|
|
7
7
|
// Provides control sap.ui.fl.variants.VariantManagement.
|
|
8
8
|
sap.ui.define([
|
|
9
9
|
"sap/ui/model/Context",
|
|
10
|
-
"sap/
|
|
11
|
-
"sap/
|
|
12
|
-
"sap/ui/
|
|
13
|
-
"sap/ui/
|
|
14
|
-
"sap/ui/Device",
|
|
15
|
-
"sap/ui/core/InvisibleText",
|
|
10
|
+
"sap/m/VariantItem",
|
|
11
|
+
"sap/m/VariantManagement",
|
|
12
|
+
"sap/ui/fl/Utils",
|
|
13
|
+
"sap/ui/fl/registry/Settings",
|
|
16
14
|
"sap/ui/core/Control",
|
|
17
|
-
"sap/ui/core/Icon",
|
|
18
|
-
"sap/ui/layout/HorizontalLayout",
|
|
19
|
-
"sap/ui/layout/Grid",
|
|
20
|
-
'sap/base/Log',
|
|
21
|
-
"sap/m/SearchField",
|
|
22
|
-
"sap/m/RadioButton",
|
|
23
|
-
"sap/m/ColumnListItem",
|
|
24
|
-
"sap/m/Column",
|
|
25
|
-
"sap/m/Text",
|
|
26
|
-
"sap/m/Bar",
|
|
27
|
-
"sap/m/Table",
|
|
28
|
-
"sap/m/Page",
|
|
29
|
-
"sap/m/Toolbar",
|
|
30
|
-
"sap/m/ToolbarSpacer",
|
|
31
|
-
"sap/m/Button",
|
|
32
|
-
"sap/m/ToggleButton",
|
|
33
|
-
"sap/m/CheckBox",
|
|
34
|
-
"sap/m/Dialog",
|
|
35
|
-
"sap/m/Input",
|
|
36
|
-
"sap/m/Label",
|
|
37
|
-
"sap/m/Title",
|
|
38
|
-
"sap/m/ResponsivePopover",
|
|
39
|
-
"sap/m/SelectList",
|
|
40
|
-
"sap/m/ObjectIdentifier",
|
|
41
|
-
"sap/m/OverflowToolbar",
|
|
42
|
-
"sap/m/OverflowToolbarLayoutData",
|
|
43
|
-
"sap/m/VBox",
|
|
44
|
-
'sap/m/HBox',
|
|
45
|
-
"sap/ui/events/KeyCodes",
|
|
46
15
|
"sap/ui/core/library",
|
|
47
|
-
|
|
48
|
-
"sap/ui/fl/Utils",
|
|
49
|
-
"sap/ui/fl/registry/Settings"
|
|
16
|
+
'sap/base/Log'
|
|
50
17
|
], function(
|
|
51
18
|
Context,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Device,
|
|
57
|
-
InvisibleText,
|
|
19
|
+
VariantItem,
|
|
20
|
+
MVariantManagement,
|
|
21
|
+
flUtils,
|
|
22
|
+
flSettings,
|
|
58
23
|
Control,
|
|
59
|
-
Icon,
|
|
60
|
-
HorizontalLayout,
|
|
61
|
-
Grid,
|
|
62
|
-
Log,
|
|
63
|
-
SearchField,
|
|
64
|
-
RadioButton,
|
|
65
|
-
ColumnListItem,
|
|
66
|
-
Column,
|
|
67
|
-
Text,
|
|
68
|
-
Bar,
|
|
69
|
-
Table,
|
|
70
|
-
Page,
|
|
71
|
-
Toolbar,
|
|
72
|
-
ToolbarSpacer,
|
|
73
|
-
Button,
|
|
74
|
-
ToggleButton,
|
|
75
|
-
CheckBox,
|
|
76
|
-
Dialog,
|
|
77
|
-
Input,
|
|
78
|
-
Label,
|
|
79
|
-
Title,
|
|
80
|
-
ResponsivePopover,
|
|
81
|
-
SelectList,
|
|
82
|
-
ObjectIdentifier,
|
|
83
|
-
OverflowToolbar,
|
|
84
|
-
OverflowToolbarLayoutData,
|
|
85
|
-
VBox,
|
|
86
|
-
HBox,
|
|
87
|
-
KeyCodes,
|
|
88
24
|
coreLibrary,
|
|
89
|
-
|
|
90
|
-
flUtils,
|
|
91
|
-
flSettings
|
|
25
|
+
Log
|
|
92
26
|
) {
|
|
93
27
|
"use strict";
|
|
94
28
|
|
|
95
|
-
// shortcut for sap.
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
// shortcut for sap.m.ButtonType
|
|
99
|
-
var ButtonType = mobileLibrary.ButtonType;
|
|
100
|
-
|
|
101
|
-
// shortcut for sap.m.PlacementType
|
|
102
|
-
var PlacementType = mobileLibrary.PlacementType;
|
|
103
|
-
|
|
104
|
-
// shortcut for sap.m.PopinDisplay
|
|
105
|
-
var PopinDisplay = mobileLibrary.PopinDisplay;
|
|
106
|
-
|
|
107
|
-
// shortcut for sap.m.ScreenSize
|
|
108
|
-
var ScreenSize = mobileLibrary.ScreenSize;
|
|
109
|
-
|
|
110
|
-
// shortcut for sap.ui.core.ValueState
|
|
111
|
-
var ValueState = coreLibrary.ValueState;
|
|
112
|
-
|
|
113
|
-
// shortcut for sap.ui.core.TextAlign
|
|
114
|
-
var TextAlign = coreLibrary.TextAlign;
|
|
29
|
+
// shortcut for sap.ui.core.TitleLevel
|
|
30
|
+
var TitleLevel = coreLibrary.TitleLevel;
|
|
115
31
|
|
|
116
32
|
/**
|
|
117
33
|
* Constructor for a new <code>VariantManagement</code>.
|
|
@@ -135,77 +51,70 @@ sap.ui.define([
|
|
|
135
51
|
designtime: "sap/ui/fl/designtime/variants/VariantManagement.designtime",
|
|
136
52
|
properties: {
|
|
137
53
|
/**
|
|
138
|
-
*
|
|
54
|
+
* Determines the intention of setting the current variant based on passed information.
|
|
55
|
+
* <p>
|
|
56
|
+
* <b>Note:</b> The <code>VariantManagement</code> control does not react in any way to this property.
|
|
139
57
|
*/
|
|
140
|
-
|
|
58
|
+
updateVariantInURL: {
|
|
141
59
|
type: "boolean",
|
|
142
60
|
group: "Misc",
|
|
143
|
-
defaultValue:
|
|
61
|
+
defaultValue: false
|
|
144
62
|
},
|
|
145
|
-
|
|
146
63
|
/**
|
|
147
|
-
*
|
|
148
|
-
* <b>Note:</b>This flag is only used internally in the app variant scenarios.
|
|
64
|
+
* When set to false, doesn't reset the <code>VariantManagement</code> control to the default variant, when its binding context is changed.
|
|
149
65
|
*/
|
|
150
|
-
|
|
66
|
+
resetOnContextChange: {
|
|
151
67
|
type: "boolean",
|
|
152
68
|
group: "Misc",
|
|
153
|
-
defaultValue:
|
|
69
|
+
defaultValue: true
|
|
154
70
|
},
|
|
155
|
-
|
|
156
71
|
/**
|
|
157
|
-
*
|
|
158
|
-
* opened.
|
|
72
|
+
* The name of the model containing the data.
|
|
159
73
|
*/
|
|
160
|
-
|
|
161
|
-
type: "
|
|
74
|
+
modelName: {
|
|
75
|
+
type: "string",
|
|
162
76
|
group: "Misc",
|
|
163
|
-
defaultValue:
|
|
77
|
+
defaultValue: ""
|
|
164
78
|
},
|
|
165
|
-
|
|
166
79
|
/**
|
|
167
|
-
*
|
|
80
|
+
* Indicated if the buttons on the 'My Views' are visible.
|
|
168
81
|
*/
|
|
169
82
|
editable: {
|
|
170
83
|
type: "boolean",
|
|
171
84
|
group: "Misc",
|
|
172
85
|
defaultValue: true
|
|
173
86
|
},
|
|
174
|
-
|
|
175
87
|
/**
|
|
176
|
-
*
|
|
177
|
-
* <p>
|
|
178
|
-
* <b>Note:</b> In a UI adaptation scenario, this property is not used at all, because the model name is <code>$FlexVariants</code>.
|
|
88
|
+
* Indicated if the defaulting functionality is enabled.
|
|
179
89
|
*/
|
|
180
|
-
|
|
181
|
-
type: "
|
|
90
|
+
showSetAsDefault: {
|
|
91
|
+
type: "boolean",
|
|
182
92
|
group: "Misc",
|
|
183
|
-
defaultValue:
|
|
93
|
+
defaultValue: true
|
|
184
94
|
},
|
|
185
|
-
|
|
186
95
|
/**
|
|
187
|
-
*
|
|
188
|
-
* <
|
|
189
|
-
* <b>Note:</b> The <code>VariantManagement</code> control does not react in any way to this property.
|
|
96
|
+
* If set to <code>true</code>, the key for a vendor variant will be added manually.<br>
|
|
97
|
+
* <b>Note:</b>This flag is only used internally in the app variant scenarios.
|
|
190
98
|
*/
|
|
191
|
-
|
|
99
|
+
manualVariantKey: {
|
|
192
100
|
type: "boolean",
|
|
193
101
|
group: "Misc",
|
|
194
102
|
defaultValue: false
|
|
195
103
|
},
|
|
104
|
+
|
|
196
105
|
/**
|
|
197
|
-
*
|
|
106
|
+
* Indicates that the control is in error state. If set to <code>true</code>, an error message will be displayed whenever the variant is
|
|
107
|
+
* opened.
|
|
198
108
|
*/
|
|
199
|
-
|
|
109
|
+
inErrorState: {
|
|
200
110
|
type: "boolean",
|
|
201
111
|
group: "Misc",
|
|
202
|
-
defaultValue:
|
|
112
|
+
defaultValue: false
|
|
203
113
|
},
|
|
204
114
|
|
|
205
115
|
/**
|
|
206
116
|
* Determines the behavior for Apply Automatically if the standard variant is marked as the default variant.
|
|
207
117
|
*
|
|
208
|
-
* @since 1.80
|
|
209
118
|
*/
|
|
210
119
|
executeOnSelectionForStandardDefault: {
|
|
211
120
|
type: "boolean",
|
|
@@ -217,25 +126,30 @@ sap.ui.define([
|
|
|
217
126
|
* Defines the Apply Automatically text for the standard variant in the Manage Views dialog if the application controls this behavior.
|
|
218
127
|
*
|
|
219
128
|
* <br><b>Note:</b> the usage of this property is restricted to <code>sap.fe</code> components only.
|
|
220
|
-
* @since 1.85
|
|
221
129
|
*/
|
|
222
130
|
displayTextForExecuteOnSelectionForStandardVariant: {
|
|
223
131
|
type: "string",
|
|
224
132
|
group: "Misc",
|
|
225
133
|
defaultValue: ""
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
associations: {
|
|
134
|
+
},
|
|
229
135
|
|
|
230
136
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
137
|
+
* Semantic level of the header.
|
|
138
|
+
* For more information, see {@link sap.m.Title#setLevel}.
|
|
139
|
+
*
|
|
140
|
+
* @since 1.104
|
|
141
|
+
*/
|
|
142
|
+
headerLevel: {
|
|
143
|
+
type: "sap.ui.core.TitleLevel",
|
|
144
|
+
group: "Appearance",
|
|
145
|
+
defaultValue: TitleLevel.Auto
|
|
236
146
|
}
|
|
237
147
|
},
|
|
238
148
|
events: {
|
|
149
|
+
/**
|
|
150
|
+
* This event is fired when the model and context are set.
|
|
151
|
+
*/
|
|
152
|
+
initialized: {},
|
|
239
153
|
|
|
240
154
|
/**
|
|
241
155
|
* This event is fired when the <i>Save View</i> dialog or the <i>Save As</i> dialog is closed with the save button.
|
|
@@ -270,11 +184,26 @@ sap.ui.define([
|
|
|
270
184
|
type: "boolean"
|
|
271
185
|
},
|
|
272
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Indicates the check box state for 'Public'.
|
|
189
|
+
*/
|
|
190
|
+
'public': {
|
|
191
|
+
type: "boolean"
|
|
192
|
+
},
|
|
193
|
+
|
|
273
194
|
/**
|
|
274
195
|
* The default variant indicator
|
|
275
196
|
*/
|
|
276
197
|
def: {
|
|
277
198
|
type: "boolean"
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Indicates the check box state for 'Create Tile'.
|
|
203
|
+
* <br>Note:</br>This event parameter is used only internally.
|
|
204
|
+
*/
|
|
205
|
+
tile: {
|
|
206
|
+
type: "boolean"
|
|
278
207
|
}
|
|
279
208
|
}
|
|
280
209
|
},
|
|
@@ -287,12 +216,38 @@ sap.ui.define([
|
|
|
287
216
|
/**
|
|
288
217
|
* This event is fired when users apply changes to variants in the <i>Manage Views</i> dialog.
|
|
289
218
|
*/
|
|
290
|
-
manage: {},
|
|
291
219
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
220
|
+
manage: {
|
|
221
|
+
parameters: {
|
|
222
|
+
/**
|
|
223
|
+
* List of changed variants. Each entry contains a 'key' - the variant key and a 'name' - the new title of the variant
|
|
224
|
+
*/
|
|
225
|
+
renamed: {
|
|
226
|
+
type: "object[]"
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* List of deleted variant keys
|
|
231
|
+
*/
|
|
232
|
+
deleted: {
|
|
233
|
+
type: "string[]"
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* List of variant keys and the associated Execute on Selection indicator
|
|
238
|
+
*/
|
|
239
|
+
exe: {
|
|
240
|
+
type: "object[]"
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The default variant key
|
|
245
|
+
*/
|
|
246
|
+
def: {
|
|
247
|
+
type: "string"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
296
251
|
|
|
297
252
|
/**
|
|
298
253
|
* This event is fired when a new variant is selected.
|
|
@@ -307,154 +262,66 @@ sap.ui.define([
|
|
|
307
262
|
}
|
|
308
263
|
}
|
|
309
264
|
}
|
|
265
|
+
},
|
|
266
|
+
associations: {
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Contains the controls for which the variant management is responsible.
|
|
270
|
+
*/
|
|
271
|
+
"for": {
|
|
272
|
+
type: "sap.ui.core.Control",
|
|
273
|
+
multiple: true
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
aggregations: {
|
|
277
|
+
/**
|
|
278
|
+
* Used for embedded vm
|
|
279
|
+
*/
|
|
280
|
+
_embeddedVM: {
|
|
281
|
+
type: "sap.m.VariantManagement",
|
|
282
|
+
multiple: false,
|
|
283
|
+
visibility: "hidden"
|
|
284
|
+
}
|
|
310
285
|
}
|
|
311
286
|
},
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
|
|
315
|
-
* @param {sap.ui.core.RenderManager} oRm - <code>RenderManager</code> that can be used for writing to the render output buffer
|
|
316
|
-
* @param {sap.ui.core.Control} oControl - Object representation of the control that should be rendered
|
|
317
|
-
*/
|
|
318
287
|
renderer: {
|
|
319
288
|
apiVersion: 2,
|
|
320
289
|
render: function(oRm, oControl) {
|
|
321
|
-
oRm.openStart("div", oControl)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
oRm.renderControl(oControl.oVariantLayout);
|
|
290
|
+
oRm.openStart("div", oControl);
|
|
291
|
+
oRm.openEnd();
|
|
292
|
+
oRm.renderControl(oControl._oVM);
|
|
326
293
|
oRm.close("div");
|
|
327
294
|
}
|
|
328
295
|
}
|
|
329
296
|
});
|
|
330
297
|
|
|
331
|
-
VariantManagement.INNER_MODEL_NAME = "$sapUiFlVariants";
|
|
332
|
-
VariantManagement.MAX_NAME_LEN = 100;
|
|
333
|
-
VariantManagement.COLUMN_FAV_IDX = 0;
|
|
334
|
-
VariantManagement.COLUMN_NAME_IDX = 1;
|
|
335
|
-
|
|
336
298
|
/*
|
|
337
299
|
* Constructs and initializes the <code>VariantManagement</code> control.
|
|
338
300
|
*/
|
|
339
301
|
VariantManagement.prototype.init = function() {
|
|
340
|
-
this
|
|
341
|
-
|
|
342
|
-
this.attachModelContextChange(this._setModel, this);
|
|
302
|
+
Control.prototype.init.apply(this); // Call base class
|
|
343
303
|
|
|
304
|
+
this.addStyleClass("sapUiFlVarMngmt"); // required for finding the control by RTA/FL
|
|
344
305
|
this._oRb = sap.ui.getCore().getLibraryResourceBundle("sap.ui.fl");
|
|
345
306
|
|
|
346
|
-
this.
|
|
347
|
-
|
|
348
|
-
this.oVariantInvisibleText = new InvisibleText();
|
|
349
|
-
|
|
350
|
-
this.oVariantText = new Title(this.getId() + "-text", {
|
|
351
|
-
text: {
|
|
352
|
-
path: 'currentVariant',
|
|
353
|
-
model: this._sModelName,
|
|
354
|
-
formatter: function(sKey) {
|
|
355
|
-
var sText = "";
|
|
356
|
-
if (sKey) {
|
|
357
|
-
sText = this.getSelectedVariantText(sKey);
|
|
358
|
-
this._setInvisibleText(sText, this.getModified());
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
return sText;
|
|
362
|
-
}.bind(this)
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
this.oVariantText.addStyleClass("sapUiFlVarMngmtClickable");
|
|
367
|
-
this.oVariantText.addStyleClass("sapUiFlVarMngmtTitle");
|
|
368
|
-
this.oVariantText.addStyleClass("sapMTitleStyleH4");
|
|
369
|
-
if (Device.system.phone) {
|
|
370
|
-
this.oVariantText.addStyleClass("sapUiFlVarMngmtTextPhoneMaxWidth");
|
|
371
|
-
} else {
|
|
372
|
-
this.oVariantText.addStyleClass("sapUiFlVarMngmtTextMaxWidth");
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
var oVariantModifiedText = new Text(this.getId() + "-modified", {
|
|
376
|
-
text: "*",
|
|
377
|
-
visible: {
|
|
378
|
-
path: "modified",
|
|
379
|
-
model: this._sModelName,
|
|
380
|
-
formatter: function(bValue) {
|
|
381
|
-
var sKey = this.getCurrentVariantKey();
|
|
382
|
-
|
|
383
|
-
if (sKey) {
|
|
384
|
-
this._setInvisibleText(this.getSelectedVariantText(sKey), bValue);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
return ((bValue === null) || (bValue === undefined)) ? false : bValue;
|
|
388
|
-
}.bind(this)
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
oVariantModifiedText.setVisible(false);
|
|
392
|
-
oVariantModifiedText.addStyleClass("sapUiFlVarMngmtModified");
|
|
393
|
-
oVariantModifiedText.addStyleClass("sapUiFlVarMngmtClickable");
|
|
394
|
-
|
|
395
|
-
this.oVariantPopoverTrigger = new ToggleButton(this.getId() + "-trigger", {
|
|
396
|
-
icon: "sap-icon://slim-arrow-down",
|
|
397
|
-
type: ButtonType.Transparent,
|
|
398
|
-
tooltip: this._oRb.getText("VARIANT_MANAGEMENT_TRIGGER_TT")
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
this.oVariantPopoverTrigger.addAriaLabelledBy(this.oVariantInvisibleText);
|
|
402
|
-
this.oVariantPopoverTrigger.addStyleClass("sapUiFlVarMngmtClickable");
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
this.oVariantLayout = new HorizontalLayout({
|
|
406
|
-
content: [
|
|
407
|
-
this.oVariantText, oVariantModifiedText, this.oVariantPopoverTrigger
|
|
408
|
-
]
|
|
409
|
-
});
|
|
410
|
-
this.oVariantLayout.addStyleClass("sapUiFlVarMngmtLayout");
|
|
307
|
+
this.setModelName(flUtils.VARIANT_MODEL_NAME);
|
|
411
308
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.oVariantModifiedText = oVariantModifiedText;
|
|
415
|
-
|
|
416
|
-
this.oVariantInvisibleText.toStatic();
|
|
417
|
-
|
|
418
|
-
this.addDependent(this.oVariantLayout);
|
|
419
|
-
|
|
420
|
-
this._fRegisteredApplyAutomaticallyOnStandardVariant = null;
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Registration of a callback function. The provided callback function is executed to check if apply automatically on standard variant should be considered.
|
|
425
|
-
* @private
|
|
426
|
-
* @ui5-restricted sap.fe
|
|
427
|
-
* @since 1.93
|
|
428
|
-
* @param {function} fCallBack Called when standard variant must be applied. It determines if apply automatically on standard variant should be considered.
|
|
429
|
-
* As a convenience the current variant will be passed to the callback. This variant instance may not be changed in any ways. It is only intended to provide certain variant information.
|
|
430
|
-
* @returns {this} Reference to this in order to allow method chaining.
|
|
431
|
-
*/
|
|
432
|
-
VariantManagement.prototype.registerApplyAutomaticallyOnStandardVariant = function(fCallBack) {
|
|
433
|
-
this._fRegisteredApplyAutomaticallyOnStandardVariant = fCallBack;
|
|
309
|
+
this.attachModelContextChange(this._setModel, this);
|
|
434
310
|
|
|
435
|
-
|
|
436
|
-
|
|
311
|
+
this._oVM = new MVariantManagement(this.getId() + "-vm");
|
|
312
|
+
this.setAggregation("_embeddedVM", this._oVM, true);
|
|
437
313
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
* @since 1.93
|
|
443
|
-
* @param {object} oVariant the inner variant object
|
|
444
|
-
* @returns {boolean} apply automatically state
|
|
445
|
-
*/
|
|
446
|
-
VariantManagement.prototype.getApplyAutomaticallyOnVariant = function(oVariant) {
|
|
447
|
-
var bExecuteOnSelection = oVariant.executeOnSelect;
|
|
314
|
+
this._aCancelEventHandlers = [];
|
|
315
|
+
this._aSaveEventHandlers = [];
|
|
316
|
+
this._aManageEventHandlers = [];
|
|
317
|
+
this._aSelectEventHandlers = [];
|
|
448
318
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
Log.error("callback for determination of apply automatically on standard variant failed");
|
|
454
|
-
}
|
|
455
|
-
}
|
|
319
|
+
this._oVM.attachManage(this._fireManage, this);
|
|
320
|
+
this._oVM.attachCancel(this._fireCancel, this);
|
|
321
|
+
this._oVM.attachSave(this._fireSave, this);
|
|
322
|
+
this._oVM.attachSelect(this._fireSelect, this);
|
|
456
323
|
|
|
457
|
-
|
|
324
|
+
this._updateWithSettingsInfo();
|
|
458
325
|
};
|
|
459
326
|
|
|
460
327
|
/**
|
|
@@ -471,256 +338,266 @@ sap.ui.define([
|
|
|
471
338
|
};
|
|
472
339
|
};
|
|
473
340
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
*/
|
|
479
|
-
VariantManagement.prototype.getTitle = function() {
|
|
480
|
-
return this.oVariantText;
|
|
341
|
+
/// <EVENT FORWARDING>
|
|
342
|
+
VariantManagement.prototype.attachCancel = function(mProps, fnCallback, oObj) {
|
|
343
|
+
this.attachEvent("cancel", mProps, fnCallback, oObj);
|
|
344
|
+
return this;
|
|
481
345
|
};
|
|
482
346
|
|
|
483
|
-
VariantManagement.prototype.
|
|
484
|
-
var
|
|
485
|
-
|
|
486
|
-
if (
|
|
487
|
-
|
|
488
|
-
} else {
|
|
489
|
-
sInvisibleTextKey = "VARIANT_MANAGEMENT_SEL_VARIANT";
|
|
347
|
+
VariantManagement.prototype._findCallback = function(aArray, fnCallback, oObj) {
|
|
348
|
+
var mCallbackIdx = -1;
|
|
349
|
+
aArray.some(function(oEntry, nIdx) {
|
|
350
|
+
if ((oEntry.fCallback === fnCallback) && (oEntry.oObj === oObj)) {
|
|
351
|
+
mCallbackIdx = nIdx;
|
|
490
352
|
}
|
|
491
353
|
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
VariantManagement.prototype._createInnerModel = function() {
|
|
497
|
-
var oModel = new JSONModel({
|
|
498
|
-
showExecuteOnSelection: false,
|
|
499
|
-
showSetAsDefault: true,
|
|
500
|
-
showPublic: false,
|
|
501
|
-
showContexts: false,
|
|
502
|
-
editable: true,
|
|
503
|
-
popoverTitle: this._oRb.getText("VARIANT_MANAGEMENT_VARIANTS")
|
|
354
|
+
return (mCallbackIdx >= 0);
|
|
504
355
|
});
|
|
505
|
-
this.setModel(oModel, VariantManagement.INNER_MODEL_NAME);
|
|
506
356
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
this._updateInnerModelWithSettingsInfo();
|
|
357
|
+
return mCallbackIdx;
|
|
510
358
|
};
|
|
511
359
|
|
|
512
|
-
VariantManagement.prototype.
|
|
513
|
-
this.
|
|
514
|
-
path: "/showSetAsDefault",
|
|
515
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
516
|
-
});
|
|
517
|
-
this.bindProperty("editable", {
|
|
518
|
-
path: "/editable",
|
|
519
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
520
|
-
});
|
|
521
|
-
};
|
|
360
|
+
VariantManagement.prototype.detachCancel = function(fnCallback, oObj) {
|
|
361
|
+
var nCancelEntryIdx = this._findCallback(this._aCancelEventHandlers, fnCallback, oObj);
|
|
522
362
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
this.getModel(VariantManagement.INNER_MODEL_NAME).setProperty("/showSaveAs", oSettings.isVariantPersonalizationEnabled());
|
|
526
|
-
this.getModel(VariantManagement.INNER_MODEL_NAME).setProperty("/showPublic", oSettings.isPublicFlVariantEnabled());
|
|
527
|
-
}.bind(this));
|
|
528
|
-
};
|
|
363
|
+
if (nCancelEntryIdx >= 0) {
|
|
364
|
+
this.detachEvent("cancel", fnCallback, oObj);
|
|
529
365
|
|
|
530
|
-
|
|
531
|
-
var oModel = this.getModel(VariantManagement.INNER_MODEL_NAME);
|
|
532
|
-
if (oModel) {
|
|
533
|
-
return oModel.getProperty("/showPublic");
|
|
366
|
+
this._aCancelEventHandlers.splice(nCancelEntryIdx, 1);
|
|
534
367
|
}
|
|
535
368
|
|
|
536
|
-
return
|
|
369
|
+
return this;
|
|
537
370
|
};
|
|
538
371
|
|
|
539
|
-
VariantManagement.prototype.
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
372
|
+
VariantManagement.prototype.fireManage = function(oEvent) {
|
|
373
|
+
this._oVM.fireManage(oEvent);
|
|
374
|
+
};
|
|
375
|
+
VariantManagement.prototype.fireSave = function(oEvent) {
|
|
376
|
+
this._oVM.fireSave(oEvent);
|
|
544
377
|
};
|
|
545
378
|
|
|
546
|
-
VariantManagement.prototype.
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
|
|
379
|
+
VariantManagement.prototype._fireCancel = function(oEvent) {
|
|
380
|
+
for (var i = 0; i < this._aCancelEventHandlers.length; i++) {
|
|
381
|
+
oEvent.oSource = this;
|
|
382
|
+
this._aCancelEventHandlers[i].fCallbackBound(oEvent, this._aCancelEventHandlers[i].mProps);
|
|
550
383
|
}
|
|
551
|
-
|
|
552
|
-
return false;
|
|
553
384
|
};
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
385
|
+
|
|
386
|
+
VariantManagement.prototype.attachSave = function(mProps, fnCallback, oObj) {
|
|
387
|
+
this.attachEvent("save", mProps, fnCallback, oObj);
|
|
388
|
+
return this;
|
|
559
389
|
};
|
|
560
390
|
|
|
561
|
-
VariantManagement.prototype.
|
|
562
|
-
var
|
|
563
|
-
if (oModel) {
|
|
564
|
-
return oModel.getProperty("/showExecuteOnSelection");
|
|
565
|
-
}
|
|
391
|
+
VariantManagement.prototype.detachSave = function(fnCallback, oObj) {
|
|
392
|
+
var nSaveEntryIdx = this._findCallback(this._aSaveEventHandlers, fnCallback, oObj);
|
|
566
393
|
|
|
567
|
-
|
|
568
|
-
|
|
394
|
+
if (nSaveEntryIdx > -1) {
|
|
395
|
+
this.detachEvent("save", fnCallback, oObj);
|
|
569
396
|
|
|
570
|
-
|
|
571
|
-
var oInnerModel = this.getModel(VariantManagement.INNER_MODEL_NAME);
|
|
572
|
-
if (oInnerModel) {
|
|
573
|
-
oInnerModel.setProperty("/showExecuteOnSelection", bValue);
|
|
397
|
+
this._aSaveEventHandlers.splice(nSaveEntryIdx, 1);
|
|
574
398
|
}
|
|
575
|
-
};
|
|
576
399
|
|
|
577
|
-
|
|
578
|
-
var oModel = this.getModel(this._sModelName);
|
|
579
|
-
if (oModel && this.oContext) {
|
|
580
|
-
oModel.setProperty(this.oContext + "/executeOnSelection", bValue);
|
|
581
|
-
}
|
|
400
|
+
return this;
|
|
582
401
|
};
|
|
583
402
|
|
|
584
|
-
VariantManagement.prototype.
|
|
585
|
-
|
|
586
|
-
if (oModel && this.oContext) {
|
|
587
|
-
return oModel.getProperty(this.oContext + "/originalDefaultVariant");
|
|
588
|
-
}
|
|
589
|
-
return null;
|
|
403
|
+
VariantManagement.prototype._fireSave = function(oEvent) {
|
|
404
|
+
this._handleAllListeners(oEvent, this._aSaveEventHandlers);
|
|
590
405
|
};
|
|
591
406
|
|
|
592
|
-
VariantManagement.prototype.
|
|
593
|
-
var
|
|
594
|
-
if (
|
|
595
|
-
|
|
407
|
+
VariantManagement.prototype.hasListeners = function(sEvent) {
|
|
408
|
+
var aInnerEvents = ["save", "select", "cancel", "manage"];
|
|
409
|
+
if (aInnerEvents.indexOf(sEvent) > -1) {
|
|
410
|
+
var aEventHandler = null;
|
|
411
|
+
|
|
412
|
+
if (sEvent === "select") {
|
|
413
|
+
aEventHandler = this._aSelectEventHandlers;
|
|
414
|
+
} else if (sEvent === "save") {
|
|
415
|
+
aEventHandler = this._aSaveEventHandlers;
|
|
416
|
+
} else if (sEvent === "manage") {
|
|
417
|
+
aEventHandler = this._aManageEventHandlers;
|
|
418
|
+
} else if (sEvent === "cancel") {
|
|
419
|
+
aEventHandler = this._aCancelEventHandlers;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
return (aEventHandler.length > 0);
|
|
596
423
|
}
|
|
424
|
+
return Control.prototype.hasListeners.apply(this, arguments);
|
|
597
425
|
};
|
|
598
426
|
|
|
599
|
-
VariantManagement.prototype.
|
|
600
|
-
var
|
|
601
|
-
|
|
602
|
-
|
|
427
|
+
VariantManagement.prototype.attachEvent = function(sEvent, mProps, fnCallback, oObj) {
|
|
428
|
+
var aInnerEvents = ["save", "select", "cancel", "manage"];
|
|
429
|
+
|
|
430
|
+
if (aInnerEvents.indexOf(sEvent) > -1) {
|
|
431
|
+
var aEventHandler = null;
|
|
432
|
+
var fnFunction = fnCallback;
|
|
433
|
+
if (typeof (mProps) === "function") {
|
|
434
|
+
fnFunction = mProps;
|
|
435
|
+
oObj = fnCallback;
|
|
436
|
+
mProps = undefined;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
oObj = oObj === this ? undefined : oObj;
|
|
440
|
+
|
|
441
|
+
if (sEvent === "select") {
|
|
442
|
+
aEventHandler = this._aSelectEventHandlers;
|
|
443
|
+
} else if (sEvent === "save") {
|
|
444
|
+
aEventHandler = this._aSaveEventHandlers;
|
|
445
|
+
} else if (sEvent === "manage") {
|
|
446
|
+
aEventHandler = this._aManageEventHandlers;
|
|
447
|
+
} else if (sEvent === "cancel") {
|
|
448
|
+
aEventHandler = this._aCancelEventHandlers;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
aEventHandler.push({
|
|
452
|
+
fCallback: fnFunction,
|
|
453
|
+
fCallbackBound: oObj ? fnFunction.bind(oObj) : fnFunction,
|
|
454
|
+
oObj: oObj,
|
|
455
|
+
mProps: mProps
|
|
456
|
+
});
|
|
457
|
+
} else {
|
|
458
|
+
Control.prototype.attachEvent.apply(this, arguments);
|
|
603
459
|
}
|
|
604
|
-
return null;
|
|
605
460
|
};
|
|
606
461
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
462
|
+
VariantManagement.prototype.attachEventOnce = function(sEvent, mPros, fnCallback, oObj) {
|
|
463
|
+
var nIdx;
|
|
464
|
+
if (sEvent === "manage") {
|
|
465
|
+
nIdx = this._findCallback(this._aManageEventHandlers, fnCallback, oObj);
|
|
466
|
+
if ((nIdx > -1) && this._aManageEventHandlers[nIdx].bOnce) {
|
|
467
|
+
this._aManageEventHandlers.splice(nIdx, 1);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
this.attachManage(mPros, fnCallback, oObj);
|
|
471
|
+
nIdx = this._findCallback(this._aManageEventHandlers, fnCallback, oObj);
|
|
472
|
+
if (nIdx > -1) {
|
|
473
|
+
this._aManageEventHandlers[nIdx].bOnce = true;
|
|
474
|
+
}
|
|
475
|
+
} else if (sEvent === "save") {
|
|
476
|
+
nIdx = this._findCallback(this._aSaveEventHandlers, fnCallback, oObj);
|
|
477
|
+
if ((nIdx > -1) && this._aSaveEventHandlers[nIdx].bOnce) {
|
|
478
|
+
this._aSaveEventHandlers.splice(nIdx, 1);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
this.attachSave(mPros, fnCallback, oObj);
|
|
482
|
+
nIdx = this._findCallback(this._aSaveEventHandlers, fnCallback, oObj);
|
|
483
|
+
if (nIdx > -1) {
|
|
484
|
+
this._aSaveEventHandlers[nIdx].bOnce = true;
|
|
485
|
+
}
|
|
486
|
+
} else if (sEvent === "select") {
|
|
487
|
+
nIdx = this._findCallback(this._aSelectEventHandlers, fnCallback, oObj);
|
|
488
|
+
if ((nIdx > -1) && this._aSelectEventHandlers[nIdx].bOnce) {
|
|
489
|
+
this._aSelectEventHandlers.splice(nIdx, 1);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
this.attachSelect(mPros, fnCallback, oObj);
|
|
493
|
+
nIdx = this._findCallback(this._aSelectEventHandlers, fnCallback, oObj);
|
|
494
|
+
if (nIdx > -1) {
|
|
495
|
+
this._aSelectEventHandlers[nIdx].bOnce = true;
|
|
496
|
+
}
|
|
497
|
+
} else {
|
|
498
|
+
Control.prototype.attachEventOnce.apply(this, arguments);
|
|
617
499
|
}
|
|
500
|
+
};
|
|
618
501
|
|
|
502
|
+
VariantManagement.prototype.attachManage = function(mProps, fnCallback, oObj) {
|
|
503
|
+
this.attachEvent("manage", mProps, fnCallback, oObj);
|
|
619
504
|
return this;
|
|
620
505
|
};
|
|
621
506
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
* @returns {string} Key of the currently selected variant. In case the model is not yet set <code>null</code> will be returned.
|
|
626
|
-
*/
|
|
627
|
-
VariantManagement.prototype.getCurrentVariantKey = function() {
|
|
628
|
-
var oModel = this.getModel(this._sModelName);
|
|
629
|
-
if (oModel && this.oContext) {
|
|
630
|
-
return oModel.getProperty(this.oContext + "/currentVariant");
|
|
631
|
-
}
|
|
507
|
+
VariantManagement.prototype._handleAllListeners = function(oEvent, aEventHandler) {
|
|
508
|
+
var i = 0;
|
|
509
|
+
var aOnlyOnce = [];
|
|
632
510
|
|
|
633
|
-
|
|
634
|
-
|
|
511
|
+
while (i < aEventHandler.length) {
|
|
512
|
+
oEvent.oSource = this;
|
|
513
|
+
aEventHandler[i].fCallbackBound(oEvent, aEventHandler[i].mProps);
|
|
635
514
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
var oModel = this.getModel(this._sModelName);
|
|
643
|
-
if (oModel && this.oContext) {
|
|
644
|
-
sTitle = oModel.getProperty(this.oContext + "/popoverTitle");
|
|
515
|
+
if (aEventHandler[i]) {
|
|
516
|
+
if (aEventHandler[i].hasOwnProperty("bOnce") && aEventHandler[i].bOnce) {
|
|
517
|
+
aOnlyOnce.push(i);
|
|
518
|
+
}
|
|
519
|
+
i += 1;
|
|
520
|
+
}
|
|
645
521
|
}
|
|
646
522
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
if (oInnerModel) {
|
|
650
|
-
oInnerModel.setProperty("/popoverTitle", sTitle);
|
|
651
|
-
}
|
|
523
|
+
for (i = aOnlyOnce.length - 1; i > -1; i--) {
|
|
524
|
+
aEventHandler.splice(aOnlyOnce[i], 1);
|
|
652
525
|
}
|
|
653
526
|
};
|
|
654
527
|
|
|
655
|
-
/**
|
|
656
|
-
* Retrieves all variants.
|
|
657
|
-
* @public
|
|
658
|
-
* @returns {array} All variants. In case the model is not yet set, an empty array will be returned.
|
|
659
|
-
*/
|
|
660
|
-
VariantManagement.prototype.getVariants = function() {
|
|
661
|
-
return this._getItems();
|
|
662
|
-
};
|
|
663
528
|
|
|
664
|
-
VariantManagement.prototype.
|
|
665
|
-
|
|
666
|
-
if (oModel && this.oContext) {
|
|
667
|
-
oModel.setProperty(this.oContext + "/modified", bFlag);
|
|
668
|
-
}
|
|
529
|
+
VariantManagement.prototype._fireManage = function(oEvent) {
|
|
530
|
+
this._handleAllListeners(oEvent, this._aManageEventHandlers);
|
|
669
531
|
};
|
|
670
532
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
* @public
|
|
674
|
-
* @returns {boolean} If the current variant is modified <code>true</code>, otherwise <code>false</code>
|
|
675
|
-
*/
|
|
676
|
-
VariantManagement.prototype.getModified = function() {
|
|
677
|
-
var oModel = this.getModel(this._sModelName);
|
|
678
|
-
if (oModel && this.oContext) {
|
|
679
|
-
return oModel.getProperty(this.oContext + "/modified");
|
|
680
|
-
}
|
|
681
|
-
return false;
|
|
682
|
-
};
|
|
533
|
+
VariantManagement.prototype.detachManage = function(fnCallback, oObj) {
|
|
534
|
+
var nManageEntryIdx = this._findCallback(this._aManageEventHandlers, fnCallback, oObj);
|
|
683
535
|
|
|
684
|
-
|
|
685
|
-
|
|
536
|
+
if (nManageEntryIdx > -1) {
|
|
537
|
+
this.detachEvent("manage", fnCallback, oObj);
|
|
686
538
|
|
|
687
|
-
|
|
688
|
-
return oItem.title;
|
|
539
|
+
this._aManageEventHandlers.splice(nManageEntryIdx, 1);
|
|
689
540
|
}
|
|
690
541
|
|
|
691
|
-
return
|
|
542
|
+
return this;
|
|
692
543
|
};
|
|
693
544
|
|
|
694
|
-
VariantManagement.prototype.
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}
|
|
545
|
+
VariantManagement.prototype.attachSelect = function(mProps, fnCallback, oObj) {
|
|
546
|
+
this.attachEvent("select", mProps, fnCallback, oObj);
|
|
547
|
+
return this;
|
|
548
|
+
};
|
|
699
549
|
|
|
700
|
-
|
|
550
|
+
VariantManagement.prototype._fireSelect = function(oEvent) {
|
|
551
|
+
this._handleAllListeners(oEvent, this._aSelectEventHandlers);
|
|
701
552
|
};
|
|
702
553
|
|
|
703
|
-
VariantManagement.prototype.
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
|
|
554
|
+
VariantManagement.prototype.detachSelect = function(fnCallback, oObj) {
|
|
555
|
+
var nSelectEntryIdx = this._findCallback(this._aSelectEventHandlers, fnCallback, oObj);
|
|
556
|
+
|
|
557
|
+
if (nSelectEntryIdx > -1) {
|
|
558
|
+
this.detachEvent("select", fnCallback, oObj);
|
|
559
|
+
|
|
560
|
+
this._aSelectEventHandlers.splice(nSelectEntryIdx, 1);
|
|
707
561
|
}
|
|
708
|
-
|
|
562
|
+
|
|
563
|
+
return this;
|
|
709
564
|
};
|
|
565
|
+
/// </EVENT FORWARDING>
|
|
710
566
|
|
|
711
|
-
|
|
712
|
-
|
|
567
|
+
|
|
568
|
+
///<OVERWRITES>
|
|
569
|
+
|
|
570
|
+
VariantManagement.prototype.onclick = function(oEvent) {
|
|
571
|
+
this._oVM.onclick(oEvent);
|
|
572
|
+
};
|
|
573
|
+
VariantManagement.prototype._createSaveAsDialog = function() {
|
|
574
|
+
this._oVM._createSaveAsDialog();
|
|
575
|
+
};
|
|
576
|
+
VariantManagement.prototype._handleVariantSaveAs = function(sNewVariantName) {
|
|
577
|
+
this._oVM._handleVariantSaveAs(sNewVariantName);
|
|
713
578
|
};
|
|
579
|
+
VariantManagement.prototype.getFocusDomRef = function() {
|
|
580
|
+
if (this._oVM) {
|
|
581
|
+
return this._oVM.oVariantPopoverTrigger.getFocusDomRef();
|
|
582
|
+
}
|
|
714
583
|
|
|
715
|
-
|
|
716
|
-
this._aDeletedItems.push(oItem);
|
|
584
|
+
return null;
|
|
717
585
|
};
|
|
718
586
|
|
|
719
|
-
VariantManagement.prototype.
|
|
720
|
-
|
|
587
|
+
VariantManagement.prototype.getManageDialog = function() {
|
|
588
|
+
if (this._oVM) {
|
|
589
|
+
return this._oVM.oManagementDialog;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return null;
|
|
721
593
|
};
|
|
722
594
|
|
|
723
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Retrieves all variants.
|
|
597
|
+
* @public
|
|
598
|
+
* @returns {array} All variants. In case the model is not yet set, an empty array will be returned.
|
|
599
|
+
*/
|
|
600
|
+
VariantManagement.prototype.getVariants = function() {
|
|
724
601
|
var aItems = [];
|
|
725
602
|
if (this.oContext && this.oContext.getObject()) {
|
|
726
603
|
aItems = this.oContext.getObject().variants.filter(function(oItem) {
|
|
@@ -735,1739 +612,341 @@ sap.ui.define([
|
|
|
735
612
|
return aItems;
|
|
736
613
|
};
|
|
737
614
|
|
|
738
|
-
VariantManagement.prototype.
|
|
739
|
-
|
|
740
|
-
var aItems = this._getItems();
|
|
741
|
-
aItems.some(function(oEntry) {
|
|
742
|
-
if (oEntry.key === sKey) {
|
|
743
|
-
oItem = oEntry;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
return (oItem !== null);
|
|
747
|
-
});
|
|
748
|
-
|
|
749
|
-
return oItem;
|
|
615
|
+
VariantManagement.prototype.getTitle = function() {
|
|
616
|
+
return this._oVM.getTitle();
|
|
750
617
|
};
|
|
751
618
|
|
|
752
|
-
VariantManagement.prototype.
|
|
753
|
-
this.
|
|
754
|
-
this
|
|
755
|
-
|
|
756
|
-
model: this._sModelName,
|
|
757
|
-
formatter: function(sKey) {
|
|
758
|
-
var sText = "";
|
|
759
|
-
if (sKey) {
|
|
760
|
-
sText = this.getSelectedVariantText(sKey);
|
|
761
|
-
this._setInvisibleText(sText, this.getModified());
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return sText;
|
|
765
|
-
}.bind(this)
|
|
766
|
-
});
|
|
767
|
-
|
|
768
|
-
this.oVariantModifiedText.unbindProperty("visible");
|
|
769
|
-
this.oVariantModifiedText.bindProperty("visible", {
|
|
770
|
-
path: "modified",
|
|
771
|
-
model: this._sModelName,
|
|
772
|
-
formatter: function(bValue) {
|
|
773
|
-
var sKey = this.getCurrentVariantKey();
|
|
619
|
+
VariantManagement.prototype.setPopoverTitle = function(sTitle) {
|
|
620
|
+
this._oVM.setPopoverTitle(sTitle);
|
|
621
|
+
return this;
|
|
622
|
+
};
|
|
774
623
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
624
|
+
VariantManagement.prototype.setHeaderLevel = function(sValue) {
|
|
625
|
+
this.setProperty("headerLevel", sValue);
|
|
626
|
+
this._oVM.setLevel(sValue);
|
|
627
|
+
return this;
|
|
628
|
+
};
|
|
778
629
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
630
|
+
VariantManagement.prototype.setEditable = function(bValue) {
|
|
631
|
+
this.setProperty("editable", bValue);
|
|
632
|
+
this._oVM.setShowFooter(bValue);
|
|
633
|
+
return this;
|
|
782
634
|
};
|
|
783
635
|
|
|
784
|
-
VariantManagement.prototype.
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
636
|
+
VariantManagement.prototype.setShowExecuteOnSelection = function(bValue) {
|
|
637
|
+
this.setProperty("showExecuteOnSelection", bValue);
|
|
638
|
+
this._oVM.setSupportApplyAutomatically(bValue);
|
|
639
|
+
return this;
|
|
640
|
+
};
|
|
788
641
|
|
|
789
|
-
this.setProperty("modelName", sValue);
|
|
790
642
|
|
|
791
|
-
|
|
643
|
+
VariantManagement.prototype.setShowSetAsDefault = function(bValue) {
|
|
644
|
+
this.setProperty("showSetAsDefault", bValue);
|
|
645
|
+
this._oVM.setSupportDefault(bValue);
|
|
646
|
+
return this;
|
|
647
|
+
};
|
|
792
648
|
|
|
793
|
-
|
|
649
|
+
VariantManagement.prototype.setExecuteOnSelectionForStandardDefault = function(bValue) {
|
|
650
|
+
this.setProperty("executeOnSelectionForStandardDefault", bValue);
|
|
651
|
+
this._oVM.setExecuteOnSelectionForStandardDefault(bValue);
|
|
652
|
+
return this;
|
|
653
|
+
};
|
|
794
654
|
|
|
655
|
+
VariantManagement.prototype.setDisplayTextForExecuteOnSelectionForStandardVariant = function(sValue) {
|
|
656
|
+
this.setProperty("displayTextForExecuteOnSelectionForStandardVariant", sValue);
|
|
657
|
+
this._oVM.setDisplayTextForExecuteOnSelectionForStandardVariant(sValue);
|
|
795
658
|
return this;
|
|
796
659
|
};
|
|
797
660
|
|
|
798
|
-
VariantManagement.prototype.
|
|
799
|
-
|
|
800
|
-
|
|
661
|
+
VariantManagement.prototype.setManualVariantKey = function(bValue) {
|
|
662
|
+
this.setProperty("manualVariantKey", bValue);
|
|
663
|
+
this._oVM._setShowManualVariantKey(bValue);
|
|
664
|
+
return this;
|
|
665
|
+
};
|
|
801
666
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
this.oContext = new Context(oModel, "/" + sLocalId);
|
|
808
|
-
this.setBindingContext(this.oContext, this._sModelName);
|
|
667
|
+
VariantManagement.prototype.setInErrorState = function(bValue) {
|
|
668
|
+
this.setProperty("inErrorState", bValue);
|
|
669
|
+
this._oVM.setInErrorState(bValue);
|
|
670
|
+
return this;
|
|
671
|
+
};
|
|
809
672
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
673
|
+
VariantManagement.prototype.openManagementDialog = function(bCreateAlways, sClass, oRolesComponentContainer) {
|
|
674
|
+
this._oVM.openManagementDialog(bCreateAlways, sClass, oRolesComponentContainer);
|
|
675
|
+
};
|
|
813
676
|
|
|
814
|
-
this._assignPopoverTitle();
|
|
815
677
|
|
|
816
|
-
|
|
678
|
+
VariantManagement.prototype.openSaveAsDialogForKeyUser = function(sClass, oRolesComponentContainer) {
|
|
679
|
+
this._oVM.openSaveAsDialog(sClass, oRolesComponentContainer);
|
|
680
|
+
};
|
|
817
681
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
682
|
+
VariantManagement.prototype.setEditable = function(bValue) {
|
|
683
|
+
this._oVM.setProperty("showFooter", bValue);
|
|
684
|
+
return this;
|
|
822
685
|
};
|
|
823
686
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
687
|
+
/**
|
|
688
|
+
* Sets the new selected variant.
|
|
689
|
+
* @public
|
|
690
|
+
* @param {string} sKey - Key of the variant that should be selected.
|
|
691
|
+
*/
|
|
692
|
+
VariantManagement.prototype.setCurrentVariantKey = function(sKey) {
|
|
693
|
+
this._oVM.setSelectedKey(sKey);
|
|
829
694
|
};
|
|
830
695
|
|
|
831
|
-
|
|
832
|
-
|
|
696
|
+
/**
|
|
697
|
+
* Gets the currently selected variant key.
|
|
698
|
+
* @public
|
|
699
|
+
* @returns {string} Key of the currently selected variant. In case the model is not yet set <code>null</code> will be returned.
|
|
700
|
+
*/
|
|
701
|
+
VariantManagement.prototype.getCurrentVariantKey = function() {
|
|
702
|
+
return this._oVM.getSelectedKey();
|
|
833
703
|
};
|
|
834
704
|
|
|
835
|
-
VariantManagement.prototype.
|
|
836
|
-
|
|
837
|
-
oBinding.attachChange(function(oData) {
|
|
838
|
-
if (oData && oData.oSource && oData.oSource.oModel && oData.oSource.sPath) {
|
|
839
|
-
var bFlag = oData.oSource.oModel.getProperty(oData.oSource.sPath);
|
|
840
|
-
if (bFlag !== undefined) {
|
|
841
|
-
this._setShowExecuteOnSelection(bFlag);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}.bind(this));
|
|
845
|
-
|
|
846
|
-
oBinding = new PropertyBinding(oModel, this.oContext + "/variantsEditable");
|
|
847
|
-
oBinding.attachChange(function(oData) {
|
|
848
|
-
if (oData && oData.oSource && oData.oSource.oModel && oData.oSource.sPath) {
|
|
849
|
-
var oInnerModel;
|
|
850
|
-
var bFlag = oData.oSource.oModel.getProperty(oData.oSource.sPath);
|
|
851
|
-
oInnerModel = this.getModel(VariantManagement.INNER_MODEL_NAME);
|
|
852
|
-
if (oInnerModel && (bFlag !== undefined)) {
|
|
853
|
-
oInnerModel.setProperty("/editable", bFlag);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}.bind(this));
|
|
705
|
+
VariantManagement.prototype.setDefaultVariantKey = function(sKey) {
|
|
706
|
+
this._oVM.setDefaultKey(sKey);
|
|
857
707
|
};
|
|
858
708
|
|
|
709
|
+
VariantManagement.prototype.getDefaultVariantKey = function() {
|
|
710
|
+
return this._oVM.getDefaultKey();
|
|
711
|
+
};
|
|
859
712
|
|
|
860
|
-
VariantManagement.prototype.
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}
|
|
867
|
-
return sap.ui.getCore().byId(sId);
|
|
868
|
-
}
|
|
713
|
+
VariantManagement.prototype.getModified = function() {
|
|
714
|
+
return this._oVM.getModified();
|
|
715
|
+
};
|
|
716
|
+
VariantManagement.prototype.setModified = function(bFlag) {
|
|
717
|
+
this._oVM.setModified(bFlag);
|
|
718
|
+
};
|
|
869
719
|
|
|
870
|
-
|
|
720
|
+
VariantManagement.prototype.getStandardVariantKey = function() {
|
|
721
|
+
return this._oVM.getStandardVariantKey();
|
|
871
722
|
};
|
|
723
|
+
/// </OVERWRITES>
|
|
872
724
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
if (!this.bPopoverOpen) {
|
|
876
|
-
this._oCtrlRef = this._obtainControl(oEvent);
|
|
877
|
-
this._openVariantList();
|
|
878
|
-
} else if (this.oVariantPopOver && this.oVariantPopOver.isOpen()) {
|
|
879
|
-
this.oVariantPopOver.close();
|
|
880
|
-
} else if (this.getInErrorState() && this.oErrorVariantPopOver && this.oErrorVariantPopOver.isOpen()) {
|
|
881
|
-
this.oErrorVariantPopOver.close();
|
|
882
|
-
}
|
|
725
|
+
VariantManagement.prototype._getEmbeddedVM = function() {
|
|
726
|
+
return this._oVM;
|
|
883
727
|
};
|
|
884
728
|
|
|
885
|
-
VariantManagement.prototype.
|
|
886
|
-
|
|
729
|
+
VariantManagement.prototype._updateWithSettingsInfo = function() {
|
|
730
|
+
flSettings.getInstance().then(function (oSettings) {
|
|
731
|
+
if (this._oVM) {
|
|
732
|
+
this._oVM.setShowSaveAs(oSettings.isVariantPersonalizationEnabled());
|
|
733
|
+
this._oVM.setSupportPublic(oSettings.isPublicFlVariantEnabled());
|
|
734
|
+
}
|
|
735
|
+
}.bind(this)).catch(function(oEx) {
|
|
736
|
+
Log.error(oEx);
|
|
737
|
+
});
|
|
887
738
|
};
|
|
888
739
|
|
|
889
|
-
VariantManagement.prototype.
|
|
890
|
-
|
|
891
|
-
this.oVariantPopoverTrigger.focus();
|
|
892
|
-
}
|
|
893
|
-
this.handleOpenCloseVariantPopover(oEvent);
|
|
740
|
+
VariantManagement.prototype.getModelName = function() {
|
|
741
|
+
return this.getProperty("modelName");
|
|
894
742
|
};
|
|
895
743
|
|
|
896
|
-
VariantManagement.prototype.
|
|
897
|
-
if (
|
|
898
|
-
this.
|
|
899
|
-
this.
|
|
744
|
+
VariantManagement.prototype.setModelName = function(sModelName) {
|
|
745
|
+
if (this.getModelName()) {
|
|
746
|
+
this.oContext = null;
|
|
747
|
+
this._aCancelEventHandlers = [];
|
|
748
|
+
this._aSaveEventHandlers = [];
|
|
749
|
+
this._aManageEventHandlers = [];
|
|
750
|
+
this._aSelectEventHandlers = [];
|
|
900
751
|
}
|
|
752
|
+
this.setProperty("modelName", sModelName);
|
|
753
|
+
|
|
754
|
+
return this;
|
|
901
755
|
};
|
|
902
756
|
|
|
903
|
-
VariantManagement.prototype.
|
|
904
|
-
this.
|
|
905
|
-
this.oVariantPopoverTrigger.addStyleClass("sapUiFlVarMngmtTriggerBtnHover");
|
|
906
|
-
}.bind(this));
|
|
907
|
-
this.oVariantText.$().off("mouseout").on("mouseout", function() {
|
|
908
|
-
this.oVariantPopoverTrigger.removeStyleClass("sapUiFlVarMngmtTriggerBtnHover");
|
|
909
|
-
}.bind(this));
|
|
757
|
+
VariantManagement.prototype._setModel = function() {
|
|
758
|
+
this._setBindingContext();
|
|
910
759
|
};
|
|
911
760
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
var
|
|
915
|
-
|
|
916
|
-
if (!this.oErrorVariantPopOver) {
|
|
917
|
-
oVBox = new VBox({
|
|
918
|
-
fitContainer: true,
|
|
919
|
-
alignItems: sap.m.FlexAlignItems.Center,
|
|
920
|
-
items: [
|
|
921
|
-
new Icon({
|
|
922
|
-
size: "4rem",
|
|
923
|
-
color: "lightgray",
|
|
924
|
-
src: "sap-icon://message-error"
|
|
925
|
-
}), new Title({
|
|
926
|
-
titleStyle: sap.ui.core.TitleLevel.H2,
|
|
927
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_ERROR_TEXT1")
|
|
928
|
-
}), new Text({
|
|
929
|
-
textAlign: sap.ui.core.TextAlign.Center,
|
|
930
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_ERROR_TEXT2")
|
|
931
|
-
})
|
|
932
|
-
]
|
|
933
|
-
});
|
|
761
|
+
VariantManagement.prototype._setBindingContext = function() {
|
|
762
|
+
var oModel;
|
|
763
|
+
var sLocalId;
|
|
934
764
|
|
|
935
|
-
|
|
765
|
+
var sModelName = this.getModelName();
|
|
936
766
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
showNavButton: false,
|
|
948
|
-
showHeader: false,
|
|
949
|
-
content: [
|
|
950
|
-
oVBox
|
|
951
|
-
]
|
|
952
|
-
})
|
|
953
|
-
],
|
|
954
|
-
afterOpen: function() {
|
|
955
|
-
this.bPopoverOpen = true;
|
|
956
|
-
}.bind(this),
|
|
957
|
-
afterClose: function() {
|
|
958
|
-
if (this.bPopoverOpen) {
|
|
959
|
-
setTimeout(function() {
|
|
960
|
-
this.bPopoverOpen = false;
|
|
961
|
-
}.bind(this), 200);
|
|
767
|
+
if (!this.oContext) {
|
|
768
|
+
oModel = this.getModel(sModelName);
|
|
769
|
+
if (oModel) {
|
|
770
|
+
sLocalId = this._getLocalId(oModel);
|
|
771
|
+
if (sLocalId) {
|
|
772
|
+
this.oContext = new Context(oModel, "/" + sLocalId);
|
|
773
|
+
this.setBindingContext(this.oContext, sModelName);
|
|
774
|
+
|
|
775
|
+
if (oModel.registerToModel) { // Relevant for key user adaptation
|
|
776
|
+
oModel.registerToModel(this);
|
|
962
777
|
}
|
|
963
|
-
}.bind(this),
|
|
964
|
-
contentHeight: "300px"
|
|
965
|
-
});
|
|
966
778
|
|
|
967
|
-
|
|
968
|
-
if (e.which === 32) { // UP
|
|
969
|
-
this.oErrorVariantPopOver.close();
|
|
970
|
-
}
|
|
971
|
-
}.bind(this));
|
|
972
|
-
}
|
|
779
|
+
this.fireInitialized();
|
|
973
780
|
|
|
974
|
-
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
781
|
+
this._oVM.setModel(oModel, sModelName);
|
|
977
782
|
|
|
978
|
-
|
|
979
|
-
};
|
|
783
|
+
this._oVM.setSupportDefault(true);
|
|
980
784
|
|
|
981
|
-
// My Views List
|
|
982
|
-
VariantManagement.prototype._createVariantList = function() {
|
|
983
|
-
if (this.oVariantPopOver) {
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
785
|
|
|
987
|
-
|
|
988
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_MANAGE"),
|
|
989
|
-
enabled: true,
|
|
990
|
-
press: function() {
|
|
991
|
-
this._openManagementDialog();
|
|
992
|
-
}.bind(this),
|
|
993
|
-
layoutData: new OverflowToolbarLayoutData({
|
|
994
|
-
priority: OverflowToolbarPriority.Low
|
|
995
|
-
})
|
|
996
|
-
});
|
|
786
|
+
this._createItemsModel(sModelName);
|
|
997
787
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}.bind(this),
|
|
1003
|
-
visible: {
|
|
1004
|
-
path: "modified",
|
|
1005
|
-
model: this._sModelName,
|
|
1006
|
-
formatter: function(bValue) {
|
|
1007
|
-
return bValue;
|
|
1008
|
-
}
|
|
1009
|
-
},
|
|
1010
|
-
type: ButtonType.Emphasized,
|
|
1011
|
-
layoutData: new OverflowToolbarLayoutData({
|
|
1012
|
-
priority: OverflowToolbarPriority.Low
|
|
1013
|
-
})
|
|
1014
|
-
});
|
|
788
|
+
this._oVM.bindProperty("selectedKey", {
|
|
789
|
+
path: this.oContext + "/currentVariant",
|
|
790
|
+
model: sModelName
|
|
791
|
+
});
|
|
1015
792
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
}.bind(this),
|
|
1021
|
-
layoutData: new OverflowToolbarLayoutData({
|
|
1022
|
-
priority: OverflowToolbarPriority.Low
|
|
1023
|
-
}),
|
|
1024
|
-
visible: {
|
|
1025
|
-
path: "/showSaveAs",
|
|
1026
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1027
|
-
}
|
|
1028
|
-
});
|
|
793
|
+
this._oVM.bindProperty("defaultKey", {
|
|
794
|
+
path: this.oContext + "/defaultVariant",
|
|
795
|
+
model: sModelName
|
|
796
|
+
});
|
|
1029
797
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
},
|
|
1035
|
-
itemPress: function(oEvent) {
|
|
1036
|
-
var sSelectionKey = null;
|
|
1037
|
-
if (oEvent && oEvent.getParameters()) {
|
|
1038
|
-
var oItemPressed = oEvent.getParameters().item;
|
|
1039
|
-
if (oItemPressed) {
|
|
1040
|
-
sSelectionKey = oItemPressed.getKey();
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
if (sSelectionKey) {
|
|
1044
|
-
// this.setModified(false);
|
|
1045
|
-
this.setCurrentVariantKey(sSelectionKey);
|
|
798
|
+
this._oVM.bindProperty("modified", {
|
|
799
|
+
path: this.oContext + "/modified",
|
|
800
|
+
model: sModelName
|
|
801
|
+
});
|
|
1046
802
|
|
|
1047
|
-
this.
|
|
1048
|
-
|
|
803
|
+
this._oVM.bindProperty("supportFavorites", {
|
|
804
|
+
path: this.oContext + "/showFavorites",
|
|
805
|
+
model: sModelName
|
|
1049
806
|
});
|
|
1050
|
-
this.oVariantPopOver.close();
|
|
1051
|
-
}
|
|
1052
|
-
}.bind(this)
|
|
1053
|
-
});
|
|
1054
|
-
this._oVariantList.setNoDataText(this._oRb.getText("VARIANT_MANAGEMENT_NODATA"));
|
|
1055
807
|
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
808
|
+
this._oVM.bindProperty("supportApplyAutomatically", {
|
|
809
|
+
path: this.oContext + "/showExecuteOnSelection",
|
|
810
|
+
model: sModelName
|
|
811
|
+
});
|
|
1060
812
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
});
|
|
813
|
+
this._oVM.bindProperty("showFooter", {
|
|
814
|
+
path: this.oContext + "/variantsEditable",
|
|
815
|
+
model: sModelName
|
|
816
|
+
});
|
|
1066
817
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
this._triggerSearch(oEvent, this._oVariantList);
|
|
1070
|
-
}.bind(this));
|
|
1071
|
-
|
|
1072
|
-
this.oVariantSelectionPage = new Page(this.getId() + "-selpage", {
|
|
1073
|
-
subHeader: new Toolbar({
|
|
1074
|
-
content: [
|
|
1075
|
-
this._oSearchField
|
|
1076
|
-
]
|
|
1077
|
-
}),
|
|
1078
|
-
content: [
|
|
1079
|
-
this._oVariantList
|
|
1080
|
-
],
|
|
1081
|
-
footer: new OverflowToolbar({
|
|
1082
|
-
content: [
|
|
1083
|
-
new ToolbarSpacer(this.getId() + "-spacer"), this.oVariantSaveBtn, this.oVariantSaveAsBtn, this.oVariantManageBtn
|
|
1084
|
-
]
|
|
1085
|
-
}),
|
|
1086
|
-
showNavButton: false,
|
|
1087
|
-
showHeader: false,
|
|
1088
|
-
showFooter: {
|
|
1089
|
-
path: "/editable",
|
|
1090
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
818
|
+
this._oVM.setPopoverTitle(this._oRb.getText("VARIANT_MANAGEMENT_VARIANTS"));
|
|
819
|
+
}
|
|
1091
820
|
}
|
|
1092
|
-
}
|
|
821
|
+
}
|
|
822
|
+
};
|
|
1093
823
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
},
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
if (this.bPopoverOpen) {
|
|
1112
|
-
setTimeout(function() {
|
|
1113
|
-
this.bPopoverOpen = false;
|
|
1114
|
-
}.bind(this), 200);
|
|
1115
|
-
}
|
|
1116
|
-
}.bind(this),
|
|
1117
|
-
contentHeight: "300px"
|
|
824
|
+
VariantManagement.prototype._createItemsModel = function(sModelName) {
|
|
825
|
+
var oItemsTemplate = new VariantItem({
|
|
826
|
+
key: "{" + sModelName + ">key}",
|
|
827
|
+
title: "{" + sModelName + ">title}",
|
|
828
|
+
sharing: "{" + sModelName + ">sharing}",
|
|
829
|
+
remove: "{" + sModelName + ">remove}",
|
|
830
|
+
favorite: "{" + sModelName + ">favorite}",
|
|
831
|
+
originalFavorite: "{" + sModelName + ">originalFavorite}",
|
|
832
|
+
executeOnSelect: "{" + sModelName + ">executeOnSelect}",
|
|
833
|
+
originalExecuteOnSelect: "{" + sModelName + ">originalExecuteOnSelect}",
|
|
834
|
+
rename: "{" + sModelName + ">rename}",
|
|
835
|
+
originalTitle: "{" + sModelName + ">originalTitle}",
|
|
836
|
+
visible: "{" + sModelName + ">visible}",
|
|
837
|
+
changeable: "{" + sModelName + ">change}",
|
|
838
|
+
author: "{" + sModelName + ">author}",
|
|
839
|
+
contexts: "{" + sModelName + ">contexts}",
|
|
840
|
+
originalContexts: "{" + sModelName + ">originalContexts}"
|
|
1118
841
|
});
|
|
1119
842
|
|
|
1120
|
-
this.oVariantPopOver.addStyleClass("sapUiFlVarMngmtPopover");
|
|
1121
|
-
if (this.oVariantLayout.$().closest(".sapUiSizeCompact").length > 0) {
|
|
1122
|
-
this.oVariantPopOver.addStyleClass("sapUiSizeCompact");
|
|
1123
|
-
}
|
|
1124
|
-
this.addDependent(this.oVariantPopOver);
|
|
1125
843
|
|
|
1126
|
-
|
|
844
|
+
this._oVM.bindAggregation("items", {
|
|
845
|
+
path: this.oContext + "/variants",
|
|
846
|
+
model: sModelName,
|
|
847
|
+
template: oItemsTemplate
|
|
848
|
+
});
|
|
1127
849
|
};
|
|
1128
850
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
*/
|
|
1134
|
-
VariantManagement.prototype.showSaveButton = function(bShow) {
|
|
1135
|
-
if (bShow === false) {
|
|
1136
|
-
this.oVariantSaveAsBtn.setType(ButtonType.Emphasized);
|
|
1137
|
-
this.oVariantSaveBtn.setVisible(false);
|
|
1138
|
-
} else {
|
|
1139
|
-
this.oVariantSaveAsBtn.setType(ButtonType.Default);
|
|
1140
|
-
this.oVariantSaveBtn.setVisible(true);
|
|
851
|
+
VariantManagement.prototype._getLocalId = function(oModel) {
|
|
852
|
+
var sModelName = this.getModelName();
|
|
853
|
+
if (!sModelName) {
|
|
854
|
+
return null;
|
|
1141
855
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
VariantManagement.prototype._openVariantList = function() {
|
|
1145
|
-
var oItem;
|
|
1146
|
-
|
|
1147
|
-
if (this.getInErrorState()) {
|
|
1148
|
-
this._openInErrorState();
|
|
1149
|
-
return;
|
|
856
|
+
if (sModelName !== flUtils.VARIANT_MODEL_NAME) {
|
|
857
|
+
return this.getId();
|
|
1150
858
|
}
|
|
1151
859
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
}
|
|
860
|
+
return oModel.getVariantManagementReferenceForControl(this);
|
|
861
|
+
};
|
|
1155
862
|
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
863
|
+
VariantManagement.prototype._getInnerItems = function() {
|
|
864
|
+
var aItems = [];
|
|
865
|
+
if (this.oContext && this.oContext.getObject()) {
|
|
866
|
+
aItems = this.oContext.getObject().variants.filter(function(oItem) {
|
|
867
|
+
if (!oItem.hasOwnProperty("visible")) {
|
|
868
|
+
return true;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
return oItem.visible;
|
|
872
|
+
});
|
|
1159
873
|
}
|
|
1160
874
|
|
|
1161
|
-
|
|
1162
|
-
|
|
875
|
+
return aItems;
|
|
876
|
+
};
|
|
1163
877
|
|
|
1164
|
-
|
|
878
|
+
VariantManagement.prototype._getInnerItemByKey = function(sKey) {
|
|
879
|
+
var oItem = null;
|
|
880
|
+
var aItems = this._getInnerItems();
|
|
881
|
+
aItems.some(function(oEntry) {
|
|
882
|
+
if (oEntry.key === sKey) {
|
|
883
|
+
oItem = oEntry;
|
|
884
|
+
}
|
|
1165
885
|
|
|
1166
|
-
|
|
886
|
+
return (oItem !== null);
|
|
887
|
+
});
|
|
1167
888
|
|
|
1168
|
-
|
|
889
|
+
return oItem;
|
|
890
|
+
};
|
|
1169
891
|
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
892
|
+
/**
|
|
893
|
+
* Registration of a callback function. The provided callback function is executed to check if apply automatically on standard variant should be considered.
|
|
894
|
+
* @private
|
|
895
|
+
* @ui5-restricted sap.fe
|
|
896
|
+
* @since 1.103
|
|
897
|
+
* @param {function} fCallBack Called when standard variant must be applied. It determines if apply automatically on standard variant should be considered.
|
|
898
|
+
* As a convenience the current variant will be passed to the callback. This variant instance may not be changed in any ways. It is only intended to provide certain variant information.
|
|
899
|
+
* @returns {this} Reference to this in order to allow method chaining.
|
|
900
|
+
*/
|
|
901
|
+
VariantManagement.prototype.registerApplyAutomaticallyOnStandardVariant = function(fCallBack) {
|
|
902
|
+
this._fRegisteredApplyAutomaticallyOnStandardVariant = fCallBack;
|
|
1176
903
|
|
|
1177
|
-
|
|
1178
|
-
this._oCtrlRef = null;
|
|
1179
|
-
this.oVariantPopOver.openBy(oControlRef);
|
|
904
|
+
return this;
|
|
1180
905
|
};
|
|
1181
906
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
907
|
+
/**
|
|
908
|
+
* Retrieves the apply automatically state for a variant.
|
|
909
|
+
* @private
|
|
910
|
+
* @ui5-restricted sap.mdc
|
|
911
|
+
* @param {object} oVariant the fl-variant object
|
|
912
|
+
* @returns {boolean} apply automatically state
|
|
913
|
+
*/
|
|
914
|
+
VariantManagement.prototype.getApplyAutomaticallyOnVariant = function(oVariant) {
|
|
915
|
+
var bExecuteOnSelection = false;
|
|
916
|
+
if (oVariant) {
|
|
917
|
+
bExecuteOnSelection = oVariant.executeOnSelect;
|
|
1186
918
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
919
|
+
if (this._fRegisteredApplyAutomaticallyOnStandardVariant && this.getDisplayTextForExecuteOnSelectionForStandardVariant() && (oVariant.key === this._oVM.getStandardVariantKey())) {
|
|
920
|
+
try {
|
|
921
|
+
bExecuteOnSelection = this._fRegisteredApplyAutomaticallyOnStandardVariant(oVariant);
|
|
922
|
+
} catch (ex) {
|
|
923
|
+
Log.error("callback for determination of apply automatically on standard variant failed");
|
|
924
|
+
}
|
|
925
|
+
}
|
|
1190
926
|
}
|
|
1191
927
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
var oFilter = new Filter({
|
|
1195
|
-
path: "title",
|
|
1196
|
-
operator: FilterOperator.Contains,
|
|
1197
|
-
value1: sValue
|
|
1198
|
-
});
|
|
1199
|
-
|
|
1200
|
-
oVariantList.getBinding("items").filter(this._getFilters(oFilter));
|
|
928
|
+
return bExecuteOnSelection;
|
|
1201
929
|
};
|
|
1202
930
|
|
|
1203
|
-
// Save View dialog
|
|
1204
931
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
});
|
|
932
|
+
// exit destroy all controls created in init
|
|
933
|
+
VariantManagement.prototype.exit = function() {
|
|
934
|
+
this._oVM.detachManage(this._fireManage, this);
|
|
935
|
+
this._oVM.detachCancel(this._fireCancel, this);
|
|
936
|
+
this._oVM.detachSelect(this._fireSelect, this);
|
|
937
|
+
this._oVM.detachSave(this._fireSave, this);
|
|
1212
938
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
});
|
|
1216
|
-
oLabelName.setLabelFor(this.oInputName);
|
|
1217
|
-
oLabelName.addStyleClass("sapUiFlVarMngmtSaveDialogLabel");
|
|
1218
|
-
|
|
1219
|
-
this.oDefault = new CheckBox(this.getId() + "-default", {
|
|
1220
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_SETASDEFAULT"),
|
|
1221
|
-
visible: {
|
|
1222
|
-
path: "/showSetAsDefault",
|
|
1223
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1224
|
-
},
|
|
1225
|
-
width: "100%"
|
|
1226
|
-
});
|
|
939
|
+
Control.prototype.exit.apply(this, arguments);
|
|
940
|
+
this._oVM = undefined;
|
|
1227
941
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
path: "/showPublic",
|
|
1232
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1233
|
-
},
|
|
1234
|
-
width: "100%"
|
|
1235
|
-
});
|
|
942
|
+
this._fRegisteredApplyAutomaticallyOnStandardVariant = null;
|
|
943
|
+
this.oContext = undefined;
|
|
944
|
+
this._oRb = undefined;
|
|
1236
945
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1242
|
-
},
|
|
1243
|
-
width: "100%"
|
|
1244
|
-
});
|
|
1245
|
-
|
|
1246
|
-
this.oInputManualKey = new Input(this.getId() + "-key", {
|
|
1247
|
-
liveChange: function() {
|
|
1248
|
-
this._checkVariantNameConstraints(this.oInputManualKey);
|
|
1249
|
-
}.bind(this)
|
|
1250
|
-
});
|
|
1251
|
-
|
|
1252
|
-
this.oLabelKey = new Label(this.getId() + "-keylabel", {
|
|
1253
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_KEY"),
|
|
1254
|
-
required: true
|
|
1255
|
-
});
|
|
1256
|
-
this.oLabelKey.setLabelFor(this.oInputManualKey);
|
|
1257
|
-
|
|
1258
|
-
this.oSaveSave = new Button(this.getId() + "-variantsave", {
|
|
1259
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_SAVE"),
|
|
1260
|
-
type: ButtonType.Emphasized,
|
|
1261
|
-
press: function() {
|
|
1262
|
-
if (!this._bSaveOngoing) {
|
|
1263
|
-
this._checkVariantNameConstraints(this.oInputName);
|
|
1264
|
-
|
|
1265
|
-
if (this.oInputName.getValueState() === "Error") {
|
|
1266
|
-
this.oInputName.focus();
|
|
1267
|
-
return;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
this._bSaveOngoing = true;
|
|
1271
|
-
this._bSaveCanceled = false;
|
|
1272
|
-
this._handleVariantSaveAs(this.oInputName.getValue());
|
|
1273
|
-
}
|
|
1274
|
-
}.bind(this),
|
|
1275
|
-
enabled: true
|
|
1276
|
-
});
|
|
1277
|
-
var oSaveAsDialogOptionsGrid = new Grid({
|
|
1278
|
-
defaultSpan: "L12 M12 S12"
|
|
1279
|
-
});
|
|
1280
|
-
|
|
1281
|
-
if (this.getShowSetAsDefault()) {
|
|
1282
|
-
oSaveAsDialogOptionsGrid.addContent(this.oDefault);
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
oSaveAsDialogOptionsGrid.addContent(this.oPublic);
|
|
1287
|
-
|
|
1288
|
-
if (this._getShowExecuteOnSelection()) {
|
|
1289
|
-
oSaveAsDialogOptionsGrid.addContent(this.oExecuteOnSelect);
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
this.oSaveAsDialog = new Dialog(this.getId() + "-savedialog", {
|
|
1293
|
-
title: this._oRb.getText("VARIANT_MANAGEMENT_SAVEDIALOG"),
|
|
1294
|
-
afterClose: function() {
|
|
1295
|
-
this._bSaveOngoing = false;
|
|
1296
|
-
|
|
1297
|
-
if (this._sStyleClass) {
|
|
1298
|
-
this._setShowPublic(this._bShowPublic);
|
|
1299
|
-
this.oSaveAsDialog.removeStyleClass(this._sStyleClass);
|
|
1300
|
-
|
|
1301
|
-
if (this._oRolesComponentContainer) {
|
|
1302
|
-
this.oSaveAsDialog.removeContent(this._oRolesComponentContainer);
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
this._sStyleClass = undefined;
|
|
1306
|
-
this._oRolesComponentContainer = null;
|
|
1307
|
-
}
|
|
1308
|
-
}.bind(this),
|
|
1309
|
-
beginButton: this.oSaveSave,
|
|
1310
|
-
endButton: new Button(this.getId() + "-variantcancel", {
|
|
1311
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_CANCEL"),
|
|
1312
|
-
press: this._cancelPressed.bind(this)
|
|
1313
|
-
}),
|
|
1314
|
-
content: [
|
|
1315
|
-
oLabelName, this.oInputName, this.oLabelKey, this.oInputManualKey, oSaveAsDialogOptionsGrid
|
|
1316
|
-
],
|
|
1317
|
-
stretch: Device.system.phone
|
|
1318
|
-
});
|
|
1319
|
-
|
|
1320
|
-
this.oSaveAsDialog.isPopupAdaptationAllowed = function() {
|
|
1321
|
-
return false;
|
|
1322
|
-
};
|
|
1323
|
-
|
|
1324
|
-
this.oSaveAsDialog.addStyleClass("sapUiContentPadding");
|
|
1325
|
-
this.oSaveAsDialog.addStyleClass("sapUiFlVarMngmtSaveDialog");
|
|
1326
|
-
|
|
1327
|
-
if (this.oVariantLayout.$().closest(".sapUiSizeCompact").length > 0) {
|
|
1328
|
-
this.oSaveAsDialog.addStyleClass("sapUiSizeCompact");
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
this.addDependent(this.oSaveAsDialog);
|
|
1332
|
-
}
|
|
1333
|
-
};
|
|
1334
|
-
|
|
1335
|
-
VariantManagement.prototype._cancelPressed = function() {
|
|
1336
|
-
this._bSaveCanceled = true;
|
|
1337
|
-
|
|
1338
|
-
this.fireCancel();
|
|
1339
|
-
this.oSaveAsDialog.close();
|
|
1340
|
-
};
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
VariantManagement.prototype._getSelectedContexts = function() {
|
|
1344
|
-
return this._oRolesComponentContainer.getComponentInstance().getSelectedContexts();
|
|
1345
|
-
};
|
|
1346
|
-
VariantManagement.prototype._setSelectedContexts = function(mContexts) {
|
|
1347
|
-
if (!mContexts) {
|
|
1348
|
-
mContexts = { role: []};
|
|
1349
|
-
}
|
|
1350
|
-
this._oRolesComponentContainer.getComponentInstance().setSelectedContexts(mContexts);
|
|
1351
|
-
};
|
|
1352
|
-
|
|
1353
|
-
VariantManagement.prototype._isInErrorContexts = function() {
|
|
1354
|
-
return this._oRolesComponentContainer.getComponentInstance().hasErrorsAndShowErrorMessage();
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
VariantManagement.prototype._determineRolesSpecificText = function(mContexts, oTextControl) {
|
|
1358
|
-
if (!mContexts) {
|
|
1359
|
-
mContexts = { role: []};
|
|
1360
|
-
}
|
|
1361
|
-
if (mContexts && oTextControl) {
|
|
1362
|
-
oTextControl.setText(this._oRb.getText((mContexts.role && mContexts.role.length > 0) ? "VARIANT_MANAGEMENT_VISIBILITY_RESTRICTED" : "VARIANT_MANAGEMENT_VISIBILITY_NON_RESTRICTED"));
|
|
1363
|
-
}
|
|
1364
|
-
};
|
|
1365
|
-
|
|
1366
|
-
VariantManagement.prototype._checkAndAddRolesContainerToManageDialog = function() {
|
|
1367
|
-
if (this._oRolesComponentContainer && this._oRolesDialog) {
|
|
1368
|
-
var oRolesComponentContainer = null;
|
|
1369
|
-
this._oRolesDialog.getContent().some(function(oContent) {
|
|
1370
|
-
if (oContent === this._oRolesComponentContainer) {
|
|
1371
|
-
oRolesComponentContainer = oContent;
|
|
1372
|
-
return true;
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
return false;
|
|
1376
|
-
}.bind(this));
|
|
1377
|
-
|
|
1378
|
-
if (!oRolesComponentContainer) {
|
|
1379
|
-
this._oRolesDialog.addContent(this._oRolesComponentContainer);
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
};
|
|
1383
|
-
|
|
1384
|
-
VariantManagement.prototype._createRolesDialog = function() {
|
|
1385
|
-
if (!this._oRolesDialog) {
|
|
1386
|
-
this._oRolesDialog = new Dialog(this.getId() + "-roledialog", {
|
|
1387
|
-
draggable: true,
|
|
1388
|
-
resizable: true,
|
|
1389
|
-
contentWidth: "40%",
|
|
1390
|
-
title: this._oRb.getText("VARIANT_MANAGEMENT_SELECTROLES_DIALOG"),
|
|
1391
|
-
beginButton: new Button(this.getId() + "-rolesave", {
|
|
1392
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_SAVE"),
|
|
1393
|
-
type: ButtonType.Emphasized,
|
|
1394
|
-
press: function() {
|
|
1395
|
-
if (!this._checkAndCreateContextInfoChanges(this._oCurrentContextsKey, this._oTextControl)) {
|
|
1396
|
-
return;
|
|
1397
|
-
}
|
|
1398
|
-
this._oRolesDialog.close();
|
|
1399
|
-
}.bind(this)
|
|
1400
|
-
}),
|
|
1401
|
-
endButton: new Button(this.getId() + "-rolecancel", {
|
|
1402
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_CANCEL"),
|
|
1403
|
-
press: function() {
|
|
1404
|
-
this._oRolesDialog.close();
|
|
1405
|
-
}.bind(this)
|
|
1406
|
-
}),
|
|
1407
|
-
content: [this._oRolesComponentContainer],
|
|
1408
|
-
stretch: Device.system.phone
|
|
1409
|
-
});
|
|
1410
|
-
|
|
1411
|
-
this._oRolesDialog.setParent(this);
|
|
1412
|
-
this._oRolesDialog.addStyleClass("sapUiContentPadding");
|
|
1413
|
-
this._oRolesDialog.addStyleClass(this._sStyleClass);
|
|
1414
|
-
|
|
1415
|
-
this._oRolesDialog.isPopupAdaptationAllowed = function() {
|
|
1416
|
-
return false;
|
|
1417
|
-
};
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
this._checkAndAddRolesContainerToManageDialog();
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
|
-
VariantManagement.prototype._openRolesDialog = function(oItem, oTextControl) {
|
|
1424
|
-
this._createRolesDialog();
|
|
1425
|
-
|
|
1426
|
-
this._oCurrentContextsKey = oItem.key;
|
|
1427
|
-
this._oTextControl = oTextControl;
|
|
1428
|
-
|
|
1429
|
-
this._setSelectedContexts(oItem.contexts);
|
|
1430
|
-
|
|
1431
|
-
this._oRolesDialog.open();
|
|
1432
|
-
};
|
|
1433
|
-
|
|
1434
|
-
VariantManagement.prototype._checkAndCreateContextInfoChanges = function(sKey, oTextControl) {
|
|
1435
|
-
if (sKey) {
|
|
1436
|
-
if (this._oRolesComponentContainer) {
|
|
1437
|
-
try {
|
|
1438
|
-
if (!this._isInErrorContexts()) {
|
|
1439
|
-
var mContexts = this._getSelectedContexts();
|
|
1440
|
-
|
|
1441
|
-
var oItem = this._getItemByKey(sKey);
|
|
1442
|
-
if (oItem) {
|
|
1443
|
-
oItem.contexts = mContexts;
|
|
1444
|
-
this._determineRolesSpecificText(mContexts, oTextControl);
|
|
1445
|
-
}
|
|
1446
|
-
} else {
|
|
1447
|
-
return false;
|
|
1448
|
-
}
|
|
1449
|
-
} catch (ex) {
|
|
1450
|
-
return false;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
return true;
|
|
1454
|
-
}
|
|
1455
|
-
return false;
|
|
1456
|
-
};
|
|
1457
|
-
|
|
1458
|
-
VariantManagement.prototype._checkAndAddRolesContainerToSaveAsDialog = function() {
|
|
1459
|
-
if (this._oRolesComponentContainer && this.oSaveAsDialog) {
|
|
1460
|
-
var oRolesComponentContainer = null;
|
|
1461
|
-
this.oSaveAsDialog.getContent().some(function(oContent) {
|
|
1462
|
-
if (oContent === this._oRolesComponentContainer) {
|
|
1463
|
-
oRolesComponentContainer = oContent;
|
|
1464
|
-
return true;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
return false;
|
|
1468
|
-
}.bind(this));
|
|
1469
|
-
|
|
1470
|
-
this._setSelectedContexts({ role: []});
|
|
1471
|
-
if (!oRolesComponentContainer) {
|
|
1472
|
-
this.oSaveAsDialog.addContent(this._oRolesComponentContainer);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
/**
|
|
1478
|
-
* Opens the <i>Save As</i> dialog.
|
|
1479
|
-
* @param {string} sRtaStyleClassName - style-class to be used
|
|
1480
|
-
* @param {object} oRolesComponentContainer - component for roles handling
|
|
1481
|
-
*/
|
|
1482
|
-
VariantManagement.prototype.openSaveAsDialogForKeyUser = function (sRtaStyleClassName, oRolesComponentContainer) {
|
|
1483
|
-
this._openSaveAsDialog(true);
|
|
1484
|
-
this.oSaveAsDialog.addStyleClass(sRtaStyleClassName);
|
|
1485
|
-
this._sStyleClass = sRtaStyleClassName; // indicates that dialog is running in key user scenario
|
|
1486
|
-
|
|
1487
|
-
this._bShowPublic = this._getShowPublic();
|
|
1488
|
-
this._setShowPublic(false);
|
|
1489
|
-
|
|
1490
|
-
if (oRolesComponentContainer) {
|
|
1491
|
-
Promise.all([oRolesComponentContainer]).then(function(vArgs) {
|
|
1492
|
-
this._oRolesComponentContainer = vArgs[0];
|
|
1493
|
-
this._checkAndAddRolesContainerToSaveAsDialog();
|
|
1494
|
-
|
|
1495
|
-
this.oSaveAsDialog.open();
|
|
1496
|
-
}.bind(this));
|
|
1497
|
-
} else {
|
|
1498
|
-
this.oSaveAsDialog.open();
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
VariantManagement.prototype._openSaveAsDialog = function(bDoNotOpen) {
|
|
1503
|
-
this._createSaveAsDialog();
|
|
1504
|
-
|
|
1505
|
-
this.oInputName.setValue(this.getSelectedVariantText(this.getCurrentVariantKey()));
|
|
1506
|
-
this.oInputName.setEnabled(true);
|
|
1507
|
-
this.oInputName.setValueState(ValueState.None);
|
|
1508
|
-
this.oInputName.setValueStateText(null);
|
|
1509
|
-
|
|
1510
|
-
this.oDefault.setSelected(false);
|
|
1511
|
-
this.oPublic.setSelected(false);
|
|
1512
|
-
this.oExecuteOnSelect.setSelected(false);
|
|
1513
|
-
|
|
1514
|
-
if (this.oVariantPopOver) {
|
|
1515
|
-
this.oVariantPopOver.close();
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
if (this.getManualVariantKey()) {
|
|
1519
|
-
this.oInputManualKey.setVisible(true);
|
|
1520
|
-
this.oInputManualKey.setEnabled(true);
|
|
1521
|
-
this.oInputManualKey.setValueState(ValueState.None);
|
|
1522
|
-
this.oInputManualKey.setValueStateText(null);
|
|
1523
|
-
this.oLabelKey.setVisible(true);
|
|
1524
|
-
} else {
|
|
1525
|
-
this.oInputManualKey.setVisible(false);
|
|
1526
|
-
this.oLabelKey.setVisible(false);
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
if (!bDoNotOpen) {
|
|
1530
|
-
this.oSaveAsDialog.open();
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
VariantManagement.prototype._handleVariantSaveAs = function(sNewVariantName) {
|
|
1535
|
-
var sKey = null;
|
|
1536
|
-
var sName = sNewVariantName.trim();
|
|
1537
|
-
var sManualKey = this.oInputManualKey.getValue().trim();
|
|
1538
|
-
|
|
1539
|
-
if (sName === "") {
|
|
1540
|
-
this.oInputName.setValueState(ValueState.Error);
|
|
1541
|
-
this.oInputName.setValueStateText(this._oRb.getText("VARIANT_MANAGEMENT_ERROR_EMPTY"));
|
|
1542
|
-
return;
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
if (this.getManualVariantKey()) {
|
|
1546
|
-
if (sManualKey === "") {
|
|
1547
|
-
this.oInputManualKey.setValueState(ValueState.Error);
|
|
1548
|
-
this.oInputManualKey.setValueStateText(this._oRb.getText("VARIANT_MANAGEMENT_ERROR_EMPTY"));
|
|
1549
|
-
return;
|
|
1550
|
-
}
|
|
1551
|
-
sKey = sManualKey;
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
if (this.oSaveAsDialog) {
|
|
1555
|
-
this.oSaveAsDialog.close();
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
if (this.oDefault.getSelected()) {
|
|
1559
|
-
this.setDefaultVariantKey(sKey);
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
this.setModified(false);
|
|
1563
|
-
|
|
1564
|
-
this.fireSave({
|
|
1565
|
-
key: sKey, // is null
|
|
1566
|
-
name: sName,
|
|
1567
|
-
overwrite: false,
|
|
1568
|
-
def: this.oDefault.getSelected(),
|
|
1569
|
-
execute: this.oExecuteOnSelect.getSelected(),
|
|
1570
|
-
"public": this._sStyleClass ? undefined : this.oPublic.getSelected(),
|
|
1571
|
-
contexts: this._sStyleClass ? this._getContextInfoChanges() : undefined
|
|
1572
|
-
});
|
|
1573
|
-
};
|
|
1574
|
-
|
|
1575
|
-
VariantManagement.prototype._getContextInfoChanges = function() {
|
|
1576
|
-
if (this._oRolesComponentContainer) {
|
|
1577
|
-
try {
|
|
1578
|
-
if (!this._isInErrorContexts()) {
|
|
1579
|
-
return this._getSelectedContexts();
|
|
1580
|
-
}
|
|
1581
|
-
} catch (ex) {
|
|
1582
|
-
return null;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
return null;
|
|
1587
|
-
};
|
|
1588
|
-
|
|
1589
|
-
VariantManagement.prototype._handleVariantSave = function() {
|
|
1590
|
-
var oItem = this._getItemByKey(this.getCurrentVariantKey());
|
|
1591
|
-
|
|
1592
|
-
var bDefault = false;
|
|
1593
|
-
if (this.getDefaultVariantKey() === oItem.key) {
|
|
1594
|
-
bDefault = true;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
if (this.oVariantPopOver) {
|
|
1598
|
-
this.oVariantPopOver.close();
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
this.fireSave({
|
|
1602
|
-
name: oItem.title,
|
|
1603
|
-
overwrite: true,
|
|
1604
|
-
key: oItem.key,
|
|
1605
|
-
def: bDefault
|
|
1606
|
-
});
|
|
1607
|
-
|
|
1608
|
-
this.setModified(false);
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
|
-
// Manage Views dialog
|
|
1612
|
-
|
|
1613
|
-
/**
|
|
1614
|
-
* Opens the <i>Manage Views</i> dialog.
|
|
1615
|
-
* @param {boolean} bCreateAlways - Indicates that if this is set to <code>true</code>, the former dialog will be destroyed before a new one is created
|
|
1616
|
-
* @param {string} sClass - style-class to be used
|
|
1617
|
-
* @param {object} oRolesComponentContainer - component for roles handling
|
|
1618
|
-
*/
|
|
1619
|
-
VariantManagement.prototype.openManagementDialog = function(bCreateAlways, sClass, oRolesComponentContainer) {
|
|
1620
|
-
if (bCreateAlways && this.oManagementDialog) {
|
|
1621
|
-
this.oManagementDialog.destroy();
|
|
1622
|
-
this.oManagementDialog = undefined;
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
if (sClass) {
|
|
1626
|
-
this._sStyleClass = sClass;
|
|
1627
|
-
this._bShowPublic = this._getShowPublic();
|
|
1628
|
-
this._setShowPublic(false);
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
if (oRolesComponentContainer) {
|
|
1632
|
-
Promise.all([oRolesComponentContainer]).then(function(vArgs) {
|
|
1633
|
-
this._oRolesComponentContainer = vArgs[0];
|
|
1634
|
-
|
|
1635
|
-
this._setShowContexts(!!this._oRolesComponentContainer);
|
|
1636
|
-
this._openManagementDialog();
|
|
1637
|
-
|
|
1638
|
-
if (this._sStyleClass) {
|
|
1639
|
-
this.oManagementDialog.addStyleClass(this._sStyleClass);
|
|
1640
|
-
}
|
|
1641
|
-
}.bind(this));
|
|
1642
|
-
} else {
|
|
1643
|
-
this._setShowContexts(false);
|
|
1644
|
-
this._openManagementDialog();
|
|
1645
|
-
|
|
1646
|
-
if (this._sStyleClass) {
|
|
1647
|
-
this.oManagementDialog.addStyleClass(this._sStyleClass);
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
|
|
1652
|
-
VariantManagement.prototype._triggerSearchInManageDialog = function(oEvent, oManagementTable) {
|
|
1653
|
-
if (!oEvent) {
|
|
1654
|
-
return;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
var parameters = oEvent.getParameters();
|
|
1658
|
-
if (!parameters) {
|
|
1659
|
-
return;
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
var sValue = parameters.newValue ? parameters.newValue : "";
|
|
1663
|
-
|
|
1664
|
-
var aFilters = [
|
|
1665
|
-
this._getVisibleFilter(), new Filter({
|
|
1666
|
-
filters: [
|
|
1667
|
-
new Filter({
|
|
1668
|
-
path: "title",
|
|
1669
|
-
operator: FilterOperator.Contains,
|
|
1670
|
-
value1: sValue
|
|
1671
|
-
}), new Filter({
|
|
1672
|
-
path: "author",
|
|
1673
|
-
operator: FilterOperator.Contains,
|
|
1674
|
-
value1: sValue
|
|
1675
|
-
})
|
|
1676
|
-
],
|
|
1677
|
-
and: false
|
|
1678
|
-
})
|
|
1679
|
-
];
|
|
1680
|
-
|
|
1681
|
-
oManagementTable.getBinding("items").filter(aFilters);
|
|
1682
|
-
|
|
1683
|
-
this._bDeleteOccured = true;
|
|
1684
|
-
};
|
|
1685
|
-
|
|
1686
|
-
VariantManagement.prototype.getManageDialog = function() {
|
|
1687
|
-
return this.oManagementDialog;
|
|
1688
|
-
};
|
|
1689
|
-
|
|
1690
|
-
VariantManagement.prototype._createManagementDialog = function() {
|
|
1691
|
-
if (!this.oManagementDialog || this.oManagementDialog.bIsDestroyed) {
|
|
1692
|
-
this.oManagementTable = new Table(this.getId() + "-managementTable", {
|
|
1693
|
-
contextualWidth: "Auto",
|
|
1694
|
-
fixedLayout: false,
|
|
1695
|
-
growing: true,
|
|
1696
|
-
columns: [
|
|
1697
|
-
new Column({
|
|
1698
|
-
width: "3rem",
|
|
1699
|
-
visible: {
|
|
1700
|
-
path: "showFavorites",
|
|
1701
|
-
model: this._sModelName
|
|
1702
|
-
}
|
|
1703
|
-
}), new Column({
|
|
1704
|
-
header: new Text({
|
|
1705
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_NAME")
|
|
1706
|
-
}),
|
|
1707
|
-
width: "16rem"
|
|
1708
|
-
}), new Column({
|
|
1709
|
-
header: new Text({
|
|
1710
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_VARIANTTYPE"),
|
|
1711
|
-
wrappingType: "Hyphenated"
|
|
1712
|
-
}),
|
|
1713
|
-
visible: {
|
|
1714
|
-
path: "/showPublic",
|
|
1715
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1716
|
-
},
|
|
1717
|
-
demandPopin: true,
|
|
1718
|
-
popinDisplay: PopinDisplay.Inline,
|
|
1719
|
-
minScreenWidth: ScreenSize.Tablet
|
|
1720
|
-
}), new Column({
|
|
1721
|
-
header: new Text({
|
|
1722
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_DEFAULT"),
|
|
1723
|
-
wrappingType: "Hyphenated"
|
|
1724
|
-
}),
|
|
1725
|
-
hAlign: TextAlign.Center,
|
|
1726
|
-
demandPopin: true,
|
|
1727
|
-
popinDisplay: PopinDisplay.Block,
|
|
1728
|
-
minScreenWidth: ScreenSize.Tablet,
|
|
1729
|
-
visible: {
|
|
1730
|
-
path: "/showSetAsDefault",
|
|
1731
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1732
|
-
}
|
|
1733
|
-
}), new Column({
|
|
1734
|
-
header: new Text({
|
|
1735
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_EXECUTEONSELECT"),
|
|
1736
|
-
wrappingType: "Hyphenated"
|
|
1737
|
-
}),
|
|
1738
|
-
hAlign: this.getDisplayTextForExecuteOnSelectionForStandardVariant() ? TextAlign.Begin : TextAlign.Center,
|
|
1739
|
-
demandPopin: true,
|
|
1740
|
-
popinDisplay: PopinDisplay.Block,
|
|
1741
|
-
minScreenWidth: ScreenSize.Tablet,
|
|
1742
|
-
visible: {
|
|
1743
|
-
path: "/showExecuteOnSelection",
|
|
1744
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1745
|
-
}
|
|
1746
|
-
}), new Column({
|
|
1747
|
-
header: new Text({
|
|
1748
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_VISIBILITY"),
|
|
1749
|
-
wrappingType: "Hyphenated"
|
|
1750
|
-
}),
|
|
1751
|
-
width: "8rem",
|
|
1752
|
-
demandPopin: true,
|
|
1753
|
-
popinDisplay: PopinDisplay.Inline,
|
|
1754
|
-
minScreenWidth: ScreenSize.Tablet,
|
|
1755
|
-
visible: {
|
|
1756
|
-
path: "/showContexts",
|
|
1757
|
-
model: VariantManagement.INNER_MODEL_NAME
|
|
1758
|
-
}
|
|
1759
|
-
}), new Column({
|
|
1760
|
-
header: new Text({
|
|
1761
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_AUTHOR")
|
|
1762
|
-
}),
|
|
1763
|
-
demandPopin: true,
|
|
1764
|
-
popinDisplay: PopinDisplay.Block,
|
|
1765
|
-
minScreenWidth: ScreenSize.Tablet
|
|
1766
|
-
}), new Column({
|
|
1767
|
-
hAlign: TextAlign.Center
|
|
1768
|
-
}), new Column({
|
|
1769
|
-
visible: false
|
|
1770
|
-
})
|
|
1771
|
-
]
|
|
1772
|
-
});
|
|
1773
|
-
|
|
1774
|
-
this.oManagementSave = new Button(this.getId() + "-managementsave", {
|
|
1775
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_SAVE"),
|
|
1776
|
-
enabled: true,
|
|
1777
|
-
type: ButtonType.Emphasized,
|
|
1778
|
-
press: function() {
|
|
1779
|
-
this._handleManageSavePressed();
|
|
1780
|
-
}.bind(this)
|
|
1781
|
-
});
|
|
1782
|
-
|
|
1783
|
-
this.oManagementCancel = new Button(this.getId() + "-managementcancel", {
|
|
1784
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_CANCEL"),
|
|
1785
|
-
press: function() {
|
|
1786
|
-
this._resumeManagementTableBinding();
|
|
1787
|
-
this.oManagementDialog.close();
|
|
1788
|
-
this._handleManageCancelPressed();
|
|
1789
|
-
}.bind(this)
|
|
1790
|
-
});
|
|
1791
|
-
|
|
1792
|
-
this.oManagementDialog = new Dialog(this.getId() + "-managementdialog", {
|
|
1793
|
-
contentWidth: "64%",
|
|
1794
|
-
resizable: true,
|
|
1795
|
-
draggable: true,
|
|
1796
|
-
title: this._oRb.getText("VARIANT_MANAGEMENT_MANAGEDIALOG"),
|
|
1797
|
-
beginButton: this.oManagementSave,
|
|
1798
|
-
endButton: this.oManagementCancel,
|
|
1799
|
-
afterClose: function() {
|
|
1800
|
-
if (this._sStyleClass) {
|
|
1801
|
-
this._setShowPublic(this._bShowPublic);
|
|
1802
|
-
this.oManagementDialog.removeStyleClass(this._sStyleClass);
|
|
1803
|
-
this._sStyleClass = undefined;
|
|
1804
|
-
this._oRolesComponentContainer = null;
|
|
1805
|
-
}
|
|
1806
|
-
}.bind(this),
|
|
1807
|
-
content: [
|
|
1808
|
-
this.oManagementTable
|
|
1809
|
-
],
|
|
1810
|
-
stretch: Device.system.phone
|
|
1811
|
-
});
|
|
1812
|
-
|
|
1813
|
-
// add marker
|
|
1814
|
-
this.oManagementDialog.isPopupAdaptationAllowed = function() {
|
|
1815
|
-
return false;
|
|
1816
|
-
};
|
|
1817
|
-
|
|
1818
|
-
this._oSearchFieldOnMgmtDialog = new SearchField();
|
|
1819
|
-
this._oSearchFieldOnMgmtDialog.attachLiveChange(function(oEvent) {
|
|
1820
|
-
this._triggerSearchInManageDialog(oEvent, this.oManagementTable);
|
|
1821
|
-
}.bind(this));
|
|
1822
|
-
|
|
1823
|
-
var oSubHeader = new Bar(this.getId() + "-mgmHeaderSearch", {
|
|
1824
|
-
contentMiddle: [
|
|
1825
|
-
this._oSearchFieldOnMgmtDialog
|
|
1826
|
-
]
|
|
1827
|
-
});
|
|
1828
|
-
this.oManagementDialog.setSubHeader(oSubHeader);
|
|
1829
|
-
|
|
1830
|
-
if (this.oVariantLayout.$().closest(".sapUiSizeCompact").length > 0) {
|
|
1831
|
-
this.oManagementDialog.addStyleClass("sapUiSizeCompact");
|
|
1832
|
-
}
|
|
1833
|
-
this.addDependent(this.oManagementDialog);
|
|
1834
|
-
|
|
1835
|
-
this.oManagementTable.bindAggregation("items", {
|
|
1836
|
-
path: "variants",
|
|
1837
|
-
model: this._sModelName,
|
|
1838
|
-
factory: this._templateFactoryManagementDialog.bind(this),
|
|
1839
|
-
filters: this._getVisibleFilter()
|
|
1840
|
-
});
|
|
1841
|
-
|
|
1842
|
-
this._bDeleteOccured = false;
|
|
1843
|
-
}
|
|
1844
|
-
};
|
|
1845
|
-
|
|
1846
|
-
VariantManagement.prototype._setFavoriteIcon = function(oIcon, bFlagged) {
|
|
1847
|
-
if (oIcon) {
|
|
1848
|
-
oIcon.setSrc(bFlagged ? "sap-icon://favorite" : "sap-icon://unfavorite");
|
|
1849
|
-
oIcon.setTooltip(this._oRb.getText(bFlagged ? "VARIANT_MANAGEMENT_FAV_DEL_TOOLTIP" : "VARIANT_MANAGEMENT_FAV_ADD_TOOLTIP"));
|
|
1850
|
-
oIcon.setAlt(this._oRb.getText(bFlagged ? "VARIANT_MANAGEMENT_FAV_DEL_ACC" : "VARIANT_MANAGEMENT_FAV_ADD_ACC"));
|
|
1851
|
-
}
|
|
1852
|
-
};
|
|
1853
|
-
|
|
1854
|
-
VariantManagement.prototype._templateFactoryManagementDialog = function(sId, oContext) {
|
|
1855
|
-
var sTooltip = null;
|
|
1856
|
-
var oDeleteButton;
|
|
1857
|
-
var sBindingPath;
|
|
1858
|
-
var oNameControl;
|
|
1859
|
-
var oExecuteOnSelectCtrl;
|
|
1860
|
-
var oRolesCell;
|
|
1861
|
-
var oItem = oContext.getObject();
|
|
1862
|
-
if (!oItem) {
|
|
1863
|
-
return undefined;
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
var fLiveChange = function(oEvent) {
|
|
1867
|
-
this._checkVariantNameConstraints(oEvent.oSource, oEvent.oSource.getBindingContext(this._sModelName).getObject().key);
|
|
1868
|
-
}.bind(this);
|
|
1869
|
-
|
|
1870
|
-
var fChange = function(oEvent) {
|
|
1871
|
-
this._handleManageTitleChanged(oEvent.oSource.getBindingContext(this._sModelName).getObject());
|
|
1872
|
-
}.bind(this);
|
|
1873
|
-
|
|
1874
|
-
var fSelectRB = function(oEvent) {
|
|
1875
|
-
this._handleManageDefaultVariantChange(oEvent.oSource, oEvent.oSource.getBindingContext(this._sModelName).getObject(), oEvent.getParameters().selected);
|
|
1876
|
-
}.bind(this);
|
|
1877
|
-
|
|
1878
|
-
var fSelectCB = function(oEvent) {
|
|
1879
|
-
this._handleManageExecuteOnSelectionChanged(oEvent.oSource.getBindingContext(this._sModelName).getObject());
|
|
1880
|
-
}.bind(this);
|
|
1881
|
-
|
|
1882
|
-
var fPress = function(oEvent) {
|
|
1883
|
-
this._handleManageDeletePressed(oEvent.oSource.getBindingContext(this._sModelName).getObject());
|
|
1884
|
-
var oListItem = oEvent.oSource.getParent();
|
|
1885
|
-
if (oListItem) {
|
|
1886
|
-
oListItem.setVisible(false);
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
this._reCheckVariantNameConstraints();
|
|
1890
|
-
}.bind(this);
|
|
1891
|
-
|
|
1892
|
-
var fSelectFav = function(oEvent) {
|
|
1893
|
-
this._handleManageFavoriteChanged(oEvent.oSource, oEvent.oSource.getBindingContext(this._sModelName).getObject());
|
|
1894
|
-
}.bind(this);
|
|
1895
|
-
|
|
1896
|
-
var fRolesPressed = function(oEvent) {
|
|
1897
|
-
var oItem = oEvent.oSource.getBindingContext(this._sModelName).getObject();
|
|
1898
|
-
this._openRolesDialog(oItem, oEvent.oSource.getParent().getItems()[0]);
|
|
1899
|
-
}.bind(this);
|
|
1900
|
-
|
|
1901
|
-
if (oItem.rename) {
|
|
1902
|
-
oNameControl = new Input({
|
|
1903
|
-
liveChange: fLiveChange,
|
|
1904
|
-
change: fChange,
|
|
1905
|
-
value: '{' + this._sModelName + ">title}"
|
|
1906
|
-
});
|
|
1907
|
-
} else {
|
|
1908
|
-
oNameControl = new ObjectIdentifier({
|
|
1909
|
-
title: '{' + this._sModelName + ">title}"
|
|
1910
|
-
});
|
|
1911
|
-
if (sTooltip) {
|
|
1912
|
-
oNameControl.setTooltip(sTooltip);
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
oDeleteButton = new Button({
|
|
1917
|
-
icon: "sap-icon://decline",
|
|
1918
|
-
enabled: true,
|
|
1919
|
-
type: ButtonType.Transparent,
|
|
1920
|
-
press: fPress,
|
|
1921
|
-
tooltip: this._oRb.getText("VARIANT_MANAGEMENT_DELETE"),
|
|
1922
|
-
visible: oItem.remove
|
|
1923
|
-
});
|
|
1924
|
-
|
|
1925
|
-
this._assignColumnInfoForDeleteButton(oDeleteButton);
|
|
1926
|
-
|
|
1927
|
-
sBindingPath = this.oContext.getPath();
|
|
1928
|
-
|
|
1929
|
-
var oFavoriteIcon = new Icon({
|
|
1930
|
-
src: {
|
|
1931
|
-
path: "favorite",
|
|
1932
|
-
model: this._sModelName,
|
|
1933
|
-
formatter: function(bFlagged) {
|
|
1934
|
-
return bFlagged ? "sap-icon://favorite" : "sap-icon://unfavorite";
|
|
1935
|
-
}
|
|
1936
|
-
},
|
|
1937
|
-
tooltip: {
|
|
1938
|
-
path: 'favorite',
|
|
1939
|
-
model: this._sModelName,
|
|
1940
|
-
formatter: function(bFlagged) {
|
|
1941
|
-
return this._oRb.getText(bFlagged ? "VARIANT_MANAGEMENT_FAV_DEL_TOOLTIP" : "VARIANT_MANAGEMENT_FAV_ADD_TOOLTIP");
|
|
1942
|
-
}.bind(this)
|
|
1943
|
-
},
|
|
1944
|
-
press: fSelectFav
|
|
1945
|
-
});
|
|
1946
|
-
|
|
1947
|
-
if ((this.getStandardVariantKey() === oItem.key) || (this.getDefaultVariantKey() === oItem.key)) {
|
|
1948
|
-
oFavoriteIcon.addStyleClass("sapUiFlVarMngmtFavNonInteractiveColor");
|
|
1949
|
-
} else {
|
|
1950
|
-
oFavoriteIcon.addStyleClass("sapUiFlVarMngmtFavColor");
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
if (this.getDisplayTextForExecuteOnSelectionForStandardVariant() && (this.getStandardVariantKey() === oItem.key)) {
|
|
1954
|
-
oExecuteOnSelectCtrl = new CheckBox({
|
|
1955
|
-
wrapping: true,
|
|
1956
|
-
text: this.getDisplayTextForExecuteOnSelectionForStandardVariant(),
|
|
1957
|
-
select: fSelectCB,
|
|
1958
|
-
selected: '{' + this._sModelName + ">executeOnSelect}"
|
|
1959
|
-
});
|
|
1960
|
-
} else {
|
|
1961
|
-
oExecuteOnSelectCtrl = new CheckBox({
|
|
1962
|
-
text: "",
|
|
1963
|
-
select: fSelectCB,
|
|
1964
|
-
selected: '{' + this._sModelName + ">executeOnSelect}"
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
// roles
|
|
1969
|
-
if (this._sStyleClass && (oItem.key !== this.getStandardVariantKey())) {
|
|
1970
|
-
var oText = new Text({ wrapping: false });
|
|
1971
|
-
this._determineRolesSpecificText(oItem.contexts, oText);
|
|
1972
|
-
var oIcon = new Icon({
|
|
1973
|
-
src: "sap-icon://edit",
|
|
1974
|
-
press: fRolesPressed
|
|
1975
|
-
});
|
|
1976
|
-
oIcon.addStyleClass("sapUiFlVarMngmtRolesEdit");
|
|
1977
|
-
oIcon.setTooltip(this._oRb.getText("VARIANT_MANAGEMENT_VISIBILITY_ICON_TT"));
|
|
1978
|
-
oRolesCell = new HBox({
|
|
1979
|
-
items: [oText, oIcon]
|
|
1980
|
-
});
|
|
1981
|
-
} else {
|
|
1982
|
-
oRolesCell = new Text();
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
return new ColumnListItem({
|
|
1986
|
-
cells: [
|
|
1987
|
-
oFavoriteIcon, oNameControl, new Text({
|
|
1988
|
-
text: {
|
|
1989
|
-
path: "sharing",
|
|
1990
|
-
model: this._sModelName,
|
|
1991
|
-
formatter: function(sValue) {
|
|
1992
|
-
return this._oRb.getText(sValue === "private" ? "VARIANT_MANAGEMENT_PRIVATE" : "VARIANT_MANAGEMENT_PUBLIC");
|
|
1993
|
-
}.bind(this)
|
|
1994
|
-
},
|
|
1995
|
-
textAlign: "Center"
|
|
1996
|
-
}), new RadioButton({
|
|
1997
|
-
groupName: this.getId(),
|
|
1998
|
-
select: fSelectRB,
|
|
1999
|
-
selected: {
|
|
2000
|
-
path: sBindingPath + "/defaultVariant",
|
|
2001
|
-
model: this._sModelName,
|
|
2002
|
-
formatter: function(sKey) {
|
|
2003
|
-
return oItem.key === sKey;
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
}), oExecuteOnSelectCtrl, oRolesCell, new Text({
|
|
2007
|
-
text: '{' + this._sModelName + ">author}",
|
|
2008
|
-
textAlign: "Begin"
|
|
2009
|
-
}), oDeleteButton, new Text({
|
|
2010
|
-
text: '{' + this._sModelName + ">key}"
|
|
2011
|
-
})
|
|
2012
|
-
]
|
|
2013
|
-
});
|
|
2014
|
-
};
|
|
2015
|
-
|
|
2016
|
-
VariantManagement.prototype._openManagementDialog = function() {
|
|
2017
|
-
this._createManagementDialog();
|
|
2018
|
-
|
|
2019
|
-
if (this.oVariantPopOver) {
|
|
2020
|
-
this.oVariantPopOver.close();
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
this._suspendManagementTableBinding();
|
|
2024
|
-
|
|
2025
|
-
this._clearDeletedItems();
|
|
2026
|
-
// this.oManagementSave.setEnabled(false);
|
|
2027
|
-
this._oSearchFieldOnMgmtDialog.setValue("");
|
|
2028
|
-
|
|
2029
|
-
// Ideally, this should be done only once in <code>_createtManagementDialog</code>. However, the binding does not recognize a change if filtering is involved.
|
|
2030
|
-
// After a deletion on the UI, the item is filtered out <code>.visible=false</code>. The real deletion will occur only when <i>OK</i> is pressed.
|
|
2031
|
-
// Since the filtered items and the result after the real deletion are identical, no change is detected. Based on this, the context on the table is
|
|
2032
|
-
// not invalidated....
|
|
2033
|
-
// WA: Always do the binding while opening the dialog.
|
|
2034
|
-
if (this._bDeleteOccured) {
|
|
2035
|
-
this._bDeleteOccured = false;
|
|
2036
|
-
this.oManagementTable.bindAggregation("items", {
|
|
2037
|
-
path: "variants",
|
|
2038
|
-
model: this._sModelName,
|
|
2039
|
-
factory: this._templateFactoryManagementDialog.bind(this),
|
|
2040
|
-
filters: this._getVisibleFilter()
|
|
2041
|
-
});
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
this.oManagementDialog.open();
|
|
2045
|
-
};
|
|
2046
|
-
|
|
2047
|
-
VariantManagement.prototype._assignColumnInfoForDeleteButton = function(oDeleteButton) {
|
|
2048
|
-
if (!this._oInvisibleDeleteColumnName) {
|
|
2049
|
-
this._oInvisibleDeleteColumnName = new InvisibleText({
|
|
2050
|
-
text: this._oRb.getText("VARIANT_MANAGEMENT_ACTION_COLUMN")
|
|
2051
|
-
});
|
|
2052
|
-
|
|
2053
|
-
this.oManagementDialog.addContent(this._oInvisibleDeleteColumnName);
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
if (this._oInvisibleDeleteColumnName) {
|
|
2057
|
-
oDeleteButton.addAriaLabelledBy(this._oInvisibleDeleteColumnName);
|
|
2058
|
-
}
|
|
2059
|
-
};
|
|
2060
|
-
|
|
2061
|
-
VariantManagement.prototype._toggleIconActivityState = function(oIcon, oItem, bToInActive) {
|
|
2062
|
-
if (!oIcon) {
|
|
2063
|
-
return;
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
if (oItem.key === this.getStandardVariantKey()) {
|
|
2067
|
-
return;
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
if (bToInActive && oIcon.hasStyleClass("sapUiFlVarMngmtFavColor")) {
|
|
2071
|
-
oIcon.removeStyleClass("sapUiFlVarMngmtFavColor");
|
|
2072
|
-
oIcon.addStyleClass("sapUiFlVarMngmtFavNonInteractiveColor");
|
|
2073
|
-
} else if (oIcon.hasStyleClass("sapUiFlVarMngmtFavNonInteractiveColor")) {
|
|
2074
|
-
oIcon.removeStyleClass("sapUiFlVarMngmtFavNonInteractiveColor");
|
|
2075
|
-
oIcon.addStyleClass("sapUiFlVarMngmtFavColor");
|
|
2076
|
-
}
|
|
2077
|
-
};
|
|
2078
|
-
|
|
2079
|
-
VariantManagement.prototype._handleManageDefaultVariantChange = function(oRadioButton, oItem, bSelected) {
|
|
2080
|
-
var sKey = oItem.key;
|
|
2081
|
-
|
|
2082
|
-
if (oRadioButton) {
|
|
2083
|
-
var oIcon = oRadioButton.getParent().getCells()[VariantManagement.COLUMN_FAV_IDX];
|
|
2084
|
-
|
|
2085
|
-
if (bSelected) {
|
|
2086
|
-
if (this.getShowFavorites() && !oItem.favorite) {
|
|
2087
|
-
oItem.favorite = true;
|
|
2088
|
-
this._setFavoriteIcon(oIcon, true);
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
this.setDefaultVariantKey(sKey);
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
this._toggleIconActivityState(oIcon, oItem, bSelected);
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
|
|
2098
|
-
VariantManagement.prototype._handleManageCancelPressed = function() {
|
|
2099
|
-
var sDefaultVariantKey;
|
|
2100
|
-
var oModel;
|
|
2101
|
-
this._getDeletedItems().forEach(function(oItem) {
|
|
2102
|
-
oItem.visible = true;
|
|
2103
|
-
});
|
|
2104
|
-
|
|
2105
|
-
this._getItems().forEach(function(oItem) {
|
|
2106
|
-
oItem.title = oItem.originalTitle;
|
|
2107
|
-
oItem.favorite = oItem.originalFavorite;
|
|
2108
|
-
oItem.executeOnSelection = oItem.originalExecuteOnSelection;
|
|
2109
|
-
oItem.contexts = oItem.originalContexts;
|
|
2110
|
-
});
|
|
2111
|
-
|
|
2112
|
-
sDefaultVariantKey = this.getOriginalDefaultVariantKey();
|
|
2113
|
-
if (sDefaultVariantKey !== this.getDefaultVariantKey()) {
|
|
2114
|
-
this.setDefaultVariantKey(sDefaultVariantKey);
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
oModel = this.getModel(this._sModelName);
|
|
2118
|
-
if (oModel) {
|
|
2119
|
-
oModel.checkUpdate();
|
|
2120
|
-
}
|
|
2121
|
-
};
|
|
2122
|
-
|
|
2123
|
-
VariantManagement.prototype._handleManageFavoriteChanged = function(oIcon, oItem) {
|
|
2124
|
-
// if (!this._anyInErrorState(this.oManagementTable)) {
|
|
2125
|
-
// this.oManagementSave.setEnabled(true);
|
|
2126
|
-
// }
|
|
2127
|
-
if (this.getStandardVariantKey() === oItem.key) {
|
|
2128
|
-
return;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
if ((this.getDefaultVariantKey() === oItem.key) && oItem.favorite) {
|
|
2132
|
-
return;
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
oItem.favorite = !oItem.favorite;
|
|
2136
|
-
this._setFavoriteIcon(oIcon, oItem.favorite);
|
|
2137
|
-
};
|
|
2138
|
-
|
|
2139
|
-
VariantManagement.prototype._getRowForKey = function(sKey) {
|
|
2140
|
-
var oRowForKey = null;
|
|
2141
|
-
if (this.oManagementTable) {
|
|
2142
|
-
this.oManagementTable.getItems().some(function(oRow) {
|
|
2143
|
-
if (sKey === oRow.getCells()[0].getBindingContext(this._sModelName).getObject().key) {
|
|
2144
|
-
oRowForKey = oRow;
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
return oRowForKey !== null;
|
|
2148
|
-
}.bind(this));
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
return oRowForKey;
|
|
2152
|
-
};
|
|
2153
|
-
|
|
2154
|
-
VariantManagement.prototype._handleManageDeletePressed = function(oItem) {
|
|
2155
|
-
var oModel;
|
|
2156
|
-
var sKey = oItem.key;
|
|
2157
|
-
|
|
2158
|
-
// do not allow the deletion of the standard
|
|
2159
|
-
if (this.getStandardVariantKey() === sKey) {
|
|
2160
|
-
return;
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
oItem.visible = false;
|
|
2164
|
-
this._addDeletedItem(oItem);
|
|
2165
|
-
|
|
2166
|
-
if ((sKey === this.getDefaultVariantKey())) {
|
|
2167
|
-
this.setDefaultVariantKey(this.getStandardVariantKey());
|
|
2168
|
-
if (this.getShowFavorites()) {
|
|
2169
|
-
var oNewDefaultItem = this._getItemByKey(this.getStandardVariantKey());
|
|
2170
|
-
if (oNewDefaultItem && !oNewDefaultItem.favorite) {
|
|
2171
|
-
var oRow = this._getRowForKey(this.getStandardVariantKey());
|
|
2172
|
-
if (oRow) {
|
|
2173
|
-
oNewDefaultItem.favorite = true;
|
|
2174
|
-
this._setFavoriteIcon(oRow.getCells()[VariantManagement.COLUMN_FAV_IDX], true);
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
oModel = this.getModel(this._sModelName);
|
|
2181
|
-
if (oModel) {
|
|
2182
|
-
oModel.checkUpdate();
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
this.oManagementCancel.focus();
|
|
2186
|
-
};
|
|
2187
|
-
|
|
2188
|
-
VariantManagement.prototype._handleManageExecuteOnSelectionChanged = function() {
|
|
2189
|
-
// if (!this._anyInErrorState(this.oManagementTable)) {
|
|
2190
|
-
// this.oManagementSave.setEnabled(true);
|
|
2191
|
-
// }
|
|
2192
|
-
};
|
|
2193
|
-
|
|
2194
|
-
VariantManagement.prototype._handleManageTitleChanged = function() {
|
|
2195
|
-
// if (!this._anyInErrorState(this.oManagementTable)) {
|
|
2196
|
-
// this.oManagementSave.setEnabled(true);
|
|
2197
|
-
// }
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
VariantManagement.prototype._handleManageSavePressed = function() {
|
|
2201
|
-
if (this._anyInErrorState(this.oManagementTable)) {
|
|
2202
|
-
return;
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
this._getDeletedItems().some(function(oItem) {
|
|
2206
|
-
if (oItem.key === this.getCurrentVariantKey()) {
|
|
2207
|
-
var sKey = this.getStandardVariantKey();
|
|
2208
|
-
|
|
2209
|
-
this.setModified(false);
|
|
2210
|
-
this.setCurrentVariantKey(sKey);
|
|
2211
|
-
|
|
2212
|
-
this.fireEvent("select", {
|
|
2213
|
-
key: sKey
|
|
2214
|
-
});
|
|
2215
|
-
return true;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
return false;
|
|
2219
|
-
}.bind(this));
|
|
2220
|
-
|
|
2221
|
-
this.fireManage();
|
|
2222
|
-
|
|
2223
|
-
this._resumeManagementTableBinding();
|
|
2224
|
-
this.oManagementDialog.close();
|
|
2225
|
-
};
|
|
2226
|
-
|
|
2227
|
-
VariantManagement.prototype._resumeManagementTableBinding = function() {
|
|
2228
|
-
if (this.oManagementTable) {
|
|
2229
|
-
var oListBinding = this.oManagementTable.getBinding("items");
|
|
2230
|
-
if (oListBinding) {
|
|
2231
|
-
oListBinding.resume();
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
};
|
|
2235
|
-
|
|
2236
|
-
VariantManagement.prototype._suspendManagementTableBinding = function() {
|
|
2237
|
-
if (this.oManagementTable) {
|
|
2238
|
-
var oListBinding = this.oManagementTable.getBinding("items");
|
|
2239
|
-
if (oListBinding) {
|
|
2240
|
-
oListBinding.suspend();
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
};
|
|
2244
|
-
|
|
2245
|
-
VariantManagement.prototype._anyInErrorState = function(oManagementTable) {
|
|
2246
|
-
var aItems;
|
|
2247
|
-
var oInput;
|
|
2248
|
-
var bInError = false;
|
|
2249
|
-
|
|
2250
|
-
if (oManagementTable) {
|
|
2251
|
-
aItems = oManagementTable.getItems();
|
|
2252
|
-
aItems.some(function(oItem) {
|
|
2253
|
-
oInput = oItem.getCells()[VariantManagement.COLUMN_NAME_IDX];
|
|
2254
|
-
if (oInput && oInput.getValueState && (oInput.getValueState() === ValueState.Error)) {
|
|
2255
|
-
bInError = true;
|
|
2256
|
-
}
|
|
2257
|
-
return bInError;
|
|
2258
|
-
});
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
return bInError;
|
|
2262
|
-
};
|
|
2263
|
-
|
|
2264
|
-
// UTILS
|
|
2265
|
-
|
|
2266
|
-
VariantManagement.prototype._getFilters = function(oFilter) {
|
|
2267
|
-
var aFilters = [];
|
|
2268
|
-
|
|
2269
|
-
if (oFilter) {
|
|
2270
|
-
aFilters.push(oFilter);
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
aFilters.push(this._getVisibleFilter());
|
|
2274
|
-
|
|
2275
|
-
if (this.getShowFavorites()) {
|
|
2276
|
-
aFilters.push(this._getFilterFavorites());
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
|
-
return aFilters;
|
|
2280
|
-
};
|
|
2281
|
-
|
|
2282
|
-
VariantManagement.prototype._getVisibleFilter = function() {
|
|
2283
|
-
return new Filter({
|
|
2284
|
-
path: "visible",
|
|
2285
|
-
operator: FilterOperator.EQ,
|
|
2286
|
-
value1: true
|
|
2287
|
-
});
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
|
-
VariantManagement.prototype._getFilterFavorites = function() {
|
|
2291
|
-
return new Filter({
|
|
2292
|
-
path: "favorite",
|
|
2293
|
-
operator: FilterOperator.EQ,
|
|
2294
|
-
value1: true
|
|
2295
|
-
});
|
|
2296
|
-
};
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
VariantManagement.prototype._verifyVariantNameConstraints = function(oInputField, sKey) {
|
|
2300
|
-
if (!oInputField) {
|
|
2301
|
-
return;
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
var sValue = oInputField.getValue();
|
|
2305
|
-
sValue = sValue.trim();
|
|
2306
|
-
|
|
2307
|
-
if (!this._checkIsDuplicate(sValue, sKey)) {
|
|
2308
|
-
if (sValue === "") {
|
|
2309
|
-
oInputField.setValueState(ValueState.Error);
|
|
2310
|
-
oInputField.setValueStateText(this._oRb.getText("VARIANT_MANAGEMENT_ERROR_EMPTY"));
|
|
2311
|
-
} else if (sValue.indexOf('{') > -1) {
|
|
2312
|
-
oInputField.setValueState(ValueState.Error);
|
|
2313
|
-
oInputField.setValueStateText(this._oRb.getText("VARIANT_MANAGEMENT_NOT_ALLOWED_CHAR", [
|
|
2314
|
-
"{"
|
|
2315
|
-
]));
|
|
2316
|
-
} else if (sValue.length > VariantManagement.MAX_NAME_LEN) {
|
|
2317
|
-
oInputField.setValueState(ValueState.Error);
|
|
2318
|
-
oInputField.setValueStateText(this._oRb.getText("VARIANT_MANAGEMENT_MAX_LEN", [
|
|
2319
|
-
VariantManagement.MAX_NAME_LEN
|
|
2320
|
-
]));
|
|
2321
|
-
} else {
|
|
2322
|
-
oInputField.setValueState(ValueState.None);
|
|
2323
|
-
oInputField.setValueStateText(null);
|
|
2324
|
-
}
|
|
2325
|
-
} else {
|
|
2326
|
-
oInputField.setValueState(ValueState.Error);
|
|
2327
|
-
oInputField.setValueStateText(this._oRb.getText("VARIANT_MANAGEMENT_ERROR_DUPLICATE"));
|
|
2328
|
-
}
|
|
2329
|
-
};
|
|
2330
|
-
|
|
2331
|
-
VariantManagement.prototype._checkVariantNameConstraints = function(oInputField, sKey) {
|
|
2332
|
-
this._verifyVariantNameConstraints(oInputField, sKey);
|
|
2333
|
-
|
|
2334
|
-
if (this.oManagementDialog && this.oManagementDialog.isOpen()) {
|
|
2335
|
-
this._reCheckVariantNameConstraints();
|
|
2336
|
-
}
|
|
2337
|
-
};
|
|
2338
|
-
|
|
2339
|
-
VariantManagement.prototype._reCheckVariantNameConstraints = function() {
|
|
2340
|
-
var aItems;
|
|
2341
|
-
var bInError = false;
|
|
2342
|
-
|
|
2343
|
-
if (this.oManagementTable) {
|
|
2344
|
-
aItems = this.oManagementTable.getItems();
|
|
2345
|
-
aItems.some(function(oItem) {
|
|
2346
|
-
var oObject = oItem.getBindingContext(this._sModelName).getObject();
|
|
2347
|
-
if (oObject && oObject.visible) {
|
|
2348
|
-
var oInput = oItem.getCells()[VariantManagement.COLUMN_NAME_IDX];
|
|
2349
|
-
if (oInput && oInput.getValueState && (oInput.getValueState() === ValueState.Error)) {
|
|
2350
|
-
this._verifyVariantNameConstraints(oInput, oObject.key);
|
|
2351
|
-
if (oInput.getValueState() === ValueState.Error) {
|
|
2352
|
-
bInError = true;
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
return bInError;
|
|
2358
|
-
}.bind(this));
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
return bInError;
|
|
2362
|
-
};
|
|
2363
|
-
|
|
2364
|
-
VariantManagement.prototype._checkIsDuplicate = function(sValue, sKey) {
|
|
2365
|
-
if (this.oManagementDialog && this.oManagementDialog.isOpen()) {
|
|
2366
|
-
return this._checkIsDuplicateInManageTable(sValue, sKey);
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
return this._checkIsDuplicateInModel(sValue, sKey);
|
|
2370
|
-
};
|
|
2371
|
-
|
|
2372
|
-
VariantManagement.prototype._checkIsDuplicateInModel = function(sValue, sKey) {
|
|
2373
|
-
var bDublicate = false;
|
|
2374
|
-
var aItems = this._getItems();
|
|
2375
|
-
var sLowerCaseValue = sValue.toLowerCase();
|
|
2376
|
-
aItems.some(function(oItem) {
|
|
2377
|
-
if (oItem.title.toLowerCase() === sLowerCaseValue) {
|
|
2378
|
-
if (sKey && (sKey === oItem.key)) {
|
|
2379
|
-
return false;
|
|
2380
|
-
}
|
|
2381
|
-
bDublicate = true;
|
|
2382
|
-
}
|
|
2383
|
-
|
|
2384
|
-
return bDublicate;
|
|
2385
|
-
});
|
|
2386
|
-
|
|
2387
|
-
return bDublicate;
|
|
2388
|
-
};
|
|
2389
|
-
|
|
2390
|
-
VariantManagement.prototype._checkIsDuplicateInManageTable = function(sValue, sKey) {
|
|
2391
|
-
var aItems;
|
|
2392
|
-
var bInError = false;
|
|
2393
|
-
var sLowerCaseValue = sValue.toLowerCase();
|
|
2394
|
-
|
|
2395
|
-
if (this.oManagementTable) {
|
|
2396
|
-
aItems = this.oManagementTable.getItems();
|
|
2397
|
-
aItems.some(function(oItem) {
|
|
2398
|
-
var sTitleLowerCase;
|
|
2399
|
-
var oObject = oItem.getBindingContext(this._sModelName).getObject();
|
|
2400
|
-
if (oObject && oObject.visible) {
|
|
2401
|
-
var oInput = oItem.getCells()[VariantManagement.COLUMN_NAME_IDX];
|
|
2402
|
-
|
|
2403
|
-
if (oInput && (oObject.key !== sKey)) {
|
|
2404
|
-
if (oInput.isA("sap.m.Input")) {
|
|
2405
|
-
sTitleLowerCase = oInput.getValue().toLowerCase();
|
|
2406
|
-
} else {
|
|
2407
|
-
sTitleLowerCase = oInput.getTitle().toLowerCase();
|
|
2408
|
-
}
|
|
2409
|
-
if (sTitleLowerCase === sLowerCaseValue) {
|
|
2410
|
-
bInError = true;
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
return bInError;
|
|
2415
|
-
}.bind(this));
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
return bInError;
|
|
2419
|
-
};
|
|
2420
|
-
|
|
2421
|
-
// exit destroy all controls created in init
|
|
2422
|
-
VariantManagement.prototype.exit = function() {
|
|
2423
|
-
var oModel;
|
|
2424
|
-
|
|
2425
|
-
if (this.oVariantInvisibleText) {
|
|
2426
|
-
this.oVariantInvisibleText.destroy(true);
|
|
2427
|
-
this.oVariantInvisibleText = undefined;
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
if (this.oDefault && !this.oDefault._bIsBeingDestroyed) {
|
|
2431
|
-
this.oDefault.destroy();
|
|
2432
|
-
}
|
|
2433
|
-
this.oDefault = undefined;
|
|
2434
|
-
|
|
2435
|
-
if (this.oPublic && !this.oPublic._bIsBeingDestroyed) {
|
|
2436
|
-
this.oPublic.destroy();
|
|
2437
|
-
}
|
|
2438
|
-
this.oPublic = undefined;
|
|
2439
|
-
|
|
2440
|
-
if (this.oExecuteOnSelect && !this.oExecuteOnSelect._bIsBeingDestroyed) {
|
|
2441
|
-
this.oExecuteOnSelect.destroy();
|
|
2442
|
-
}
|
|
2443
|
-
this.oExecuteOnSelect = undefined;
|
|
2444
|
-
this._oRb = undefined;
|
|
2445
|
-
|
|
2446
|
-
this.oContext = undefined;
|
|
2447
|
-
|
|
2448
|
-
this._oVariantList = undefined;
|
|
2449
|
-
this.oVariantSelectionPage = undefined;
|
|
2450
|
-
this.oVariantLayout = undefined;
|
|
2451
|
-
this.oVariantText = undefined;
|
|
2452
|
-
this.oVariantModifiedText = undefined;
|
|
2453
|
-
this.oVariantPopoverTrigger = undefined;
|
|
2454
|
-
this._oSearchField = undefined;
|
|
2455
|
-
this._oSearchFieldOnMgmtDialog = undefined;
|
|
2456
|
-
|
|
2457
|
-
oModel = this.getModel(VariantManagement.INNER_MODEL_NAME);
|
|
2458
|
-
if (oModel) {
|
|
2459
|
-
oModel.destroy();
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
this._oRolesComponentContainer = null;
|
|
2463
|
-
this._sStyleClass = null;
|
|
2464
|
-
|
|
2465
|
-
this._fRegisteredApplyAutomaticallyOnStandardVariant = null;
|
|
2466
|
-
|
|
2467
|
-
if (this._oRolesDialog) {
|
|
2468
|
-
this._oRolesDialog.destroy();
|
|
2469
|
-
this._oRolesDialog = null;
|
|
2470
|
-
}
|
|
946
|
+
this._aCancelEventHandlers = undefined;
|
|
947
|
+
this._aSaveEventHandlers = undefined;
|
|
948
|
+
this._aManageEventHandlers = undefined;
|
|
949
|
+
this._aSelectEventHandlers = undefined;
|
|
2471
950
|
};
|
|
2472
951
|
|
|
2473
952
|
return VariantManagement;
|