Skip to content

Commit dd16d98

Browse files
authored
messagebox demo (#179)
1 parent c2c85ee commit dd16d98

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

src/z2ui5_cl_demo_app_002.clas.abap

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ENDCLASS.
5353

5454

5555

56-
CLASS z2ui5_cl_demo_app_002 IMPLEMENTATION.
56+
CLASS Z2UI5_CL_DEMO_APP_002 IMPLEMENTATION.
5757

5858

5959
METHOD z2ui5_if_app~main.
@@ -72,7 +72,23 @@ CLASS z2ui5_cl_demo_app_002 IMPLEMENTATION.
7272
METHOD z2ui5_on_event.
7373

7474
CASE client->get( )-event.
75-
75+
WHEN 'BUTTON_MCUSTOM'.
76+
* send type = '' is mandatory in order to not break current implementation
77+
client->message_box_display( type = '' text = 'Custom MessageBox' icon = `SUCCESS`
78+
title = 'Custom MessageBox' actions = VALUE #( ( `First Button` ) ( `Second Button` ) ) emphasizedaction = `First Button`
79+
onclose = `callMessageToast()` details = `<h3>these are details</h3>`).
80+
WHEN 'BUTTON_MCONFIRM'.
81+
client->message_box_display( type = 'confirm' text = 'Confirm MessageBox' ).
82+
WHEN 'BUTTON_MALERT'.
83+
client->message_box_display( type = 'alert' text = 'Alert MessageBox' ).
84+
WHEN 'BUTTON_MERROR'.
85+
client->message_box_display( type = 'error' text = 'Error MessageBox' ).
86+
WHEN 'BUTTON_MINFO'.
87+
client->message_box_display( type = 'information' text = 'Information MessageBox' ).
88+
WHEN 'BUTTON_MWARNING'.
89+
client->message_box_display( type = 'warning' text = 'Warning MessageBox' ).
90+
WHEN 'BUTTON_MSUCCESS'.
91+
client->message_box_display( type = 'success' text = 'Success MessageBox' icon = `sap-icon://accept` ).
7692
WHEN 'BUTTON_SEND'.
7793
client->message_box_display( 'success - values send to the server' ).
7894
WHEN 'BUTTON_CLEAR'.
@@ -112,7 +128,7 @@ CLASS z2ui5_cl_demo_app_002 IMPLEMENTATION.
112128
METHOD z2ui5_on_rendering.
113129

114130
DATA(view) = z2ui5_cl_xml_view=>factory( ).
115-
131+
view->_generic( name = `script` ns = `html` )->_cc_plain_xml( `function callMessageToast(sAction) { sap.m.MessageToast.show('Hello there !!'); }` ).
116132
data(page) = view->shell(
117133
)->page(
118134
showheader = xsdbool( abap_false = client->get( )-check_launchpad_active )
@@ -220,6 +236,28 @@ CLASS z2ui5_cl_demo_app_002 IMPLEMENTATION.
220236
customtextoff = 'NO' ).
221237

222238
page->footer( )->overflow_toolbar(
239+
)->text( text = `MessageBox Types`
240+
)->button(
241+
text = 'Confirm'
242+
press = client->_event( 'BUTTON_MCONFIRM' )
243+
)->button(
244+
text = 'Alert'
245+
press = client->_event( 'BUTTON_MALERT' )
246+
)->button(
247+
text = 'Error'
248+
press = client->_event( 'BUTTON_MERROR' )
249+
)->button(
250+
text = 'Information'
251+
press = client->_event( 'BUTTON_MINFO' )
252+
)->button(
253+
text = 'Warning'
254+
press = client->_event( 'BUTTON_MWARNING' )
255+
)->button(
256+
text = 'Success'
257+
press = client->_event( 'BUTTON_MSUCCESS' )
258+
)->button(
259+
text = 'Custom'
260+
press = client->_event( 'BUTTON_MCUSTOM' )
223261
)->toolbar_spacer(
224262
)->button(
225263
text = 'Clear'

0 commit comments

Comments
 (0)