Samples / Controls / sap.m

Placing a Title in OverflowToolbar/Toolbar

The sap.m.Title control can be used to place a title inside an OverflowToolbar/Toolbar.

Class
z2ui5_cl_smpc_app_395
Repository
abap2UI5/samples-controls
Ports
sap.m.sample.TitleToolBar
UI5 libraries
sap.m, sap.ui.core
Lowest UI5 release
1.71
In the browser
Runs in the playground
Controls it builds
sap.m.Button, sap.m.OverflowToolbar, sap.m.Title, sap.m.ToolbarSpacer, sap.ui.core.mvc.View

The class

" @keywords overflowtoolbar overflow toolbar sap.m titletoolbar title toolbarspacer button
" @summary The sap.m.Title control can be used to place a title inside an OverflowToolbar/Toolbar.
" @origin sap.m.sample.TitleToolBar - https://sdk.openui5.org/entity/sap.m.OverflowToolbar/sample/sap.m.sample.TitleToolBar (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_395 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_395 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 = `height`    v = `100%`
        )->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
        )->a( n = `xmlns`     v = `sap.m`

        )->ele( `OverflowToolbar`
            )->a( n = `design` v = `Transparent`
            )->a( n = `height` v = `3rem`

            )->tag( `Title`
                )->a( n = `text` v = `Title Only`

        )->end(

        )->ele( `OverflowToolbar`
            )->a( n = `design` v = `Transparent`
            )->a( n = `height` v = `3rem`

            )->tag( `Title`
                )->a( n = `text` v = `Title and Actions`
            )->tag( `ToolbarSpacer`
            )->tag( `Button`
                )->a( n = `icon` v = `sap-icon://group-2`
            )->tag( `Button`
                )->a( n = `icon` v = `sap-icon://action-settings` ).

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

  ENDMETHOD.

ENDCLASS.