|
| 1 | +CLASS z2ui5_cl_demo_app_286 DEFINITION |
| 2 | + PUBLIC |
| 3 | + CREATE PUBLIC. |
| 4 | + |
| 5 | + PUBLIC SECTION. |
| 6 | + |
| 7 | + INTERFACES z2ui5_if_app. |
| 8 | + |
| 9 | + TYPES: |
| 10 | + BEGIN OF ty_name, |
| 11 | + title TYPE string, |
| 12 | + desc TYPE string, |
| 13 | + icon TYPE string, |
| 14 | + highlight TYPE string, |
| 15 | + info TYPE string, |
| 16 | + END OF ty_name . |
| 17 | + |
| 18 | + DATA lt_o_model TYPE TABLE OF ty_name. |
| 19 | + DATA check_initialized TYPE abap_bool. |
| 20 | + |
| 21 | + PROTECTED SECTION. |
| 22 | + |
| 23 | + DATA client TYPE REF TO z2ui5_if_client. |
| 24 | + |
| 25 | + METHODS display_view |
| 26 | + IMPORTING |
| 27 | + client TYPE REF TO z2ui5_if_client. |
| 28 | + METHODS on_event |
| 29 | + IMPORTING |
| 30 | + client TYPE REF TO z2ui5_if_client. |
| 31 | + METHODS z2ui5_display_popover |
| 32 | + IMPORTING |
| 33 | + id TYPE string. |
| 34 | + |
| 35 | + PRIVATE SECTION. |
| 36 | +ENDCLASS. |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +CLASS z2ui5_cl_demo_app_286 IMPLEMENTATION. |
| 41 | + |
| 42 | + |
| 43 | + METHOD display_view. |
| 44 | + |
| 45 | + DATA(page) = z2ui5_cl_xml_view=>factory( )->shell( |
| 46 | + )->page( |
| 47 | + title = 'abap2UI5 - Sample: Standard List Item - Info State Inverted' |
| 48 | + navbuttonpress = client->_event( 'BACK' ) |
| 49 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). |
| 50 | + |
| 51 | + page->header_content( |
| 52 | + )->button( id = `button_hint_id` |
| 53 | + icon = `sap-icon://hint` |
| 54 | + tooltip = `Sample information` |
| 55 | + press = client->_event( 'CLICK_HINT_ICON' ) ). |
| 56 | + |
| 57 | + page->header_content( |
| 58 | + )->link( |
| 59 | + text = 'UI5 Demo Kit' |
| 60 | + target = '_blank' |
| 61 | + href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.StandardListItem/sample/sap.m.sample.StandardListItemInfoStateInverted' ). |
| 62 | + |
| 63 | + page->list( |
| 64 | + id = `myList` |
| 65 | + mode = `MultiSelect` |
| 66 | + headertext = `Inverted Info State` |
| 67 | + items = client->_bind( lt_o_model ) |
| 68 | + )->items( |
| 69 | + )->standard_list_item( |
| 70 | + title = '{TITLE}' |
| 71 | + description = '{DESC}' |
| 72 | + icon = '{ICON}' |
| 73 | + iconInset = abap_false |
| 74 | + highlight = '{HIGHLIGHT}' |
| 75 | + info = '{INFO}' |
| 76 | + infostate = '{HIGHLIGHT}' |
| 77 | + infostateinverted = abap_true |
| 78 | + ). |
| 79 | + |
| 80 | + client->view_display( page->stringify( ) ). |
| 81 | + |
| 82 | + ENDMETHOD. |
| 83 | + |
| 84 | + |
| 85 | + METHOD on_event. |
| 86 | + |
| 87 | + CASE client->get( )-event. |
| 88 | + WHEN 'BACK'. |
| 89 | + client->nav_app_leave( ). |
| 90 | + WHEN 'CLICK_HINT_ICON'. |
| 91 | + z2ui5_display_popover( `button_hint_id` ). |
| 92 | + ENDCASE. |
| 93 | + |
| 94 | + ENDMETHOD. |
| 95 | + |
| 96 | + |
| 97 | + METHOD z2ui5_display_popover. |
| 98 | + |
| 99 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 100 | + view->quick_view( placement = `Bottom` width = `auto` |
| 101 | + )->quick_view_page( pageid = `sampleInformationId` |
| 102 | + header = `Sample information` |
| 103 | + description = `This sample demonstrates the inverted rendering behavior of the info text and the info state of the StandardListItem control.` ). |
| 104 | + |
| 105 | + client->popover_display( |
| 106 | + xml = view->stringify( ) |
| 107 | + by_id = id |
| 108 | + ). |
| 109 | + |
| 110 | + ENDMETHOD. |
| 111 | + |
| 112 | + |
| 113 | + METHOD z2ui5_if_app~main. |
| 114 | + |
| 115 | + me->client = client. |
| 116 | + |
| 117 | + IF check_initialized = abap_false. |
| 118 | + check_initialized = abap_true. |
| 119 | + display_view( client ). |
| 120 | + |
| 121 | + lt_o_model = VALUE #( |
| 122 | + ( title = 'Title text' desc = 'Description text' icon = 'sap-icon://favorite' highlight = 'Success' info = 'Completed' ) |
| 123 | + ( title = 'Title text' desc = 'Description text' icon = 'sap-icon://employee' highlight = 'Error' info = 'Incomplete' ) |
| 124 | + ( title = 'Title text' icon = 'sap-icon://accept' highlight = 'Information' info = 'Information' ) |
| 125 | + ( title = 'Title text' icon = 'sap-icon://activities' highlight = 'None' info = 'None' ) |
| 126 | + ( title = 'Title text' desc = 'Description text' icon = 'sap-icon://badge' highlight = 'Warning' info = 'Warning' ) |
| 127 | + ). |
| 128 | + ENDIF. |
| 129 | + |
| 130 | + on_event( client ). |
| 131 | + |
| 132 | + ENDMETHOD. |
| 133 | +ENDCLASS. |
0 commit comments