Samples / Controls / sap.m

Segmented Button in Input List Item

Segmented Button used in Input List Item component

Class
z2ui5_cl_smpc_app_391
Repository
abap2UI5/samples-controls
Ports
sap.m.sample.SegmentedButtonLI
UI5 libraries
sap.m, sap.ui.core
Lowest UI5 release
1.71
In the browser
Runs in the playground
Controls it builds
sap.m.InputListItem, sap.m.List, sap.m.SegmentedButton, sap.m.SegmentedButtonItem, sap.ui.core.mvc.View

The class

" @keywords segmentedbutton segmented button sap.m segmentedbuttonli list inputlistitem segmentedbuttonitem
" @summary Segmented Button used in Input List Item component
" @origin sap.m.sample.SegmentedButtonLI - https://sdk.openui5.org/entity/sap.m.SegmentedButton/sample/sap.m.sample.SegmentedButtonLI (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_391 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_391 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.m`

        )->ele( `List`
            )->a( n = `headerText` v = `Input List Item`

            )->ele( `InputListItem`
                )->a( n = `label` v = `Battery Saving`

                )->ele( `SegmentedButton`
                    )->a( n = `selectedKey` v = `SBYes`

                    )->ele( `items`
                        )->tag( `SegmentedButtonItem`
                            )->a( n = `text` v = `High`
                            )->a( n = `key`  v = `SBYes`
                        )->tag( `SegmentedButtonItem`
                            )->a( n = `text` v = `Low`
                        )->tag( `SegmentedButtonItem`
                            )->a( n = `text` v = `Off` ).

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

  ENDMETHOD.

ENDCLASS.