Skip to content

Commit

Permalink
add demo sizelimit (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
oblomov-dev authored Sep 9, 2024
1 parent 15f6b1d commit efff523
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 23 deletions.
2 changes: 0 additions & 2 deletions src/z2ui5_cl_demo_app_000.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
)->header_content(
)->toolbar_spacer(
* )->link( text = 'SCN' target = '_blank' href = 'https://community.sap.com/t5/technology-blogs-by-members/abap2ui5-1-introduction-developing-ui5-apps-purely-in-abap/ba-p/13567635'
* )->link( text = 'Twitter' target = '_blank' href = 'https://twitter.com/abap2UI5'
)->link( text = 'Install with abapGit from GitHub' target = '_blank' href = 'https://github.com/oblomov-dev/abap2ui5'
)->get_parent( ).

Expand Down
36 changes: 18 additions & 18 deletions src/z2ui5_cl_demo_app_001.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ ENDCLASS.



CLASS Z2UI5_CL_DEMO_APP_001 IMPLEMENTATION.
CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.


METHOD z2ui5_if_app~main.

IF check_initialized = abap_false.
check_initialized = abap_true.

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

DATA(view) = z2ui5_cl_xml_view=>factory( ).
client->view_display( view->shell(
)->page(
title = 'abap2UI5 - First Example'
navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) )
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'
)->label( 'quantity'
)->input( client->_bind_edit( quantity )
)->label( `product`
)->input( value = product enabled = abap_false
)->button(
text = 'post'
press = client->_event( val = 'BUTTON_POST' )
)->stringify( ) ).
client->view_display( val = view->shell(
)->page(
title = 'abap2UI5 - First Example'
navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) )
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'
)->label( 'quantity'
)->input( client->_bind_edit( quantity )
)->label( `product`
)->input( value = product enabled = abap_false
)->button(
text = 'post'
press = client->_event( val = 'BUTTON_POST' )
)->stringify( ) ).

ENDIF.

Expand Down
8 changes: 5 additions & 3 deletions src/z2ui5_cl_demo_app_002.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ ENDCLASS.



CLASS Z2UI5_CL_DEMO_APP_002 IMPLEMENTATION.
CLASS z2ui5_cl_demo_app_002 IMPLEMENTATION.


METHOD z2ui5_if_app~main.

me->client = client.

IF check_initialized = abap_false.
check_initialized = abap_true.

DATA(lv_script) = `` && |\n| &&
`function setInputFIlter(){` && |\n| &&
Expand All @@ -81,8 +82,9 @@ CLASS Z2UI5_CL_DEMO_APP_002 IMPLEMENTATION.
)->_generic( ns = `html` name = `script` )->_cc_plain_xml( lv_script
)->stringify( ) ).

check_initialized = abap_true.

z2ui5_on_init( ).
RETURN.
ENDIF.

z2ui5_on_event( ).
Expand Down Expand Up @@ -151,7 +153,7 @@ CLASS Z2UI5_CL_DEMO_APP_002 IMPLEMENTATION.
METHOD z2ui5_on_rendering.

DATA(view) = z2ui5_cl_xml_view=>factory( ).
view->_generic( name = `script` ns = `html` )->_cc_plain_xml( `function callMessageToast(sAction) { sap.m.MessageToast.show('Hello there !!'); }` ).
* view->_generic( name = `script` ns = `html` )->_cc_plain_xml( `function callMessageToast(sAction) { sap.m.MessageToast.show('Hello there !!'); }` ).
DATA(page) = view->shell(
)->page(
showheader = xsdbool( abap_false = client->get( )-check_launchpad_active )
Expand Down
66 changes: 66 additions & 0 deletions src/z2ui5_cl_demo_app_071.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CLASS z2ui5_cl_demo_app_071 DEFINITION PUBLIC.

PUBLIC SECTION.

INTERFACES z2ui5_if_app.

TYPES:
BEGIN OF s_combobox,
key TYPE string,
text TYPE string,
END OF s_combobox.
TYPES ty_t_combo TYPE STANDARD TABLE OF s_combobox WITH EMPTY KEY.

DATA mv_set_size_limit TYPE i VALUE 100.
DATA mv_combo_number TYPE i VALUE 105.
DATA check_initialized TYPE abap_bool.

PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.



CLASS z2ui5_cl_demo_app_071 IMPLEMENTATION.


METHOD z2ui5_if_app~main.

CASE client->get( )-event.
WHEN 'BACK'.
client->nav_app_leave( ).
RETURN.
ENDCASE.

client->message_toast_display( `View updated` ).

DATA(lt_combo) = VALUE ty_T_combo( ).
DO mv_combo_number TIMES.
INSERT VALUE #( key = sy-index text = sy-index ) INTO TABLE lt_combo.
ENDDO.

DATA(view) = z2ui5_cl_xml_view=>factory( ).
client->view_display( val = view->shell(
)->page(
title = 'abap2UI5 - First Example'
navbuttonpress = client->_event( val = 'BACK' s_ctrl = VALUE #( check_view_destroy = abap_true ) )
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'
)->label( 'Link'
)->label( 'setSizeLimit'
)->input( value = client->_bind_edit( mv_set_size_limit )
)->label( 'Number of Entries'
)->input( value = client->_bind_edit( mv_combo_number )
)->label( 'demo'
)->combobox( items = client->_bind_local( lt_combo )
)->item( key = '{KEY}' text = '{TEXT}'
)->get_parent( )->get_parent(
)->button(
text = 'update'
press = client->_event( val = 'UPDATE' )
)->stringify( ) t_config = VALUE #( ( n = `setSizeLimit` v = mv_set_size_limit ) ) ).

ENDMETHOD.
ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_071.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_071</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>setSizeLimit</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit efff523

Please sign in to comment.