|
| 1 | +CLASS z2ui5_cl_demo_app_299 DEFINITION |
| 2 | + PUBLIC |
| 3 | + CREATE PUBLIC. |
| 4 | + |
| 5 | + PUBLIC SECTION. |
| 6 | + |
| 7 | + INTERFACES z2ui5_if_app. |
| 8 | + |
| 9 | + TYPES: |
| 10 | + BEGIN OF ty_product_collection, |
| 11 | + product_id TYPE string, |
| 12 | + name TYPE string, |
| 13 | + END OF ty_product_collection. |
| 14 | + |
| 15 | + DATA check_initialized TYPE abap_bool. |
| 16 | + DATA lt_product_collection TYPE TABLE OF ty_product_collection. |
| 17 | + DATA lt_product_collection2 TYPE TABLE OF ty_product_collection. |
| 18 | + |
| 19 | + PROTECTED SECTION. |
| 20 | + |
| 21 | + DATA client TYPE REF TO z2ui5_if_client. |
| 22 | + |
| 23 | + METHODS z2ui5_set_data. |
| 24 | + METHODS display_view |
| 25 | + IMPORTING |
| 26 | + client TYPE REF TO z2ui5_if_client. |
| 27 | + METHODS on_event |
| 28 | + IMPORTING |
| 29 | + client TYPE REF TO z2ui5_if_client. |
| 30 | + METHODS z2ui5_display_popover |
| 31 | + IMPORTING |
| 32 | + id TYPE string. |
| 33 | + |
| 34 | + PRIVATE SECTION. |
| 35 | +ENDCLASS. |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +CLASS z2ui5_cl_demo_app_299 IMPLEMENTATION. |
| 40 | + |
| 41 | + |
| 42 | + METHOD display_view. |
| 43 | + |
| 44 | + DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell( |
| 45 | + )->page( |
| 46 | + title = `abap2UI5 - Sample: Select - Wrapping text` |
| 47 | + navbuttonpress = client->_event( 'BACK' ) |
| 48 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). |
| 49 | + |
| 50 | + page_01->header_content( |
| 51 | + )->button( id = `button_hint_id` |
| 52 | + icon = `sap-icon://hint` |
| 53 | + tooltip = `Sample information` |
| 54 | + press = client->_event( 'CLICK_HINT_ICON' ) ). |
| 55 | + |
| 56 | + page_01->header_content( |
| 57 | + )->link( |
| 58 | + text = 'UI5 Demo Kit' |
| 59 | + target = '_blank' |
| 60 | + href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.Select/sample/sap.m.sample.SelectWithWrappedItemText' ). |
| 61 | + |
| 62 | + page_01->select( |
| 63 | + width = `300px` |
| 64 | + wrapitemstext = abap_true |
| 65 | + class = `sapUiLargeMargin` |
| 66 | + items = client->_bind( lt_product_collection ) |
| 67 | + )->item( key = '{PRODUCT_ID}' text = '{NAME}' |
| 68 | + )->get_parent( |
| 69 | + )->select( |
| 70 | + width = `300px` |
| 71 | + wrapitemstext = abap_true |
| 72 | + class = `sapUiLargeMargin` |
| 73 | + items = client->_bind( lt_product_collection2 ) |
| 74 | + )->item( key = '{PRODUCT_ID}' text = '{NAME}' |
| 75 | + )->get_parent( |
| 76 | + ). |
| 77 | + |
| 78 | + client->view_display( page_01->stringify( ) ). |
| 79 | + |
| 80 | + ENDMETHOD. |
| 81 | + |
| 82 | + |
| 83 | + METHOD on_event. |
| 84 | + |
| 85 | + CASE client->get( )-event. |
| 86 | + WHEN 'BACK'. |
| 87 | + client->nav_app_leave( ). |
| 88 | + WHEN 'CLICK_HINT_ICON'. |
| 89 | + z2ui5_display_popover( `button_hint_id` ). |
| 90 | + ENDCASE. |
| 91 | + |
| 92 | + ENDMETHOD. |
| 93 | + |
| 94 | + |
| 95 | + METHOD z2ui5_display_popover. |
| 96 | + |
| 97 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 98 | + view->quick_view( placement = `Bottom` width = `auto` |
| 99 | + )->quick_view_page( pageid = `sampleInformationId` |
| 100 | + header = `Sample information` |
| 101 | + description = `Illustrates how the text in items wrap.` ). |
| 102 | + |
| 103 | + client->popover_display( |
| 104 | + xml = view->stringify( ) |
| 105 | + by_id = id |
| 106 | + ). |
| 107 | + |
| 108 | + ENDMETHOD. |
| 109 | + |
| 110 | + |
| 111 | + METHOD z2ui5_if_app~main. |
| 112 | + |
| 113 | + me->client = client. |
| 114 | + |
| 115 | + IF check_initialized = abap_false. |
| 116 | + check_initialized = abap_true. |
| 117 | + display_view( client ). |
| 118 | + z2ui5_set_data( ). |
| 119 | + ENDIF. |
| 120 | + |
| 121 | + on_event( client ). |
| 122 | + |
| 123 | + ENDMETHOD. |
| 124 | + |
| 125 | + |
| 126 | + METHOD z2ui5_set_data. |
| 127 | + |
| 128 | + CLEAR lt_product_collection. |
| 129 | + CLEAR lt_Product_collection2. |
| 130 | + |
| 131 | + " Populating lt_product_collection |
| 132 | + lt_product_collection = VALUE #( |
| 133 | + ( product_id = 'HT-1001' Name = 'Select option 1' ) |
| 134 | + ( product_id = 'HT-1002' Name = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.' ) |
| 135 | + ( product_id = 'HT-1003' Name = 'Select option 3' ) |
| 136 | + ( product_id = 'HT-1007' Name = 'Select option 4' ) |
| 137 | + ( product_id = 'HT-1010' Name = 'Select option 5' ) |
| 138 | + ). |
| 139 | + SORT lt_product_collection BY name. |
| 140 | + |
| 141 | + " Populating lt_product_collection2 |
| 142 | + lt_Product_collection2 = VALUE #( |
| 143 | + ( product_id = 'key1' Name = 'Select option 1' ) |
| 144 | + ( product_id = 'key2' Name = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.' ) |
| 145 | + ( product_id = 'key3' Name = 'Select option 3' ) |
| 146 | + ( product_id = 'key4' Name = 'Select option 4' ) |
| 147 | + ( product_id = 'key5' Name = 'Select option 5' ) |
| 148 | + ). |
| 149 | + SORT lt_Product_collection2 BY name. |
| 150 | + |
| 151 | + ENDMETHOD. |
| 152 | +ENDCLASS. |
0 commit comments