|
| 1 | +class z2ui5_cl_demo_app_263 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_263 IMPLEMENTATION. |
| 30 | + |
| 31 | + |
| 32 | + METHOD DISPLAY_VIEW. |
| 33 | + |
| 34 | + DATA(page) = z2ui5_cl_xml_view=>factory( )->shell( |
| 35 | + )->page( |
| 36 | + title = 'abap2UI5 - Sample: Numeric Content with Icon' |
| 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.NumericContent/sample/sap.m.sample.NumericContentIcon' ). |
| 51 | + |
| 52 | + page->numeric_content( value = `65` scale = `MM` |
| 53 | + valueColor = `Error` indicator = `Down` icon = `sap-icon://travel-expense` |
| 54 | + class = `sapUiSmallMargin` press = client->_event( 'press' ) ). |
| 55 | + page->numeric_content( value = `11` scale = `MM` |
| 56 | + valueColor = `Critical` indicator = `Up` |
| 57 | + icon = `test-resources/sap/m/demokit/sample/NumericContentIcon/images/grass.jpg` class = `sapUiSmallMargin` |
| 58 | + press = client->_event( 'press' ) ). |
| 59 | + |
| 60 | + client->view_display( page->stringify( ) ). |
| 61 | + |
| 62 | + ENDMETHOD. |
| 63 | + |
| 64 | + |
| 65 | + METHOD ON_EVENT. |
| 66 | + |
| 67 | + CASE client->get( )-event. |
| 68 | + WHEN 'BACK'. |
| 69 | + client->nav_app_leave( ). |
| 70 | + WHEN 'press'. |
| 71 | + client->message_toast_display( `The numeric content is pressed.` ). |
| 72 | + WHEN 'POPOVER'. |
| 73 | + z2ui5_display_popover( `hint_icon` ). |
| 74 | + ENDCASE. |
| 75 | + |
| 76 | + ENDMETHOD. |
| 77 | + |
| 78 | + |
| 79 | + METHOD Z2UI5_DISPLAY_POPOVER. |
| 80 | + |
| 81 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 82 | + view->quick_view( placement = `Bottom` width = `auto` |
| 83 | + )->quick_view_page( pageid = `sampleInformationId` |
| 84 | + header = `Sample information` |
| 85 | + description = `Shows NumericContent including an icon.` ). |
| 86 | + |
| 87 | + client->popover_display( |
| 88 | + xml = view->stringify( ) |
| 89 | + by_id = id |
| 90 | + ). |
| 91 | + |
| 92 | + ENDMETHOD. |
| 93 | + |
| 94 | + |
| 95 | + METHOD Z2UI5_IF_APP~MAIN. |
| 96 | + |
| 97 | + me->client = client. |
| 98 | + |
| 99 | + IF check_initialized = abap_false. |
| 100 | + check_initialized = abap_true. |
| 101 | + display_view( client ). |
| 102 | + ENDIF. |
| 103 | + |
| 104 | + on_event( client ). |
| 105 | + |
| 106 | + ENDMETHOD. |
| 107 | +ENDCLASS. |
0 commit comments