|
| 1 | +CLASS z2ui5_cl_demo_app_302 DEFINITION |
| 2 | + PUBLIC |
| 3 | + CREATE PUBLIC. |
| 4 | + |
| 5 | + PUBLIC SECTION. |
| 6 | + |
| 7 | + INTERFACES z2ui5_if_app. |
| 8 | + |
| 9 | + TYPES: |
| 10 | + BEGIN OF ty_product, |
| 11 | + product TYPE string, |
| 12 | + supplier TYPE string, |
| 13 | + additionalInfo TYPE string, |
| 14 | + END OF ty_product. |
| 15 | + |
| 16 | + DATA check_initialized TYPE abap_bool. |
| 17 | + DATA lt_a_data TYPE TABLE OF ty_product. |
| 18 | + |
| 19 | + PROTECTED SECTION. |
| 20 | + |
| 21 | + DATA client TYPE REF TO z2ui5_if_client. |
| 22 | + |
| 23 | + METHODS display_view |
| 24 | + IMPORTING |
| 25 | + client TYPE REF TO z2ui5_if_client. |
| 26 | + METHODS on_event |
| 27 | + IMPORTING |
| 28 | + client TYPE REF TO z2ui5_if_client. |
| 29 | + METHODS z2ui5_display_popover |
| 30 | + IMPORTING |
| 31 | + id TYPE string. |
| 32 | + |
| 33 | + PRIVATE SECTION. |
| 34 | +ENDCLASS. |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +CLASS z2ui5_cl_demo_app_302 IMPLEMENTATION. |
| 39 | + |
| 40 | + |
| 41 | + METHOD display_view. |
| 42 | + |
| 43 | + DATA(page) = z2ui5_cl_xml_view=>factory( )->shell( |
| 44 | + )->page( |
| 45 | + title = 'abap2UI5 - Sample: Object Attribute inside Table' |
| 46 | + navbuttonpress = client->_event( 'BACK' ) |
| 47 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). |
| 48 | + |
| 49 | + page->header_content( |
| 50 | + )->button( id = `button_hint_id` |
| 51 | + icon = `sap-icon://hint` |
| 52 | + tooltip = `Sample information` |
| 53 | + press = client->_event( 'CLICK_HINT_ICON' ) ). |
| 54 | + |
| 55 | + page->header_content( |
| 56 | + )->link( |
| 57 | + text = 'UI5 Demo Kit' |
| 58 | + target = '_blank' |
| 59 | + href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.ObjectAttribute/sample/sap.m.sample.ObjectAttributeInTable' ). |
| 60 | + |
| 61 | + page->table( id = `idProductsTable` |
| 62 | + items = client->_bind( lt_a_data ) |
| 63 | + )->columns( |
| 64 | + )->column( |
| 65 | + )->text( text = `Products` |
| 66 | + )->get_parent( |
| 67 | + )->column( |
| 68 | + )->text( text = `Supplier` |
| 69 | + )->get_parent( |
| 70 | + )->column( |
| 71 | + )->text( text = `Supplier (active)` |
| 72 | + )->get_parent( )->get_parent( |
| 73 | + )->column_list_item( |
| 74 | + )->object_identifier( |
| 75 | + text = '{PRODUCT}' )->get_parent( |
| 76 | + )->object_attribute( |
| 77 | + text = '{SUPPLIER}' |
| 78 | + )->object_attribute( |
| 79 | + text = '{SUPPLIER}' |
| 80 | + active = abap_true |
| 81 | + )->get_parent( |
| 82 | + ). |
| 83 | + |
| 84 | + client->view_display( page->stringify( ) ). |
| 85 | + |
| 86 | + ENDMETHOD. |
| 87 | + |
| 88 | + |
| 89 | + METHOD on_event. |
| 90 | + |
| 91 | + CASE client->get( )-event. |
| 92 | + WHEN 'BACK'. |
| 93 | + client->nav_app_leave( ). |
| 94 | + WHEN 'CLICK_HINT_ICON'. |
| 95 | + z2ui5_display_popover( `button_hint_id` ). |
| 96 | + WHEN 'onPress'. |
| 97 | + client->message_toast_display( client->get_event_arg( 1 ) && ` marker pressed!` ). |
| 98 | + ENDCASE. |
| 99 | + |
| 100 | + ENDMETHOD. |
| 101 | + |
| 102 | + |
| 103 | + METHOD z2ui5_display_popover. |
| 104 | + |
| 105 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 106 | + view->quick_view( placement = `Bottom` width = `auto` |
| 107 | + )->quick_view_page( pageid = `sampleInformationId` |
| 108 | + header = `Sample information` |
| 109 | + description = `This is an example of Object Attribute used inside Table.` ). |
| 110 | + |
| 111 | + client->popover_display( |
| 112 | + xml = view->stringify( ) |
| 113 | + by_id = id |
| 114 | + ). |
| 115 | + |
| 116 | + ENDMETHOD. |
| 117 | + |
| 118 | + |
| 119 | + METHOD z2ui5_if_app~main. |
| 120 | + |
| 121 | + me->client = client. |
| 122 | + |
| 123 | + IF check_initialized = abap_false. |
| 124 | + check_initialized = abap_true. |
| 125 | + display_view( client ). |
| 126 | + |
| 127 | + lt_a_data = VALUE #( |
| 128 | + ( product = 'Power Projector 4713' supplier = 'Robert Brown Entertainment' ) |
| 129 | + ( product = 'HT-1022' supplier = 'Pear Computing Services' ) |
| 130 | + ( product = 'Ergo Screen E-III' supplier = 'DelBont Industries' ) |
| 131 | + ( product = 'Gladiator MX' supplier = 'Asia High tech' ) |
| 132 | + ( product = 'Hurricane GX' supplier = 'Telecomunicaciones Star' ) |
| 133 | + ( product = 'Notebook Basic 17' supplier = 'Pear Computing Services' ) |
| 134 | + ( product = 'ITelO Vault SAT' supplier = 'New Line Design' ) |
| 135 | + ( product = 'Hurricane GX' supplier = 'Robert Brown Entertainment' ) |
| 136 | + ( product = 'Webcam' supplier = 'Getränkegroßhandel Janssen' ) |
| 137 | + ( product = 'Deskjet Super Highspeed' supplier = 'Vente Et Réparation de Ordinateur' ) |
| 138 | + ). |
| 139 | + ENDIF. |
| 140 | + |
| 141 | + on_event( client ). |
| 142 | + |
| 143 | + ENDMETHOD. |
| 144 | +ENDCLASS. |
0 commit comments