* popups

* abaplint fixes

* popups

* abaplint fixes
This commit is contained in:
oblomov 2023-12-01 16:26:47 +01:00 committed by GitHub
parent 9409736bc2
commit d5f94eab7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 285 additions and 4 deletions

View File

@ -161,10 +161,10 @@ CLASS z2ui5_cl_util_func DEFINITION
IMPORTING
!val TYPE any
RETURNING
VALUE(result) TYPE string .
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

View File

@ -81,6 +81,13 @@ CLASS z2ui5_cl_fw_binding DEFINITION
RETURNING
VALUE(result) TYPE ty_t_attri.
METHODS get_t_attri_by_include
IMPORTING
type TYPE REF TO cl_abap_datadescr
attri TYPE clike
RETURNING
VALUE(result) TYPE ty_t_attri.
METHODS get_t_attri_by_oref
IMPORTING
val TYPE clike OPTIONAL
@ -314,6 +321,24 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION.
ENDMETHOD.
METHOD get_t_attri_by_include.
data(sdescr) = cast cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( type->absolute_name ) ).
LOOP AT sdescr->components REFERENCE INTO DATA(lr_comp).
DATA(lv_element) = attri && lr_comp->name.
DATA(ls_attri) = VALUE ty_s_attri(
name = lv_element
type_kind = lr_comp->type_kind ).
INSERT ls_attri INTO TABLE result.
ENDLOOP.
ENDMETHOD.
METHOD get_t_attri_by_struc.
DATA(lv_name) = `MO_APP->` && val.
@ -322,6 +347,7 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION.
z2ui5_cl_util_func=>x_check_raise( xsdbool( sy-subrc <> 0 ) ).
DATA(lt_comp) = z2ui5_cl_util_func=>rtti_get_t_comp_by_struc( <attribute> ).
DATA(lv_attri) = z2ui5_cl_util_func=>c_replace_assign_struc( val ).
LOOP AT lt_comp REFERENCE INTO DATA(lr_comp).
@ -331,7 +357,12 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION.
OR lr_comp->type->type_kind = cl_abap_classdescr=>typekind_struct2
OR lr_comp->type->type_kind = cl_abap_classdescr=>typekind_struct1.
DATA(lt_attri) = get_t_attri_by_struc( lv_element ).
IF lr_comp->name IS INITIAL.
DATA(lt_attri) = me->get_t_attri_by_include( type = lr_comp->type attri = lv_attri ).
ELSE.
lt_attri = get_t_attri_by_struc( lv_element ).
ENDIF.
INSERT LINES OF lt_attri INTO TABLE result.
ELSE.

View File

@ -95,7 +95,7 @@ CLASS Z2UI5_CL_CC_BWIPJS IMPLEMENTATION.
` });` && |\n| &&
` },` && |\n| &&
` renderer: function (oRm, oControl) {` && |\n| &&
` debugger; oRm.write( "&lt;canvas id='mycanvas' /&gt;");` && |\n| && |\n| &&
` oRm.write( "&lt;canvas id='mycanvas' /&gt;");` && |\n| && |\n| &&
` // The return value is the canvas element` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&

View File

@ -0,0 +1,109 @@
CLASS z2ui5_cl_ui_pop_messages DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
TYPES:
BEGIN OF ty_s_msg,
type TYPE string,
id TYPE string,
number TYPE string,
message TYPE string,
log_no TYPE string,
log_msg_no TYPE string,
message_v1 TYPE string,
message_v2 TYPE string,
message_v3 TYPE string,
message_v4 TYPE string,
parameter TYPE string,
row TYPE string,
field TYPE string,
system TYPE string,
END OF ty_s_msg.
TYPES ty_t_msg TYPE STANDARD TABLE OF ty_s_msg.
DATA mt_msg TYPE ty_t_msg.
CLASS-METHODS factory
IMPORTING
i_messages TYPE ty_t_msg
i_title TYPE string DEFAULT `abap2UI5 - Message Popup`
RETURNING
VALUE(r_result) TYPE REF TO z2ui5_cl_ui_pop_messages.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
DATA title TYPE string.
DATA check_initialized TYPE abap_bool.
METHODS view_display.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_ui_pop_messages IMPLEMENTATION.
METHOD factory.
r_result = NEW #( ).
r_result->mt_msg = i_messages.
r_result->title = i_title.
ENDMETHOD.
METHOD view_display.
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( client )->dialog( title
)->table(
mode = 'SingleSelectLeft'
items = client->_bind_edit( mt_msg )
)->columns(
)->column( )->text( 'Title' )->get_parent(
)->column( )->text( 'Color' )->get_parent(
)->column( )->text( 'Info' )->get_parent(
)->column( )->text( 'Description' )->get_parent(
)->get_parent(
)->items( )->column_list_item( selected = '{SELKZ}'
)->cells(
)->text( '{TYPE}'
)->text( '{ID}'
)->text( '{NUMBER}'
)->text( '{MESSAGE}'
)->get_parent( )->get_parent( )->get_parent( )->get_parent(
)->footer( )->overflow_toolbar(
)->toolbar_spacer(
)->button(
text = 'continue'
press = client->_event( 'BUTTON_CONTINUE' )
type = 'Emphasized' ).
client->popup_display( popup->stringify( ) ).
ENDMETHOD.
METHOD z2ui5_if_app~main.
me->client = client.
IF check_initialized = abap_false.
check_initialized = abap_true.
view_display( ).
RETURN.
ENDIF.
CASE client->get( )-event.
WHEN `BUTTON_CONTINUE`.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
ENDCASE.
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_UI_POP_MESSAGES</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>ui - popup messages</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -96,9 +96,11 @@ CLASS Z2UI5_CL_UI_POP_TO_CONFIRM IMPLEMENTATION.
CASE client->get( )-event.
WHEN `BUTTON_CONFIRM`.
check_result_confirmed = abap_true.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN `BUTTON_CANCEL`.
check_result_confirmed = abap_false.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
ENDCASE.

View File

@ -0,0 +1,107 @@
CLASS z2ui5_cl_test_features DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA mv_input TYPE string.
DATA mv_input2 TYPE string.
DATA mv_check_popup_active TYPE abap_bool.
DATA mv_check_initialized TYPE abap_bool.
PROTECTED SECTION.
METHODS display_view
IMPORTING
client TYPE REF TO z2ui5_if_client.
PRIVATE SECTION.
ENDCLASS.
CLASS Z2UI5_CL_TEST_FEATURES IMPLEMENTATION.
METHOD display_view.
DATA(view) = z2ui5_cl_xml_view=>factory( ).
view->shell(
)->page( title = 'abap2UI5 - flow logic - APP 01' navbuttonpress = client->_event( val = 'BACK' check_view_destroy = abap_true ) shownavbutton = abap_true
)->grid( 'L6 M12 S12' )->content( 'layout'
)->simple_form( 'Controller' )->content( 'form'
)->label( 'Test'
)->button( text = 'z2ui5_cl_ui_pop_to_confirm' press = client->_event( 'z2ui5_cl_ui_pop_to_confirm' )
)->label( 'Test'
)->button( text = 'z2ui5_cl_ui_pop_messages' press = client->_event( 'z2ui5_cl_ui_pop_messages' )
)->label( 'Demo'
)->button( text = 'z2ui5_cl_ui_pop_to_select' press = client->_event( 'z2ui5_cl_ui_pop_to_select' )
)->label( 'Demo'
)->input( client->_bind_edit( mv_input )
)->button( text = 'call new app (set data)' press = client->_event( 'CALL_NEW_APP_READ' )
)->label( 'some data, you can read it in the next app'
)->input( client->_bind_edit( mv_input2 )
).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD z2ui5_if_app~main.
if mv_check_initialized = abap_false.
mv_check_initialized = abap_true.
display_view( client ).
endif.
* IF client->get( )-check_on_navigated = abap_true.
* display_view( client ).
* ENDIF.
IF mv_check_popup_active = abap_true.
DATA(lo_prev) = client->get_app( client->get( )-s_draft-id_prev_app ).
TRY.
DATA(lo_popup_decide) = CAST z2ui5_cl_ui_pop_to_confirm( lo_prev ).
client->message_box_display( `the result is ` && lo_popup_decide->check_result( ) ).
CATCH cx_root.
ENDTRY.
ENDIF.
mv_check_popup_active = abap_false.
CASE client->get( )-event.
WHEN 'z2ui5_cl_ui_pop_messages'.
data(lo_popup_msg) = z2ui5_cl_ui_pop_messages=>factory(
i_messages = VALUE #(
( message = 'An empty Report field causes an empty XML Message to be sent' type = 'E' id = 'MSG1' number = '001' )
( message = 'Check was executed for wrong Scenario' type = 'E' id = 'MSG1' number = '002' )
( message = 'Request was handled without errors' type = 'S' id = 'MSG1' number = '003' )
( message = 'product activated' type = 'S' id = 'MSG4' number = '375' )
( message = 'check the input values' type = 'W' id = 'MSG2' number = '375' )
( message = 'product already in use' type = 'I' id = 'MSG2' number = '375' )
)
).
client->nav_app_call( lo_popup_msg ).
WHEN 'z2ui5_cl_ui_pop_to_confirm'.
DATA(lo_app) = z2ui5_cl_ui_pop_to_confirm=>factory(
i_question_text = `this is a question`
).
mv_check_popup_active = abap_true.
client->nav_app_call( lo_app ).
WHEN 'BACK'.
DATA(lo_prev_stack_app) = client->get_app( client->get( )-s_draft-id_prev_app_stack ).
client->nav_app_leave( lo_prev_stack_app ).
WHEN OTHERS.
ENDCASE.
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_TEST_FEATURES</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - test more features</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>