예제 #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());
        }
예제 #2
0
        // Errors Pressed
        public void onMessagePopoverPress([email protected] oEvent, object oData)
        {
            if (this.byId <sap.m.MessagePopover>("errorMessagePopover") == null)
            {
                sap.m.MessagePopover oMessagePopover = new sap.m.MessagePopover(oView.createId("errorMessagePopover"), new sap.m.MessagePopover.Settings()
                {
                    placement = sap.m.VerticalPlacementType.Bottom,
                    items     = new [email protected]()
                    {
                        path    = "alerts>/alerts/errors",
                        factory = this._createError
                    },
                    afterClose = ([email protected] <sap.m.AfterOpenCloseBeforeInfo> ev, object data) => {
                        ev.getSource().destroy();
                    }
                });

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

                // forward compact/cozy style into dialog
                jQuery.sap.syncStyleClass(oView.getController <AppController>().getOwnerComponent <Component>().getContentDensityClass(), oView, oMessagePopover);
                oMessagePopover.openBy(oEvent.getSource <sap.ui.core.Control>());
            }
        }
예제 #3
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());
        }