|  | 
|  | 1 | +class z2ui5_cl_demo_app_245 definition | 
|  | 2 | +  public | 
|  | 3 | +  create public . | 
|  | 4 | + | 
|  | 5 | +public section. | 
|  | 6 | + | 
|  | 7 | +  interfaces Z2UI5_IF_APP . | 
|  | 8 | + | 
|  | 9 | +  data CHECK_INITIALIZED type ABAP_BOOL . | 
|  | 10 | +  PROTECTED SECTION. | 
|  | 11 | + | 
|  | 12 | +    DATA client TYPE REF TO z2ui5_if_client. | 
|  | 13 | + | 
|  | 14 | +    METHODS display_view | 
|  | 15 | +      IMPORTING | 
|  | 16 | +        client TYPE REF TO z2ui5_if_client. | 
|  | 17 | +    METHODS on_event | 
|  | 18 | +      IMPORTING | 
|  | 19 | +        client TYPE REF TO z2ui5_if_client. | 
|  | 20 | +    METHODS z2ui5_display_popover | 
|  | 21 | +      IMPORTING | 
|  | 22 | +        id TYPE string. | 
|  | 23 | + | 
|  | 24 | +  PRIVATE SECTION. | 
|  | 25 | +ENDCLASS. | 
|  | 26 | + | 
|  | 27 | + | 
|  | 28 | + | 
|  | 29 | +CLASS z2ui5_cl_demo_app_245 IMPLEMENTATION. | 
|  | 30 | + | 
|  | 31 | + | 
|  | 32 | +  METHOD DISPLAY_VIEW. | 
|  | 33 | + | 
|  | 34 | +    DATA(page) = z2ui5_cl_xml_view=>factory( )->shell( | 
|  | 35 | +         )->page( | 
|  | 36 | +            title          = `abap2UI5 - Sample: Flex Box - Direction & Order` | 
|  | 37 | +            navbuttonpress = client->_event( 'BACK' ) | 
|  | 38 | +            shownavbutton  = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). | 
|  | 39 | + | 
|  | 40 | +    page->header_content( | 
|  | 41 | +       )->button( id = `hint_icon` | 
|  | 42 | +           icon = `sap-icon://hint` | 
|  | 43 | +           tooltip = `Sample information` | 
|  | 44 | +           press = client->_event( 'POPOVER' ) ). | 
|  | 45 | + | 
|  | 46 | +    page->header_content( | 
|  | 47 | +       )->link( | 
|  | 48 | +           text   = 'UI5 Demo Kit' | 
|  | 49 | +           target = '_blank' | 
|  | 50 | +           href   = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.FlexBox/sample/sap.m.sample.FlexBoxDirectionOrder' ). | 
|  | 51 | + | 
|  | 52 | +    DATA(layout) = page->vbox( | 
|  | 53 | +                          )->panel( headertext = `Reverse, horizontal` | 
|  | 54 | +                              )->flex_box( direction = `RowReverse` alignItems = `Start` | 
|  | 55 | +                                  )->button( text = `1` type = `Emphasized` | 
|  | 56 | +                                  )->button( text = `2` type = `Reject` | 
|  | 57 | +                                  )->button( text = `3` type = `Accept` )->get_parent( )->get_parent( | 
|  | 58 | + | 
|  | 59 | +                          )->panel( headertext = `Top to bottom, vertical` | 
|  | 60 | +                              )->flex_box( direction = `Column` alignItems = `Start` | 
|  | 61 | +                                  )->button( text = `1` type = `Emphasized` | 
|  | 62 | +                                  )->button( text = `2` type = `Reject` | 
|  | 63 | +                                  )->button( text = `3` type = `Accept` )->get_parent( )->get_parent( | 
|  | 64 | + | 
|  | 65 | +                          )->panel( headertext = `Bottom to top, reverse vertical` | 
|  | 66 | +                              )->flex_box( direction = `ColumnReverse` alignItems = `Start` | 
|  | 67 | +                                  )->button( text = `1` type = `Emphasized` | 
|  | 68 | +                                  )->button( text = `2` type = `Reject` | 
|  | 69 | +                                  )->button( text = `3` type = `Accept` )->get_parent( )->get_parent( | 
|  | 70 | + | 
|  | 71 | +                          )->panel( headertext = `Arbitrary flex item order` | 
|  | 72 | +                              )->flex_box( alignItems = `Start` | 
|  | 73 | +                                  )->button( text = `1` type = `Emphasized` class = `sapUiTinyMarginEnd` )->get( | 
|  | 74 | +                                      )->layout_data( | 
|  | 75 | +                                          )->flex_item_data( order = `2` )->get_parent( )->get_parent( | 
|  | 76 | +                                  )->button( text = `2` type = `Reject` class = `sapUiTinyMarginEnd` )->get( | 
|  | 77 | +                                      )->layout_data( | 
|  | 78 | +                                          )->flex_item_data( order = `3` )->get_parent( )->get_parent( | 
|  | 79 | +                                  )->button( text = `3` type = `Accept` class = `sapUiTinyMarginEnd` )->get( | 
|  | 80 | +                                      )->layout_data( | 
|  | 81 | +                                          )->flex_item_data( order = `1` | 
|  | 82 | +                         ). | 
|  | 83 | + | 
|  | 84 | +    client->view_display( page->stringify( ) ). | 
|  | 85 | + | 
|  | 86 | +  ENDMETHOD. | 
|  | 87 | + | 
|  | 88 | + | 
|  | 89 | +  METHOD ON_EVENT. | 
|  | 90 | + | 
|  | 91 | +    CASE client->get( )-event. | 
|  | 92 | +      WHEN 'BACK'. | 
|  | 93 | +        client->nav_app_leave( ). | 
|  | 94 | +      WHEN 'POPOVER'. | 
|  | 95 | +        z2ui5_display_popover( `hint_icon` ). | 
|  | 96 | +    ENDCASE. | 
|  | 97 | + | 
|  | 98 | +  ENDMETHOD. | 
|  | 99 | + | 
|  | 100 | + | 
|  | 101 | +  METHOD Z2UI5_DISPLAY_POPOVER. | 
|  | 102 | + | 
|  | 103 | +    DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). | 
|  | 104 | +    view->quick_view( placement = `Bottom` width = `auto` | 
|  | 105 | +              )->quick_view_page( pageid = `sampleInformationId` | 
|  | 106 | +                                  header = `Sample information` | 
|  | 107 | +                                  description = `You can influence the direction and order of elements in horizontal and vertical Flex Box controls with the direction property.` ). | 
|  | 108 | + | 
|  | 109 | +    client->popover_display( | 
|  | 110 | +      xml   = view->stringify( ) | 
|  | 111 | +      by_id = id | 
|  | 112 | +    ). | 
|  | 113 | + | 
|  | 114 | +  ENDMETHOD. | 
|  | 115 | + | 
|  | 116 | + | 
|  | 117 | +  METHOD Z2UI5_IF_APP~MAIN. | 
|  | 118 | + | 
|  | 119 | +    me->client = client. | 
|  | 120 | + | 
|  | 121 | +    IF check_initialized = abap_false. | 
|  | 122 | +      check_initialized = abap_true. | 
|  | 123 | +      display_view( client ). | 
|  | 124 | +    ENDIF. | 
|  | 125 | + | 
|  | 126 | +    on_event( client ). | 
|  | 127 | + | 
|  | 128 | +  ENDMETHOD. | 
|  | 129 | +ENDCLASS. | 
0 commit comments