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| && - `