Skip to content

Commit

Permalink
Update Demo 001 & Demo 021 for ABAP Cloud compatibility (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-milan authored Nov 11, 2024
1 parent 0220ada commit 9747b8d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 22 deletions.
49 changes: 41 additions & 8 deletions src/z2ui5_cl_demo_app_001.clas.abap
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
CLASS z2ui5_cl_demo_app_001 DEFINITION PUBLIC.
CLASS z2ui5_cl_demo_app_001 DEFINITION PUBLIC CREATE PUBLIC.

PUBLIC SECTION.

INTERFACES z2ui5_if_app.

DATA product TYPE string.
DATA quantity TYPE string.
DATA check_initialized TYPE abap_bool.

PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client.

METHODS z2ui5_set_data.

METHODS display_view
IMPORTING
client TYPE REF TO z2ui5_if_client.
METHODS on_event
IMPORTING
client TYPE REF TO z2ui5_if_client.

PRIVATE SECTION.
ENDCLASS.



CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.


METHOD z2ui5_if_app~main.

IF client->check_on_init( ).
me->client = client.

product = 'products'.
quantity = '500'.
IF check_initialized = abap_false.
check_initialized = abap_true.
display_view( client ).
z2ui5_set_data( ).
ENDIF.

on_event( client ).

ENDMETHOD.


METHOD display_view.

DATA(view) = z2ui5_cl_xml_view=>factory( ).
client->view_display( val = view->shell(
)->page(
title = 'abap2UI5 - First Example'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = client->check_app_prev_stack( )
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )

)->simple_form( title = 'Form Title' editable = abap_true
)->content( 'form'
)->title( 'Input'
Expand All @@ -41,8 +64,10 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.
press = client->_event( val = 'BUTTON_POST' )
)->stringify( ) ).

RETURN.
ENDIF.
ENDMETHOD.


METHOD on_event.

CASE client->get( )-event.
WHEN 'BUTTON_POST'.
Expand All @@ -52,4 +77,12 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.
ENDCASE.

ENDMETHOD.


METHOD z2ui5_set_data.

product = 'products'.
quantity = '500'.

ENDMETHOD.
ENDCLASS.
32 changes: 18 additions & 14 deletions src/z2ui5_cl_demo_app_021.clas.abap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CLASS z2ui5_cl_demo_app_021 DEFINITION PUBLIC.
CLASS z2ui5_cl_demo_app_021 DEFINITION PUBLIC CREATE PUBLIC.

PUBLIC SECTION.

Expand All @@ -7,10 +7,16 @@ CLASS z2ui5_cl_demo_app_021 DEFINITION PUBLIC.

PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client.
METHODS display_view.
METHODS on_event.
METHODS on_init.
DATA client TYPE REF TO z2ui5_if_client.
DATA check_initialized TYPE abap_bool.

METHODS z2ui5_set_data.
METHODS display_view
IMPORTING
client TYPE REF TO z2ui5_if_client.
METHODS on_event
IMPORTING
client TYPE REF TO z2ui5_if_client.

PRIVATE SECTION.

Expand Down Expand Up @@ -60,16 +66,18 @@ CLASS z2ui5_cl_demo_app_021 IMPLEMENTATION.

me->client = client.

IF client->check_on_init( ).
on_init( ).
RETURN.
IF check_initialized = abap_false.
check_initialized = abap_true.
display_view( client ).
z2ui5_set_data( ).
ENDIF.

on_event( ).
on_event( client ).

ENDMETHOD.

METHOD on_init.

METHOD z2ui5_set_data.

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` &&
Expand All @@ -78,9 +86,5 @@ CLASS z2ui5_cl_demo_app_021 IMPLEMENTATION.
` 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.

0 comments on commit 9747b8d

Please sign in to comment.