Skip to content

Commit

Permalink
New apis (#410)
Browse files Browse the repository at this point in the history
* new_apis

* update
  • Loading branch information
oblomov-dev authored Oct 25, 2024
1 parent 89e9527 commit 4bb52af
Show file tree
Hide file tree
Showing 19 changed files with 335 additions and 248 deletions.
54 changes: 35 additions & 19 deletions src/z2ui5_cl_demo_app_000.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down
12 changes: 4 additions & 8 deletions src/z2ui5_cl_demo_app_001.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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'.
Expand All @@ -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'
Expand All @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/z2ui5_cl_demo_app_003.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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( ).
Expand Down
7 changes: 4 additions & 3 deletions src/z2ui5_cl_demo_app_012.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ 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)'
press = client->_event( 'BUTTON_POPUP_03' )
)->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'
Expand Down Expand Up @@ -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( ).
Expand Down
48 changes: 24 additions & 24 deletions src/z2ui5_cl_demo_app_021.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down Expand Up @@ -52,35 +47,40 @@ 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.


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.
5 changes: 3 additions & 2 deletions src/z2ui5_cl_demo_app_024.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/z2ui5_cl_demo_app_033.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 4 additions & 10 deletions src/z2ui5_cl_demo_app_038.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand All @@ -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(
Expand Down Expand Up @@ -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}`
Expand Down
2 changes: 1 addition & 1 deletion src/z2ui5_cl_demo_app_061.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/z2ui5_cl_demo_app_071.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading

0 comments on commit 4bb52af

Please sign in to comment.