This commit is contained in:
oblomov 2023-04-30 13:24:59 +02:00
parent d60019737e
commit fc4c3f03de
4 changed files with 103 additions and 5 deletions

View File

@ -111,7 +111,8 @@ CLASS Z2UI5_CL_APP_DEMO_00 IMPLEMENTATION.
).
grid->simple_form( title = 'HowTo - More' layout = 'ResponsiveGridLayout' )->content( 'form'
)->button( text = 'Side Effects' press = client->_event( 'z2ui5_cl_app_demo_27' )
)->button( text = 'Side Effects' press = client->_event( 'z2ui5_cl_app_demo_27' )
)->button( text = 'Integer and Decimals' press = client->_event( 'z2ui5_cl_app_demo_47' )
).
DATA(form) = page->grid( 'L9 M12 S12'

View File

@ -0,0 +1,72 @@
CLASS z2ui5_cl_app_demo_47 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA int1 TYPE i.
DATA int2 TYPE i.
DATA int_sum TYPE i.
DATA dec1 TYPE p length 10 DECIMALS 4.
DATA dec2 TYPE p length 10 DECIMALS 4.
DATA dec_sum TYPE p length 10 DECIMALS 4.
DATA check_initialized TYPE abap_bool.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_demo_47 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
IF check_initialized = abap_false.
check_initialized = abap_true.
ENDIF.
CASE client->get( )-event.
WHEN 'BUTTON_INT'.
int_sum = int1 + int2.
WHEN 'BUTTON_DEC'.
dec_sum = dec1 + dec2.
WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-id_prev_app_stack ) ).
ENDCASE.
int1 = 5 / 3.
dec1 = 1 / 3.
client->set_next( VALUE #( xml_main = z2ui5_cl_xml_view=>factory( )->shell(
)->page(
title = 'abap2UI5 - Integer and Decimals'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
)->header_content(
)->link(
text = 'Source_Code'
href = z2ui5_cl_xml_view=>hlp_get_source_code_url( app = me get = client->get( ) )
target = '_blank'
)->get_parent(
)->simple_form( title = 'Integer and Decimals' editable = abap_true
)->content( 'form'
)->title( 'Input'
)->label( 'integer'
)->input( value = client->_bind( int1 )
)->input( value = client->_bind( int2 )
)->input( enabled = abap_false value = client->_bind( int_sum )
)->button( text = 'calc sum' press = client->_event( 'BUTTON_INT' )
)->label( 'decimals'
)->input( client->_bind( dec1 )
)->input( client->_bind( dec2 )
)->input( enabled = abap_false value = client->_bind( dec_sum )
)->button( text = 'calc sum' press = client->_event( 'BUTTON_DEC' )
)->get_root( )->xml_get( ) ) ).
ENDMETHOD.
ENDCLASS.

View File

@ -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_APP_DEMO_47</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>type conversion</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -1331,9 +1331,11 @@ CLASS z2ui5_lcl_fw_handler IMPLEMENTATION.
CASE lr_attri->type_kind.
WHEN `g` OR `I` OR `C`.
DATA(lv_value) = lo_model->get_attribute( lr_attri->name )->get_val( ).
<attribute> = lv_value.
WHEN `g` OR `I` OR `C` OR `P`.
DATA(lo_attri) = lo_model->get_attribute( lr_attri->name ).
FIELD-SYMBOLS <val> TYPE any.
ASSIGN lo_attri->mr_actual->* TO <val>.
<attribute> = <val>.
WHEN `h`.
z2ui5_lcl_utility=>trans_ref_tab_2_tab(
@ -1574,13 +1576,20 @@ CLASS z2ui5_lcl_fw_handler IMPLEMENTATION.
CASE lr_attri->type_kind.
WHEN `g` OR `D` OR `P` OR `T` OR `C`.
WHEN `g` OR `D` OR `T` OR `C`.
lo_actual->add_attribute( n = lr_attri->name
v = z2ui5_lcl_utility=>get_abap_2_json( <attribute> )
apos_active = abap_false ).
WHEN `P`.
lo_actual->add_attribute( n = lr_attri->name
" v = <attribute>
v = CONV string( <attribute> )
apos_active = abap_false ).
WHEN `I`.
lo_actual->add_attribute( n = lr_attri->name
" v = <attribute>
v = CONV string( <attribute> )
apos_active = abap_false ).