@sapui5/sap.ui.vbm 1.119.0 → 1.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/package.json +1 -1
  2. package/src/sap/ui/vbm/.library +1 -1
  3. package/src/sap/ui/vbm/Adapter.js +19 -19
  4. package/src/sap/ui/vbm/Adapter3D.js +7 -18
  5. package/src/sap/ui/vbm/AnalyticMap.js +3 -2
  6. package/src/sap/ui/vbm/ContainerBase.js +799 -0
  7. package/src/sap/ui/vbm/ContainerBaseRenderer.js +85 -0
  8. package/src/sap/ui/vbm/ContainerContent.js +82 -0
  9. package/src/sap/ui/vbm/ContainerContentRenderer.js +28 -0
  10. package/src/sap/ui/vbm/ContainerLegendItem.js +68 -0
  11. package/src/sap/ui/vbm/ContainerLegendItemRenderer.js +58 -0
  12. package/src/sap/ui/vbm/GeoMap.js +4 -4
  13. package/src/sap/ui/vbm/Legend.js +5 -3
  14. package/src/sap/ui/vbm/ListPanel.js +336 -0
  15. package/src/sap/ui/vbm/ListPanelRenderer.js +36 -0
  16. package/src/sap/ui/vbm/ListPanelStack.js +254 -0
  17. package/src/sap/ui/vbm/ListPanelStackRenderer.js +29 -0
  18. package/src/sap/ui/vbm/MapContainer.js +514 -0
  19. package/src/sap/ui/vbm/MapContainerButtonType.js +23 -0
  20. package/src/sap/ui/vbm/MapContainerRenderer.js +67 -0
  21. package/src/sap/ui/vbm/Viewport.js +1 -1
  22. package/src/sap/ui/vbm/VoAbstract.js +15 -1
  23. package/src/sap/ui/vbm/VoBase.js +4 -0
  24. package/src/sap/ui/vbm/adapter3d/DragDropHandler.js +1 -1
  25. package/src/sap/ui/vbm/adapter3d/ModelHandler.js +1 -1
  26. package/src/sap/ui/vbm/adapter3d/ObjectFactory.js +1 -1
  27. package/src/sap/ui/vbm/adapter3d/PolygonHandler.js +1 -1
  28. package/src/sap/ui/vbm/adapter3d/SceneBuilder.js +6 -5
  29. package/src/sap/ui/vbm/adapter3d/VBIJSONParser.js +10 -10
  30. package/src/sap/ui/vbm/getResourceBundle.js +14 -0
  31. package/src/sap/ui/vbm/i18n/messagebundle.properties +25 -0
  32. package/src/sap/ui/vbm/i18n/messagebundle_ar.properties +14 -0
  33. package/src/sap/ui/vbm/i18n/messagebundle_ca.properties +14 -0
  34. package/src/sap/ui/vbm/i18n/messagebundle_cnr.properties +14 -0
  35. package/src/sap/ui/vbm/i18n/messagebundle_cs.properties +14 -0
  36. package/src/sap/ui/vbm/i18n/messagebundle_cy.properties +14 -0
  37. package/src/sap/ui/vbm/i18n/messagebundle_da.properties +14 -0
  38. package/src/sap/ui/vbm/i18n/messagebundle_de.properties +14 -0
  39. package/src/sap/ui/vbm/i18n/messagebundle_el.properties +14 -0
  40. package/src/sap/ui/vbm/i18n/messagebundle_en.properties +13 -0
  41. package/src/sap/ui/vbm/i18n/messagebundle_en_GB.properties +14 -0
  42. package/src/sap/ui/vbm/i18n/messagebundle_en_US_sappsd.properties +14 -0
  43. package/src/sap/ui/vbm/i18n/messagebundle_en_US_saprigi.properties +14 -0
  44. package/src/sap/ui/vbm/i18n/messagebundle_en_US_saptrc.properties +14 -0
  45. package/src/sap/ui/vbm/i18n/messagebundle_es.properties +14 -0
  46. package/src/sap/ui/vbm/i18n/messagebundle_es_MX.properties +14 -0
  47. package/src/sap/ui/vbm/i18n/messagebundle_et.properties +14 -0
  48. package/src/sap/ui/vbm/i18n/messagebundle_fi.properties +14 -0
  49. package/src/sap/ui/vbm/i18n/messagebundle_fr.properties +14 -0
  50. package/src/sap/ui/vbm/i18n/messagebundle_fr_CA.properties +14 -0
  51. package/src/sap/ui/vbm/i18n/messagebundle_hi.properties +14 -0
  52. package/src/sap/ui/vbm/i18n/messagebundle_hr.properties +14 -0
  53. package/src/sap/ui/vbm/i18n/messagebundle_hu.properties +14 -0
  54. package/src/sap/ui/vbm/i18n/messagebundle_id.properties +14 -0
  55. package/src/sap/ui/vbm/i18n/messagebundle_it.properties +14 -0
  56. package/src/sap/ui/vbm/i18n/messagebundle_iw.properties +14 -0
  57. package/src/sap/ui/vbm/i18n/messagebundle_ja.properties +14 -0
  58. package/src/sap/ui/vbm/i18n/messagebundle_kk.properties +15 -0
  59. package/src/sap/ui/vbm/i18n/messagebundle_ko.properties +14 -0
  60. package/src/sap/ui/vbm/i18n/messagebundle_lt.properties +14 -0
  61. package/src/sap/ui/vbm/i18n/messagebundle_lv.properties +14 -0
  62. package/src/sap/ui/vbm/i18n/messagebundle_mk.properties +14 -0
  63. package/src/sap/ui/vbm/i18n/messagebundle_ms.properties +14 -0
  64. package/src/sap/ui/vbm/i18n/messagebundle_nl.properties +14 -0
  65. package/src/sap/ui/vbm/i18n/messagebundle_no.properties +14 -0
  66. package/src/sap/ui/vbm/i18n/messagebundle_pl.properties +14 -0
  67. package/src/sap/ui/vbm/i18n/messagebundle_pt.properties +14 -0
  68. package/src/sap/ui/vbm/i18n/messagebundle_pt_PT.properties +14 -0
  69. package/src/sap/ui/vbm/i18n/messagebundle_ro.properties +14 -0
  70. package/src/sap/ui/vbm/i18n/messagebundle_ru.properties +14 -0
  71. package/src/sap/ui/vbm/i18n/messagebundle_sk.properties +14 -0
  72. package/src/sap/ui/vbm/i18n/messagebundle_sl.properties +14 -0
  73. package/src/sap/ui/vbm/i18n/messagebundle_sr.properties +14 -0
  74. package/src/sap/ui/vbm/i18n/messagebundle_sv.properties +14 -0
  75. package/src/sap/ui/vbm/i18n/messagebundle_th.properties +14 -0
  76. package/src/sap/ui/vbm/i18n/messagebundle_tr.properties +14 -0
  77. package/src/sap/ui/vbm/i18n/messagebundle_uk.properties +14 -0
  78. package/src/sap/ui/vbm/i18n/messagebundle_vi.properties +14 -0
  79. package/src/sap/ui/vbm/i18n/messagebundle_zh_CN.properties +14 -0
  80. package/src/sap/ui/vbm/i18n/messagebundle_zh_TW.properties +14 -0
  81. package/src/sap/ui/vbm/lib/sapnavigation.js +7 -3
  82. package/src/sap/ui/vbm/lib/sapscale.js +1 -1
  83. package/src/sap/ui/vbm/lib/saputilities.js +11 -5
  84. package/src/sap/ui/vbm/lib/sapvbmenu.js +6 -1
  85. package/src/sap/ui/vbm/library.js +13 -7
  86. package/src/sap/ui/vbm/themes/base/ContainerBase.less +45 -0
  87. package/src/sap/ui/vbm/themes/base/ContainerLegendItem.less +46 -0
  88. package/src/sap/ui/vbm/themes/base/ListPanel.less +43 -0
  89. package/src/sap/ui/vbm/themes/base/ListPanelStack.less +30 -0
  90. package/src/sap/ui/vbm/themes/base/MapContainer.less +210 -0
  91. package/src/sap/ui/vbm/themes/base/fonts/map-container.eot +0 -0
  92. package/src/sap/ui/vbm/themes/base/fonts/map-container.svg +13 -0
  93. package/src/sap/ui/vbm/themes/base/fonts/map-container.ttf +0 -0
  94. package/src/sap/ui/vbm/themes/base/fonts/map-container.woff +0 -0
  95. package/src/sap/ui/vbm/themes/base/library.source.less +5 -0
@@ -0,0 +1,799 @@
1
+ /*!
2
+ * SAP UI development toolkit for HTML5 (SAPUI5) (c) Copyright 2009-2012 SAP AG. All rights reserved
3
+ */
4
+
5
+ // Provides control sap.ui.vbm.ContainerBase.
6
+ sap.ui.define([
7
+ "./library",
8
+ "sap/ui/core/Control",
9
+ "sap/ui/core/IconPool",
10
+ "sap/ui/core/Popup",
11
+ "sap/ui/core/ResizeHandler",
12
+ "sap/ui/core/delegate/ScrollEnablement",
13
+ "sap/ui/Device",
14
+ "sap/m/library",
15
+ "sap/m/Label",
16
+ "sap/m/OverflowToolbar",
17
+ "sap/m/OverflowToolbarButton",
18
+ "sap/m/Button",
19
+ "sap/m/OverflowToolbarToggleButton",
20
+ "sap/m/ToggleButton",
21
+ "sap/m/SegmentedButton",
22
+ "sap/m/SegmentedButtonItem",
23
+ "sap/m/ToolbarSpacer",
24
+ "sap/m/OverflowToolbarLayoutData",
25
+ "./ContainerBaseRenderer",
26
+ "./MapContainerButtonType",
27
+ "./getResourceBundle",
28
+ "sap/base/util/uid",
29
+ "sap/base/Log"
30
+ ], function(
31
+ vkLibrary,
32
+ Control,
33
+ IconPool,
34
+ Popup,
35
+ ResizeHandler,
36
+ ScrollEnablement,
37
+ Device,
38
+ mobileLibrary,
39
+ Label,
40
+ OverflowToolbar,
41
+ OverflowToolbarButton,
42
+ Button,
43
+ OverflowToolbarToggleButton,
44
+ ToggleButton,
45
+ SegmentedButton,
46
+ SegmentedButtonItem,
47
+ ToolbarSpacer,
48
+ OverflowToolbarLayoutData,
49
+ ContainerBaseRenderer,
50
+ MapContainerButtonType,
51
+ getResourceBundle,
52
+ uid,
53
+ Log
54
+ ) {
55
+ "use strict";
56
+
57
+ /**
58
+ * Abstract Constructor for a new Container.
59
+ *
60
+ * @param {string} [sId] id for the new control, generated automatically if no id is given
61
+ * @param {object} [mSettings] initial settings for the new control
62
+ * @class Abstract Constructor for a new Container.
63
+ * @extends sap.ui.core.Control
64
+ * @author SAP SE
65
+ * @constructor
66
+ * @public
67
+ * @alias sap.ui.vbm.ContainerBase
68
+ * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
69
+ * @since 1.38.0
70
+ */
71
+ var ContainerBase = Control.extend("sap.ui.vbm.ContainerBase", /** @lends sap.ui.vbm.ContainerBase.prototype */ {
72
+ metadata: {
73
+
74
+ library: "sap.ui.vbm",
75
+ properties: {
76
+ /**
77
+ * Show fullscreen toggle button in toolbar
78
+ */
79
+ "showFullScreen": {
80
+ type: "boolean",
81
+ group: "Misc",
82
+ defaultValue: true
83
+ },
84
+ /**
85
+ * Show settings button in toolbar
86
+ */
87
+ "showSettings": {
88
+ type: "boolean",
89
+ group: "Misc",
90
+ defaultValue: true
91
+ },
92
+ /**
93
+ * Show selection button in toolbar
94
+ */
95
+ "showSelection": {
96
+ type: "boolean",
97
+ group: "Misc",
98
+ defaultValue: true
99
+ },
100
+ /**
101
+ * Controls whether the control is show fullscreen or embedded
102
+ */
103
+ "fullScreen": {
104
+ type: "boolean",
105
+ group: "Misc",
106
+ defaultValue: false
107
+ },
108
+ /**
109
+ * Title to show in toolbar
110
+ */
111
+ "title": {
112
+ type: "string",
113
+ group: "Misc",
114
+ defaultValue: ""
115
+ },
116
+ "autoAdjustHeight": {
117
+ type: "boolean",
118
+ group: "Misc",
119
+ defaultValue: false
120
+ }
121
+ },
122
+ defaultAggregation: "content",
123
+ aggregations: {
124
+ /**
125
+ * Content Aggregation.
126
+ */
127
+ content: {
128
+ type: "sap.ui.vbm.ContainerContent",
129
+ multiple: true,
130
+ singularName: "content"
131
+ },
132
+ /**
133
+ * Toolbar aggregation
134
+ */
135
+ "toolbar": {
136
+ type: "sap.m.Toolbar",
137
+ multiple: false,
138
+ visibility: "hidden"
139
+ }
140
+ },
141
+ associations: {
142
+ /**
143
+ * Association to controls / ids which describe this control (see WAI-ARIA attribute aria-describedby).
144
+ */
145
+ ariaDescribedBy: { type: "sap.ui.core.Control", multiple: true, singularName: "ariaDescribedBy" },
146
+
147
+ /**
148
+ * Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledBy).
149
+ */
150
+ ariaLabelledBy: { type: "sap.ui.core.Control", multiple: true, singularName: "ariaLabelledBy" }
151
+ },
152
+ events: {
153
+ "contentChange": {
154
+ parameters: {
155
+ selectedItemId: "string"
156
+ }
157
+ },
158
+ "settingsPressed": {}
159
+ },
160
+
161
+ renderer: ContainerBaseRenderer
162
+ }
163
+ });
164
+
165
+ // ...........................................................................//
166
+ // This file defines behavior for the control,...............................//
167
+ // ...........................................................................//
168
+ // Public API functions
169
+ // ............................................................................//
170
+
171
+ /**
172
+ * default Content could be defined in application
173
+ *
174
+ * @param {sap.ui.vbm.ContainerContent} oContent the content to be visible; involves re-rendering
175
+ * @returns {void}
176
+ * @public
177
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
178
+ */
179
+ ContainerBase.prototype.switchContent = function(oContent) {
180
+ this.setSelectedContent(oContent);
181
+ // fire the change event with id of the newly selected item..
182
+ this.rerender();// invalidate();
183
+ };
184
+
185
+ /**
186
+ * update container to allow dynamic change button layout
187
+ *
188
+ * @returns {void}
189
+ * @public
190
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
191
+ */
192
+ ContainerBase.prototype.updateContainer = function() {
193
+ this._contentChanged = true;
194
+ this.rerender();
195
+ };
196
+
197
+ /**
198
+ * set selected content
199
+ *
200
+ * @param {sap.ui.vbm.ContainerContent} oContent the selected content; involves no re-rendering
201
+ * @returns {void}
202
+ * @public
203
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
204
+ */
205
+ ContainerBase.prototype.setSelectedContent = function(oContent) {
206
+ this._oSelectedContent = oContent;
207
+ };
208
+
209
+ /**
210
+ * get selected content
211
+ *
212
+ * @returns {sap.ui.vbm.ContainerContent} the currently selected content container
213
+ * @public
214
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
215
+ */
216
+ ContainerBase.prototype.getSelectedContent = function() {
217
+ return this._oSelectedContent;
218
+ };
219
+
220
+ // ........................................................................//
221
+ // Implementation of UI5 Interface functions
222
+ // ........................................................................//
223
+
224
+ ContainerBase.prototype.init = function() {
225
+ this._selectionState = "SINGLE";
226
+ this._firstTime = true;
227
+ this._aContentIcons = [];
228
+ this._selectedContent = null;
229
+ this._oSelectedContent = null;
230
+ this._bSegmentedButtonSaveSelectState = false;
231
+ this._oMenu = null;
232
+ this._customButtons = [];
233
+
234
+ // Right side..
235
+ var oLayoutData = new OverflowToolbarLayoutData({
236
+ priority: sap.m.OverflowToolbarPriority.High
237
+ });
238
+ var buttonType = sap.m.ButtonType.Transparent;
239
+
240
+ // Full screen button
241
+ this._oFullScreenButton = new OverflowToolbarButton({
242
+ layoutData: oLayoutData,
243
+ type: buttonType,
244
+ icon: "sap-icon://full-screen",
245
+ text: getResourceBundle().getText("CONTAINERBASE_FULLSCREEN"),
246
+ tooltip: getResourceBundle().getText("CONTAINERBASE_FULLSCREEN"),
247
+ press: function() {
248
+ this._bSegmentedButtonSaveSelectState = true;
249
+ this._toggleFullScreen();
250
+ }.bind(this)
251
+ });
252
+
253
+ // Settings button
254
+ this._oSettingsButton = new OverflowToolbarButton({
255
+ layoutData: oLayoutData.clone(),
256
+ type: buttonType,
257
+ icon: "sap-icon://action-settings",
258
+ text: getResourceBundle().getText("CONTAINERBASE_SETTINGS"),
259
+ tooltip: getResourceBundle().getText("CONTAINERBASE_SETTINGS"),
260
+ press: function() {
261
+ this._bSegmentedButtonSaveSelectState = true;
262
+ this.fireSettingsPressed();
263
+ }.bind(this)
264
+ });
265
+
266
+ // Selection buttons
267
+ this._oSelectionButtonSingle = new SegmentedButtonItem({
268
+ icon: "sap-icon://map-container/selection-single",
269
+ tooltip: getResourceBundle().getText("CONTAINERBASE_MENU_SINGLE"),
270
+ press: this._handleSelection.bind(this, "SINGLE")
271
+ });
272
+
273
+ this._oSelectionButtonRectangle = new SegmentedButtonItem({
274
+ icon: "sap-icon://map-container/selection-rectangle",
275
+ tooltip: getResourceBundle().getText("CONTAINERBASE_MENU_RECT"),
276
+ press: this._handleSelection.bind(this, "RECT")
277
+ });
278
+
279
+ this._oSelectionButtonLasso = new SegmentedButtonItem({
280
+ icon: "sap-icon://map-container/selection-lasso",
281
+ tooltip: getResourceBundle().getText("CONTAINERBASE_MENU_LASSO"),
282
+ press: this._handleSelection.bind(this, "LASSO")
283
+ });
284
+
285
+ this._selectionMenu = new SegmentedButton({
286
+ items: [
287
+ this._oSelectionButtonSingle,
288
+ this._oSelectionButtonRectangle,
289
+ this._oSelectionButtonLasso
290
+ ]
291
+ });
292
+ // Popup for container content
293
+ this._oPopup = new Popup({
294
+ modal: true,
295
+ shadow: false,
296
+ autoClose: false
297
+ });
298
+
299
+ // segmentedButton for for multiple content entries
300
+ this._oContentSegmentedButton = new SegmentedButton({
301
+ layoutData: oLayoutData.clone(),
302
+ select: this._onContentButtonSelect.bind(this)
303
+ });
304
+
305
+ // Left side...
306
+ // display title
307
+ this._oContTitle = new Label();
308
+
309
+ // toolbar
310
+ this._oToolbar = new OverflowToolbar({
311
+ // Use ToolbarDesign.Auto
312
+ width: "auto"
313
+ }).addStyleClass("sapUiVkContainerBaseToolbar");
314
+ this.setAggregation("toolbar", this._oToolbar);
315
+
316
+ this.sResizeListenerId = null;
317
+ if (Device.system.desktop) {
318
+ this.sResizeListenerId = ResizeHandler.register(this, jQuery.proxy(this._performHeightChanges, this));
319
+ } else {
320
+ Device.orientation.attachHandler(this._performHeightChanges, this);
321
+ Device.resize.attachHandler(this._performHeightChanges, this);
322
+ }
323
+
324
+ // Adding new icons to the IconPool
325
+ var mapContainerIcons = [{
326
+ name: "selection-lasso",
327
+ unicode: "E000"
328
+ }, {
329
+ name: "selection-rectangle",
330
+ unicode: "E001"
331
+ }, {
332
+ name: "selection-single",
333
+ unicode: "E002"
334
+ }],
335
+ collectionName = "map-container",
336
+ fontFamily = "map-container";
337
+
338
+ mapContainerIcons.forEach(function(icon) {
339
+ IconPool.addIcon(icon.name, collectionName, fontFamily, icon.unicode);
340
+ });
341
+ };
342
+
343
+ ContainerBase.prototype.exit = function() {
344
+ if (this._oFullScreenButton) {
345
+ this._oFullScreenButton.destroy();
346
+ this._oFullScreenButton = undefined;
347
+ }
348
+ if (this._oPopup) {
349
+ this._oPopup.destroy();
350
+ this._oPopup = undefined;
351
+ }
352
+ if (this._oContentSegmentedButton) {
353
+ this._oContentSegmentedButton.destroy();
354
+ this._oContentSegmentedButton = undefined;
355
+ }
356
+ if (this._oSelectedContent) {
357
+ this._oSelectedContent.destroy();
358
+ this._oSelectedContent = undefined;
359
+ }
360
+ if (this._oToolbar) {
361
+ this._oToolbar.destroy();
362
+ this._oToolbar = undefined;
363
+ }
364
+ if (Device.system.desktop && this.sResizeListenerId) {
365
+ ResizeHandler.deregister(this.sResizeListenerId);
366
+ this.sResizeListenerId = null;
367
+ } else {
368
+ Device.orientation.detachHandler(this._performHeightChanges, this);
369
+ Device.resize.detachHandler(this._performHeightChanges, this);
370
+ }
371
+ };
372
+
373
+ /**
374
+ * set FullScreen - default is normal mode, but app can call this method to set the default to full screen
375
+ *
376
+ * @param {boolean} bFullScreen Fullscreen mode on or off
377
+ * @returns {void}
378
+ * @public
379
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
380
+ */
381
+ ContainerBase.prototype.setFullScreen = function(bFullScreen) {
382
+ if (this._firstTime) {
383
+ // can't set the full screen and toggle since dom is not loaded yet
384
+ return;
385
+ }
386
+ if (this.getFullScreen() == bFullScreen) { // check setter is overridden, if not, no need to set the property
387
+ return;
388
+ }
389
+ var fullScreen = this.getProperty("fullScreen");
390
+ if (fullScreen !== bFullScreen) {
391
+ this._toggleFullScreen();
392
+ }
393
+ };
394
+
395
+ ContainerBase.prototype.onAfterRendering = function() {
396
+ var that = this;
397
+ if ((this.sResizeListenerId === null) && (Device.system.desktop)) {
398
+ this.sResizeListenerId = ResizeHandler.register(this, jQuery.proxy(this._performHeightChanges, this));
399
+ }
400
+ if (this.getAutoAdjustHeight() || this.getFullScreen()) {
401
+ // fix the flickering issue when switch chart in full screen mode
402
+ setTimeout(function() {
403
+ that._performHeightChanges();
404
+ }, 500);
405
+ }
406
+ this._firstTime = false;
407
+ if (this.getSelectedContent() !== null) {
408
+ var control = this.getSelectedContent().getContent();
409
+ if (control instanceof sap.ui.vbm.GeoMap || control instanceof sap.ui.vbm.AnalyticMap) {
410
+ if (this.getShowSelection()) {
411
+ if (this._selectionState === "LASSO") {
412
+ control.setLassoSelection(true);
413
+ } else if (this._selectionState === "RECT") {
414
+ control.setRectangularSelection(true);
415
+ } else if (this._selectionState === "SINGLE") {
416
+ control.setRectangularSelection(false);
417
+ control.setLassoSelection(false);
418
+ }
419
+ }
420
+ }
421
+ }
422
+ };
423
+
424
+ ContainerBase.prototype.onBeforeRendering = function() {
425
+ var that = this;
426
+ if (that._contentChanged) {
427
+ that._contentChange();
428
+ }
429
+
430
+ // Before destroying the toolbar, collect the button toggled states and update the data
431
+ that._oToolbar.getContent().forEach(function(element) {
432
+ var customButtonId = element.getId();
433
+ var isPressed = element["getPressed"] ? element.getPressed() : null;
434
+ for (var i in that._customButtons) {
435
+ if (that._customButtons[i].button && that._customButtons[i].button.getId() == customButtonId) {
436
+ that._customButtons[i].toggled = isPressed;
437
+ }
438
+ }
439
+ });
440
+
441
+ // re-populate toolbar content according to current settings
442
+ that._oToolbar.removeAllContent();
443
+ that._addToolbarContent();
444
+ };
445
+
446
+ /**
447
+ * Display title
448
+ *
449
+ * @param {string} sValue the title
450
+ * @returns {void}
451
+ * @public
452
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
453
+ */
454
+ ContainerBase.prototype.setTitle = function(sValue) {
455
+ this._oContTitle.setText(sValue);
456
+ this.setProperty("title", sValue, true);
457
+ };
458
+
459
+ /**
460
+ * add container content - map, table..
461
+ *
462
+ * @param {sap.ui.vbm.ContainerContent} oObject content object to add
463
+ * @returns {void}
464
+ * @public
465
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
466
+ */
467
+ ContainerBase.prototype.addContent = function(oObject) {
468
+ this.addAggregation("content", oObject);
469
+ this._contentChanged = true;
470
+ };
471
+
472
+ /**
473
+ * insert container content - map, table..
474
+ *
475
+ * @param {sap.ui.vbm.ContainerContent} oObject content object to insert
476
+ * @param {int} iIndex index in the content aggregation where to insert the new content object
477
+ * @returns {void}
478
+ * @public
479
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
480
+ */
481
+ ContainerBase.prototype.insertContent = function(oObject, iIndex) {
482
+ this.insertAggregation("content", oObject, iIndex);
483
+ this._contentChanged = true;
484
+ };
485
+
486
+ /**
487
+ * update chartcontainer content
488
+ */
489
+ ContainerBase.prototype.updateContent = function() {
490
+ this.updateAggregation("content");
491
+ this._contentChanged = true;
492
+ };
493
+
494
+ // ...............................................................................
495
+ // Internal functions
496
+ // ...............................................................................
497
+
498
+ /**
499
+ * Toggle normal and full screen mode
500
+ *
501
+ * @private
502
+ */
503
+ ContainerBase.prototype._toggleFullScreen = function() {
504
+ var fullScreen = this.getProperty("fullScreen");
505
+ var sId;
506
+ var sHeight;
507
+ var oContent;
508
+ if (fullScreen) {
509
+ this._closeFullScreen();
510
+ this.setProperty("fullScreen", false, true);
511
+ oContent = this.getSelectedContent().getContent();
512
+ sId = oContent.getId();
513
+ oContent.setWidth("100%");
514
+ sHeight = this._contentHeight[sId];
515
+ if (sHeight) {
516
+ oContent.setHeight(sHeight);
517
+ }
518
+ this.invalidate();
519
+ } else {
520
+ var aObjects = this.getAggregation("content");
521
+ this._contentHeight = {};
522
+ if (aObjects) {
523
+ for (var i = 0; i < aObjects.length; i++) {
524
+ oContent = aObjects[i].getContent();
525
+ sId = oContent.getId();
526
+ if (jQuery.isFunction(oContent.getHeight)) {
527
+ sHeight = oContent.getHeight();
528
+ } else {
529
+ sHeight = 0;
530
+ }
531
+ this._contentHeight[sId] = sHeight;
532
+ }
533
+ }
534
+ // fix content disappear when toggle content with full screen button
535
+ // by suppressing the invalid for the setProperty, this delay shouldn't be needed.
536
+ this._openFullScreen(true);
537
+ this.setProperty("fullScreen", true, true);
538
+ }
539
+ var sIcon = (fullScreen ? "sap-icon://full-screen" : "sap-icon://exit-full-screen");
540
+ this._oFullScreenButton.setIcon(sIcon);
541
+ this._oFullScreenButton.focus();
542
+ };
543
+
544
+ /**
545
+ * Open Container content with Full Screen
546
+ *
547
+ * @param {boolean} bNeedsScroll add scrolling to full screen display
548
+ * @private
549
+ */
550
+ ContainerBase.prototype._openFullScreen = function(bNeedsScroll) {
551
+ if ((bNeedsScroll !== null) && (bNeedsScroll === true)) {
552
+ this._oScrollEnablement = new ScrollEnablement(this, this.getId() + "-wrapper", {
553
+ horizontal: true,
554
+ vertical: true
555
+ });
556
+ }
557
+ this.$content = this.$();
558
+ if (this.$content) {
559
+ this.$tempNode = jQuery("<div></div>"); // id='" + this.$content.attr("id")+"-overlay"+ "'
560
+ this.$content.before(this.$tempNode);
561
+ this._$overlay = jQuery("<div id='" + uid() + "'></div>");
562
+ this._$overlay.addClass("sapUiVkContainerBaseOverlay");
563
+ this._$overlay.append(this.$content);
564
+ this._oPopup.setContent(this._$overlay);
565
+ } else {
566
+ Log.warning("Overlay: content does not exist or contains more than one child");
567
+ }
568
+ this._oPopup.open(200, undefined, undefined, jQuery("body"));
569
+ };
570
+
571
+ /**
572
+ * Close Full Screen and return to normal mode
573
+ */
574
+ ContainerBase.prototype._closeFullScreen = function() {
575
+ if (this._oScrollEnablement !== null) {
576
+ this._oScrollEnablement.destroy();
577
+ this._oScrollEnablement = null;
578
+ }
579
+ this.$tempNode.replaceWith(this.$content);
580
+ this._oToolbar.setDesign(sap.m.ToolbarDesign.Auto);
581
+ this._oPopup.close();
582
+ this._$overlay.remove();
583
+ };
584
+
585
+ /**
586
+ * Height change when toggle full and normal model mobile swap between portrait and Landscape will execute height change too
587
+ */
588
+ ContainerBase.prototype._performHeightChanges = function() {
589
+ if (this.getAutoAdjustHeight() || this.getFullScreen()) {
590
+ var $this = this.$();
591
+ // Only adjust height after both toolbar and content area are rendered in DOM
592
+ if (($this.find(".sapUiVkContainerBaseToolbarArea").children()[0]) && ($this.find(".sapUiVkContainerBaseContentArea").children()[0])) {
593
+ // var iContainerHeight = $this.height();
594
+ // var iToolbarHeight = $this.find('.sapUiVkContainerBaseToolbarArea').children()[0].clientHeight;
595
+ // var iToolbarBottomBorder = Math.round(parseFloat($this.find('.sapUiVkContainerBaseToolbarArea').children().css("border-bottom")));
596
+ // var iNewHeight = iContainerHeight - iToolbarHeight - iToolbarBottomBorder;
597
+ // var iExisitngHeight = $this.find('.sapUiVkContainerBaseContentArea').children()[0].clientHeight;
598
+ var oinnerContent = this.getSelectedContent().getContent();
599
+ if (oinnerContent.getDomRef().offsetWidth !== this.getDomRef().clientWidth) {
600
+ // For table/non-vizFrame case, if width changes during resize event, force a rerender to have it fit 100% width
601
+ this.rerender();
602
+ }
603
+ }
604
+ }
605
+ };
606
+
607
+ /**
608
+ * Switch Content
609
+ *
610
+ * @param {string} sContentId id of the content object
611
+ * @private
612
+ */
613
+ ContainerBase.prototype._switchContent = function(sContentId) {
614
+
615
+ var oContent = this._findContentById(sContentId);
616
+
617
+ this.setSelectedContent(oContent);
618
+
619
+ this.fireContentChange({
620
+ selectedItemId: sContentId
621
+ }); // fire the change event with id of the newly selected item..
622
+ this.rerender();// invalidate();
623
+ };
624
+
625
+ /**
626
+ * collect all content and repopulate content segmented button
627
+ */
628
+ ContainerBase.prototype._contentChange = function() {
629
+ var aContent = this.getContent();
630
+ // remove and destroy all buttons for old content
631
+ this._oContentSegmentedButton.removeAllButtons();
632
+ this._destroyButtons(this._aContentIcons);
633
+
634
+ this._aContentIcons = [];
635
+ if (aContent.length === 0) {
636
+ this._oContentSegmentedButton.removeAllButtons();
637
+ this._setDefaultOnSegmentedButton();
638
+ this.switchContent(null);
639
+ }
640
+ if (aContent) {
641
+ for (var i = 0; i < aContent.length; i++) {
642
+ var innerContent = aContent[i].getContent();
643
+ if (innerContent.setWidth) {
644
+ innerContent.setWidth("100%");
645
+ }
646
+ var oButton = new SegmentedButtonItem({
647
+ icon: aContent[i].getIcon(),
648
+ tooltip: aContent[i].getTitle(),
649
+ key: innerContent.getId()
650
+ });
651
+ this._aContentIcons.push(oButton);
652
+ this._oContentSegmentedButton.addItem(oButton);
653
+ if (i === 0) {
654
+ this.setSelectedContent(aContent[i]);
655
+ }
656
+ }
657
+ }
658
+
659
+ this._contentChanged = false;
660
+ };
661
+
662
+ ContainerBase.prototype._onContentButtonSelect = function(oEvent) {
663
+ var sContentId = oEvent.getParameter("key");
664
+ this._switchContent(sContentId);
665
+ };
666
+
667
+ /**
668
+ * get content to display by id
669
+ *
670
+ * @param {string} sId id of the content object
671
+ * @returns {sap.ui.vbm.ContainerContent} content object found for given id
672
+ */
673
+ ContainerBase.prototype._findContentById = function(sId) {
674
+ var aContent = null;
675
+ var aObjects = this.getAggregation("content");
676
+ if (aObjects) {
677
+ for (var i = 0; !aContent && i < aObjects.length; i++) {
678
+ if (aObjects[i].getContent().getId() === sId) {
679
+ aContent = aObjects[i];
680
+ }
681
+ }
682
+ }
683
+ return aContent;
684
+ };
685
+
686
+ /**
687
+ * adjusts customizable buttons of overflow toolbar, displays content buttons
688
+ * @protected
689
+ */
690
+ ContainerBase.prototype._addToolbarContent = function() {
691
+ this._oToolbar.addContent(new ToolbarSpacer()); // right align remaining content
692
+
693
+ if (this._aContentIcons.length > 1) {
694
+ this._oToolbar.addContent(this._oContentSegmentedButton);
695
+ }
696
+
697
+ if (this.getSelectedContent() !== null) {
698
+ var control = this.getSelectedContent().getContent();
699
+ if (control instanceof sap.ui.vbm.GeoMap || control instanceof sap.ui.vbm.AnalyticMap) {
700
+ if (this.getShowSelection()) {
701
+ this._oToolbar.addContent(this._selectionMenu);
702
+ }
703
+ }
704
+ }
705
+
706
+ this._customButtons.forEach(function(item) {
707
+ if (item.visible) {
708
+ var settings = {
709
+ type: sap.m.ButtonType.Transparent,
710
+ layoutData: new OverflowToolbarLayoutData({ priority: sap.m.OverflowToolbarPriority.High })
711
+ };
712
+ if ("active" in item) {
713
+ settings.enabled = item.active;
714
+ }
715
+ if ("icon" in item) {
716
+ settings.icon = item.icon;
717
+ }
718
+ if ("activeIcon" in item) {
719
+ settings.activeIcon = item.activeIcon;
720
+ }
721
+ if ("text" in item) {
722
+ settings.text = item.text;
723
+ }
724
+ if ("tooltip" in item) {
725
+ settings.tooltip = item.tooltip;
726
+ }
727
+ if ("press" in item) {
728
+ settings.press = item.press;
729
+ }
730
+
731
+ switch (item.type) { // supports "click" and "toggle" types only for now
732
+ case MapContainerButtonType.Click:
733
+ item.button = item.overflow ? new OverflowToolbarButton(settings) : new Button(settings);
734
+ break;
735
+ default:
736
+ if ("toggled" in item) {
737
+ settings.pressed = item.toggled;
738
+ }
739
+ item.button = item.overflow ? new OverflowToolbarToggleButton(settings) : new ToggleButton(settings);
740
+ break;
741
+ }
742
+ this._oToolbar.addContent(item.button);
743
+ }
744
+ }, this);
745
+
746
+ if (this.getShowSettings()) {
747
+ this._oToolbar.addContent(this._oSettingsButton);
748
+ }
749
+ if (!Device.system.phone && this.getShowFullScreen()) {
750
+ this._oToolbar.addContent(this._oFullScreenButton);
751
+ }
752
+ };
753
+
754
+ /**
755
+ * The first button inside the segmented button is only set as default if the user did not click explicitly on another button inside the segmented
756
+ * button
757
+ *
758
+ * @private
759
+ */
760
+ ContainerBase.prototype._setDefaultOnSegmentedButton = function() {
761
+ if (!this._bSegmentedButtonSaveSelectState) {
762
+ this._oContentSegmentedButton.setSelectedButton(null);
763
+ }
764
+ this._bSegmentedButtonSaveSelectState = false;
765
+ };
766
+
767
+ /**
768
+ * Buttons which are not needed anymore are destroyed here.
769
+ *
770
+ * @param {array} buttons The buttons which need to be destroyed.
771
+ * @private
772
+ */
773
+ ContainerBase.prototype._destroyButtons = function(buttons) {
774
+ buttons.forEach(function(oButton) {
775
+ oButton.destroy();
776
+ });
777
+ };
778
+
779
+ ContainerBase.prototype._handleSelection = function(mode) {
780
+ var control = this.getSelectedContent().getContent();
781
+ if (control instanceof sap.ui.vbm.GeoMap || control instanceof sap.ui.vbm.AnalyticMap) {
782
+ if (mode === "LASSO") {
783
+ control.setLassoSelection(true);
784
+ this._selectionState = mode;
785
+ } else if (mode === "RECT") {
786
+ control.setRectangularSelection(true);
787
+ this._selectionState = mode;
788
+ } else if (mode === "SINGLE") {
789
+ control.setRectangularSelection(false);
790
+ control.setLassoSelection(false);
791
+ this._selectionState = mode;
792
+ }
793
+ }
794
+
795
+ };
796
+
797
+ return ContainerBase;
798
+
799
+ });