mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 20:16:24 +08:00
refactoring && to || (#118)
* refactoring && to || * refactoring * refactoring * renaming
This commit is contained in:
parent
75279d0c77
commit
9ff354c995
|
@ -51,7 +51,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS Z2UI5_CL_APP_DEMO_02 IMPLEMENTATION.
|
CLASS z2ui5_cl_app_demo_02 IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD z2ui5_if_app~controller.
|
METHOD z2ui5_if_app~controller.
|
||||||
|
@ -61,7 +61,9 @@ CLASS Z2UI5_CL_APP_DEMO_02 IMPLEMENTATION.
|
||||||
WHEN client->cs-lifecycle_method-on_event.
|
WHEN client->cs-lifecycle_method-on_event.
|
||||||
|
|
||||||
IF check_initialized = abap_false.
|
IF check_initialized = abap_false.
|
||||||
|
check_initialized = abap_true.
|
||||||
z2ui5_on_init( ).
|
z2ui5_on_init( ).
|
||||||
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
z2ui5_on_event( client ).
|
z2ui5_on_event( client ).
|
||||||
|
|
||||||
|
@ -92,8 +94,6 @@ CLASS Z2UI5_CL_APP_DEMO_02 IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD z2ui5_on_init.
|
METHOD z2ui5_on_init.
|
||||||
|
|
||||||
check_initialized = abap_true.
|
|
||||||
|
|
||||||
screen = VALUE #(
|
screen = VALUE #(
|
||||||
check_is_active = abap_true
|
check_is_active = abap_true
|
||||||
colour = 'BLUE'
|
colour = 'BLUE'
|
||||||
|
@ -102,8 +102,7 @@ CLASS Z2UI5_CL_APP_DEMO_02 IMPLEMENTATION.
|
||||||
date = '07.12.22'
|
date = '07.12.22'
|
||||||
date_time = '23.12.2022, 19:27:20'
|
date_time = '23.12.2022, 19:27:20'
|
||||||
time_start = '05:24:00'
|
time_start = '05:24:00'
|
||||||
time_end = '17:23:57'
|
time_end = '17:23:57').
|
||||||
).
|
|
||||||
|
|
||||||
mt_suggestion = VALUE #(
|
mt_suggestion = VALUE #(
|
||||||
( descr = 'Green' value = 'GREEN' )
|
( descr = 'Green' value = 'GREEN' )
|
||||||
|
|
|
@ -78,6 +78,7 @@ CLASS Z2UI5_CL_APP_DEMO_05 IMPLEMENTATION.
|
||||||
)->page(
|
)->page(
|
||||||
title = 'abap2UI5 - Selection-Screen more Controls'
|
title = 'abap2UI5 - Selection-Screen more Controls'
|
||||||
navbuttonpress = client->_event( 'BACK' )
|
navbuttonpress = client->_event( 'BACK' )
|
||||||
|
class = `class="sapUiContentPadding sapUiResponsivePadding--header sapUiResponsivePadding--subHeader sapUiResponsivePadding--content sapUiResponsivePadding--footer"`
|
||||||
)->header_content(
|
)->header_content(
|
||||||
)->link(
|
)->link(
|
||||||
text = 'Source_Code'
|
text = 'Source_Code'
|
||||||
|
|
|
@ -64,7 +64,7 @@ CLASS z2ui5_cl_app_demo_19 IMPLEMENTATION.
|
||||||
|
|
||||||
DATA(page) = client->factory_view(
|
DATA(page) = client->factory_view(
|
||||||
)->page(
|
)->page(
|
||||||
title = 'abap2ui5 - Table with different Selection-Modes'
|
title = 'abap2UI5 - Table with different Selection-Modes'
|
||||||
navbuttonpress = client->_event( 'BACK' )
|
navbuttonpress = client->_event( 'BACK' )
|
||||||
)->header_content(
|
)->header_content(
|
||||||
)->link(
|
)->link(
|
||||||
|
|
|
@ -58,8 +58,8 @@ CLASS Z2UI5_CL_HTTP_HANDLER IMPLEMENTATION.
|
||||||
CAST z2ui5_if_app( lo_runtime->ms_db-o_app )->controller( li_client ).
|
CAST z2ui5_if_app( lo_runtime->ms_db-o_app )->controller( li_client ).
|
||||||
ROLLBACK WORK.
|
ROLLBACK WORK.
|
||||||
|
|
||||||
CATCH cx_root INTO DATA(cx).
|
CATCH cx_root INTO DATA(x).
|
||||||
lo_runtime = lo_runtime->set_app_system_error( kind = 'ON_EVENT' ix = cx ).
|
lo_runtime = lo_runtime->set_app_system_error( x ).
|
||||||
CONTINUE.
|
CONTINUE.
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ CLASS Z2UI5_CL_HTTP_HANDLER IMPLEMENTATION.
|
||||||
|
|
||||||
result = lo_runtime->request_end( ).
|
result = lo_runtime->request_end( ).
|
||||||
|
|
||||||
CATCH cx_root INTO cx.
|
CATCH cx_root INTO x.
|
||||||
lo_runtime = lo_runtime->set_app_system_error( kind = 'ON_RENDERING' ix = cx ).
|
lo_runtime = lo_runtime->set_app_system_error( x ).
|
||||||
CONTINUE.
|
CONTINUE.
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
||||||
|
|
|
@ -886,7 +886,7 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF mv_check_list = abap_false.
|
IF mv_check_list = abap_false.
|
||||||
result = result && |"{ lo_attri->mv_name }":|.
|
result = |{ result }"{ lo_attri->mv_name }":|.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
|
||||||
|
@ -956,13 +956,6 @@ CLASS z2ui5_lcl_if_view DEFINITION.
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(result) TYPE ty_s_view.
|
VALUE(result) TYPE ty_s_view.
|
||||||
|
|
||||||
METHODS _get_name_by_ref
|
|
||||||
IMPORTING
|
|
||||||
value TYPE data
|
|
||||||
type TYPE string DEFAULT cs-bind_type-two_way
|
|
||||||
RETURNING
|
|
||||||
VALUE(result) TYPE string.
|
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
|
|
||||||
METHODS xml_get
|
METHODS xml_get
|
||||||
|
@ -1088,7 +1081,6 @@ CLASS z2ui5_lcl_system_runtime DEFINITION.
|
||||||
|
|
||||||
METHODS set_app_system_error
|
METHODS set_app_system_error
|
||||||
IMPORTING
|
IMPORTING
|
||||||
kind TYPE string
|
|
||||||
ix TYPE REF TO cx_root
|
ix TYPE REF TO cx_root
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
|
VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
|
||||||
|
@ -1126,56 +1118,11 @@ ENDCLASS.
|
||||||
|
|
||||||
CLASS z2ui5_lcl_if_view IMPLEMENTATION.
|
CLASS z2ui5_lcl_if_view IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD _get_name_by_ref.
|
|
||||||
|
|
||||||
CONSTANTS c_prefix TYPE string VALUE `M_ROOT->MO_RUNTIME->MS_DB-O_APP->`.
|
|
||||||
|
|
||||||
IF type = cs-bind_type-one_time.
|
|
||||||
DATA(lv_id) = _=>get_uuid_session( ).
|
|
||||||
INSERT VALUE #(
|
|
||||||
name = lv_id
|
|
||||||
data_stringify = _=>trans_any_2_json( value )
|
|
||||||
bind_type = type
|
|
||||||
) INTO TABLE m_root->mo_runtime->ms_db-t_attri.
|
|
||||||
result = `/` && lv_id && ``.
|
|
||||||
RETURN.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
DATA(lr_in) = REF #( value ).
|
|
||||||
|
|
||||||
LOOP AT m_root->mo_runtime->ms_db-t_attri REFERENCE INTO DATA(lr_attri).
|
|
||||||
|
|
||||||
FIELD-SYMBOLS <attribute> TYPE any.
|
|
||||||
DATA(lv_name) = c_prefix && to_upper( lr_attri->name ).
|
|
||||||
ASSIGN (lv_name) TO <attribute>.
|
|
||||||
_=>raise( when = xsdbool( sy-subrc <> 0 ) v = `Attribute in App with name ` && lv_name && ` not found` ).
|
|
||||||
|
|
||||||
DATA(lr_ref) = REF #( <attribute> ).
|
|
||||||
|
|
||||||
IF lr_in = lr_ref.
|
|
||||||
lr_attri->bind_type = type.
|
|
||||||
result = COND #( WHEN type = cs-bind_type-two_way THEN `/oUpdate/` ELSE `/` ) && lr_attri->name.
|
|
||||||
RETURN.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDLOOP.
|
|
||||||
|
|
||||||
"one time when not global class attribute
|
|
||||||
lv_id = _=>get_uuid_session( ).
|
|
||||||
INSERT VALUE #(
|
|
||||||
name = lv_id
|
|
||||||
data_stringify = _=>trans_any_2_json( value )
|
|
||||||
bind_type = cs-bind_type-one_time
|
|
||||||
) INTO TABLE m_root->mo_runtime->ms_db-t_attri.
|
|
||||||
result = `/` && lv_id && ``.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD xml_get_begin.
|
METHOD xml_get_begin.
|
||||||
|
|
||||||
result = COND #( WHEN check_popup_active = abap_true THEN `<core:FragmentDefinition` ELSE `<mvc:View controllerName="MyController"` ).
|
result = COND #( WHEN check_popup_active = abap_true THEN `<core:FragmentDefinition` ELSE `<mvc:View controllerName="MyController"` ).
|
||||||
|
|
||||||
result = result && ` xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout" xmlns:html="http://www.w3.org/1999/xhtml"` &&
|
result = result && ` displayBlock="true" height="100%" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout" xmlns:html="http://www.w3.org/1999/xhtml"` &&
|
||||||
` xmlns:f="sap.ui.layout.form" xmlns:mvc="sap.ui.core.mvc" xmlns:editor="sap.ui.codeeditor" xmlns:ui="sap.ui.table" ` &&
|
` xmlns:f="sap.ui.layout.form" xmlns:mvc="sap.ui.core.mvc" xmlns:editor="sap.ui.codeeditor" xmlns:ui="sap.ui.table" ` &&
|
||||||
`xmlns="sap.m" xmlns:mchart="sap.suite.ui.microchart" xmlns:z2ui5="z2ui5" xmlns:webc="sap.ui.webc.main" xmlns:text="sap.ui.richtexteditor" > `.
|
`xmlns="sap.m" xmlns:mchart="sap.suite.ui.microchart" xmlns:z2ui5="z2ui5" xmlns:webc="sap.ui.webc.main" xmlns:text="sap.ui.richtexteditor" > `.
|
||||||
|
|
||||||
|
@ -1219,18 +1166,18 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION.
|
||||||
result = |{ result } <{ lv_tmp2 }{ m_name } \n { lv_tmp3 }|.
|
result = |{ result } <{ lv_tmp2 }{ m_name } \n { lv_tmp3 }|.
|
||||||
|
|
||||||
IF t_child IS INITIAL.
|
IF t_child IS INITIAL.
|
||||||
result = result && `/>`.
|
result = |{ result }/>|.
|
||||||
RETURN.
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
result = result && `>`.
|
result = |{ result }>|.
|
||||||
|
|
||||||
LOOP AT t_child INTO lr_child.
|
LOOP AT t_child INTO lr_child.
|
||||||
result = result && lr_child->xml_get( ).
|
result = result && lr_child->xml_get( ).
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
|
||||||
DATA(lv_ns) = COND #( WHEN m_ns <> || THEN |{ m_ns }:| ).
|
DATA(lv_ns) = COND #( WHEN m_ns <> || THEN |{ m_ns }:| ).
|
||||||
result = result && |</{ lv_ns }{ m_name }>|.
|
result = |{ result }</{ lv_ns }{ m_name }>|.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -2326,9 +2273,8 @@ CLASS z2ui5_lcl_system_app DEFINITION.
|
||||||
IMPORTING
|
IMPORTING
|
||||||
error TYPE REF TO cx_root
|
error TYPE REF TO cx_root
|
||||||
app TYPE REF TO object OPTIONAL
|
app TYPE REF TO object OPTIONAL
|
||||||
kind TYPE string OPTIONAL
|
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(result) TYPE REF TO z2ui5_lcl_system_app.
|
VALUE(result) TYPE REF TO z2ui5_lcl_system_app.
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
|
|
||||||
|
@ -2353,8 +2299,6 @@ CLASS z2ui5_lcl_system_app IMPLEMENTATION.
|
||||||
METHOD z2ui5_if_app~controller.
|
METHOD z2ui5_if_app~controller.
|
||||||
|
|
||||||
CASE client->get( )-lifecycle_method.
|
CASE client->get( )-lifecycle_method.
|
||||||
* WHEN client->cs-lifecycle_method-on_init.
|
|
||||||
* z2ui5_on_init( client ).
|
|
||||||
WHEN client->cs-lifecycle_method-on_event.
|
WHEN client->cs-lifecycle_method-on_event.
|
||||||
IF mv_is_initialized = abap_false.
|
IF mv_is_initialized = abap_false.
|
||||||
mv_is_initialized = abap_true.
|
mv_is_initialized = abap_true.
|
||||||
|
@ -2372,8 +2316,7 @@ CLASS z2ui5_lcl_system_app IMPLEMENTATION.
|
||||||
|
|
||||||
result = NEW #( ).
|
result = NEW #( ).
|
||||||
result->ms_error-x_error = error.
|
result->ms_error-x_error = error.
|
||||||
result->ms_error-app ?= app.
|
result->ms_error-app = cast #( app ).
|
||||||
result->ms_error-kind = kind.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -2875,7 +2818,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
||||||
data_stringify = _=>trans_any_2_json( value )
|
data_stringify = _=>trans_any_2_json( value )
|
||||||
bind_type = type
|
bind_type = type
|
||||||
) INTO TABLE ms_db-t_attri.
|
) INTO TABLE ms_db-t_attri.
|
||||||
result = `/` && lv_id && ``.
|
result = |/{ lv_id }|.
|
||||||
RETURN.
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -2905,7 +2848,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
||||||
data_stringify = _=>trans_any_2_json( value )
|
data_stringify = _=>trans_any_2_json( value )
|
||||||
bind_type = z2ui5_if_view=>cs-bind_type-one_time
|
bind_type = z2ui5_if_view=>cs-bind_type-one_time
|
||||||
) INTO TABLE ms_db-t_attri.
|
) INTO TABLE ms_db-t_attri.
|
||||||
result = `/` && lv_id && ``.
|
result = |/{ lv_id }|.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -2915,7 +2858,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
||||||
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
|
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
|
||||||
result = NEW #( ).
|
result = NEW #( ).
|
||||||
result->ms_db-id = _=>get_uuid( ).
|
result->ms_db-id = _=>get_uuid( ).
|
||||||
result->ms_db-o_app = z2ui5_lcl_system_app=>factory_error( error = ix app = ms_db-o_app kind = kind ).
|
result->ms_db-o_app = z2ui5_lcl_system_app=>factory_error( error = ix app = ms_db-o_app ).
|
||||||
result->ms_db-app_classname = _=>get_classname_by_ref( result->ms_db-o_app ).
|
result->ms_db-app_classname = _=>get_classname_by_ref( result->ms_db-o_app ).
|
||||||
|
|
||||||
result->ms_db-id_prev_app = ms_db-id.
|
result->ms_db-id_prev_app = ms_db-id.
|
||||||
|
@ -2941,7 +2884,6 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
||||||
|
|
||||||
result = NEW z2ui5_lcl_if_client( me ).
|
result = NEW z2ui5_lcl_if_client( me ).
|
||||||
|
|
||||||
CLEAR ms_actual.
|
|
||||||
DATA(lv_url) = ss_client-t_header[ name = `referer` ]-value.
|
DATA(lv_url) = ss_client-t_header[ name = `referer` ]-value.
|
||||||
|
|
||||||
ms_actual = VALUE #(
|
ms_actual = VALUE #(
|
||||||
|
@ -2964,16 +2906,10 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
||||||
url_app_gen = lv_url && `?sap-client=` && ms_actual-s_request-tenant && `&app=`
|
url_app_gen = lv_url && `?sap-client=` && ms_actual-s_request-tenant && `&app=`
|
||||||
origin = ss_client-t_header[ name = `origin` ]-value
|
origin = ss_client-t_header[ name = `origin` ]-value
|
||||||
url_source_code = ms_actual-s_request-origin && `/sap/bc/adt/oo/classes/` && ms_db-app_classname && `/source/main`
|
url_source_code = ms_actual-s_request-origin && `/sap/bc/adt/oo/classes/` && ms_db-app_classname && `/source/main`
|
||||||
)
|
) ).
|
||||||
).
|
|
||||||
|
|
||||||
CLEAR ms_next.
|
CLEAR ms_next.
|
||||||
|
|
||||||
* IF ms_actual-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init.
|
|
||||||
* "call new app with view
|
|
||||||
* ms_next-view = ms_actual-view_active.
|
|
||||||
* ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user