Skip to content

Commit

Permalink
follow up action demos (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
choper725 authored Mar 17, 2024
1 parent 47a5e20 commit 5fade35
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
87 changes: 87 additions & 0 deletions src/z2ui5_cl_demo_app_180.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
CLASS z2ui5_cl_demo_app_180 DEFINITION
PUBLIC
CREATE PUBLIC .

PUBLIC SECTION.

INTERFACES if_serializable_object .
INTERFACES z2ui5_if_app .

DATA mv_initialized TYPE abap_bool.
DATA mv_url TYPE string.

METHODS on_event.
METHODS view_display.

PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client.

PRIVATE SECTION.
ENDCLASS.



CLASS Z2UI5_CL_DEMO_APP_180 IMPLEMENTATION.


METHOD on_event.

CASE client->get( )-event.

WHEN 'CUSTOM_JS_FROM_EB'.

client->follow_up_action( custom_js = `sap.z2ui5.afterBE()` ).

WHEN 'CALL_EF'.

mv_url = `https://www.google.com`.

client->view_model_update( ).

client->follow_up_action( custom_js = client->_event_client( val = client->cs_event-open_new_tab t_arg = VALUE #( ( mv_url ) ) ) ).

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

ENDMETHOD.


METHOD view_display.

DATA(view) = z2ui5_cl_xml_view=>factory( ).
view->_generic( name = `script` ns = `html` )->_cc_plain_xml( `sap.z2ui5.afterBE = () => { alert("afterBE triggered !!"); }` ).

DATA(page) = view->shell( )->page( title = `Client->FOLLOW_UP_ACTION use cases` class = `sapUiContentPadding` ).
page = page->vbox( ).
page->button( text = `call frontend event from backend event` press = client->_event( `CALL_EF` ) ).
page->label( text = `MV_URL was set AFTER backend event and model update to:` ).
page->label( text = client->_bind_edit( mv_url ) ).

page->get_parent( )->hbox( class = `sapUiSmallMargin` ).
* page = page->vbox( ).
page->button( text = `call custom JS from EB` press = client->_event( 'CUSTOM_JS_FROM_EB' ) ).


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

ENDMETHOD.


METHOD z2ui5_if_app~main.

me->client = client.

IF mv_initialized = abap_false.
mv_initialized = abap_true.

view_display( ).

ENDIF.

on_event( ).

ENDMETHOD.
ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_180.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_DEMO_APP_180</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>follow_up_action</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 5fade35

Please sign in to comment.