|
| 1 | +CLASS z2ui5_cl_demo_app_278 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_278 IMPLEMENTATION. |
| 31 | + |
| 32 | + |
| 33 | + METHOD display_view. |
| 34 | + " Define the base URL for the server |
| 35 | + DATA base_url TYPE string VALUE 'https://sapui5.hana.ondemand.com/'. |
| 36 | + |
| 37 | + DATA(page) = z2ui5_cl_xml_view=>factory( )->shell( |
| 38 | + )->page( |
| 39 | + title = 'abap2UI5 - Sample: Feed and News Tile' |
| 40 | + navbuttonpress = client->_event( 'BACK' ) |
| 41 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). |
| 42 | + |
| 43 | + page->header_content( |
| 44 | + )->button( id = `button_hint_id` |
| 45 | + icon = `sap-icon://hint` |
| 46 | + tooltip = `Sample information` |
| 47 | + press = client->_event( 'CLICK_HINT_ICON' ) ). |
| 48 | + |
| 49 | + page->header_content( |
| 50 | + )->link( |
| 51 | + text = 'UI5 Demo Kit' |
| 52 | + target = '_blank' |
| 53 | + href = base_url && 'sdk/#/entity/sap.m.GenericTile/sample/sap.m.sample.GenericTileAsFeedTile' ). |
| 54 | + |
| 55 | + page->generic_tile( class = `sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout` header = `Feed Tile that shows updates of the last feeds given to a specific topic:` |
| 56 | + frametype = `TwoByOne` press = client->_event( `press` ) |
| 57 | + )->tile_content( footer = `New Notifications` |
| 58 | + )->feed_content( contenttext = `@@notify Great outcome of the Presentation today. New functionality well received.` |
| 59 | + subheader = `About 1 minute ago in Computer Market` value = `352` )->get_parent( )->get_parent( )->get_parent( |
| 60 | + |
| 61 | + )->slide_tile( class = `sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout` |
| 62 | + )->tiles( |
| 63 | + )->generic_tile( |
| 64 | + backgroundimage = base_url && `test-resources/sap/m/demokit/sample/GenericTileAsFeedTile/images/NewsImage1.png` |
| 65 | + frametype = `TwoByOne` press = client->_event( `press` ) |
| 66 | + )->tile_content( footer = `August 21, 2016` |
| 67 | + )->news_content( |
| 68 | + contentText = `Wind Map: Monitoring Real-Time and Fore-casted Wind Conditions across the Globe` |
| 69 | + subheader = `Today, SAP News` )->get_parent( )->get_parent( )->get_parent( |
| 70 | + )->generic_tile( |
| 71 | + backgroundImage = base_url && `test-resources/sap/m/demokit/sample/GenericTileAsFeedTile/images/NewsImage2.png` |
| 72 | + frametype = `TwoByOne` press = client->_event( `press` ) |
| 73 | + )->tile_content( footer = `August 21, 2016` |
| 74 | + )->news_content( |
| 75 | + contenttext = `SAP Unveils Powerful New Player Comparision Tool Exclusively on NFL.com` |
| 76 | + subheader = `Today, SAP News` |
| 77 | + ). |
| 78 | + |
| 79 | + client->view_display( page->stringify( ) ). |
| 80 | + |
| 81 | + ENDMETHOD. |
| 82 | + |
| 83 | + |
| 84 | + METHOD on_event. |
| 85 | + |
| 86 | + CASE client->get( )-event. |
| 87 | + WHEN 'BACK'. |
| 88 | + client->nav_app_leave( ). |
| 89 | + WHEN 'CLICK_HINT_ICON'. |
| 90 | + z2ui5_display_popover( `button_hint_id` ). |
| 91 | + WHEN 'press'. |
| 92 | + client->message_toast_display( `The GenericTile is pressed.` ). |
| 93 | + ENDCASE. |
| 94 | + |
| 95 | + ENDMETHOD. |
| 96 | + |
| 97 | + |
| 98 | + METHOD z2ui5_display_popover. |
| 99 | + |
| 100 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 101 | + view->quick_view( placement = `Bottom` width = `auto` |
| 102 | + )->quick_view_page( pageid = `sampleInformationId` |
| 103 | + header = `Sample information` |
| 104 | + description = `Shows Feed Tile and News Tile samples that can contain feed content, news content, and a footer.` ). |
| 105 | + |
| 106 | + client->popover_display( |
| 107 | + xml = view->stringify( ) |
| 108 | + by_id = id |
| 109 | + ). |
| 110 | + |
| 111 | + ENDMETHOD. |
| 112 | + |
| 113 | + |
| 114 | + METHOD z2ui5_if_app~main. |
| 115 | + |
| 116 | + me->client = client. |
| 117 | + |
| 118 | + IF check_initialized = abap_false. |
| 119 | + check_initialized = abap_true. |
| 120 | + display_view( client ). |
| 121 | + ENDIF. |
| 122 | + |
| 123 | + on_event( client ). |
| 124 | + |
| 125 | + ENDMETHOD. |
| 126 | +ENDCLASS. |
0 commit comments