|
| 1 | +CLASS z2ui5_cl_demo_app_296 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 | + |
| 11 | + PROTECTED SECTION. |
| 12 | + |
| 13 | + DATA client TYPE REF TO z2ui5_if_client. |
| 14 | + |
| 15 | + METHODS display_view |
| 16 | + IMPORTING |
| 17 | + client TYPE REF TO z2ui5_if_client. |
| 18 | + METHODS on_event |
| 19 | + IMPORTING |
| 20 | + client TYPE REF TO z2ui5_if_client. |
| 21 | + METHODS z2ui5_display_popover |
| 22 | + IMPORTING |
| 23 | + id TYPE string. |
| 24 | + |
| 25 | + PRIVATE SECTION. |
| 26 | +ENDCLASS. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +CLASS z2ui5_cl_demo_app_296 IMPLEMENTATION. |
| 31 | + |
| 32 | + |
| 33 | + METHOD display_view. |
| 34 | + |
| 35 | + DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell( |
| 36 | + )->page( |
| 37 | + title = `abap2UI5 - Sample: Search Field` |
| 38 | + navbuttonpress = client->_event( 'BACK' ) |
| 39 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). |
| 40 | + |
| 41 | + page_01->header_content( |
| 42 | + )->button( id = `button_hint_id` |
| 43 | + icon = `sap-icon://hint` |
| 44 | + tooltip = `Sample information` |
| 45 | + press = client->_event( 'CLICK_HINT_ICON' ) ). |
| 46 | + |
| 47 | + page_01->header_content( |
| 48 | + )->link( |
| 49 | + text = 'UI5 Demo Kit' |
| 50 | + target = '_blank' |
| 51 | + href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.SearchField/sample/sap.m.sample.SearchField' ). |
| 52 | + |
| 53 | + page_01->page( showheader = abap_false |
| 54 | + )->sub_header( |
| 55 | + )->toolbar( |
| 56 | + )->search_field( width = `100%` search = client->_event( val = `onSearch` ) |
| 57 | + )->text( text = `Default Search` id = `idSearchListToolbar` |
| 58 | + )->get_parent( |
| 59 | + )->get_parent( |
| 60 | + )->vbox( class = `sapUiSmallMargin` |
| 61 | + )->label( text = `Default Search Field:` |
| 62 | + )->search_field( width = `90%` class = `sapUiSmallMargin` |
| 63 | + )->get_parent( |
| 64 | + ). |
| 65 | + |
| 66 | + client->view_display( page_01->stringify( ) ). |
| 67 | + |
| 68 | + ENDMETHOD. |
| 69 | + |
| 70 | + |
| 71 | + METHOD on_event. |
| 72 | + |
| 73 | + CASE client->get( )-event. |
| 74 | + WHEN 'BACK'. |
| 75 | + client->nav_app_leave( ). |
| 76 | + WHEN 'CLICK_HINT_ICON'. |
| 77 | + z2ui5_display_popover( `button_hint_id` ). |
| 78 | + WHEN 'onSearch'. |
| 79 | + client->message_toast_display( `'search' event fired with 'searchButtonPressed' parameter` ). |
| 80 | + ENDCASE. |
| 81 | + |
| 82 | + ENDMETHOD. |
| 83 | + |
| 84 | + |
| 85 | + METHOD z2ui5_display_popover. |
| 86 | + |
| 87 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 88 | + view->quick_view( placement = `Bottom` width = `auto` |
| 89 | + )->quick_view_page( pageid = `sampleInformationId` |
| 90 | + header = `Sample information` |
| 91 | + description = `Use the Search Field to let the user enter a search string and trigger the search process.` ). |
| 92 | + |
| 93 | + client->popover_display( |
| 94 | + xml = view->stringify( ) |
| 95 | + by_id = id |
| 96 | + ). |
| 97 | + |
| 98 | + ENDMETHOD. |
| 99 | + |
| 100 | + |
| 101 | + METHOD z2ui5_if_app~main. |
| 102 | + |
| 103 | + me->client = client. |
| 104 | + |
| 105 | + IF check_initialized = abap_false. |
| 106 | + check_initialized = abap_true. |
| 107 | + display_view( client ). |
| 108 | + ENDIF. |
| 109 | + |
| 110 | + on_event( client ). |
| 111 | + |
| 112 | + ENDMETHOD. |
| 113 | +ENDCLASS. |
0 commit comments