Samples / Controls / sap.f

Shell Bar with title mega menu

Shell Bar example showing the control title as part of a mega menu, configurable by the app developer.

Class
z2ui5_cl_smpc_app_110
Repository
abap2UI5/samples-controls
Ports
sap.f.sample.ShellBar
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.m.Menu, sap.m.MenuItem, sap.ui.core.mvc.View

The class

" @keywords shellbar shell bar sap.f application header menu menuitem avatar
" @summary Shell Bar example showing the control title as part of a mega menu, configurable by the app developer.
" @origin sap.f.sample.ShellBar - https://sdk.openui5.org/entity/sap.f.ShellBar/sample/sap.f.sample.ShellBar (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_110 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_110 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`     v = `sap.f`
        )->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
        )->a( n = `xmlns:m`   v = `sap.m`
        )->a( n = `xmlns:l`   v = `sap.ui.layout`
        )->a( n = `height`    v = `100%`

        )->ele( `ShellBar`
            )->a( n = `title`               v = `Application Title`
            )->a( n = `secondTitle`         v = `Short description`
            )->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 = `showNotifications`   v = `true`
            )->a( n = `notificationsNumber` v = `2`

            )->ele( `menu`
                )->ele( n = `Menu` ns = `m`
                    )->tag( n = `MenuItem` ns = `m`
                        )->a( n = `text` v = `Flight booking`
                        )->a( n = `icon` v = `sap-icon://flight`
                    )->tag( n = `MenuItem` ns = `m`
                        )->a( n = `text` v = `Car rental`
                        )->a( n = `icon` v = `sap-icon://car-rental`

                )->end(
            )->end(
            )->ele( `profile`
                )->tag( n = `Avatar` ns = `m`
                    )->a( n = `initials` v = `UI` ).

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

  ENDMETHOD.

ENDCLASS.