From e7912d17e0a63f7b1dfb982510412b744ab215dd Mon Sep 17 00:00:00 2001 From: oblomov <102328295+oblomov-dev@users.noreply.github.com> Date: Tue, 28 Mar 2023 17:20:57 +0200 Subject: [PATCH] bugfixes and configuration (#128) * Update README.md * fix table maintenance * bugfixes scroll container * bugfix demo boxes on small devices * bugfix popup * add table toolbar * bugfix flow logic * bugfixes flow and popup * bugfix landing page * refactoring type * bug url creation * cleanup constants * theme, ui5 path configuration * abalint issues * cleanup constants * cleanup constants * abaplint issues --- src/00/z2ui5_cl_app_demo_01.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_02.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_03.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_04.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_06.clas.abap | 33 +- src/00/z2ui5_cl_app_demo_08.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_09.clas.abap | 299 +++++++++--------- src/00/z2ui5_cl_app_demo_10.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_13.clas.abap | 131 ++++---- src/00/z2ui5_cl_app_demo_14.clas.abap | 4 +- src/00/z2ui5_cl_app_demo_16.clas.abap | 111 +++---- src/00/z2ui5_cl_app_demo_19.clas.abap | 2 +- src/00/z2ui5_cl_app_demo_21.clas.abap | 200 ++++++------ src/00/z2ui5_cl_app_demo_22.clas.abap | 8 +- src/00/z2ui5_cl_app_demo_24.clas.abap | 12 +- src/00/z2ui5_cl_app_demo_25.clas.abap | 12 +- src/z2ui5_cl_http_handler.clas.abap | 114 +++---- ...z2ui5_cl_http_handler.clas.locals_imp.abap | 69 ++-- src/z2ui5_if_client.intf.abap | 33 +- src/z2ui5_if_view.intf.abap | 27 +- 20 files changed, 557 insertions(+), 510 deletions(-) diff --git a/src/00/z2ui5_cl_app_demo_01.clas.abap b/src/00/z2ui5_cl_app_demo_01.clas.abap index effff985..d72f25e5 100644 --- a/src/00/z2ui5_cl_app_demo_01.clas.abap +++ b/src/00/z2ui5_cl_app_demo_01.clas.abap @@ -14,7 +14,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_01 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_01 IMPLEMENTATION. METHOD z2ui5_if_app~controller. diff --git a/src/00/z2ui5_cl_app_demo_02.clas.abap b/src/00/z2ui5_cl_app_demo_02.clas.abap index 8961344a..42e2d65e 100644 --- a/src/00/z2ui5_cl_app_demo_02.clas.abap +++ b/src/00/z2ui5_cl_app_demo_02.clas.abap @@ -51,7 +51,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_02 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_02 IMPLEMENTATION. METHOD z2ui5_if_app~controller. diff --git a/src/00/z2ui5_cl_app_demo_03.clas.abap b/src/00/z2ui5_cl_app_demo_03.clas.abap index 26bbc727..20ce5bb2 100644 --- a/src/00/z2ui5_cl_app_demo_03.clas.abap +++ b/src/00/z2ui5_cl_app_demo_03.clas.abap @@ -23,7 +23,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_03 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_03 IMPLEMENTATION. METHOD z2ui5_if_app~controller. diff --git a/src/00/z2ui5_cl_app_demo_04.clas.abap b/src/00/z2ui5_cl_app_demo_04.clas.abap index c2230aa3..5b859588 100644 --- a/src/00/z2ui5_cl_app_demo_04.clas.abap +++ b/src/00/z2ui5_cl_app_demo_04.clas.abap @@ -20,7 +20,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_04 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_04 IMPLEMENTATION. METHOD factory. diff --git a/src/00/z2ui5_cl_app_demo_06.clas.abap b/src/00/z2ui5_cl_app_demo_06.clas.abap index 3591ece1..8d00176f 100644 --- a/src/00/z2ui5_cl_app_demo_06.clas.abap +++ b/src/00/z2ui5_cl_app_demo_06.clas.abap @@ -16,6 +16,7 @@ CLASS z2ui5_cl_app_demo_06 DEFINITION PUBLIC. DATA t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. DATA check_initialized TYPE abap_bool. + data mv_key type string. PROTECTED SECTION. PRIVATE SECTION. @@ -46,6 +47,7 @@ CLASS Z2UI5_CL_APP_DEMO_06 IMPLEMENTATION. CASE client->get( )-event. WHEN 'BUTTON_SORT'. + client->popup_message_box( 'button sort was pressed' ). SORT t_tab BY value. WHEN 'BUTTON_POST'. @@ -79,12 +81,41 @@ CLASS Z2UI5_CL_APP_DEMO_06 IMPLEMENTATION. tab->header_toolbar( )->overflow_toolbar( )->title( 'title of the table' + )->button( + text = 'letf side button' + icon = 'sap-icon://account' + press = client->_event( 'BUTTON_SORT' ) + )->segmented_button( selected_key = mv_key + )->items( + )->segmented_button_item( + key = 'BLUE' + icon = 'sap-icon://accept' + text = 'blue' + )->segmented_button_item( + key = 'GREEN' + icon = 'sap-icon://add-favorite' + text = 'green' + )->get_parent( )->get_parent( + )->toolbar_spacer( + )->generic_tag( + arialabelledby = 'genericTagLabel' + text = 'Project Cost' + design = 'StatusIconHidden' + status = 'Error' + class = 'sapUiSmallMarginBottom' + )->object_number( + state = 'Error' + emphasized = 'false' + number = '3.5M' + unit = 'EUR' + )->get_parent( )->toolbar_spacer( )->button( text = 'Sort' + icon = 'sap-icon://sort-descending' press = client->_event( 'BUTTON_SORT' ) )->button( - text = 'Post' + icon = 'sap-icon://edit' press = client->_event( 'BUTTON_POST' ) ). tab->columns( diff --git a/src/00/z2ui5_cl_app_demo_08.clas.abap b/src/00/z2ui5_cl_app_demo_08.clas.abap index 6d23dec4..590f15db 100644 --- a/src/00/z2ui5_cl_app_demo_08.clas.abap +++ b/src/00/z2ui5_cl_app_demo_08.clas.abap @@ -13,7 +13,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_08 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_08 IMPLEMENTATION. METHOD z2ui5_if_app~controller. diff --git a/src/00/z2ui5_cl_app_demo_09.clas.abap b/src/00/z2ui5_cl_app_demo_09.clas.abap index 8553786f..8fa1a1d6 100644 --- a/src/00/z2ui5_cl_app_demo_09.clas.abap +++ b/src/00/z2ui5_cl_app_demo_09.clas.abap @@ -61,7 +61,7 @@ ENDCLASS. -CLASS Z2UI5_CL_APP_DEMO_09 IMPLEMENTATION. +CLASS z2ui5_cl_app_demo_09 IMPLEMENTATION. METHOD z2ui5_if_app~controller. @@ -136,155 +136,6 @@ CLASS Z2UI5_CL_APP_DEMO_09 IMPLEMENTATION. ENDMETHOD. - METHOD z2ui5_on_rendering. - - DATA(page) = client->factory_view( 'MAIN' - )->page( - title = 'abap2UI5 - Value Help Examples' - navbuttonpress = client->_event( 'BACK' ) - )->header_content( - )->link( - text = 'Demo' - href = 'https://twitter.com/OblomovDev/status/1637470531136921600' - )->link( - text = 'Source_Code' - href = client->get( )-s_request-url_source_code - )->get_parent( ). - - DATA(form) = page->grid( 'L7 M7 S7' - )->content( 'l' - )->simple_form( 'Input with Value Help' - )->content( 'f' ). - - form->label( 'Input with sugestion items' - )->input( - value = client->_bind( screen-color_01 ) - placeholder = 'fill in your favorite colour' - suggestionitems = client->_bind_one_way( mt_suggestion ) - showsuggestion = abap_true )->get( - )->suggestion_items( )->get( - )->list_item( - text = '{VALUE}' - additionaltext = '{DESCR}' ). - - form->label( 'Input only numbers allowed' - )->input( - value = client->_bind( screen-quantity ) - type = 'Number' - placeholder = 'quantity' ). - - form->label( 'Input with F4' - )->input( - value = client->_bind( screen-color_02 ) - placeholder = 'fill in your favorite colour' - showvaluehelp = abap_true - valuehelprequest = client->_event( 'POPUP_TABLE_F4' ) ). - - form->label( 'Custom F4 Popup' - )->input( - value = client->_bind( screen-name ) - placeholder = 'name' - showvaluehelp = abap_true - valuehelprequest = client->_event( 'POPUP_TABLE_F4_CUSTOM' ) - )->input( - value = client->_bind( screen-lastname ) - placeholder = 'lastname' - showvaluehelp = abap_true - valuehelprequest = client->_event( 'POPUP_TABLE_F4_CUSTOM' ) ). - - page->footer( - )->overflow_toolbar( - )->toolbar_spacer( - )->button( - text = 'Clear' - press = client->_event( 'BUTTON_CLEAR' ) - type = 'Reject' - enabled = abap_false - icon = 'sap-icon://delete' - )->button( - text = 'Send to Server' - press = client->_event( 'BUTTON_SEND' ) - enabled = abap_false - type = 'Success' ). - - - DATA(popup) = client->factory_view( 'POPUP_TABLE_F4' - )->dialog( 'abap2UI5 - F4 Value Help' ). - - DATA(tab) = popup->table( - mode = 'SingleSelectLeft' - items = client->_bind( mt_suggestion_sel ) ). - - tab->columns( - )->column( '20rem' - )->text( 'Color' )->get_parent( - )->column( )->text( 'Description' ). - - tab->items( )->column_list_item( selected = '{SELKZ}' - )->cells( - )->text( '{VALUE}' - )->text( '{DESCR}' ). - - popup->footer( - )->overflow_toolbar( - )->toolbar_spacer( - )->button( - text = 'continue' - press = client->_event( 'POPUP_TABLE_F4_CONTINUE' ) - type = 'Emphasized' ). - - - popup = client->factory_view( 'POPUP_TABLE_F4_CUSTOM' - )->dialog( 'abap2UI5 - F4 Value Help' ). - - popup->simple_form( - )->label( 'Location' - )->input( - value = client->_bind( screen-city ) - suggestionitems = client->_bind_one_way( mt_suggestion_city ) - showsuggestion = abap_true )->get( - )->suggestion_items( )->get( - )->list_item( - text = '{VALUE}' - additionaltext = '{DESCR}' - )->get_parent( )->get_parent( - )->button( - text = 'search...' - press = client->_event( 'SEARCH' ) ). - - tab = popup->table( - headertext = 'Employees' - mode = 'SingleSelectLeft' - items = client->_bind( mt_employees_sel ) ). - - tab->columns( - )->column( '10rem' - )->text( 'City' )->get_parent( - )->column( '10rem' - )->text( 'Nr' )->get_parent( - )->column( '15rem' - )->text( 'Name' )->get_parent( - )->column( '30rem' - )->text( 'Lastname' )->get_parent( ). - - tab->items( )->column_list_item( selected = '{SELKZ}' - )->cells( - )->text( '{CITY}' - )->text( '{NR}' - )->text( '{NAME}' - )->text( '{LASTNAME}' ). - - popup->footer( - )->overflow_toolbar( - )->toolbar_spacer( - )->button( - text = 'continue' - press = client->_event( 'POPUP_TABLE_F4_CUSTOM_CONTINUE' ) - type = 'Emphasized' ). - - ENDMETHOD. - - METHOD z2ui5_on_init. mt_suggestion = VALUE #( @@ -357,4 +208,152 @@ CLASS Z2UI5_CL_APP_DEMO_09 IMPLEMENTATION. ENDMETHOD. + + METHOD z2ui5_on_rendering. + + DATA(page) = client->factory_view( 'MAIN' + )->page( + title = 'abap2UI5 - Value Help Examples' + navbuttonpress = client->_event( 'BACK' ) + )->header_content( + )->link( + text = 'Demo' + href = 'https://twitter.com/OblomovDev/status/1637470531136921600' + )->link( + text = 'Source_Code' + href = client->get( )-s_request-url_source_code + )->get_parent( ). + + DATA(form) = page->grid( 'L7 M7 S7' + )->content( 'l' + )->simple_form( 'Input with Value Help' + )->content( 'f' ). + + form->label( 'Input with sugestion items' + )->input( + value = client->_bind( screen-color_01 ) + placeholder = 'fill in your favorite colour' + suggestionitems = client->_bind_one_way( mt_suggestion ) + showsuggestion = abap_true )->get( + )->suggestion_items( )->get( + )->list_item( + text = '{VALUE}' + additionaltext = '{DESCR}' ). + + form->label( 'Input only numbers allowed' + )->input( + value = client->_bind( screen-quantity ) + type = 'Number' + placeholder = 'quantity' ). + + form->label( 'Input with F4' + )->input( + value = client->_bind( screen-color_02 ) + placeholder = 'fill in your favorite colour' + showvaluehelp = abap_true + valuehelprequest = client->_event( 'POPUP_TABLE_F4' ) ). + + form->label( 'Custom F4 Popup' + )->input( + value = client->_bind( screen-name ) + placeholder = 'name' + showvaluehelp = abap_true + valuehelprequest = client->_event( 'POPUP_TABLE_F4_CUSTOM' ) + )->input( + value = client->_bind( screen-lastname ) + placeholder = 'lastname' + showvaluehelp = abap_true + valuehelprequest = client->_event( 'POPUP_TABLE_F4_CUSTOM' ) ). + + page->footer( + )->overflow_toolbar( + )->toolbar_spacer( + )->button( + text = 'Clear' + press = client->_event( 'BUTTON_CLEAR' ) + type = 'Reject' + enabled = abap_false + icon = 'sap-icon://delete' + )->button( + text = 'Send to Server' + press = client->_event( 'BUTTON_SEND' ) + enabled = abap_false + type = 'Success' ). + + + client->factory_view( 'POPUP_TABLE_F4' + )->dialog( 'abap2UI5 - F4 Value Help' + )->table( + mode = 'SingleSelectLeft' + items = client->_bind( mt_suggestion_sel ) + )->columns( + )->column( '20rem' + )->text( 'Color' )->get_parent( + )->column( + )->text( 'Description' + )->get_parent( )->get_parent( + )->items( + )->column_list_item( selected = '{SELKZ}' + )->cells( + )->text( '{VALUE}' + )->text( '{DESCR}' + )->get_parent( )->get_parent( )->get_parent( )->get_parent( + )->footer( + )->overflow_toolbar( + )->toolbar_spacer( + )->button( + text = 'continue' + press = client->_event( 'POPUP_TABLE_F4_CONTINUE' ) + type = 'Emphasized' ). + + + data(popup) = client->factory_view( 'POPUP_TABLE_F4_CUSTOM' + )->dialog( 'abap2UI5 - F4 Value Help' ). + + popup->simple_form( + )->label( 'Location' + )->input( + value = client->_bind( screen-city ) + suggestionitems = client->_bind_one_way( mt_suggestion_city ) + showsuggestion = abap_true )->get( + )->suggestion_items( )->get( + )->list_item( + text = '{VALUE}' + additionaltext = '{DESCR}' + )->get_parent( )->get_parent( + )->button( + text = 'search...' + press = client->_event( 'SEARCH' ) ). + + data(tab) = popup->table( + headertext = 'Employees' + mode = 'SingleSelectLeft' + items = client->_bind( mt_employees_sel ) ). + + tab->columns( + )->column( '10rem' + )->text( 'City' )->get_parent( + )->column( '10rem' + )->text( 'Nr' )->get_parent( + )->column( '15rem' + )->text( 'Name' )->get_parent( + )->column( '30rem' + )->text( 'Lastname' )->get_parent( ). + + tab->items( )->column_list_item( selected = '{SELKZ}' + )->cells( + )->text( '{CITY}' + )->text( '{NR}' + )->text( '{NAME}' + )->text( '{LASTNAME}' ). + + popup->footer( + )->overflow_toolbar( + )->toolbar_spacer( + )->button( + text = 'continue' + press = client->_event( 'POPUP_TABLE_F4_CUSTOM_CONTINUE' ) + type = 'Emphasized' ). + + ENDMETHOD. ENDCLASS. diff --git a/src/00/z2ui5_cl_app_demo_10.clas.abap b/src/00/z2ui5_cl_app_demo_10.clas.abap index fbde105b..d381ddc0 100644 --- a/src/00/z2ui5_cl_app_demo_10.clas.abap +++ b/src/00/z2ui5_cl_app_demo_10.clas.abap @@ -9,7 +9,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_10 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_10 IMPLEMENTATION. METHOD z2ui5_if_app~controller. diff --git a/src/00/z2ui5_cl_app_demo_13.clas.abap b/src/00/z2ui5_cl_app_demo_13.clas.abap index 2a8566d9..1e504edd 100644 --- a/src/00/z2ui5_cl_app_demo_13.clas.abap +++ b/src/00/z2ui5_cl_app_demo_13.clas.abap @@ -19,6 +19,7 @@ CLASS z2ui5_cl_app_demo_13 DEFINITION PUBLIC. TYPES ty_t_table TYPE STANDARD TABLE OF ty_s_spfli WITH EMPTY KEY. + DATA: BEGIN OF ms_import, t_table TYPE ty_t_table, @@ -67,7 +68,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_13 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_13 IMPLEMENTATION. METHOD z2ui5_if_app~controller. @@ -157,70 +158,6 @@ CLASS z2ui5_cl_app_demo_13 IMPLEMENTATION. ENDMETHOD. - METHOD z2ui5_on_render_view_import. - - DATA(page) = client->factory_view( 'IMPORT_TABLE' - )->page( - title = 'abap2UI5 - Table Maintenance' - navbuttonpress = client->_event( 'BACK' ) - )->header_content( - )->link( - text = 'Demo' - href = `https://twitter.com/OblomovDev/status/1634206964291911682` - )->link( - text = 'Source_Code' - href = client->get( )-s_request-url_source_code - )->get_parent( - )->sub_header( - )->overflow_toolbar( - )->button( - text = '(1) Import Data' - press = client->_event( 'BTN_IMPORT' ) - enabled = abap_false - )->button( - text = '(2) Edit Data' - press = client->_event( 'BTN_EDIT' ) - )->button( - text = '(3) Export Data' - press = client->_event( 'BTN_EXPORT' ) - )->get_parent( )->get_parent( ). - - DATA(grid) = page->grid( 'L7 M7 S7' )->content( 'l' ). - - grid->simple_form( '1. Import Data' - )->content( 'f' - )->label( 'Table' - )->input( 'SPFLI' - )->label( 'Format' - )->segmented_button( client->_bind( ms_import-segment_key ) )->get( - )->items( )->get( - )->segmented_button_item( key = 'json' text = 'json' - )->segmented_button_item( key = 'csv' text = 'csv' - )->segmented_button_item( key = 'xml' text = 'xml' ). - - grid = page->grid( 'L12 M12 S12' )->content( 'l' ). - - grid->scroll_container( '75%' - )->code_editor( - type = COND #( WHEN ms_import-segment_key = 'csv' THEN |plain_text| ELSE ms_import-segment_key ) - value = client->_bind( ms_import-editor ) - editable = abap_true ). - - page->footer( )->overflow_toolbar( - )->button( - text = 'Clear' - press = client->_event( 'IMPORT_CLEAR' ) - icon = 'sap-icon://delete' - )->toolbar_spacer( - )->button( - text = 'Import' - press = client->_event( 'IMPORT_DB' ) - type = 'Emphasized' - icon = 'sap-icon://upload-to-cloud' ). - - ENDMETHOD. - - METHOD z2ui5_on_render_view_edit. DATA(page) = client->factory_view( 'EDIT_TABLE' @@ -365,4 +302,68 @@ CLASS z2ui5_cl_app_demo_13 IMPLEMENTATION. icon = 'sap-icon://download-from-cloud' ). ENDMETHOD. + + + METHOD z2ui5_on_render_view_import. + + DATA(page) = client->factory_view( 'IMPORT_TABLE' + )->page( + title = 'abap2UI5 - Table Maintenance' + navbuttonpress = client->_event( 'BACK' ) + )->header_content( + )->link( + text = 'Demo' + href = `https://twitter.com/OblomovDev/status/1634206964291911682` + )->link( + text = 'Source_Code' + href = client->get( )-s_request-url_source_code + )->get_parent( + )->sub_header( + )->overflow_toolbar( + )->button( + text = '(1) Import Data' + press = client->_event( 'BTN_IMPORT' ) + enabled = abap_false + )->button( + text = '(2) Edit Data' + press = client->_event( 'BTN_EDIT' ) + )->button( + text = '(3) Export Data' + press = client->_event( 'BTN_EXPORT' ) + )->get_parent( )->get_parent( ). + + DATA(grid) = page->grid( 'L7 M12 S12' )->content( 'l' ). + + grid->simple_form( '1. Import Data' + )->content( 'f' + )->label( 'Table' + )->input( 'SPFLI' + )->label( 'Format' + )->segmented_button( client->_bind( ms_import-segment_key ) )->get( + )->items( )->get( + )->segmented_button_item( key = 'json' text = 'json' + )->segmented_button_item( key = 'csv' text = 'csv' + )->segmented_button_item( key = 'xml' text = 'xml' ). + + grid = page->grid( 'L12 M12 S12' )->content( 'l' ). + + grid->scroll_container( '75%' + )->code_editor( + type = COND #( WHEN ms_import-segment_key = 'csv' THEN |plain_text| ELSE ms_import-segment_key ) + value = client->_bind( ms_import-editor ) + editable = abap_true ). + + page->footer( )->overflow_toolbar( + )->button( + text = 'Clear' + press = client->_event( 'IMPORT_CLEAR' ) + icon = 'sap-icon://delete' + )->toolbar_spacer( + )->button( + text = 'Import' + press = client->_event( 'IMPORT_DB' ) + type = 'Emphasized' + icon = 'sap-icon://upload-to-cloud' ). + + ENDMETHOD. ENDCLASS. diff --git a/src/00/z2ui5_cl_app_demo_14.clas.abap b/src/00/z2ui5_cl_app_demo_14.clas.abap index 0123caa0..1440ebe4 100644 --- a/src/00/z2ui5_cl_app_demo_14.clas.abap +++ b/src/00/z2ui5_cl_app_demo_14.clas.abap @@ -16,7 +16,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_14 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_14 IMPLEMENTATION. METHOD z2ui5_if_app~controller. @@ -67,7 +67,7 @@ CLASS z2ui5_cl_app_demo_14 IMPLEMENTATION. )->link( text = 'Source_Code' href = client->get( )-s_request-url_source_code )->get_parent( ). - DATA(grid) = page->grid( 'L7 M7 S7' )->content( 'l' ). + DATA(grid) = page->grid( 'L7 M12 S12' )->content( 'l' ). grid->simple_form( 'File' )->content( 'f' )->label( 'path' diff --git a/src/00/z2ui5_cl_app_demo_16.clas.abap b/src/00/z2ui5_cl_app_demo_16.clas.abap index 1e1dde9e..7a7cdbc5 100644 --- a/src/00/z2ui5_cl_app_demo_16.clas.abap +++ b/src/00/z2ui5_cl_app_demo_16.clas.abap @@ -49,65 +49,14 @@ CLASS z2ui5_cl_app_demo_16 DEFINITION PUBLIC. container TYPE REF TO z2ui5_if_view. + PROTECTED SECTION. + PRIVATE SECTION. ENDCLASS. -CLASS z2ui5_cl_app_demo_16 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_16 IMPLEMENTATION. - METHOD z2ui5_if_app~controller. - - CASE client->get( )-lifecycle_method. - - WHEN client->cs-lifecycle_method-on_event. - - IF check_initialized = abap_false. - check_initialized = abap_true. - - mv_path = '../../demo/text'. - mv_type = 'plain_text'. - mv_sel1 = abap_true. - - RETURN. - ENDIF. - - CASE client->get( )-event. - - WHEN 'DONUT_CHANGED'. - client->popup_message_toast( 'Donut selection changed' ). - - WHEN 'BAR_CHANGED'. - client->popup_message_toast( 'Bar selection changed' ). - - WHEN 'LINE_CHANGED'. - client->popup_message_toast( 'Line selection changed' ). - - WHEN 'DONUT_CHANGED'. - client->popup_message_toast( 'Donut selection changed' ). - - WHEN 'BACK'. - client->nav_app_leave( client->get( )-id_prev_app_stack ). - - ENDCASE. - - WHEN client->cs-lifecycle_method-on_rendering. - - DATA(container) = client->factory_view( 'VIEW_INPUT' - )->page( title = 'abap2UI5 - Visualization' navbuttonpress = client->_event( 'BACK' ) - )->header_content( - )->link( text = 'Demo' href = `https://twitter.com/OblomovDev/status/1639191954285113344` - )->link( text = 'Source_Code' href = client->get( )-s_request-url_source_code - )->get_parent( - )->tab_container( ). - - render_tab_donut( client = client container = container ). - render_tab_bar( client = client container = container ). - render_tab_line( client = client container = container ). - render_tab_radial( client = client container = container ). - - ENDCASE. - - ENDMETHOD. METHOD render_tab_bar. @@ -386,4 +335,58 @@ CLASS z2ui5_cl_app_demo_16 IMPLEMENTATION. ENDMETHOD. + + METHOD z2ui5_if_app~controller. + + CASE client->get( )-lifecycle_method. + + WHEN client->cs-lifecycle_method-on_event. + + IF check_initialized = abap_false. + check_initialized = abap_true. + + mv_path = '../../demo/text'. + mv_type = 'plain_text'. + mv_sel1 = abap_true. + + RETURN. + ENDIF. + + CASE client->get( )-event. + + WHEN 'DONUT_CHANGED'. + client->popup_message_toast( 'Donut selection changed' ). + + WHEN 'BAR_CHANGED'. + client->popup_message_toast( 'Bar selection changed' ). + + WHEN 'LINE_CHANGED'. + client->popup_message_toast( 'Line selection changed' ). + + WHEN 'DONUT_CHANGED'. + client->popup_message_toast( 'Donut selection changed' ). + + WHEN 'BACK'. + client->nav_app_leave( client->get( )-id_prev_app_stack ). + + ENDCASE. + + WHEN client->cs-lifecycle_method-on_rendering. + + DATA(container) = client->factory_view( 'VIEW_INPUT' + )->page( title = 'abap2UI5 - Visualization' navbuttonpress = client->_event( 'BACK' ) + )->header_content( + )->link( text = 'Demo' href = `https://twitter.com/OblomovDev/status/1639191954285113344` + )->link( text = 'Source_Code' href = client->get( )-s_request-url_source_code + )->get_parent( + )->tab_container( ). + + render_tab_donut( client = client container = container ). + render_tab_bar( client = client container = container ). + render_tab_line( client = client container = container ). + render_tab_radial( client = client container = container ). + + ENDCASE. + + ENDMETHOD. ENDCLASS. diff --git a/src/00/z2ui5_cl_app_demo_19.clas.abap b/src/00/z2ui5_cl_app_demo_19.clas.abap index 66eee76a..ccb97753 100644 --- a/src/00/z2ui5_cl_app_demo_19.clas.abap +++ b/src/00/z2ui5_cl_app_demo_19.clas.abap @@ -23,7 +23,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_19 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_19 IMPLEMENTATION. METHOD z2ui5_if_app~controller. diff --git a/src/00/z2ui5_cl_app_demo_21.clas.abap b/src/00/z2ui5_cl_app_demo_21.clas.abap index ea656cd3..4ec02810 100644 --- a/src/00/z2ui5_cl_app_demo_21.clas.abap +++ b/src/00/z2ui5_cl_app_demo_21.clas.abap @@ -61,6 +61,93 @@ ENDCLASS. CLASS Z2UI5_CL_APP_DEMO_21 IMPLEMENTATION. + METHOD z2ui5_if_app~controller. + + CASE client->get( )-lifecycle_method. + + WHEN client->cs-lifecycle_method-on_event. + + IF check_initialized = abap_false. + check_initialized = abap_true. + + t_bapiret = VALUE #( + ( message = 'An empty Report field causes an empty XML Message to be sent' type = 'E' id = 'MSG1' number = '001' ) + ( message = 'Check was executed for wrong Scenario' type = 'E' id = 'MSG1' number = '002' ) + ( message = 'Request was handled without errors' type = 'S' id = 'MSG1' number = '003' ) + ( message = 'product activated' type = 'S' id = 'MSG4' number = '375' ) + ( message = 'check the input values' type = 'W' id = 'MSG2' number = '375' ) + ( message = 'product already in use' type = 'I' id = 'MSG2' number = '375' ) + ). + + RETURN. + ENDIF. + + + CASE client->get( )-event. + + WHEN 'POPUP_TO_DECIDE'. + client->popup_view( 'POPUP_TO_DECIDE' ). + + WHEN 'BUTTON_CONFIRM'. + client->popup_message_toast( 'confirm pressed' ). + + WHEN 'BUTTON_CANCEL'. + client->popup_message_toast( 'cancel pressed' ). + + WHEN 'POPUP_TO_TEXTAREA'. + mv_stretch_active = abap_false. + client->popup_view( 'POPUP_TO_TEXTAREA' ). + + WHEN 'POPUP_TO_TEXTAREA_STRETCH'. + client->popup_view( 'POPUP_TO_TEXTAREA' ). + mv_stretch_active = abap_true. + + WHEN 'POPUP_TO_TEXTAREA_SIZE'. + client->popup_view( 'POPUP_TO_TEXTAREA_SIZE' ). + + WHEN 'BUTTON_TEXTAREA_CANCEL'. + client->popup_message_toast( 'textarea deleted' ). + CLEAR mv_textarea. + + WHEN 'POPUP_TO_INPUT'. + ms_popup_input-value1 = 'value1'. + client->popup_view( 'POPUP_TO_INPUT' ). + + WHEN 'POPUP_BAL'. + client->popup_view( 'POPUP_BAL' ). + + WHEN 'POPUP_TABLE'. + CLEAR t_tab. + DO 10 TIMES. + DATA(ls_row) = VALUE ty_row( title = 'entry_' && sy-index value = 'red' info = 'completed' descr = 'this is a description' ). + INSERT ls_row INTO TABLE t_tab. + ENDDO. + client->popup_view( 'POPUP_TABLE' ). + + WHEN 'POPUP_TABLE_CONTINUE'. + DELETE t_tab WHERE selkz = abap_false. + client->popup_message_toast( `Entry selected: ` && t_tab[ 1 ]-title ). + + WHEN 'BACK'. + client->nav_app_leave( client->get( )-id_prev_app_stack ). + + ENDCASE. + + client->show_view( 'MAIN' ). + + + WHEN client->cs-lifecycle_method-on_rendering. + + view_main( client ). + view_popup_decide( client ). + view_popup_textarea( client ). + view_popup_input( client ). + view_popup_table( client ). + + ENDCASE. + + ENDMETHOD. + METHOD view_main. DATA(page) = client->factory_view( 'MAIN' @@ -187,12 +274,13 @@ CLASS Z2UI5_CL_APP_DEMO_21 IMPLEMENTATION. )->text( 'Message' )->get_parent( )->get_parent( )->items( - )->column_list_item( )->cells( - )->text( '{TYPE}' - )->text( '{NUMBER}' - )->text( '{ID}' - )->text( '{MESSAGE}' - )->get_parent( )->get_parent( )->get_parent( + )->column_list_item( + )->cells( + )->text( '{TYPE}' + )->text( '{NUMBER}' + )->text( '{ID}' + )->text( '{MESSAGE}' + )->get_parent( )->get_parent( )->get_parent( )->get_parent( )->footer( )->overflow_toolbar( )->toolbar_spacer( )->button( @@ -211,12 +299,13 @@ CLASS Z2UI5_CL_APP_DEMO_21 IMPLEMENTATION. )->column( )->text( 'Info' )->get_parent( )->column( )->text( 'Description' )->get_parent( )->get_parent( - )->items( )->column_list_item( selected = '{SELKZ}' )->cells( - )->text( '{TITLE}' - )->text( '{VALUE}' - )->text( '{INFO}' - )->text( '{DESCR}' - )->get_parent( )->get_parent( )->get_parent( + )->items( )->column_list_item( selected = '{SELKZ}' + )->cells( + )->text( '{TITLE}' + )->text( '{VALUE}' + )->text( '{INFO}' + )->text( '{DESCR}' + )->get_parent( )->get_parent( )->get_parent( )->get_parent( )->footer( )->overflow_toolbar( )->toolbar_spacer( )->button( @@ -274,91 +363,4 @@ CLASS Z2UI5_CL_APP_DEMO_21 IMPLEMENTATION. ENDMETHOD. - - METHOD z2ui5_if_app~controller. - - CASE client->get( )-lifecycle_method. - - WHEN client->cs-lifecycle_method-on_event. - - IF check_initialized = abap_false. - check_initialized = abap_true. - - t_bapiret = VALUE #( - ( message = 'An empty Report field causes an empty XML Message to be sent' type = 'E' id = 'MSG1' number = '001' ) - ( message = 'Check was executed for wrong Scenario' type = 'E' id = 'MSG1' number = '002' ) - ( message = 'Request was handled without errors' type = 'S' id = 'MSG1' number = '003' ) - ( message = 'product activated' type = 'S' id = 'MSG4' number = '375' ) - ( message = 'check the input values' type = 'W' id = 'MSG2' number = '375' ) - ( message = 'product already in use' type = 'I' id = 'MSG2' number = '375' ) - ). - - RETURN. - ENDIF. - - - CASE client->get( )-event. - - WHEN 'POPUP_TO_DECIDE'. - client->popup_view( 'POPUP_TO_DECIDE' ). - - WHEN 'BUTTON_CONFIRM'. - client->popup_message_toast( 'confirm pressed' ). - - WHEN 'BUTTON_CANCEL'. - client->popup_message_toast( 'cancel pressed' ). - - WHEN 'POPUP_TO_TEXTAREA'. - mv_stretch_active = abap_false. - client->popup_view( 'POPUP_TO_TEXTAREA' ). - - WHEN 'POPUP_TO_TEXTAREA_STRETCH'. - client->popup_view( 'POPUP_TO_TEXTAREA' ). - mv_stretch_active = abap_true. - - WHEN 'POPUP_TO_TEXTAREA_SIZE'. - client->popup_view( 'POPUP_TO_TEXTAREA_SIZE' ). - - WHEN 'BUTTON_TEXTAREA_CANCEL'. - client->popup_message_toast( 'textarea deleted' ). - CLEAR mv_textarea. - - WHEN 'POPUP_TO_INPUT'. - ms_popup_input-value1 = 'value1'. - client->popup_view( 'POPUP_TO_INPUT' ). - - WHEN 'POPUP_BAL'. - client->popup_view( 'POPUP_BAL' ). - - WHEN 'POPUP_TABLE'. - CLEAR t_tab. - DO 10 TIMES. - DATA(ls_row) = VALUE ty_row( title = 'entry_' && sy-index value = 'red' info = 'completed' descr = 'this is a description' ). - INSERT ls_row INTO TABLE t_tab. - ENDDO. - client->popup_view( 'POPUP_TABLE' ). - - WHEN 'POPUP_TABLE_CONTINUE'. - DELETE t_tab WHERE selkz = abap_false. - client->popup_message_toast( `Entry selected: ` && t_tab[ 1 ]-title ). - - WHEN 'BACK'. - client->nav_app_leave( client->get( )-id_prev_app_stack ). - - ENDCASE. - - client->show_view( 'MAIN' ). - - - WHEN client->cs-lifecycle_method-on_rendering. - - view_main( client ). - view_popup_decide( client ). - view_popup_textarea( client ). - view_popup_input( client ). - view_popup_table( client ). - - ENDCASE. - - ENDMETHOD. ENDCLASS. diff --git a/src/00/z2ui5_cl_app_demo_22.clas.abap b/src/00/z2ui5_cl_app_demo_22.clas.abap index c3abbe28..b55ba808 100644 --- a/src/00/z2ui5_cl_app_demo_22.clas.abap +++ b/src/00/z2ui5_cl_app_demo_22.clas.abap @@ -25,7 +25,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_22 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_22 IMPLEMENTATION. METHOD z2ui5_if_app~controller. @@ -58,7 +58,7 @@ CLASS z2ui5_cl_app_demo_22 IMPLEMENTATION. "nothing to do, default mode WHEN 'BUTTON_SCROLL_BOTTOM'. - client->set( t_scroll_pos = VALUE #( ( n = 'id_page' v = '99999' ) ) ). + client->set( t_scroll_pos = VALUE #( ( name = 'id_page' value = '99999' ) ) ). " WHEN 'BUTTON_SCROLL_UP'. " DATA(lv_pos) = client->get( )-page_scroll_pos - 500. @@ -79,8 +79,8 @@ CLASS z2ui5_cl_app_demo_22 IMPLEMENTATION. WHEN 'BUTTON_FOCUS_END'. client->set( s_cursor_pos = VALUE #( id = 'id_text3' cursorpos = '99999' selectionstart = '99999' selectionend = '999999' ) ). client->set( t_scroll_pos = VALUE #( - ( n = 'id_page' v = '99999' ) - ( n = 'id_text3' v = '99999' ) + ( name = 'id_page' value = '99999' ) + ( name = 'id_text3' value = '99999' ) ) ). diff --git a/src/00/z2ui5_cl_app_demo_24.clas.abap b/src/00/z2ui5_cl_app_demo_24.clas.abap index 7b70e2f9..d09cd040 100644 --- a/src/00/z2ui5_cl_app_demo_24.clas.abap +++ b/src/00/z2ui5_cl_app_demo_24.clas.abap @@ -54,7 +54,7 @@ CLASS Z2UI5_CL_APP_DEMO_24 IMPLEMENTATION. WHEN client->cs-lifecycle_method-on_rendering. DATA(view) = client->factory_view( ). - view->page( title = 'abap2UI5 - flow logic 1' navbuttonpress = client->_event( 'BACK' ) + view->page( title = 'abap2UI5 - flow logic - APP 01' navbuttonpress = client->_event( 'BACK' ) )->header_content( )->link( text = 'Source_Code' href = client->get( )-s_request-url_source_code )->get_parent( )->grid( 'L6 M12 S12' )->content( 'l' @@ -62,14 +62,14 @@ CLASS Z2UI5_CL_APP_DEMO_24 IMPLEMENTATION. )->simple_form( 'Controller' )->content( 'f' )->label( 'Demo' - )->button( text = 'call new app (default View)' press = client->_event( 'CALL_NEW_APP' ) + )->button( text = 'call new app (first View)' press = client->_event( 'CALL_NEW_APP' ) )->label( 'Demo' - )->button( text = 'call new app with view SECOND' press = client->_event( 'CALL_NEW_APP_VIEW' ) + )->button( text = 'call new app (second View)' press = client->_event( 'CALL_NEW_APP_VIEW' ) + )->label( 'Demo' + )->button( text = 'call new app (set Event)' press = client->_event( 'CALL_NEW_APP_EVENT' ) )->label( 'Demo' - )->button( text = 'call new app and set event' press = client->_event( 'CALL_NEW_APP_EVENT' ) - )->label( 'call new app and set this data' )->input( client->_bind( mv_input ) - )->button( text = 'call' press = client->_event( 'CALL_NEW_APP_READ' ) + )->button( text = 'call new app (set data)' press = client->_event( 'CALL_NEW_APP_READ' ) )->label( 'some data, you can read it in the next app' )->input( client->_bind( mv_input2 ) ). diff --git a/src/00/z2ui5_cl_app_demo_25.clas.abap b/src/00/z2ui5_cl_app_demo_25.clas.abap index 9d270e41..729490ac 100644 --- a/src/00/z2ui5_cl_app_demo_25.clas.abap +++ b/src/00/z2ui5_cl_app_demo_25.clas.abap @@ -24,7 +24,7 @@ ENDCLASS. -CLASS z2ui5_cl_app_demo_25 IMPLEMENTATION. +CLASS Z2UI5_CL_APP_DEMO_25 IMPLEMENTATION. METHOD factory. @@ -77,17 +77,17 @@ CLASS z2ui5_cl_app_demo_25 IMPLEMENTATION. DATA(page) = client->factory_view( 'MAIN' )->page( - title = 'abap2UI5 - flow logic 2' + title = 'abap2UI5 - flow logic - APP 02' navbuttonpress = client->_event( 'BACK' ) )->header_content( )->link( - text = 'Go to Source Code' + text = 'Source_Code' href = client->get( )-s_request-url_source_code )->get_parent( ). page->grid( 'L6 M12 S12' )->content( 'l' - )->simple_form( 'MAIN View' )->content( 'f' + )->simple_form( 'View: FIRST' )->content( 'f' )->label( 'Input set by previous app' )->input( mv_input_previous_set @@ -102,7 +102,7 @@ CLASS z2ui5_cl_app_demo_25 IMPLEMENTATION. page = client->factory_view( 'SECOND' )->page( - title = 'abap2UI5 - flow logic 2' + title = 'abap2UI5 - flow logic - APP 02' navbuttonpress = client->_event( 'BACK' ) )->header_content( )->link( @@ -111,7 +111,7 @@ CLASS z2ui5_cl_app_demo_25 IMPLEMENTATION. )->get_parent( ). page->grid( 'L6 M12 S12' )->content( 'l' - )->simple_form( 'second view set by previous app' )->content( 'f' + )->simple_form( 'View: SECOND' )->content( 'f' )->label( 'Demo' )->button( text = 'leave to previous app' press = client->_event( 'BACK' ) )->label( 'Demo' diff --git a/src/z2ui5_cl_http_handler.clas.abap b/src/z2ui5_cl_http_handler.clas.abap index a1e67707..ee995d14 100644 --- a/src/z2ui5_cl_http_handler.clas.abap +++ b/src/z2ui5_cl_http_handler.clas.abap @@ -7,12 +7,6 @@ CLASS z2ui5_cl_http_handler DEFINITION CONSTANTS: BEGIN OF cs_config, - theme TYPE string VALUE 'sap_horizon', - browser_title TYPE string VALUE 'abap2UI5', - " choose your ui5 library/license here, see sap note 3207822 and 2943781 - " 'resources/sap-ui-core.js' or '/sap/public/bc/ui5_ui5/resources/sap-ui-core.js', - repository TYPE string VALUE 'https://ui5.sap.com/resources/sap-ui-core.js', - letterboxing TYPE abap_bool VALUE abap_true, check_debug_mode TYPE abap_bool VALUE abap_true, END OF cs_config. @@ -21,7 +15,7 @@ CLASS z2ui5_cl_http_handler DEFINITION name TYPE string, value TYPE string, END OF ty_s_name_value. - TYPES ty_t_name_value TYPE STANDARD TABLE OF ty_s_name_value. + TYPES ty_t_name_value TYPE STANDARD TABLE OF ty_s_name_value WITH EMPTY KEY. CLASS-DATA: BEGIN OF client, @@ -30,7 +24,16 @@ CLASS z2ui5_cl_http_handler DEFINITION t_param TYPE ty_t_name_value, END OF client. + "! loads the one page ui5 application + "! @parameter library_path | choose your ui5 license here, see sap note 3207822 and 2943781 + "! @parameter theme | sap_horizon, sap_belize, ... + "! @parameter title | browser title + "! @parameter r_result | index.html CLASS-METHODS main_index_html + IMPORTING + library_path TYPE string DEFAULT `https://ui5.sap.com/resources/sap-ui-core.js` + theme TYPE string DEFAULT `sap_horizon` + title TYPE string DEFAULT `abap2UI5` RETURNING VALUE(r_result) TYPE string. @@ -48,50 +51,6 @@ ENDCLASS. CLASS z2ui5_cl_http_handler IMPLEMENTATION. - METHOD main_roundtrip. - - DATA(lo_runtime) = z2ui5_lcl_system_runtime=>request_begin( ). - - DO. - TRY. - DATA(li_client) = lo_runtime->app_before_event( ). - ROLLBACK WORK. - CAST z2ui5_if_app( lo_runtime->ms_db-o_app )->controller( li_client ). - ROLLBACK WORK. - - CATCH cx_root INTO DATA(x). - lo_runtime = lo_runtime->set_app_system_error( x ). - CONTINUE. - ENDTRY. - - IF lo_runtime->ms_next-s_nav_app_call_new IS NOT INITIAL. - lo_runtime = lo_runtime->set_app_call_new( ). - CONTINUE. - ENDIF. - - IF lo_runtime->ms_next-nav_app_leave_to_id IS NOT INITIAL. - lo_runtime = lo_runtime->set_app_leave_to_id( ). - CONTINUE. - ENDIF. - - TRY. - li_client = lo_runtime->app_before_rendering( ). - ROLLBACK WORK. - CAST z2ui5_if_app( lo_runtime->ms_db-o_app )->controller( li_client ). - ROLLBACK WORK. - result = lo_runtime->request_end( ). - - CATCH cx_root INTO x. - lo_runtime = lo_runtime->set_app_system_error( x ). - CONTINUE. - ENDTRY. - - RETURN. - ENDDO. - - ENDMETHOD. - - METHOD main_index_html. client-t_param = VALUE #( LET tab = client-t_param IN FOR row IN tab @@ -111,14 +70,14 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION. ` ` && |\n| && ` ` && |\n| && ` ` && |\n| && - ` ` && cs_config-browser_title && `` && |\n| && + ` ` && title && `` && |\n| && ` ` && - ` ` && |\n| && @@ -160,6 +119,7 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION. ` $(ele).scrollTop( item[ key ] ); } ` && |\n| && ` // index: the ordinal position of the key within the object ` && |\n| && `})); }` && |\n| && + ` sap.ui.core.BusyIndicator.hide();` && |\n| && ` },` && |\n| && |\n| && ` onEventFrontend: function (vAction) {` && |\n| && @@ -274,7 +234,7 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION. ` oView.setModel(oModel);` && |\n| && ` oView.placeAt("content");` && |\n| && ` this.oView = oView;` && |\n| && - ` sap.ui.core.BusyIndicator.hide();` && |\n| && + ` ` && |\n| && ` }` && |\n| && ` );` && |\n| && ` } else if ( sap.z2ui5.oResponse.SET_PREV_VIEW == true ){` && |\n| && @@ -434,4 +394,48 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION. |\n| && ``. ENDMETHOD. + + + METHOD main_roundtrip. + + DATA(lo_runtime) = z2ui5_lcl_system_runtime=>request_begin( ). + + DO. + TRY. + DATA(li_client) = lo_runtime->app_before_event( ). + ROLLBACK WORK. + CAST z2ui5_if_app( lo_runtime->ms_db-o_app )->controller( li_client ). + ROLLBACK WORK. + + CATCH cx_root INTO DATA(x). + lo_runtime = lo_runtime->set_app_system_error( x ). + CONTINUE. + ENDTRY. + + IF lo_runtime->ms_next-s_nav_app_call_new IS NOT INITIAL. + lo_runtime = lo_runtime->set_app_call_new( ). + CONTINUE. + ENDIF. + + IF lo_runtime->ms_next-nav_app_leave_to_id IS NOT INITIAL. + lo_runtime = lo_runtime->set_app_leave_to_id( ). + CONTINUE. + ENDIF. + + TRY. + li_client = lo_runtime->app_before_rendering( ). + ROLLBACK WORK. + CAST z2ui5_if_app( lo_runtime->ms_db-o_app )->controller( li_client ). + ROLLBACK WORK. + result = lo_runtime->request_end( ). + + CATCH cx_root INTO x. + lo_runtime = lo_runtime->set_app_system_error( x ). + CONTINUE. + ENDTRY. + + RETURN. + ENDDO. + + ENDMETHOD. ENDCLASS. diff --git a/src/z2ui5_cl_http_handler.clas.locals_imp.abap b/src/z2ui5_cl_http_handler.clas.locals_imp.abap index 59a1b59b..c04c778c 100644 --- a/src/z2ui5_cl_http_handler.clas.locals_imp.abap +++ b/src/z2ui5_cl_http_handler.clas.locals_imp.abap @@ -12,6 +12,14 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check. TYPES ty_tt_string TYPE STANDARD TABLE OF string_table WITH EMPTY KEY. + TYPES: + BEGIN OF ty_s_name_value, + n TYPE string, + v TYPE string, + END OF ty_s_name_value. + + TYPES ty_t_name_value TYPE STANDARD TABLE OF ty_s_name_value WITH EMPTY KEY. + TYPES: BEGIN OF ty, BEGIN OF s, @@ -243,18 +251,18 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION. DATA(url_segments) = segment( val = get_trim_upper( url ) index = 2 sep = `?` ). SPLIT url_segments AT `&` INTO TABLE DATA(lt_params). - DATA lt_url_params TYPE z2ui5_if_view=>ty_t_name_value. + DATA lt_url_params TYPE z2ui5_cl_http_handler=>ty_t_name_value. LOOP AT lt_params INTO DATA(lv_param). SPLIT lv_param AT `=` INTO DATA(lv_name) DATA(lv_value) DATA(lv_dummy). - INSERT VALUE #( n = lv_name - v = lv_value ) INTO TABLE lt_url_params. + INSERT VALUE #( name = lv_name + value = lv_value ) INTO TABLE lt_url_params. ENDLOOP. - result = lt_url_params[ n = get_trim_upper( name ) ]-v. + result = lt_url_params[ name = get_trim_upper( name ) ]-value. ENDMETHOD. @@ -882,7 +890,10 @@ CLASS z2ui5_lcl_if_view DEFINITION. INTERFACES z2ui5_if_view. - CONSTANTS cs LIKE z2ui5_if_view=>cs VALUE z2ui5_if_view=>cs. + CONSTANTS: + BEGIN OF cs_config, + letterboxing TYPE abap_bool VALUE abap_true, + END OF cs_config. TYPES: BEGIN OF ty_s_view, @@ -893,7 +904,7 @@ CLASS z2ui5_lcl_if_view DEFINITION. DATA m_name TYPE string. DATA m_ns TYPE string. - DATA mt_prop TYPE z2ui5_if_view=>ty_t_name_value. + DATA mt_prop TYPE z2ui5_cl_http_handler=>ty_t_name_value. DATA m_root TYPE REF TO z2ui5_lcl_if_view. DATA m_last TYPE REF TO z2ui5_lcl_if_view. @@ -912,7 +923,7 @@ CLASS z2ui5_lcl_if_view DEFINITION. IMPORTING name TYPE clike ns TYPE clike OPTIONAL - t_prop TYPE z2ui5_if_view=>ty_t_name_value OPTIONAL + t_prop TYPE _=>ty_t_name_value OPTIONAL RETURNING VALUE(result) TYPE REF TO z2ui5_if_view. @@ -951,6 +962,13 @@ CLASS z2ui5_lcl_system_runtime DEFINITION. PUBLIC SECTION. + CONSTANTS: + BEGIN OF cs_bind_type, + one_way TYPE string VALUE 'ONE_WAY', + two_way TYPE string VALUE 'TWO_WAY', + one_time TYPE string VALUE 'ONE_TIME', + END OF cs_bind_type. + CLASS-DATA: BEGIN OF ss_client, o_body TYPE REF TO z2ui5_lcl_utility_tree_json, @@ -995,7 +1013,7 @@ CLASS z2ui5_lcl_system_runtime DEFINITION. check_set_prev_view TYPE abap_bool, - t_scroll_pos TYPE z2ui5_if_view=>ty_t_name_value, + t_scroll_pos TYPE z2ui5_cl_http_handler=>ty_t_name_value, s_cursor_pos TYPE z2ui5_if_client=>ty_s_cursor, t_view TYPE STANDARD TABLE OF s_view WITH EMPTY KEY, @@ -1023,7 +1041,7 @@ CLASS z2ui5_lcl_system_runtime DEFINITION. METHODS _create_binding IMPORTING value TYPE data - type TYPE string DEFAULT z2ui5_if_view=>cs-bind_type-two_way + type TYPE string DEFAULT cs_bind_type-two_way RETURNING VALUE(result) TYPE string. @@ -1092,14 +1110,14 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION. ` xmlns:f="sap.ui.layout.form" xmlns:mvc="sap.ui.core.mvc" xmlns:editor="sap.ui.codeeditor" xmlns:ui="sap.ui.table" ` && `xmlns="sap.m" xmlns:mchart="sap.suite.ui.microchart" xmlns:z2ui5="z2ui5" xmlns:webc="sap.ui.webc.main" xmlns:text="sap.ui.richtexteditor" > `. - result = result && COND #( WHEN z2ui5_cl_http_handler=>cs_config-letterboxing = abap_true AND check_popup_active = abap_false THEN `` ). + result = result && COND #( WHEN cs_config-letterboxing = abap_true AND check_popup_active = abap_false THEN `` ). ENDMETHOD. METHOD xml_get_end. result = result && COND #( WHEN check_popup_active = abap_false - THEN COND #( WHEN z2ui5_cl_http_handler=>cs_config-letterboxing = abap_true THEN `` ) && `` + THEN COND #( WHEN cs_config-letterboxing = abap_true THEN `` ) && `` ELSE `` ). ENDMETHOD. @@ -1121,13 +1139,13 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION. "case - normal CASE m_name. WHEN `ZZHTML`. - result = mt_prop[ n = `VALUE` ]-v. + result = mt_prop[ name = `VALUE` ]-value. RETURN. ENDCASE. DATA(lv_tmp2) = COND #( WHEN m_ns <> `` THEN |{ m_ns }:| ). - DATA(lv_tmp3) = REDUCE #( INIT val = `` FOR row IN mt_prop WHERE ( v <> `` ) - NEXT val = |{ val } { row-n }="{ escape( val = COND string( WHEN row-v = abap_true THEN `true` ELSE row-v ) format = cl_abap_format=>e_xml_attr ) }" \n | ). + DATA(lv_tmp3) = REDUCE #( INIT val = `` FOR row IN mt_prop WHERE ( value <> `` ) + NEXT val = |{ val } { row-name }="{ escape( val = COND string( WHEN row-value = abap_true THEN `true` ELSE row-value ) format = cl_abap_format=>e_xml_attr ) }" \n | ). result = |{ result } <{ lv_tmp2 }{ m_name } \n { lv_tmp3 }|. @@ -1294,7 +1312,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION. LOOP AT mo_runtime->ms_db-t_attri REFERENCE INTO DATA(lr_attri) WHERE bind_type <> ``. - IF lr_attri->bind_type = cs-bind_type-one_time. + IF lr_attri->bind_type = z2ui5_lcl_system_runtime=>cs_bind_type-one_time. m_view_model->add_attribute( n = lr_attri->name @@ -1304,7 +1322,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION. CONTINUE. ENDIF. - DATA(lo_actual) = COND #( WHEN lr_attri->bind_type = cs-bind_type-one_way THEN m_view_model + DATA(lo_actual) = COND #( WHEN lr_attri->bind_type = z2ui5_lcl_system_runtime=>cs_bind_type-one_way THEN m_view_model ELSE lo_update ). FIELD-SYMBOLS TYPE any. @@ -1338,7 +1356,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION. ENDIF. result-o_model = m_view_model. - DELETE m_root->mo_runtime->ms_db-t_attri WHERE bind_type = cs-bind_type-one_time. + DELETE m_root->mo_runtime->ms_db-t_attri WHERE bind_type = z2ui5_lcl_system_runtime=>cs_bind_type-one_time. result-t_attri = m_root->mo_runtime->ms_db-t_attri. ENDMETHOD. @@ -2361,7 +2379,7 @@ CLASS z2ui5_lcl_system_app IMPLEMENTATION. )->link( text = `Twitter` href = `https://twitter.com/OblomovDev` )->link( text = `GitHub` href = `https://github.com/oblomov-dev/abap2ui5` ). - DATA(grid) = page->grid( `XL8 L8 M12 S12` )->content( `l` ). + DATA(grid) = page->grid( `XL7 L7 M12 S12` )->content( `l` ). DATA(form) = grid->simple_form( `Quick Start` )->content( `f` ). form->label( `Step 1` @@ -2553,7 +2571,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION. lo_list = lo_ui5_model->add_attribute_list( `oScroll` ). LOOP AT ms_next-t_scroll_pos REFERENCE INTO DATA(lr_focus). - lo_list->add_list_object( )->add_attribute( n = lr_focus->n v = lr_focus->v apos_active = abap_false ). + lo_list->add_list_object( )->add_attribute( n = lr_focus->name v = lr_focus->value apos_active = abap_false ). ENDLOOP. IF ms_next-s_cursor_pos IS NOT INITIAL. @@ -2592,7 +2610,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION. ENDTRY. LOOP AT result->ms_db-t_attri REFERENCE INTO DATA(lr_attri) - WHERE bind_type = z2ui5_if_view=>cs-bind_type-two_way. + WHERE bind_type = cs_bind_type-two_way. FIELD-SYMBOLS TYPE any. DATA(lv_name) = c_prefix && to_upper( lr_attri->name ). @@ -2702,7 +2720,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION. CONSTANTS c_prefix TYPE string VALUE `MS_DB-O_APP->`. - IF type = z2ui5_if_view=>cs-bind_type-one_time. + IF type = cs_bind_type-one_time. DATA(lv_id) = _=>get_uuid_session( ). INSERT VALUE #( name = lv_id @@ -2726,7 +2744,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION. IF lr_in = lr_ref. lr_attri->bind_type = type. - result = COND #( WHEN type = z2ui5_if_view=>cs-bind_type-two_way THEN `/oUpdate/` ELSE `/` ) && lr_attri->name. + result = COND #( WHEN type = cs_bind_type-two_way THEN `/oUpdate/` ELSE `/` ) && lr_attri->name. RETURN. ENDIF. @@ -2737,7 +2755,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION. INSERT VALUE #( name = lv_id data_stringify = _=>trans_any_2_json( value ) - bind_type = z2ui5_if_view=>cs-bind_type-one_time + bind_type = cs_bind_type-one_time ) INTO TABLE ms_db-t_attri. result = |/{ lv_id }|. @@ -2776,6 +2794,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION. result = NEW z2ui5_lcl_if_client( me ). DATA(lv_url) = ss_client-t_header[ name = `referer` ]-value. + SPLIT lv_url AT '?' INTO lv_url DATA(lv_dummy). ms_actual = VALUE #( lifecycle_method = ms_next-lifecycle_method @@ -2890,13 +2909,13 @@ CLASS z2ui5_lcl_if_client IMPLEMENTATION. METHOD z2ui5_if_client~_bind. - result = `{` && mo_runtime->_create_binding( value = val type = z2ui5_if_view=>cs-bind_type-two_way ) && `}`. + result = `{` && mo_runtime->_create_binding( value = val type = z2ui5_lcl_system_runtime=>cs_bind_type-two_way ) && `}`. ENDMETHOD. METHOD z2ui5_if_client~_bind_one_way. - result = `{` && mo_runtime->_create_binding( value = val type = z2ui5_if_view=>cs-bind_type-one_way ) && `}`. + result = `{` && mo_runtime->_create_binding( value = val type = z2ui5_lcl_system_runtime=>cs_bind_type-one_way ) && `}`. ENDMETHOD. diff --git a/src/z2ui5_if_client.intf.abap b/src/z2ui5_if_client.intf.abap index ecd621e7..f30ed706 100644 --- a/src/z2ui5_if_client.intf.abap +++ b/src/z2ui5_if_client.intf.abap @@ -1,14 +1,27 @@ INTERFACE z2ui5_if_client PUBLIC . - CONSTANTS cs LIKE z2ui5_if_view=>cs VALUE z2ui5_if_view=>cs. + CONSTANTS: + BEGIN OF cs, + BEGIN OF lifecycle_method, + on_event TYPE string VALUE 'EVENT', + on_rendering TYPE string VALUE 'RENDERING', + END OF lifecycle_method, + END OF cs. -TYPES: + TYPES: + BEGIN OF ty_s_name_value, + name TYPE string, + value TYPE string, + END OF ty_s_name_value. + TYPES ty_t_name_value TYPE STANDARD TABLE OF ty_s_name_value WITH EMPTY KEY. + + TYPES: BEGIN OF ty_s_cursor, - id TYPE string, - cursorpos TYPE string, - selectionstart TYPE string, - selectionend TYPE string, + id TYPE string, + cursorpos TYPE string, + selectionstart TYPE string, + selectionend TYPE string, END OF ty_s_cursor. TYPES: @@ -35,10 +48,10 @@ TYPES: METHODS set IMPORTING - event TYPE clike OPTIONAL - t_scroll_pos TYPE z2ui5_if_view=>ty_t_name_value OPTIONAL - s_cursor_pos TYPE ty_s_cursor OPTIONAL - set_prev_view TYPE abap_bool OPTIONAL. + event TYPE clike OPTIONAL + t_scroll_pos TYPE ty_t_name_value OPTIONAL + s_cursor_pos TYPE ty_s_cursor OPTIONAL + set_prev_view TYPE abap_bool OPTIONAL. METHODS get RETURNING diff --git a/src/z2ui5_if_view.intf.abap b/src/z2ui5_if_view.intf.abap index f1b56475..1ecddad8 100644 --- a/src/z2ui5_if_view.intf.abap +++ b/src/z2ui5_if_view.intf.abap @@ -1,31 +1,6 @@ INTERFACE z2ui5_if_view PUBLIC . - CONSTANTS: - BEGIN OF cs, - BEGIN OF lifecycle_method, - on_event TYPE string VALUE 'EVENT', - on_rendering TYPE string VALUE 'RENDERING', - END OF lifecycle_method, - BEGIN OF event_type, - server_function TYPE string VALUE 'SERVER_FUNCTION', - display_id TYPE string VALUE 'CALL_PREVIOUS_APP', - END OF event_type, - BEGIN OF bind_type, - one_way TYPE string VALUE 'ONE_WAY', - two_way TYPE string VALUE 'TWO_WAY', - one_time TYPE string VALUE 'ONE_TIME', - END OF bind_type, - END OF cs. - - TYPES: - BEGIN OF ty_s_name_value, - n TYPE string, - v TYPE string, - END OF ty_s_name_value. - - TYPES ty_t_name_value TYPE STANDARD TABLE OF ty_s_name_value WITH EMPTY KEY. - METHODS layout_data IMPORTING ns TYPE clike OPTIONAL @@ -620,7 +595,7 @@ INTERFACE z2ui5_if_view IMPORTING name TYPE clike ns TYPE clike OPTIONAL - t_prop TYPE ty_t_name_value OPTIONAL + t_prop TYPE z2ui5_if_client=>ty_t_name_value OPTIONAL RETURNING VALUE(result) TYPE REF TO z2ui5_if_view.