diff --git a/src/z2ui5_cl_demo_app_000.clas.abap b/src/z2ui5_cl_demo_app_000.clas.abap index e2460855..180ec841 100644 --- a/src/z2ui5_cl_demo_app_000.clas.abap +++ b/src/z2ui5_cl_demo_app_000.clas.abap @@ -64,7 +64,7 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. )->shell( )->page( id = `page` title = c_title - navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) ) + navbuttonpress = client->_event( val = 'BACK' ) shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) )->header_content( )->toolbar_spacer( @@ -275,24 +275,40 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. ). panel->generic_tile( - header = 'Message I' + header = 'Basic' subheader = 'Toast, Box & Strip' press = client->_event( 'Z2UI5_CL_DEMO_APP_008' ) mode = 'LineMode' class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). - panel->generic_tile( - header = 'Message II' - subheader = 'Message View & Popover' + panel->generic_tile( + header = 'Message Box' + subheader = 'sy, bapiret, cx_root' + press = client->_event( 'z2ui5_cl_demo_app_187' ) + mode = 'LineMode' + class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' + ). + + panel->generic_tile( + header = 'Popup' + subheader = 'Messages & Exception' + press = client->_event( 'z2ui5_cl_demo_app_154' ) + mode = 'LineMode' + class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' + ). + + panel->generic_tile( + header = 'Message View' + subheader = 'Custom Popup, Popover & Ouput' press = client->_event( 'Z2UI5_CL_DEMO_APP_038' ) mode = 'LineMode' class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). panel->generic_tile( - header = 'Message III' - subheader = 'Message Box & Events' + header = 'Messages' + subheader = 'More...' press = client->_event( 'z2ui5_cl_demo_app_084' ) mode = 'LineMode' class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' @@ -1260,12 +1276,12 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). - panel->generic_tile( - header = 'Popup to Error' - press = client->_event( 'z2ui5_cl_demo_app_165' ) - mode = 'LineMode' - class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' - ). +* panel->generic_tile( +* header = 'Popup to Error' +* press = client->_event( 'z2ui5_cl_demo_app_165' ) +* mode = 'LineMode' +* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' +* ). panel->generic_tile( header = 'Popup to Select' @@ -1274,12 +1290,12 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). - panel->generic_tile( - header = 'Popup Messages' - press = client->_event( 'Z2UI5_CL_DEMO_APP_154' ) - mode = 'LineMode' - class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' - ). +* panel->generic_tile( +* header = 'Popup Messages' +* press = client->_event( 'Z2UI5_CL_DEMO_APP_154' ) +* mode = 'LineMode' +* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' +* ). panel->generic_tile( header = 'Popup Textedit' diff --git a/src/z2ui5_cl_demo_app_001.clas.abap b/src/z2ui5_cl_demo_app_001.clas.abap index 82e670a7..ef2c7289 100644 --- a/src/z2ui5_cl_demo_app_001.clas.abap +++ b/src/z2ui5_cl_demo_app_001.clas.abap @@ -6,7 +6,6 @@ CLASS z2ui5_cl_demo_app_001 DEFINITION PUBLIC. DATA product TYPE string. DATA quantity TYPE string. - DATA check_initialized TYPE abap_bool. PROTECTED SECTION. PRIVATE SECTION. @@ -19,8 +18,7 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION. METHOD z2ui5_if_app~main. - IF check_initialized = abap_false. - check_initialized = abap_true. + IF client->check_on_init( ). product = 'products'. quantity = '500'. @@ -29,8 +27,8 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION. client->view_display( val = view->shell( )->page( title = 'abap2UI5 - First Example' - navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) ) - shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) + navbuttonpress = client->_event( 'BACK' ) + shownavbutton = client->check_app_prev_stack( ) )->simple_form( title = 'Form Title' editable = abap_true )->content( 'form' )->title( 'Input' @@ -43,16 +41,14 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION. press = client->_event( val = 'BUTTON_POST' ) )->stringify( ) ). + RETURN. ENDIF. CASE client->get( )-event. - WHEN 'BUTTON_POST'. client->message_toast_display( text = |{ product } { quantity } - send to the server| ). - WHEN 'BACK'. client->nav_app_leave( ). - ENDCASE. ENDMETHOD. diff --git a/src/z2ui5_cl_demo_app_003.clas.abap b/src/z2ui5_cl_demo_app_003.clas.abap index 60bbaa16..7df5d346 100644 --- a/src/z2ui5_cl_demo_app_003.clas.abap +++ b/src/z2ui5_cl_demo_app_003.clas.abap @@ -69,9 +69,7 @@ CLASS Z2UI5_CL_DEMO_APP_003 IMPLEMENTATION. CASE client->get( )-event. WHEN 'SELCHANGE'. - DATA(lt_sel) = t_tab. - DELETE lt_sel WHERE selected = abap_false. - client->message_box_display( `go to details for item ` && lt_sel[ 1 ]-title ). + client->message_box_display( `go to details for item ` && t_tab[ selected = abap_true ]-title ). WHEN 'BACK'. client->nav_app_leave( ). diff --git a/src/z2ui5_cl_demo_app_012.clas.abap b/src/z2ui5_cl_demo_app_012.clas.abap index 52d90aac..66bc1fc2 100644 --- a/src/z2ui5_cl_demo_app_012.clas.abap +++ b/src/z2ui5_cl_demo_app_012.clas.abap @@ -73,11 +73,11 @@ CLASS Z2UI5_CL_DEMO_APP_012 IMPLEMENTATION. )->label( 'Demo' )->button( text = 'popup rendering, no background rendering' - press = client->_event( val = 'BUTTON_POPUP_01' s_ctrl = value #( check_view_destroy = abap_true ) ) + press = client->_event( val = 'BUTTON_POPUP_01' ) )->label( 'Demo' )->button( text = 'popup rendering, background destroyed and rerendering' - press = client->_event( val = 'BUTTON_POPUP_02' s_ctrl = value #( check_view_destroy = abap_true ) ) + press = client->_event( val = 'BUTTON_POPUP_02' ) )->label( 'Demo' )->button( text = 'popup, background unchanged (default) - close (no roundtrip)' @@ -85,7 +85,7 @@ CLASS Z2UI5_CL_DEMO_APP_012 IMPLEMENTATION. )->label( 'Demo' )->button( text = 'popup, background unchanged (default) - close with server' - press = client->_event( val = 'BUTTON_POPUP_04' ) + press = client->_event( val = 'BUTTON_POPUP_04' ) )->get_parent( )->get_parent( ). grid->simple_form( 'Popup in new App' )->content( 'form' @@ -121,6 +121,7 @@ CLASS Z2UI5_CL_DEMO_APP_012 IMPLEMENTATION. WHEN 'BUTTON_POPUP_01'. ui5_popup_decide( ). + client->view_destroy( ). WHEN 'POPUP_DECIDE_CONTINUE'. client->popup_destroy( ). diff --git a/src/z2ui5_cl_demo_app_021.clas.abap b/src/z2ui5_cl_demo_app_021.clas.abap index 543c9fb2..3166e8cd 100644 --- a/src/z2ui5_cl_demo_app_021.clas.abap +++ b/src/z2ui5_cl_demo_app_021.clas.abap @@ -3,22 +3,17 @@ CLASS z2ui5_cl_demo_app_021 DEFINITION PUBLIC. PUBLIC SECTION. INTERFACES z2ui5_if_app. - DATA mv_textarea TYPE string. - DATA check_initialized TYPE abap_bool. - PROTECTED SECTION. - METHODS display_view - IMPORTING - client TYPE REF TO z2ui5_if_client. - - METHODS on_event - IMPORTING - client TYPE REF TO z2ui5_if_client. + DATA client TYPE REF TO z2ui5_if_client. + METHODS display_view. + METHODS on_event. + METHODS on_init. PRIVATE SECTION. + ENDCLASS. @@ -52,13 +47,10 @@ CLASS z2ui5_cl_demo_app_021 IMPLEMENTATION. METHOD on_event. CASE client->get( )-event. - WHEN 'POST'. client->message_box_display( 'success - values send to the server' ). - WHEN 'BACK'. client->nav_app_leave( ). - ENDCASE. ENDMETHOD. @@ -66,21 +58,29 @@ CLASS z2ui5_cl_demo_app_021 IMPLEMENTATION. METHOD z2ui5_if_app~main. - IF check_initialized = abap_false. - check_initialized = abap_true. + me->client = client. - mv_textarea = `Lorem ipsum dolor st amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magn` && - `a aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd` && - ` gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam n ` && - ` onumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit am ` && - ` et, consetetur sadipscing elitr, sed diam nonumy eirm sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam no ` && - `numy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.`. + IF client->check_on_init( ). + on_init( ). + RETURN. + ENDIF. + on_event( ). - display_view( client ). - ENDIF. + ENDMETHOD. + + METHOD on_init. - on_event( client ). + mv_textarea = `Lorem ipsum dolor st amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magn` && + `a aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd` && + ` gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam n ` && + ` onumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit am ` && + ` et, consetetur sadipscing elitr, sed diam nonumy eirm sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam no ` && + `numy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.`. + + + display_view( ). ENDMETHOD. + ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_024.clas.abap b/src/z2ui5_cl_demo_app_024.clas.abap index f623e80f..35a7bab2 100644 --- a/src/z2ui5_cl_demo_app_024.clas.abap +++ b/src/z2ui5_cl_demo_app_024.clas.abap @@ -51,8 +51,9 @@ CLASS z2ui5_cl_demo_app_024 IMPLEMENTATION. METHOD z2ui5_if_app~main. - IF client->get( )-check_on_navigated = abap_true. + IF client->check_on_navigated( ). display_view( client ). + RETURN. ENDIF. CASE client->get( )-event. @@ -83,7 +84,7 @@ CLASS z2ui5_cl_demo_app_024 IMPLEMENTATION. CASE mv_backend_event. WHEN 'CALL_PREVIOUS_APP_INPUT_RETURN'. - DATA(lo_called_app) = CAST z2ui5_cl_demo_app_025( client->get_app( client->get( )-s_draft-id_prev_app ) ). + DATA(lo_called_app) = CAST z2ui5_cl_demo_app_025( client->get_app_prev( ) ). CLEAR mv_backend_event. client->message_box_display( `Input made in the previous app:` && lo_called_app->mv_input ). ENDCASE. diff --git a/src/z2ui5_cl_demo_app_033.clas.abap b/src/z2ui5_cl_demo_app_033.clas.abap index 790d931c..87bdfcec 100644 --- a/src/z2ui5_cl_demo_app_033.clas.abap +++ b/src/z2ui5_cl_demo_app_033.clas.abap @@ -25,7 +25,7 @@ CLASS z2ui5_cl_demo_app_033 IMPLEMENTATION. DATA(page) = view->shell( )->page( title = 'abap2UI5 - Illustrated Messages' - navbuttonpress = client->_event( val = 'BACK' s_ctrl = value #( check_view_destroy = abap_true ) ) + navbuttonpress = client->_event( val = 'BACK' ) shownavbutton = abap_true )->header_content( )->link( diff --git a/src/z2ui5_cl_demo_app_038.clas.abap b/src/z2ui5_cl_demo_app_038.clas.abap index b22c24b2..4297caaa 100644 --- a/src/z2ui5_cl_demo_app_038.clas.abap +++ b/src/z2ui5_cl_demo_app_038.clas.abap @@ -38,18 +38,12 @@ CLASS Z2UI5_CL_DEMO_APP_038 IMPLEMENTATION. DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ). -* popup = popup->popover( -* placement = `Top` -* title = `Messages` -* contentheight = '50%' -* contentwidth = '50%' ). - popup->message_popover( - items = client->_bind_edit( t_msg ) + items = client->_bind( t_msg ) groupitems = abap_true placement = `Top` initiallyexpanded = abap_true - beforeclose = client->_event( val = 'POPOVER_CLOSE' s_ctrl = VALUE #( check_view_destroy = abap_false ) ) + beforeclose = client->_event( val = 'POPOVER_CLOSE' ) )->message_item( type = `{TYPE}` title = `{TITLE}` @@ -72,7 +66,7 @@ CLASS Z2UI5_CL_DEMO_APP_038 IMPLEMENTATION. contentwidth = '50%' ). popup->message_view( - items = client->_bind_edit( val = t_msg + items = client->_bind( t_msg ) groupitems = abap_true )->message_item( @@ -116,7 +110,7 @@ CLASS Z2UI5_CL_DEMO_APP_038 IMPLEMENTATION. * )->get_parent( ). page->button( text = 'Messages in Popup' press = client->_event( 'POPUP' ) ). page->message_view( - items = client->_bind_edit( t_msg ) + items = client->_bind( t_msg ) groupitems = abap_true )->message_item( type = `{TYPE}` diff --git a/src/z2ui5_cl_demo_app_061.clas.abap b/src/z2ui5_cl_demo_app_061.clas.abap index 5eb684dc..6513a3b2 100644 --- a/src/z2ui5_cl_demo_app_061.clas.abap +++ b/src/z2ui5_cl_demo_app_061.clas.abap @@ -42,7 +42,7 @@ CLASS Z2UI5_CL_DEMO_APP_061 IMPLEMENTATION. )->toolbar_spacer( )->button( text = `server <-> client` - press = client->_event( val = 'SEND' s_ctrl = value #( check_view_destroy = abap_true ) ) + press = client->_event( val = 'SEND' ) )->get_parent( )->get_parent( ). tab->columns( diff --git a/src/z2ui5_cl_demo_app_071.clas.abap b/src/z2ui5_cl_demo_app_071.clas.abap index 892476de..d094c3e4 100644 --- a/src/z2ui5_cl_demo_app_071.clas.abap +++ b/src/z2ui5_cl_demo_app_071.clas.abap @@ -52,7 +52,7 @@ CLASS z2ui5_cl_demo_app_071 IMPLEMENTATION. client->view_display( val = view->shell( )->page( title = 'abap2UI5 - First Example' - navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) ) + navbuttonpress = client->_event( val = 'BACK' ) shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) )->simple_form( title = 'Form Title' editable = abap_true )->content( 'form' diff --git a/src/z2ui5_cl_demo_app_154.clas.abap b/src/z2ui5_cl_demo_app_154.clas.abap index 7bd74905..1de452fc 100644 --- a/src/z2ui5_cl_demo_app_154.clas.abap +++ b/src/z2ui5_cl_demo_app_154.clas.abap @@ -5,11 +5,8 @@ CLASS z2ui5_cl_demo_app_154 DEFINITION PUBLIC. INTERFACES z2ui5_if_app. DATA client TYPE REF TO z2ui5_if_client. - - DATA mv_check_initialized TYPE abap_bool. METHODS ui5_display. METHODS ui5_event. - METHODS ui5_callback. PROTECTED SECTION. PRIVATE SECTION. @@ -24,16 +21,31 @@ CLASS z2ui5_cl_demo_app_154 IMPLEMENTATION. CASE client->get( )-event. - WHEN 'POPUP'. + WHEN 'POPUP_BAPIRET'. + + DATA(lt_msg) = VALUE bapirettab( + ( type = 'E' id = 'MSG1' number = '001' message = 'An empty Report field causes an empty XML Message to be sent' ) + ( type = 'I' id = 'MSG2' number = '002' message = 'Product already in use' ) + ). + + client->nav_app_call( z2ui5_cl_pop_messages=>factory( lt_msg ) ). + + WHEN 'POPUP_BALLOG'. + +* DATA(lt_ballog) = VALUE bapirettab( +* ( type = 'E' id = 'MSG1' number = '001' message = 'An empty Report field causes an empty XML Message to be sent' ) +* ( type = 'I' id = 'MSG2' number = '002' message = 'Product already in use' ) +* ). +* +* client->nav_app_call( z2ui5_cl_pop_messages=>factory( lt_ballog ) ). - DATA(lo_app) = z2ui5_cl_pop_messages=>factory( 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' ) - ) ). + + WHEN 'POPUP_EXCEPTION'. + TRY. + DATA(lv_dummy) = 1 / 0. + CATCH cx_root INTO DATA(lx). + ENDTRY. + DATA(lo_app) = z2ui5_cl_pop_error=>factory( lx ). client->nav_app_call( lo_app ). WHEN 'BACK'. @@ -51,10 +63,17 @@ CLASS z2ui5_cl_demo_app_154 IMPLEMENTATION. )->page( title = 'abap2UI5 - Popup Messages' navbuttonpress = client->_event( val = 'BACK' ) - shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) )->button( - text = 'Open Popup...' - press = client->_event( 'POPUP' ) ). + text = 'Open Popup BAPIRET' + press = client->_event( 'POPUP_BAPIRET' ) +* )->button( +* text = 'Open Popup BALLOG' +* press = client->_event( 'POPUP_BALLOG' ) + )->button( + text = 'Open Popup Exception' + press = client->_event( 'POPUP_EXCEPTION' ) + ). client->view_display( view->stringify( ) ). @@ -65,13 +84,8 @@ CLASS z2ui5_cl_demo_app_154 IMPLEMENTATION. me->client = client. - IF client->get( )-check_on_navigated = abap_true. - IF mv_check_initialized = abap_false. - mv_check_initialized = abap_true. - ui5_display( ). - ELSE. - ui5_callback( ). - ENDIF. + IF client->check_on_init( ). + ui5_display( ). RETURN. ENDIF. @@ -79,15 +93,4 @@ CLASS z2ui5_cl_demo_app_154 IMPLEMENTATION. ENDMETHOD. - METHOD ui5_callback. - - TRY. - DATA(lo_prev) = client->get_app( client->get( )-s_draft-id_prev_app ). - DATA(lo_dummy) = CAST z2ui5_cl_pop_messages( lo_prev ). - client->message_box_display( `callback after popup messages` ). - CATCH cx_root. - ENDTRY. - - ENDMETHOD. - ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_165.clas.abap b/src/z2ui5_cl_demo_app_165.clas.abap deleted file mode 100644 index fcbe29cc..00000000 --- a/src/z2ui5_cl_demo_app_165.clas.abap +++ /dev/null @@ -1,84 +0,0 @@ -CLASS z2ui5_cl_demo_app_165 DEFINITION PUBLIC. - - PUBLIC SECTION. - - INTERFACES z2ui5_if_app. - - DATA client TYPE REF TO z2ui5_if_client. - - METHODS ui5_display. - METHODS ui5_event. - METHODS ui5_callback. - - PROTECTED SECTION. - PRIVATE SECTION. -ENDCLASS. - - - -CLASS z2ui5_cl_demo_app_165 IMPLEMENTATION. - - - METHOD ui5_event. - - CASE client->get( )-event. - - WHEN 'POPUP'. - TRY. - DATA(lv_dummy) = 1 / 0. - CATCH cx_root INTO DATA(lx). - ENDTRY. - DATA(lo_app) = z2ui5_cl_pop_error=>factory( lx ). - client->nav_app_call( lo_app ). - - WHEN 'BACK'. - client->nav_app_leave( ). - - ENDCASE. - - ENDMETHOD. - - - METHOD ui5_display. - - DATA(view) = z2ui5_cl_xml_view=>factory( ). - view->shell( - )->page( - title = 'abap2UI5 - Popup Error' - navbuttonpress = client->_event( val = 'BACK' ) - shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) - )->button( - text = 'Open Popup...' - press = client->_event( 'POPUP' ) ). - - client->view_display( view->stringify( ) ). - - ENDMETHOD. - - - METHOD z2ui5_if_app~main. - - me->client = client. - - IF client->get( )-check_on_navigated = abap_true. - ui5_display( ). - ui5_callback( ). - RETURN. - ENDIF. - - ui5_event( ). - - ENDMETHOD. - - METHOD ui5_callback. - - TRY. - DATA(lo_prev) = client->get_app( client->get( )-s_draft-id_prev_app ). - DATA(lo_dummy) = CAST z2ui5_cl_pop_to_inform( lo_prev ). - client->message_box_display( `callback after popup to inform` ). - CATCH cx_root. - ENDTRY. - - ENDMETHOD. - -ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_171.clas.abap b/src/z2ui5_cl_demo_app_171.clas.abap new file mode 100644 index 00000000..113d3efd --- /dev/null +++ b/src/z2ui5_cl_demo_app_171.clas.abap @@ -0,0 +1,45 @@ +CLASS z2ui5_cl_demo_app_171 DEFINITION PUBLIC. + + PUBLIC SECTION. + INTERFACES z2ui5_if_app. + +ENDCLASS. + +CLASS z2ui5_cl_demo_app_171 IMPLEMENTATION. + METHOD z2ui5_if_app~main. + TRY. + + "first app start, + IF client->check_on_init( ). + + "init values here.. + RETURN. + ENDIF. + + + "callback after previous app. + IF client->check_on_navigated( ). + + DATA(lo_app_prev) = client->get_app_prev( ). + "read attributes of previous app here... + RETURN. + ENDIF. + + + "handle events.. + CASE client->get( )-event. + WHEN 'OK'. + data(lt_arg) = client->get_event_arg( ). + "... + + WHEN 'CANCEL'. + "... + + ENDCASE. + + "error handling here.. + CATCH cx_root INTO DATA(lx). + client->message_box_display( lx ). + ENDTRY. + ENDMETHOD. +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_171.clas.xml b/src/z2ui5_cl_demo_app_171.clas.xml new file mode 100644 index 00000000..090ea6f5 --- /dev/null +++ b/src/z2ui5_cl_demo_app_171.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_171 + E + popup - popup_to_confirm2 + 1 + X + X + X + + + + diff --git a/src/z2ui5_cl_demo_app_174.clas.abap b/src/z2ui5_cl_demo_app_174.clas.abap new file mode 100644 index 00000000..907a6ee9 --- /dev/null +++ b/src/z2ui5_cl_demo_app_174.clas.abap @@ -0,0 +1,97 @@ +CLASS z2ui5_cl_demo_app_174 DEFINITION PUBLIC. + + PUBLIC SECTION. + + INTERFACES z2ui5_if_app. + + TYPES: + BEGIN OF ty_row, + zzselkz TYPE abap_bool, + title TYPE string, + value TYPE string, + descr TYPE string, + END OF ty_row. + TYPES ty_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. + + DATA mt_tab TYPE ty_tab. + DATA mv_multiselect TYPE abap_bool. + DATA mv_preselect TYPE abap_bool. + + PROTECTED SECTION. + PRIVATE SECTION. + +ENDCLASS. + + + +CLASS z2ui5_cl_demo_app_174 IMPLEMENTATION. + + + METHOD z2ui5_if_app~main. + + IF client->check_on_init( ). + + client->view_display( + z2ui5_cl_xml_view=>factory( )->shell( + )->page( + title = 'abap2UI5 - Popup To Select' + navbuttonpress = client->_event( val = 'BACK' ) + shownavbutton = client->check_app_prev_stack( ) + )->hbox( + )->text( text = 'Multiselect: ' class = 'sapUiTinyMargin' + )->switch( state = client->_bind_edit( mv_multiselect ) change = client->_event( `MULTISELECT_TOGGLE` ) + )->get_parent( + )->hbox( + )->text( text = 'Preselect all entries: ' class = 'sapUiTinyMargin' + )->switch( state = client->_bind_edit( mv_preselect ) enabled = client->_bind_edit( mv_multiselect ) + )->get_parent( + )->button( + text = 'Open Popup...' + press = client->_event( 'POPUP' ) )->stringify( ) + ). + + RETURN. + ENDIF. + + CASE client->get( )-event. + + WHEN 'POPUP'. + mt_tab = VALUE #( descr = 'this is a description' + ( zzselkz = mv_preselect title = 'title_01' value = 'value_01' ) + ( zzselkz = mv_preselect title = 'title_02' value = 'value_02' ) + ( zzselkz = mv_preselect title = 'title_03' value = 'value_03' ) + ( zzselkz = mv_preselect title = 'title_04' value = 'value_04' ) + ( zzselkz = mv_preselect title = 'title_05' value = 'value_05' ) ). + + client->nav_app_call( z2ui5_cl_pop_to_select=>factory( + i_tab = mt_tab + i_multiselect = mv_multiselect + i_event_confirmed = 'POPUP_CONFIRMED' + i_event_canceled = 'POPUP_CANCEL' + ) ). + + WHEN 'POPUP_CANCELED'. + client->message_box_display( `Popup was cancelled` ). + + WHEN 'POPUP_CONFIRMED'. + DATA(lr) = client->get( )-r_event_data. + DATA(lt3) = CONV ty_tab( lr->* ). + IF mv_multiselect = abap_false. + client->message_box_display( `callback after popup to select: ` && lt3[ 1 ]-title ). + ELSE. + client->nav_app_call( z2ui5_cl_pop_table=>factory( i_tab = lt3 i_title = 'Selected rows' ) ). + ENDIF. + + WHEN 'MULTISELECT_TOGGLE'. + mv_preselect = COND #( WHEN mv_multiselect = abap_false + THEN abap_false + ELSE mv_preselect ). + client->view_model_update( ). + + WHEN 'BACK'. + client->nav_app_leave( ). + + ENDCASE. + + ENDMETHOD. +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_198.clas.xml b/src/z2ui5_cl_demo_app_174.clas.xml similarity index 80% rename from src/z2ui5_cl_demo_app_198.clas.xml rename to src/z2ui5_cl_demo_app_174.clas.xml index 75822598..3163b61f 100644 --- a/src/z2ui5_cl_demo_app_198.clas.xml +++ b/src/z2ui5_cl_demo_app_174.clas.xml @@ -3,9 +3,9 @@ - Z2UI5_CL_DEMO_APP_198 + Z2UI5_CL_DEMO_APP_174 E - t_arg object example + popup - popup_to_select2 1 X X diff --git a/src/z2ui5_cl_demo_app_187.clas.abap b/src/z2ui5_cl_demo_app_187.clas.abap new file mode 100644 index 00000000..98b4d15b --- /dev/null +++ b/src/z2ui5_cl_demo_app_187.clas.abap @@ -0,0 +1,59 @@ +CLASS z2ui5_cl_demo_app_187 DEFINITION PUBLIC. + + PUBLIC SECTION. + INTERFACES z2ui5_if_app. + +ENDCLASS. + +CLASS z2ui5_cl_demo_app_187 IMPLEMENTATION. + + METHOD z2ui5_if_app~main. + + + IF client->check_on_init( ). + + client->view_display( z2ui5_cl_xml_view=>factory( )->shell( + )->page( + title = 'abap2UI5 - Popup To Confirm' + navbuttonpress = client->_event( val = 'BACK' ) + shownavbutton = client->check_app_prev_stack( ) + )->button( + text = 'SY' + press = client->_event( 'SY' ) + )->button( + text = 'BAPIRET' + press = client->_event( 'BAPIRET' ) + )->button( + text = 'CX_ROOT' + press = client->_event( 'CX_ROOT' ) + )->stringify( ) ). + + RETURN. + ENDIF. + + CASE client->get( )-event. + + WHEN 'SY'. + MESSAGE ID 'NET' TYPE 'I' NUMBER '001' INTO DATA(lv_dummy). + client->message_box_display( sy ). + + WHEN 'BAPIRET'. + DATA ls_msg TYPE bapiret2. +* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' +* IMPORTING +* return = ls_msg. + ls_msg = value #( id = 'NET' number = '001' ). + client->message_box_display( ls_msg ). + + WHEN 'CX_ROOT'. + TRY. + DATA(lv_val) = 1 / 0. + CATCH cx_root INTO DATA(lx). + client->message_box_display( lx ). + ENDTRY. + + ENDCASE. + + + ENDMETHOD. +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_165.clas.xml b/src/z2ui5_cl_demo_app_187.clas.xml similarity index 81% rename from src/z2ui5_cl_demo_app_165.clas.xml rename to src/z2ui5_cl_demo_app_187.clas.xml index 78084bc7..93f53d3d 100644 --- a/src/z2ui5_cl_demo_app_165.clas.xml +++ b/src/z2ui5_cl_demo_app_187.clas.xml @@ -3,9 +3,9 @@ - Z2UI5_CL_DEMO_APP_165 + Z2UI5_CL_DEMO_APP_187 E - popup - popup_error + popup - messages 1 X X diff --git a/src/z2ui5_cl_demo_app_198.clas.abap b/src/z2ui5_cl_demo_app_198.clas.abap deleted file mode 100644 index 347687d4..00000000 --- a/src/z2ui5_cl_demo_app_198.clas.abap +++ /dev/null @@ -1,55 +0,0 @@ -CLASS z2ui5_cl_demo_app_198 DEFINITION - PUBLIC - CREATE PUBLIC . - - PUBLIC SECTION. - - INTERFACES z2ui5_if_app . - - DATA product TYPE string . - DATA quantity TYPE string . - DATA check_initialized TYPE abap_bool. - - PROTECTED SECTION. - PRIVATE SECTION. -ENDCLASS. - - - -CLASS z2ui5_cl_demo_app_198 IMPLEMENTATION. - - - METHOD z2ui5_if_app~main. - - IF check_initialized = abap_false. - check_initialized = abap_true. - - product = 'tomato'. - quantity = '500'. - - DATA(view) = z2ui5_cl_xml_view=>factory( ). - view->_generic( ns = `html` name = `style` )->_cc_plain_xml( `.my-style{ background: black !important; opacity: 0.6; color: white; }` ). - client->view_display( view->shell( - )->page( - title = 'abap2UI5 - First Example' - navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) ) - shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) - )->button( - text = 'post' - press = client->_event( val = 'BUTTON_POST' t_arg = VALUE #( ( `$event` ) ) ) - )->stringify( ) ). - - ENDIF. - - CASE client->get( )-event. - - WHEN 'BUTTON_POST'. - DATA(lt_arg) = client->get( )-t_event_arg. - - WHEN 'BACK'. - client->nav_app_leave( ). - - ENDCASE. - - ENDMETHOD. -ENDCLASS.