Samples / Controls / sap.m

Flex Box - Gap, Row Gap & Column Gap

You can add gap between rows and columns.

Class
z2ui5_cl_smpc_app_158
Repository
abap2UI5/samples-controls
Ports
sap.m.sample.FlexBoxGap
UI5 libraries
sap.m, sap.ui.core
Lowest UI5 release
1.134
In the browser
Runs in the playground
Controls it builds
sap.m.Button, sap.m.FlexBox, sap.m.Panel, sap.m.VBox, sap.ui.core.mvc.View

The class

" @keywords flexbox flex box sap.m gap vbox panel button
" @summary You can add gap between rows and columns.
" @origin sap.m.sample.FlexBoxGap - https://sdk.openui5.org/entity/sap.m.FlexBox/sample/sap.m.sample.FlexBoxGap (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_158 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_158 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.m`
        )->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
        )->a( n = `xmlns:l`   v = `sap.ui.layout`

        )->ele( `VBox`
            )->ele( `Panel`
                )->a( n = `headerText` v = `Gap`
                )->ele( `FlexBox`
                    )->a( n = `alignItems` v = `Start`
                    " gap is @since 1.134 - kept 1:1 (POST_171)
                    )->a( n = `gap`        v = `30px`
                    )->a( n = `width`      v = `170px`
                    )->a( n = `wrap`       v = `Wrap`
                    )->tag( `Button`
                        )->a( n = `text` v = `1`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `2`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `3`
                        )->a( n = `type` v = `Accept`
                    )->tag( `Button`
                        )->a( n = `text` v = `4`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `5`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `6`
                        )->a( n = `type` v = `Accept`
                    )->tag( `Button`
                        )->a( n = `text` v = `7`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `8`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `9`
                        )->a( n = `type` v = `Accept`

                )->end(
            )->end(
            )->ele( `Panel`
                )->a( n = `headerText` v = `Column gap`
                )->ele( `FlexBox`
                    )->a( n = `alignItems` v = `Start`
                    " columnGap is @since 1.134 - kept 1:1 (POST_171)
                    )->a( n = `columnGap`  v = `30px`
                    )->a( n = `width`      v = `170px`
                    )->a( n = `wrap`       v = `Wrap`
                    )->tag( `Button`
                        )->a( n = `text` v = `1`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `2`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `3`
                        )->a( n = `type` v = `Accept`
                    )->tag( `Button`
                        )->a( n = `text` v = `4`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `5`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `6`
                        )->a( n = `type` v = `Accept`
                    )->tag( `Button`
                        )->a( n = `text` v = `7`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `8`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `9`
                        )->a( n = `type` v = `Accept`

                )->end(
            )->end(
            )->ele( `Panel`
                )->a( n = `headerText` v = `Row gap`
                )->ele( `FlexBox`
                    )->a( n = `alignItems` v = `Start`
                    " rowGap is @since 1.134 - kept 1:1 (POST_171)
                    )->a( n = `rowGap`     v = `30px`
                    )->a( n = `width`      v = `100px`
                    )->a( n = `wrap`       v = `Wrap`
                    )->tag( `Button`
                        )->a( n = `text` v = `1`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `2`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `3`
                        )->a( n = `type` v = `Accept`
                    )->tag( `Button`
                        )->a( n = `text` v = `4`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `5`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `6`
                        )->a( n = `type` v = `Accept`
                    )->tag( `Button`
                        )->a( n = `text` v = `7`
                        )->a( n = `type` v = `Emphasized`
                    )->tag( `Button`
                        )->a( n = `text` v = `8`
                        )->a( n = `type` v = `Reject`
                    )->tag( `Button`
                        )->a( n = `text` v = `9`
                        )->a( n = `type` v = `Accept`
 ).

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

  ENDMETHOD.

ENDCLASS.