Samples / Controls / sap.f

Shell Bar with menu button

Shell Bar example with a menu button and a plain title.

Class
z2ui5_cl_smpc_app_152
Repository
abap2UI5/samples-controls
Ports
sap.f.sample.ShellBarWithMenuButton
UI5 libraries
sap.f, sap.m, sap.ui.core
Lowest UI5 release
1.73
In the browser
Runs in the playground
Controls it builds
sap.f.ShellBar, sap.m.Avatar, sap.ui.core.mvc.View

The class

" @keywords shellbar shell bar sap.f menu button avatar
" @summary Shell Bar example with a menu button and a plain title.
" @origin sap.f.sample.ShellBarWithMenuButton - https://sdk.openui5.org/entity/sap.f.ShellBar/sample/sap.f.sample.ShellBarWithMenuButton (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_152 DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.

  PROTECTED SECTION.
    DATA client TYPE REF TO z2ui5_if_client.

    METHODS view_display.

  PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_smpc_app_152 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    me->client = client.
    IF client->check_on_navigated( ).
      view_display( ).
    ENDIF.

  ENDMETHOD.


  METHOD view_display.

    DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).

    view->ele( n = `View` ns = `mvc`
        )->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
        )->a( n = `xmlns`     v = `sap.f`
        )->a( n = `xmlns:m`   v = `sap.m`
        )->a( n = `xmlns:l`   v = `sap.ui.layout`
        )->a( n = `height`    v = `100%`

        )->ele( `ShellBar`
            )->a( n = `id`                  v = `sapFShellBarSample`
            )->a( n = `title`               v = `Application Title`
            )->a( n = `secondTitle`         v = `Short description`
            " homeIcon absolutized to the OpenUI5 host (original: ./resources/...)
            )->a( n = `homeIcon`            v = `https://sdk.openui5.org/resources/sap/ui/documentation/sdk/images/logo_sap.png`
            )->a( n = `showCopilot`         v = `true`
            )->a( n = `showSearch`          v = `true`
            )->a( n = `showMenuButton`      v = `true`
            )->a( n = `showNavButton`       v = `true`
            )->a( n = `showNotifications`   v = `true`
            )->a( n = `class`               v = `sapFShellBarFCLFPHeader`
            )->a( n = `notificationsNumber` v = `2`

            )->ele( `profile`
                " sap.m.Avatar is @since 1.73 - kept 1:1 (POST_171)
                )->tag( n = `Avatar` ns = `m`
                    )->a( n = `initials` v = `UI` ).

    client->view_display( view->stringify( ) ).

  ENDMETHOD.

ENDCLASS.