|
| 1 | +CLASS z2ui5_cl_demo_app_301 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 | + name TYPE string, |
| 12 | + attribute_1 TYPE string, |
| 13 | + attribute_2 TYPE string, |
| 14 | + status TYPE string, |
| 15 | + overflow_mode TYPE string, |
| 16 | + END OF ty_product. |
| 17 | + |
| 18 | + DATA check_initialized TYPE abap_bool. |
| 19 | + DATA lt_o_data TYPE TABLE OF ty_product. |
| 20 | + PROTECTED SECTION. |
| 21 | + |
| 22 | + DATA client TYPE REF TO z2ui5_if_client. |
| 23 | + |
| 24 | + METHODS z2ui5_set_data. |
| 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_301 IMPLEMENTATION. |
| 41 | + |
| 42 | + |
| 43 | + METHOD display_view. |
| 44 | + |
| 45 | + DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell( |
| 46 | + )->page( |
| 47 | + title = `abap2UI5 - Sample: Expandable Text` |
| 48 | + navbuttonpress = client->_event( 'BACK' ) |
| 49 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). |
| 50 | + |
| 51 | + page_01->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_01->header_content( |
| 58 | + )->link( |
| 59 | + text = 'UI5 Demo Kit' |
| 60 | + target = '_blank' |
| 61 | + href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.ExpandableText/sample/sap.m.sample.ExpandableText' ). |
| 62 | + |
| 63 | + page_01->table( mode = `MultiSelect` |
| 64 | + items = client->_bind( lt_o_data ) |
| 65 | + autopopinmode = abap_true |
| 66 | + )->columns( |
| 67 | + )->column( |
| 68 | + )->text( text = `Product` |
| 69 | + )->get_parent( |
| 70 | + )->column( |
| 71 | + )->text( text = `Attribute 1` |
| 72 | + )->get_parent( |
| 73 | + )->column( |
| 74 | + )->text( text = `Attribute 2` |
| 75 | + )->get_parent( |
| 76 | + )->column( |
| 77 | + )->text( text = `Status` |
| 78 | + )->get_parent( |
| 79 | + )->get_parent( |
| 80 | + |
| 81 | + )->items( |
| 82 | + )->column_list_item( |
| 83 | + )->cells( |
| 84 | + )->text( text = `{NAME}` ")->get_parent( |
| 85 | + )->expandable_text( class = `sapUiTinyMarginBottom sapUiTinyMarginTop` text = `{ATTRIBUTE_1}` overflowmode = `{OVERFLOW_MODE}` )->get_parent( |
| 86 | + )->text( text = `{ATTRIBUTE_2}` )->get_parent( |
| 87 | + )->text( text = `{STATUS}` )->get_parent( |
| 88 | + )->get_parent( |
| 89 | + )->get_parent( |
| 90 | + )->get_parent( |
| 91 | + ). |
| 92 | + |
| 93 | + client->view_display( page_01->stringify( ) ). |
| 94 | + |
| 95 | + ENDMETHOD. |
| 96 | + |
| 97 | + |
| 98 | + METHOD on_event. |
| 99 | + |
| 100 | + CASE client->get( )-event. |
| 101 | + WHEN 'BACK'. |
| 102 | + client->nav_app_leave( ). |
| 103 | + WHEN 'CLICK_HINT_ICON'. |
| 104 | + z2ui5_display_popover( `button_hint_id` ). |
| 105 | + ENDCASE. |
| 106 | + |
| 107 | + ENDMETHOD. |
| 108 | + |
| 109 | + |
| 110 | + METHOD z2ui5_display_popover. |
| 111 | + |
| 112 | + DATA(view) = z2ui5_cl_xml_view=>factory_popup( ). |
| 113 | + view->quick_view( placement = `Bottom` width = `auto` |
| 114 | + )->quick_view_page( pageid = `sampleInformationId` |
| 115 | + header = `Sample information` |
| 116 | + description = `The ExpandableText control can be used to display a larger texts inside a table, list or form.` ). |
| 117 | + |
| 118 | + client->popover_display( |
| 119 | + xml = view->stringify( ) |
| 120 | + by_id = id |
| 121 | + ). |
| 122 | + |
| 123 | + ENDMETHOD. |
| 124 | + |
| 125 | + |
| 126 | + METHOD z2ui5_if_app~main. |
| 127 | + |
| 128 | + me->client = client. |
| 129 | + |
| 130 | + IF check_initialized = abap_false. |
| 131 | + check_initialized = abap_true. |
| 132 | + display_view( client ). |
| 133 | + z2ui5_set_data( ). |
| 134 | + ENDIF. |
| 135 | + |
| 136 | + on_event( client ). |
| 137 | + |
| 138 | + ENDMETHOD. |
| 139 | + |
| 140 | + |
| 141 | + METHOD z2ui5_set_data. |
| 142 | + |
| 143 | + CLEAR lt_o_data. |
| 144 | + |
| 145 | + lt_o_data = VALUE #( |
| 146 | + ( name = 'Product 1' |
| 147 | + attribute_1 = `The full text is displayed in place. Lorem ipsum dolor sit amet, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ` && |
| 148 | + `At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore ` && |
| 149 | + `et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr` |
| 150 | + attribute_2 = 'Attribute related to label' |
| 151 | + status = 'Some status' |
| 152 | + overflow_mode = 'InPlace' ) |
| 153 | + ( name = 'Product 2' |
| 154 | + attribute_1 = `The full text is displayed in a popover. Lorem ipsum dolor sit amet, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ` && |
| 155 | + `At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore ` && |
| 156 | + `et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr` |
| 157 | + attribute_2 = 'Attribute related to label' |
| 158 | + status = 'Some status' |
| 159 | + overflow_mode = 'Popover' ) |
| 160 | + ( name = 'Product 3' |
| 161 | + attribute_1 = `The full text is displayed in place. Lorem ipsum dolor sit amet, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ` && |
| 162 | + `At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore ` && |
| 163 | + `et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr` |
| 164 | + attribute_2 = 'Attribute related to label' |
| 165 | + status = 'Some status' |
| 166 | + overflow_mode = 'InPlace' ) |
| 167 | + ( name = 'Product 4' |
| 168 | + attribute_1 = `The full text is displayed in a popover. Lorem ipsum dolor sit amet, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. ` && |
| 169 | + `At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore ` && |
| 170 | + `et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr` |
| 171 | + attribute_2 = 'Attribute related to label' |
| 172 | + status = 'Some status' |
| 173 | + overflow_mode = 'Popover' ) |
| 174 | + ). |
| 175 | + |
| 176 | + ENDMETHOD. |
| 177 | +ENDCLASS. |
0 commit comments