Ejemplo n.º 1
0
        /// <summary>
        /// Event handler for the notification button
        /// </summary>
        /// <param name="oEvent">the button press event</param>
        /// <param name="oData">not used</param>
        public void onNotificationPress([email protected] oEvent, object oData)
        {
            var oBundle = (jQuery.sap.util.ResourceBundle) this.getModel <sap.ui.model.resource.ResourceModel>("i18n").getResourceBundle();

            // close message popover
            sap.m.MessagePopover oMessagePopover = this.byId <sap.m.MessagePopover>("errorMessagePopover");
            if ((oMessagePopover != null) && oMessagePopover.isOpen())
            {
                oMessagePopover.destroy();
            }
            sap.m.Button oButton = new sap.m.Button(new sap.m.Button.Settings()
            {
                text  = oBundle.getText("notificationButtonText"),
                press = (([email protected] oEvt, object data) => {
                    sap.m.MessageToast.show("Show all Notifications was pressed");
                })
            });
            sap.m.ResponsivePopover oNotificationPopover = new sap.m.ResponsivePopover(oView.createId("notificationMessagePopover"), new sap.m.ResponsivePopover.Settings()
            {
                title        = oBundle.getText("notificationTitle"),
                contentWidth = "300px",
                endButton    = oButton,
                placement    = sap.m.PlacementType.Bottom,
                content      = new [email protected]()
                {
                    path    = "alerts>/alerts/notifications",
                    factory = this._createNotification
                },
                afterClose = ([email protected] <sap.m.CloseInfo> ev, object data) => {
                    ev.getSource().destroy();
                }
            });

            this.byId("app").addDependent(oNotificationPopover);

            // forward compact/cozy style into dialog
            jQuery.sap.syncStyleClass(oView.getController <AppController>().getOwnerComponent <Component>().getContentDensityClass(), oView, oNotificationPopover);
            oNotificationPopover.openBy(oEvent.getSource());
        }
Ejemplo n.º 2
0
        public void onUserNamePress([email protected] oEvent, object oData)
        {
            var oBundle = (jQuery.sap.util.ResourceBundle) this.getModel <sap.ui.model.resource.ResourceModel>("i18n").getResourceBundle();

            // close message popover
            sap.m.MessagePopover oMessagePopover = this.byId <sap.m.MessagePopover>("errorMessagePopover");
            if ((oMessagePopover != null) && oMessagePopover.isOpen())
            {
                oMessagePopover.destroy();
            }

            void fnHandleUserMenuItemPress([email protected] oEvt, object data)
            {
                sap.m.MessageToast.show(oEvt.getSource <sap.m.Button>().getText() + " was pressed");
            }

            sap.m.ActionSheet oActionSheet = new sap.m.ActionSheet(oView.createId("userMessageActionSheet"), new sap.m.ActionSheet.Settings()
            {
                title            = oBundle.getText("userHeaderTitle"),
                showCancelButton = false,
                buttons          = new sap.m.Button[] {
                    new sap.m.Button(new sap.m.Button.Settings()
                    {
                        text  = "User Settings",
                        type  = sap.m.ButtonType.Transparent,
                        press = fnHandleUserMenuItemPress
                    }),
                    new sap.m.Button(new sap.m.Button.Settings()
                    {
                        text  = "Online Guide",
                        type  = sap.m.ButtonType.Transparent,
                        press = fnHandleUserMenuItemPress
                    }),
                    new sap.m.Button(new sap.m.Button.Settings()
                    {
                        text  = "Feedback",
                        type  = sap.m.ButtonType.Transparent,
                        press = fnHandleUserMenuItemPress
                    }),
                    new sap.m.Button(new sap.m.Button.Settings()
                    {
                        text  = "Help",
                        type  = sap.m.ButtonType.Transparent,
                        press = fnHandleUserMenuItemPress
                    }),
                    new sap.m.Button(new sap.m.Button.Settings()
                    {
                        text  = "Logout",
                        type  = sap.m.ButtonType.Transparent,
                        press = fnHandleUserMenuItemPress
                    })
                },
                afterClose = ([email protected] ev, object d) => {
                    ev.getSource().destroy();
                }
            });

            // forward compact/cozy style into dialog
            jQuery.sap.syncStyleClass(oView.getController <AppController>().getOwnerComponent <Component>().getContentDensityClass(), oView, oActionSheet);
            oActionSheet.openBy(oEvent.getSource());
        }