github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/integration/testdata/TestKarmaIntegration/src/frontend/controller/App.controller.js (about)

     1  sap.ui.define([
     2     'sap/ui/core/mvc/Controller',
     3     'sap/m/MessageToast',
     4     'sap/ui/model/json/JSONModel'
     5  ], function (Controller, Toast, JSONModel) {
     6      'use strict';
     7      return Controller.extend('sap.ui.piper.controller.App', {
     8  
     9          onShowToast() {
    10              Toast.show('Opened Toast Message');
    11          },
    12  
    13          onShowDialog() {
    14              var oView = this.getView();
    15              var oDialog = oView.byId('demoDialog');
    16              // create dialog it doesn't already exist
    17              if (!oDialog) {
    18                  // create dialog via fragment factory
    19                  oDialog = sap.ui.xmlfragment(oView.getId(), 'sap.ui.piper.view.Dialog');
    20                  oDialog.setBeginButton(new sap.m.Button({
    21                      text: 'Close',
    22                      press: function() {
    23                          oDialog.close();
    24                      }
    25                  }));
    26                  oView.addDependent(oDialog);
    27              }
    28              
    29              // load from nodejs server
    30              var model = new JSONModel();
    31              model.loadData('data');
    32              this.getView().setModel(model);
    33  
    34              oDialog.open();
    35          }
    36      });
    37  });