Skip to content

Commit e923958

Browse files
authored
update message toast sample (#200)
1 parent 0b5d9a2 commit e923958

File tree

2 files changed

+99
-91
lines changed

2 files changed

+99
-91
lines changed

src/z2ui5_cl_demo_app_001.clas.abap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ CLASS Z2UI5_CL_DEMO_APP_001 IMPLEMENTATION.
2626
quantity = '500'.
2727

2828
DATA(view) = z2ui5_cl_xml_view=>factory( ).
29-
view->_generic( ns = `html` name = `style` )->_cc_plain_xml( `.my-style{ background: black !important; opacity: 0.6; color: white; }` ).
30-
client->view_display( view->shell(
29+
client->view_display( view->shell(
3130
)->page(
3231
title = 'abap2UI5 - First Example'
3332
navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) )
@@ -49,8 +48,7 @@ CLASS Z2UI5_CL_DEMO_APP_001 IMPLEMENTATION.
4948
CASE client->get( )-event.
5049

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

5553
WHEN 'BACK'.
5654
client->nav_app_leave( ).
Lines changed: 97 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CLASS Z2UI5_CL_DEMO_APP_008 DEFINITION PUBLIC.
1+
CLASS z2ui5_cl_demo_app_008 DEFINITION PUBLIC.
22

33
PUBLIC SECTION.
44

@@ -13,95 +13,105 @@ ENDCLASS.
1313

1414

1515

16-
CLASS Z2UI5_CL_DEMO_APP_008 IMPLEMENTATION.
16+
CLASS z2ui5_cl_demo_app_008 IMPLEMENTATION.
1717

1818

1919
METHOD Z2UI5_if_app~main.
2020

21-
CASE client->get( )-event.
22-
23-
WHEN 'BUTTON_MESSAGE_BOX'.
24-
client->message_box_display( 'this is a message box' ).
25-
26-
WHEN 'BUTTON_MESSAGE_BOX_ERROR'.
27-
client->message_box_display( text = 'this is a message box' type = 'error' ).
28-
29-
WHEN 'BUTTON_MESSAGE_BOX_SUCCESS'.
30-
client->message_box_display( text = 'this is a message box' type = 'success' ).
31-
32-
WHEN 'BUTTON_MESSAGE_BOX_WARNING'.
33-
client->message_box_display( text = 'this is a message box' type = 'warning' ).
34-
35-
WHEN 'BUTTON_MESSAGE_TOAST'.
36-
client->message_toast_display( 'this is a message toast' ).
37-
38-
WHEN 'BUTTON_MESSAGE_STRIP_INFO'.
39-
check_strip_active = abap_true.
40-
strip_type = 'Information'.
41-
42-
WHEN 'BUTTON_MESSAGE_STRIP_ERROR'.
43-
check_strip_active = abap_true.
44-
strip_type = 'Error'.
45-
46-
WHEN 'BUTTON_MESSAGE_STRIP_SUCCESS'.
47-
check_strip_active = abap_true.
48-
strip_type = 'Success'.
49-
50-
WHEN 'BACK'.
51-
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
52-
53-
ENDCASE.
54-
55-
data(view) = z2ui5_cl_xml_view=>factory( ).
56-
DATA(page) = view->shell(
57-
)->page(
58-
title = 'abap2UI5 - Messages'
59-
navbuttonpress = client->_event( 'BACK' )
60-
shownavbutton = abap_true
61-
)->header_content(
62-
)->link(
63-
)->get_parent( ).
64-
65-
IF check_strip_active = abap_true.
66-
page->message_strip( text = 'This is a Message Strip' type = strip_type ).
67-
ENDIF.
68-
69-
page->grid( 'L6 M12 S12'
70-
)->content( 'layout'
71-
)->simple_form( 'Message Box' )->content( 'form'
72-
)->button(
73-
text = 'information'
74-
press = client->_event( 'BUTTON_MESSAGE_BOX' )
75-
)->button(
76-
text = 'success'
77-
press = client->_event( 'BUTTON_MESSAGE_BOX_SUCCESS' )
78-
)->button(
79-
text = 'error'
80-
press = client->_event( 'BUTTON_MESSAGE_BOX_ERROR' )
81-
)->button(
82-
text = 'warning'
83-
press = client->_event( 'BUTTON_MESSAGE_BOX_WARNING' ) ).
84-
85-
page->grid( 'L6 M12 S12'
86-
)->content( 'layout'
87-
)->simple_form( 'Message Strip' )->content( 'form'
88-
)->button(
89-
text = 'success'
90-
press = client->_event( 'BUTTON_MESSAGE_STRIP_SUCCESS' )
91-
)->button(
92-
text = 'error'
93-
press = client->_event( 'BUTTON_MESSAGE_STRIP_ERROR' )
94-
)->button(
95-
text = 'information'
96-
press = client->_event( 'BUTTON_MESSAGE_STRIP_INFO' ) ).
97-
98-
page->grid( 'L6 M12 S12'
99-
)->content( 'layout'
100-
)->simple_form( 'Display' )->content( 'form'
101-
)->button(
102-
text = 'Message Toast'
103-
press = client->_event( 'BUTTON_MESSAGE_TOAST' ) ).
104-
105-
client->view_display( view->stringify( ) ).
21+
CASE client->get( )-event.
22+
23+
WHEN 'BUTTON_MESSAGE_BOX'.
24+
client->message_box_display( 'this is a message box' ).
25+
26+
WHEN 'BUTTON_MESSAGE_BOX_ERROR'.
27+
client->message_box_display( text = 'this is a message box' type = 'error' ).
28+
29+
WHEN 'BUTTON_MESSAGE_BOX_SUCCESS'.
30+
client->message_box_display( text = 'this is a message box' type = 'success' ).
31+
32+
WHEN 'BUTTON_MESSAGE_BOX_WARNING'.
33+
client->message_box_display( text = 'this is a message box' type = 'warning' ).
34+
35+
WHEN 'BUTTON_MESSAGE_TOAST'.
36+
client->message_toast_display( 'this is a message toast' ).
37+
38+
WHEN 'BUTTON_MESSAGE_TOAST2'.
39+
client->message_toast_display( text = 'this is a message toast' at = 'left bottom'
40+
offset = '0 -15' animationtimingfunction = `ease-in` class = 'my-style').
41+
42+
WHEN 'BUTTON_MESSAGE_STRIP_INFO'.
43+
check_strip_active = abap_true.
44+
strip_type = 'Information'.
45+
46+
WHEN 'BUTTON_MESSAGE_STRIP_ERROR'.
47+
check_strip_active = abap_true.
48+
strip_type = 'Error'.
49+
50+
WHEN 'BUTTON_MESSAGE_STRIP_SUCCESS'.
51+
check_strip_active = abap_true.
52+
strip_type = 'Success'.
53+
54+
WHEN 'BACK'.
55+
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
56+
57+
ENDCASE.
58+
59+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
60+
view->_generic( ns = `html` name = `style` )->_cc_plain_xml( `.my-style{ background: black !important; opacity: 0.6; color: white; }` ).
61+
62+
DATA(page) = view->shell(
63+
)->page(
64+
title = 'abap2UI5 - Messages'
65+
navbuttonpress = client->_event( 'BACK' )
66+
shownavbutton = abap_true
67+
)->header_content(
68+
)->link(
69+
)->get_parent( ).
70+
71+
IF check_strip_active = abap_true.
72+
page->message_strip( text = 'This is a Message Strip' type = strip_type ).
73+
ENDIF.
74+
75+
page->grid( 'L6 M12 S12'
76+
)->content( 'layout'
77+
)->simple_form( 'Message Box' )->content( 'form'
78+
)->button(
79+
text = 'information'
80+
press = client->_event( 'BUTTON_MESSAGE_BOX' )
81+
)->button(
82+
text = 'success'
83+
press = client->_event( 'BUTTON_MESSAGE_BOX_SUCCESS' )
84+
)->button(
85+
text = 'error'
86+
press = client->_event( 'BUTTON_MESSAGE_BOX_ERROR' )
87+
)->button(
88+
text = 'warning'
89+
press = client->_event( 'BUTTON_MESSAGE_BOX_WARNING' ) ).
90+
91+
page->grid( 'L6 M12 S12'
92+
)->content( 'layout'
93+
)->simple_form( 'Message Strip' )->content( 'form'
94+
)->button(
95+
text = 'success'
96+
press = client->_event( 'BUTTON_MESSAGE_STRIP_SUCCESS' )
97+
)->button(
98+
text = 'error'
99+
press = client->_event( 'BUTTON_MESSAGE_STRIP_ERROR' )
100+
)->button(
101+
text = 'information'
102+
press = client->_event( 'BUTTON_MESSAGE_STRIP_INFO' ) ).
103+
104+
page->grid( 'L6 M12 S12'
105+
)->content( 'layout'
106+
)->simple_form( 'Display' )->content( 'form'
107+
)->button(
108+
text = 'Message Toast'
109+
press = client->_event( 'BUTTON_MESSAGE_TOAST' )
110+
)->button(
111+
text = 'Message Toast Customized'
112+
press = client->_event( 'BUTTON_MESSAGE_TOAST2' ) ).
113+
114+
115+
client->view_display( view->stringify( ) ).
106116
ENDMETHOD.
107117
ENDCLASS.

0 commit comments

Comments
 (0)