Skip to content

Commit

Permalink
update message toast sample
Browse files Browse the repository at this point in the history
  • Loading branch information
oblomov-dev committed May 22, 2024
1 parent 0b5d9a2 commit e2a1082
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 91 deletions.
6 changes: 2 additions & 4 deletions src/z2ui5_cl_demo_app_001.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ CLASS Z2UI5_CL_DEMO_APP_001 IMPLEMENTATION.
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(
client->view_display( view->shell(
)->page(
title = 'abap2UI5 - First Example'
navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) )
Expand All @@ -49,8 +48,7 @@ CLASS Z2UI5_CL_DEMO_APP_001 IMPLEMENTATION.
CASE client->get( )-event.

WHEN 'BUTTON_POST'.
client->message_toast_display( text = |{ product } { quantity } - send to the server| at = 'left bottom' offset = '0 -15' animationtimingfunction = `ease-in`
class = 'my-style').
client->message_toast_display( text = |{ product } { quantity } - send to the server| ).

WHEN 'BACK'.
client->nav_app_leave( ).
Expand Down
184 changes: 97 additions & 87 deletions src/z2ui5_cl_demo_app_008.clas.abap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CLASS Z2UI5_CL_DEMO_APP_008 DEFINITION PUBLIC.
CLASS z2ui5_cl_demo_app_008 DEFINITION PUBLIC.

PUBLIC SECTION.

Expand All @@ -13,95 +13,105 @@ ENDCLASS.



CLASS Z2UI5_CL_DEMO_APP_008 IMPLEMENTATION.
CLASS z2ui5_cl_demo_app_008 IMPLEMENTATION.


METHOD Z2UI5_if_app~main.

CASE client->get( )-event.

WHEN 'BUTTON_MESSAGE_BOX'.
client->message_box_display( 'this is a message box' ).

WHEN 'BUTTON_MESSAGE_BOX_ERROR'.
client->message_box_display( text = 'this is a message box' type = 'error' ).

WHEN 'BUTTON_MESSAGE_BOX_SUCCESS'.
client->message_box_display( text = 'this is a message box' type = 'success' ).

WHEN 'BUTTON_MESSAGE_BOX_WARNING'.
client->message_box_display( text = 'this is a message box' type = 'warning' ).

WHEN 'BUTTON_MESSAGE_TOAST'.
client->message_toast_display( 'this is a message toast' ).

WHEN 'BUTTON_MESSAGE_STRIP_INFO'.
check_strip_active = abap_true.
strip_type = 'Information'.

WHEN 'BUTTON_MESSAGE_STRIP_ERROR'.
check_strip_active = abap_true.
strip_type = 'Error'.

WHEN 'BUTTON_MESSAGE_STRIP_SUCCESS'.
check_strip_active = abap_true.
strip_type = 'Success'.

WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).

ENDCASE.

data(view) = z2ui5_cl_xml_view=>factory( ).
DATA(page) = view->shell(
)->page(
title = 'abap2UI5 - Messages'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
)->header_content(
)->link(
)->get_parent( ).

IF check_strip_active = abap_true.
page->message_strip( text = 'This is a Message Strip' type = strip_type ).
ENDIF.

page->grid( 'L6 M12 S12'
)->content( 'layout'
)->simple_form( 'Message Box' )->content( 'form'
)->button(
text = 'information'
press = client->_event( 'BUTTON_MESSAGE_BOX' )
)->button(
text = 'success'
press = client->_event( 'BUTTON_MESSAGE_BOX_SUCCESS' )
)->button(
text = 'error'
press = client->_event( 'BUTTON_MESSAGE_BOX_ERROR' )
)->button(
text = 'warning'
press = client->_event( 'BUTTON_MESSAGE_BOX_WARNING' ) ).

page->grid( 'L6 M12 S12'
)->content( 'layout'
)->simple_form( 'Message Strip' )->content( 'form'
)->button(
text = 'success'
press = client->_event( 'BUTTON_MESSAGE_STRIP_SUCCESS' )
)->button(
text = 'error'
press = client->_event( 'BUTTON_MESSAGE_STRIP_ERROR' )
)->button(
text = 'information'
press = client->_event( 'BUTTON_MESSAGE_STRIP_INFO' ) ).

page->grid( 'L6 M12 S12'
)->content( 'layout'
)->simple_form( 'Display' )->content( 'form'
)->button(
text = 'Message Toast'
press = client->_event( 'BUTTON_MESSAGE_TOAST' ) ).

client->view_display( view->stringify( ) ).
CASE client->get( )-event.

WHEN 'BUTTON_MESSAGE_BOX'.
client->message_box_display( 'this is a message box' ).

WHEN 'BUTTON_MESSAGE_BOX_ERROR'.
client->message_box_display( text = 'this is a message box' type = 'error' ).

WHEN 'BUTTON_MESSAGE_BOX_SUCCESS'.
client->message_box_display( text = 'this is a message box' type = 'success' ).

WHEN 'BUTTON_MESSAGE_BOX_WARNING'.
client->message_box_display( text = 'this is a message box' type = 'warning' ).

WHEN 'BUTTON_MESSAGE_TOAST'.
client->message_toast_display( 'this is a message toast' ).

WHEN 'BUTTON_MESSAGE_TOAST2'.
client->message_toast_display( text = 'this is a message toast' at = 'left bottom'
offset = '0 -15' animationtimingfunction = `ease-in` class = 'my-style').

WHEN 'BUTTON_MESSAGE_STRIP_INFO'.
check_strip_active = abap_true.
strip_type = 'Information'.

WHEN 'BUTTON_MESSAGE_STRIP_ERROR'.
check_strip_active = abap_true.
strip_type = 'Error'.

WHEN 'BUTTON_MESSAGE_STRIP_SUCCESS'.
check_strip_active = abap_true.
strip_type = 'Success'.

WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).

ENDCASE.

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; }` ).

DATA(page) = view->shell(
)->page(
title = 'abap2UI5 - Messages'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
)->header_content(
)->link(
)->get_parent( ).

IF check_strip_active = abap_true.
page->message_strip( text = 'This is a Message Strip' type = strip_type ).
ENDIF.

page->grid( 'L6 M12 S12'
)->content( 'layout'
)->simple_form( 'Message Box' )->content( 'form'
)->button(
text = 'information'
press = client->_event( 'BUTTON_MESSAGE_BOX' )
)->button(
text = 'success'
press = client->_event( 'BUTTON_MESSAGE_BOX_SUCCESS' )
)->button(
text = 'error'
press = client->_event( 'BUTTON_MESSAGE_BOX_ERROR' )
)->button(
text = 'warning'
press = client->_event( 'BUTTON_MESSAGE_BOX_WARNING' ) ).

page->grid( 'L6 M12 S12'
)->content( 'layout'
)->simple_form( 'Message Strip' )->content( 'form'
)->button(
text = 'success'
press = client->_event( 'BUTTON_MESSAGE_STRIP_SUCCESS' )
)->button(
text = 'error'
press = client->_event( 'BUTTON_MESSAGE_STRIP_ERROR' )
)->button(
text = 'information'
press = client->_event( 'BUTTON_MESSAGE_STRIP_INFO' ) ).

page->grid( 'L6 M12 S12'
)->content( 'layout'
)->simple_form( 'Display' )->content( 'form'
)->button(
text = 'Message Toast'
press = client->_event( 'BUTTON_MESSAGE_TOAST' )
)->button(
text = 'Message Toast Customized'
press = client->_event( 'BUTTON_MESSAGE_TOAST2' ) ).


client->view_display( view->stringify( ) ).
ENDMETHOD.
ENDCLASS.

0 comments on commit e2a1082

Please sign in to comment.