Skip to content

Commit

Permalink
[INTERNAL] sap.m.Dialog: beginButton type change fixed for Quartz Light
Browse files Browse the repository at this point in the history
No matter what type of 'beginButton' or 'endButton' the user gave,
they were turned to 'Emphasized' and 'Transparent'. This is not
wanted for sap.m.Dialog, but wanted for other types of dialogs,
where we have control over the buttons.

Now the following  controls have their 'beginButton' emphasized
for all themes:
- sap.m.SelectDialog
- sap.m.TableSelectDialog

Change-Id: Iee2bb98657e2e509ec65dedba4be0c51a2372977
JIRA: BGSOFUIRODOPI-2080
  • Loading branch information
dimovpetar committed Aug 12, 2019
1 parent 504606d commit 1f421b0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
8 changes: 2 additions & 6 deletions src/sap.m/src/sap/m/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1546,21 +1546,17 @@ function(
};

Dialog.prototype.setBeginButton = function (oButton) {
var sTheme = Core.getConfiguration().getTheme();

if (oButton && oButton.isA("sap.m.Button") && sTheme.startsWith("sap_fiori_")) {
oButton.setType("Emphasized");
if (oButton && oButton.isA("sap.m.Button")) {
oButton.addStyleClass("sapMDialogBeginButton");
}

return this.setAggregation("beginButton", oButton);
};

Dialog.prototype.setEndButton = function (oButton) {
var sTheme = Core.getConfiguration().getTheme();

if (oButton && oButton.isA("sap.m.Button") && sTheme.startsWith("sap_fiori_")) {
oButton.setType("Transparent");
if (oButton && oButton.isA("sap.m.Button")) {
oButton.addStyleClass("sapMDialogEndButton");
}

Expand Down
3 changes: 3 additions & 0 deletions src/sap.m/src/sap/m/SelectDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function(
// shortcut for sap.m.ListMode
var ListMode = library.ListMode;

// shortcut for sap.m.ButtonType
var ButtonType = library.ButtonType;


/**
Expand Down Expand Up @@ -1012,6 +1014,7 @@ function(

if (!this._oOkButton) {
this._oOkButton = new Button(this.getId() + "-ok", {
type: ButtonType.Emphasized,
text: this.getConfirmButtonText() || this._oRb.getText("SELECT_CONFIRM_BUTTON"),
press: function () {
// attach the reset function to afterClose to hide the dialog changes from the end user
Expand Down
3 changes: 3 additions & 0 deletions src/sap.m/src/sap/m/TableSelectDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ sap.ui.define([
// shortcut for sap.m.ListMode
var ListMode = library.ListMode;

// shortcut for sap.m.ButtonType
var ButtonType = library.ButtonType;


/**
Expand Down Expand Up @@ -1015,6 +1017,7 @@ sap.ui.define([

if (!this._oOkButton) {
this._oOkButton = new Button(this.getId() + "-ok", {
type: ButtonType.Emphasized,
text: this.getConfirmButtonText() || this._oRb.getText("SELECT_CONFIRM_BUTTON"),
press: function () {
// attach the reset function to afterClose to hide the dialog changes from the end user
Expand Down
7 changes: 4 additions & 3 deletions src/sap.m/test/sap/m/demokit/sample/Dialog/C.controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
sap.ui.define([
'jquery.sap.global',
'sap/m/Button',
'sap/m/Dialog',
'sap/m/List',
'sap/m/StandardListItem',
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel'
], function(jQuery, Button, Dialog, List, StandardListItem, Controller, JSONModel) {
'sap/ui/model/json/JSONModel',
'sap/m/ButtonType'
], function(Button, Dialog, List, StandardListItem, Controller, JSONModel, ButtonType) {
"use strict";

return Controller.extend("sap.m.sample.Dialog.C", {
Expand Down Expand Up @@ -37,6 +37,7 @@ sap.ui.define([
}
}),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'OK',
press: function () {
this.pressDialog.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ sap.ui.define([
'sap/m/TextArea',
'sap/ui/core/mvc/Controller',
'sap/ui/layout/HorizontalLayout',
'sap/ui/layout/VerticalLayout'
], function(Button, Dialog, Label, MessageToast, Text, TextArea, Controller, HorizontalLayout, VerticalLayout) {
'sap/ui/layout/VerticalLayout',
'sap/m/ButtonType'
], function(Button, Dialog, Label, MessageToast, Text, TextArea, Controller, HorizontalLayout, VerticalLayout, ButtonType) {
"use strict";

var CController = Controller.extend("sap.m.sample.DialogConfirm.C", {
Expand All @@ -19,6 +20,7 @@ sap.ui.define([
type: 'Message',
content: new Text({ text: 'Are you sure you want to submit your shopping cart?' }),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'Submit',
press: function () {
MessageToast.show('Submit pressed!');
Expand Down Expand Up @@ -51,6 +53,7 @@ sap.ui.define([
})
],
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'Reject',
press: function () {
var sText = sap.ui.getCore().byId('rejectDialogTextarea').getValue();
Expand Down Expand Up @@ -90,6 +93,7 @@ sap.ui.define([
})
],
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'Submit',
enabled: false,
press: function () {
Expand Down Expand Up @@ -142,6 +146,7 @@ sap.ui.define([
})
],
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'Submit',
press: function () {
var sText = sap.ui.getCore().byId('confirmDialogTextarea').getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ sap.ui.define([
'sap/m/Button',
'sap/m/Dialog',
'sap/m/Text',
'sap/ui/core/mvc/Controller'
], function(Button, Dialog, Text, Controller) {
'sap/ui/core/mvc/Controller',
'sap/m/ButtonType'
], function(Button, Dialog, Text, Controller, ButtonType) {
"use strict";

var CController = Controller.extend("sap.m.sample.DialogMessage.C", {
Expand All @@ -16,6 +17,7 @@ sap.ui.define([
text: 'Build enterprise-ready web applications, responsive to all devices and running on the browser of your choice. That´s OpenUI5.'
}),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'OK',
press: function () {
dialog.close();
Expand All @@ -38,6 +40,7 @@ sap.ui.define([
text: 'The only error you can make is not even trying.'
}),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'OK',
press: function () {
dialog.close();
Expand All @@ -60,6 +63,7 @@ sap.ui.define([
text: 'Ruling the world is a time-consuming task. You will not have a lot of spare time.'
}),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'OK',
press: function () {
dialog.close();
Expand All @@ -82,6 +86,7 @@ sap.ui.define([
text: 'One of the keys to success is creating realistic goals that can be achieved in a reasonable amount of time.'
}),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'OK',
press: function () {
dialog.close();
Expand All @@ -104,6 +109,7 @@ sap.ui.define([
text: 'Dialog with value state Information.'
}),
beginButton: new Button({
type: ButtonType.Emphasized,
text: 'OK',
press: function () {
dialog.close();
Expand Down

0 comments on commit 1f421b0

Please sign in to comment.