mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-30 00:36:14 +08:00
Refactoring (#892)
* refactoring * update * lint fixes * update * update * update
This commit is contained in:
parent
8fa1eac08d
commit
1a67811f99
|
@ -129,14 +129,32 @@ CLASS z2ui5_cl_util IMPLEMENTATION.
|
|||
|
||||
METHOD db_save.
|
||||
|
||||
DATA lt_db TYPE STANDARD TABLE OF z2ui5_t_fw_02 WITH EMPTY KEY.
|
||||
|
||||
SELECT data
|
||||
FROM z2ui5_t_fw_02
|
||||
WHERE
|
||||
uname = @uname
|
||||
AND handle = @handle
|
||||
AND handle2 = @handle2
|
||||
AND handle3 = @handle3
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_db.
|
||||
ASSERT sy-subrc = 0.
|
||||
|
||||
DATA(ls_db) = VALUE z2ui5_t_fw_02(
|
||||
id = uuid_get_c32( )
|
||||
* id = lv_id
|
||||
uname = uname
|
||||
handle = handle
|
||||
handle2 = handle2
|
||||
handle3 = handle3
|
||||
data = xml_stringify( data ) ).
|
||||
|
||||
TRY.
|
||||
ls_db-id = lt_db[ 1 ]-id.
|
||||
CATCH cx_root.
|
||||
ls_db-id = uuid_get_c32( ).
|
||||
ENDTRY.
|
||||
|
||||
MODIFY z2ui5_t_fw_02 FROM @ls_db.
|
||||
ASSERT sy-subrc = 0.
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
|
||||
METHOD first_test.
|
||||
|
||||
IF sy-sysid = 'ABC'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_row,
|
||||
title TYPE string,
|
||||
|
|
|
@ -69,7 +69,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
|
||||
CLASS Z2UI5_CL_UTIL_STMPNCFCTN IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD conv_decode_x_base64.
|
||||
|
@ -282,14 +282,12 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
|
|||
|
||||
TRY.
|
||||
|
||||
|
||||
CALL METHOD ('XCO_CP_ABAP')=>interface
|
||||
EXPORTING
|
||||
iv_name = val
|
||||
RECEIVING
|
||||
ro_interface = obj.
|
||||
|
||||
|
||||
ASSIGN obj->('IF_XCO_AO_INTERFACE~IMPLEMENTATIONS') TO <any>.
|
||||
IF sy-subrc <> 0.
|
||||
RAISE EXCEPTION TYPE cx_sy_dyn_call_illegal_class.
|
||||
|
@ -328,7 +326,6 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
|
|||
|
||||
ENDTRY.
|
||||
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ CLASS ltcl_test DEFINITION FINAL FOR TESTING
|
|||
METHODS test_func_get_uuid_22 FOR TESTING RAISING cx_static_check.
|
||||
METHODS test_encoding FOR TESTING RAISING cx_static_check.
|
||||
METHODS test_element_text FOR TESTING RAISING cx_static_check.
|
||||
METHODS test_classes_impl_intf FOR TESTING RAISING cx_static_check.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
@ -58,4 +59,15 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_classes_impl_intf.
|
||||
|
||||
IF sy-sysid = 'ABC'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
DATA(mt_classes) = z2ui5_cl_util_stmpncfctn=>rtti_get_classes_impl_intf( `IF_SERIALIZABLE_OBJECT` ).
|
||||
cl_abap_unit_assert=>assert_not_initial( mt_classes ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<DDTEXT>abap2UI5 - data storage</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
</DD02V>
|
||||
|
|
|
@ -146,12 +146,16 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
|
|||
client = client
|
||||
classname = 'z2ui5_cl_demo_app_000' ).
|
||||
|
||||
* DATA(lv_url_samples3) = z2ui5_cl_util=>app_get_url(
|
||||
* client = client
|
||||
* classname = 'z2ui5_cl_app_search_apps' ).
|
||||
|
||||
simple_form2->toolbar( )->title( `What's next?` ).
|
||||
|
||||
IF z2ui5_cl_util=>rtti_check_class_exists( `z2ui5_cl_demo_app_000` ).
|
||||
simple_form2->label( `Start Developing` ).
|
||||
simple_form2->button(
|
||||
text = `Check out the samples`
|
||||
text = `Check Out the Samples`
|
||||
press = client->_event_client( val = client->cs_event-open_new_tab
|
||||
t_arg = VALUE #( ( lv_url_samples2 ) ) )
|
||||
width = `70%` ).
|
||||
|
@ -163,6 +167,13 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
|
|||
href = `https://github.com/abap2UI5/abap2UI5-samples` ).
|
||||
ENDIF.
|
||||
|
||||
* simple_form2->label( `App Finder` ).
|
||||
* simple_form2->button(
|
||||
* text = `Start & Install App`
|
||||
* press = client->_event_client( val = client->cs_event-open_new_tab
|
||||
* t_arg = VALUE #( ( lv_url_samples3 ) ) )
|
||||
* width = `70%` ).
|
||||
|
||||
simple_form2->label( `` ).
|
||||
simple_form2->text( `` ).
|
||||
simple_form2->label( `Open an issue` ).
|
||||
|
@ -243,8 +254,6 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
|
|||
ms_home-btn_icon = `sap-icon://validate`.
|
||||
ms_home-class_editable = abap_true.
|
||||
|
||||
|
||||
|
||||
ELSE.
|
||||
on_event_check( ).
|
||||
ENDIF.
|
||||
|
|
|
@ -12,28 +12,37 @@ CLASS z2ui5_cl_app_search_apps DEFINITION
|
|||
visible TYPE abap_bool,
|
||||
* check_fav TYPE abap_bool,
|
||||
END OF ty_app.
|
||||
* DATA mt_apps_backup TYPE STANDARD TABLE OF ty_app WITH EMPTY KEY.
|
||||
DATA mt_apps TYPE STANDARD TABLE OF ty_app WITH EMPTY KEY.
|
||||
DATA mt_favs TYPE STANDARD TABLE OF ty_app WITH EMPTY KEY.
|
||||
DATA ms_app_sel TYPE ty_app.
|
||||
|
||||
DATA check_initialized TYPE abap_bool.
|
||||
DATA mv_search_value TYPE string.
|
||||
DATA mv_selected_key TYPE string.
|
||||
|
||||
DATA:
|
||||
BEGIN OF ms_favrites,
|
||||
BEGIN OF ms_search,
|
||||
check_hide_samples TYPE abap_bool,
|
||||
check_hide_system TYPE abap_bool,
|
||||
search_field TYPE string,
|
||||
number TYPE string,
|
||||
END OF ms_search.
|
||||
|
||||
DATA:
|
||||
BEGIN OF ms_favorites,
|
||||
check_cloud_ready TYPE abap_bool,
|
||||
check_premise_ready TYPE abap_bool,
|
||||
search_field TYPE string,
|
||||
END OF ms_favrites.
|
||||
number TYPE string,
|
||||
END OF ms_favorites.
|
||||
|
||||
PROTECTED SECTION.
|
||||
METHODS search.
|
||||
METHODS view_display
|
||||
IMPORTING
|
||||
client TYPE REF TO z2ui5_if_client.
|
||||
METHODS view_nest_display
|
||||
IMPORTING
|
||||
client TYPE REF TO z2ui5_if_client.
|
||||
METHODS view_nest_display.
|
||||
METHODS view_action_sheet
|
||||
IMPORTING
|
||||
val TYPE clike.
|
||||
|
@ -49,17 +58,28 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
|
||||
METHOD search.
|
||||
|
||||
|
||||
DATA lv_counter TYPE i.
|
||||
|
||||
LOOP AT mt_apps REFERENCE INTO DATA(lr_app).
|
||||
|
||||
lr_app->visible = abap_false.
|
||||
IF lr_app->name CS 'DEMO' OR lr_app->name CS `Z2UI5_CL_POPUP`.
|
||||
|
||||
IF ms_search-check_hide_samples = abap_true
|
||||
AND lr_app->name CS 'Z2UI5_CL_DEMO'.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
IF ms_search-check_hide_system = abap_true
|
||||
AND lr_app->name CS `Z2UI5_CL_`
|
||||
AND lr_app->name NS `Z2UI5_CL_DEMO`.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
|
||||
IF lr_app->name CS mv_search_value.
|
||||
lr_app->visible = abap_true.
|
||||
lv_counter = lv_counter + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ms_search-number = `Result: ` && CONV string( lv_counter ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -73,23 +93,24 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
action_sheet_view->action_sheet( placement = `Botton`
|
||||
showcancelbutton = abap_true
|
||||
title = `Choose Your Action`
|
||||
)->button( text = `Accept`
|
||||
icon = `sap-icon://accept`
|
||||
)->button( text = `Add to Favorite`
|
||||
* icon = `sap-icon://accept`
|
||||
press = client->_event( `ADD_TO_FAVS` )
|
||||
)->button( text = `Add to Favorite as external Link`
|
||||
* icon = `sap-icon://decline`
|
||||
press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
)->button( text = `Reject`
|
||||
icon = `sap-icon://decline`
|
||||
press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
)->button( text = `Email`
|
||||
icon = `sap-icon://email`
|
||||
press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
)->button( text = `Forward`
|
||||
icon = `sap-icon://forward`
|
||||
press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
)->button( text = `Delete`
|
||||
icon = `sap-icon://delete`
|
||||
press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
)->button( text = `Other`
|
||||
press = `MessageToast.show('selected action is ' + ${$source>/text})` ).
|
||||
* )->button( text = `Email`
|
||||
* icon = `sap-icon://email`
|
||||
* press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
* )->button( text = `Forward`
|
||||
* icon = `sap-icon://forward`
|
||||
* press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
* )->button( text = `Delete`
|
||||
* icon = `sap-icon://delete`
|
||||
* press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
* )->button( text = `Other`
|
||||
* press = `MessageToast.show('selected action is ' + ${$source>/text})`
|
||||
).
|
||||
|
||||
client->popover_display( xml = action_sheet_view->stringify( )
|
||||
by_id = val ).
|
||||
|
@ -117,9 +138,9 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
)->tool_page(
|
||||
)->header( `tnt`
|
||||
)->tool_header(
|
||||
)->title( `abap2UI5 - App Overview`
|
||||
)->text( width = `10%`
|
||||
)->link( text = `Visit the abap2UI5 Project`
|
||||
)->title( `abap2UI5 - App Finder`
|
||||
* )->text( width = `10%`
|
||||
* )->link( text = `Visit the abap2UI5 Project`
|
||||
* )->button( text = `Bak` press = client->_event( 'BACK' )
|
||||
)->get_parent(
|
||||
)->get_parent( )->sub_header( `tnt`
|
||||
|
@ -138,9 +159,9 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
)->icon_tab_filter( key = `page_favs`
|
||||
text = `Favorites` )->get_parent(
|
||||
)->icon_tab_filter( key = `page_all`
|
||||
text = `Search...` )->get_parent(
|
||||
text = `Local` )->get_parent(
|
||||
)->icon_tab_filter( key = `page_online`
|
||||
text = `More on GitHub...`
|
||||
text = `GitHub`
|
||||
* )->items(
|
||||
* )->icon_tab_filter( key = `page11` text = `User 1` )->get_parent(
|
||||
* )->icon_tab_filter( key = `page32` text = `User 2` )->get_parent(
|
||||
|
@ -156,7 +177,7 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
)->pages( ).
|
||||
|
||||
pages->page(
|
||||
title = `12 Apps`
|
||||
title = `Result: ` && client->_bind( ms_favorites-number )
|
||||
id = `page_favs`
|
||||
)->header_content(
|
||||
)->button( text = `Edit`
|
||||
|
@ -169,9 +190,15 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
)->get_parent( ).
|
||||
|
||||
DATA(page_all) = pages->page(
|
||||
title = `12 Apps on the System`
|
||||
title = client->_bind( ms_search-number )
|
||||
id = `page_all`
|
||||
)->header_content(
|
||||
)->checkbox( text = `Hide Samples`
|
||||
selected = client->_bind_edit( ms_search-check_hide_samples )
|
||||
select = client->_event( `ON_SEARCH` )
|
||||
)->checkbox( text = `Hide System`
|
||||
selected = client->_bind_edit( ms_search-check_hide_system )
|
||||
select = client->_event( `ON_SEARCH` )
|
||||
)->search_field(
|
||||
value = client->_bind_edit( mv_search_value )
|
||||
search = client->_event( 'ON_SEARCH' )
|
||||
|
@ -191,21 +218,19 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
visible = client->_bind( val = lr_app->visible tab = mt_apps tab_index = lv_tabix ) ).
|
||||
ENDLOOP.
|
||||
|
||||
|
||||
view_nest_display( client ).
|
||||
|
||||
|
||||
|
||||
view_nest_display( ).
|
||||
|
||||
DATA(page_online) = pages->page(
|
||||
* title = `Your app is not listed here? Fell free to send a PR and extend this page`
|
||||
id = `page_online`
|
||||
)->header_content(
|
||||
)->link( text = `Install with abapGit` href = `https://abapgit.org/` target = `blank`
|
||||
)->link( text = `More Open Source on dotabap.org` href = `https://dotabap.org/` target = `blank`
|
||||
)->toolbar_spacer(
|
||||
)->checkbox( text = `Cloud`
|
||||
selected = client->_bind_edit( ms_favrites-check_cloud_ready )
|
||||
selected = client->_bind_edit( ms_favorites-check_cloud_ready )
|
||||
)->checkbox( text = `On-Premise`
|
||||
selected = client->_bind_edit( ms_favrites-check_premise_ready )
|
||||
selected = client->_bind_edit( ms_favorites-check_premise_ready )
|
||||
)->button( text = `sort`
|
||||
)->search_field(
|
||||
value = client->_bind_edit( mv_search_value )
|
||||
|
@ -221,7 +246,11 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
)->content( ).
|
||||
|
||||
page_online->message_strip( type = `Warning`
|
||||
text = `Your open-source app is not listed here? Feel free to send a PR and extend this page` ).
|
||||
text = `Your open-source app is not listed here? Feel free to send a PR and extend this page`
|
||||
)->get( )->link(
|
||||
text = `here`
|
||||
target = `blank`
|
||||
href = `https://github.com/abap2UI5/abap2UI5/blob/main/src/02/02/z2ui5_cl_app_search_apps.clas.locals_imp.abap` ).
|
||||
|
||||
DATA(lt_repos) = NEW lcl_github( )->get_repositories( ).
|
||||
|
||||
|
@ -233,8 +262,6 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
selectionchange = client->_event( 'SELCHANGE' )
|
||||
)->custom_list_item( ).
|
||||
|
||||
|
||||
|
||||
item = item->vbox( ).
|
||||
|
||||
* grid->combobox(
|
||||
|
@ -270,7 +297,7 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
row->checkbox( text = `Standard ABAP (Min. {MIN_RELEASE})`
|
||||
selected = `{CHECK_STANDARD_ABAP}`
|
||||
enabled = abap_false ).
|
||||
row->text( `{DESCR}` ).
|
||||
* row->text( `{DESCR}` ).
|
||||
|
||||
client->view_display( page->stringify( ) ).
|
||||
|
||||
|
@ -287,8 +314,8 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
lo_view_nested->generic_tile(
|
||||
* page_favs->generic_tile(
|
||||
class = 'sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout'
|
||||
press = client->_event( val = `ON_PRESS` t_arg = VALUE #( ( `${$source>/header}` ) ) )
|
||||
header = client->_bind( val = lr_app->name tab = REF #( mt_favs ) tab_index = lv_tabix ) ).
|
||||
press = client->_event( val = `ON_START` t_arg = VALUE #( ( `${$source>/header}` ) ) )
|
||||
header = client->_bind( val = lr_app->name tab = mt_favs tab_index = lv_tabix ) ).
|
||||
* visible = client->_bind( val = lr_app->check_fav tab = mt_apps tab_index = lv_tabix ) ).
|
||||
ENDLOOP.
|
||||
|
||||
|
@ -330,24 +357,38 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
|
|||
|
||||
CASE client->get( )-event.
|
||||
|
||||
WHEN `ON_PRESS`.
|
||||
|
||||
DATA(lt_arg) = client->get( )-t_event_arg.
|
||||
DATA(lv_app) = lt_arg[ 1 ].
|
||||
|
||||
|
||||
|
||||
INSERT VALUE #( name = lv_app ) INTO TABLE mt_favs.
|
||||
|
||||
WHEN `ADD_TO_FAVS`.
|
||||
|
||||
INSERT ms_app_sel INTO TABLE mt_favs.
|
||||
z2ui5_cl_util=>db_save(
|
||||
uname = sy-uname
|
||||
handle = 'z2ui5_cl_app_search_apps'
|
||||
data = mt_favs ).
|
||||
|
||||
view_nest_display( ).
|
||||
|
||||
WHEN `ON_START`.
|
||||
|
||||
TRY.
|
||||
|
||||
DATA(lt_arg2) = client->get( )-t_event_arg.
|
||||
DATA(lv_app2) = lt_arg2[ 1 ].
|
||||
DATA li_app TYPE REF TO z2ui5_if_app.
|
||||
CREATE OBJECT li_app TYPE (lv_app2).
|
||||
client->nav_app_call( li_app ).
|
||||
CATCH cx_root INTO DATA(x).
|
||||
client->nav_app_call( z2ui5_cl_popup_to_inform=>factory( x->get_text( ) ) ).
|
||||
ENDTRY.
|
||||
|
||||
WHEN `ON_PRESS`.
|
||||
DATA(lt_arg) = client->get( )-t_event_arg.
|
||||
DATA(lv_app) = lt_arg[ 1 ].
|
||||
|
||||
ms_app_sel = VALUE #( name = lv_app ).
|
||||
|
||||
view_action_sheet( lv_app ).
|
||||
|
||||
view_nest_display( client ).
|
||||
* view_nest_display( client ).
|
||||
|
||||
WHEN 'BACK'.
|
||||
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
||||
|
|
|
@ -60,8 +60,7 @@ CLASS lcl_github IMPLEMENTATION.
|
|||
) )
|
||||
(
|
||||
name = `The Quest`
|
||||
descr = `A wizard's adventure game based on a fork of the AXAGE game engine (ABAP teXt Adventure Game Engine) and abap2UI5. The game is set in a fantasy world, where the player ` &&
|
||||
`takes on the role of a wizard's apprentice. The player explores the wizard's house, interacts with various objects and explores. The Quest is work in progress...`
|
||||
descr = `A wizard's adventure game based on a fork of the AXAGE game engine (ABAP teXt Adventure Game Engine) and abap2UI5.`
|
||||
check_abap_for_cloud = abap_true
|
||||
min_release = `750`
|
||||
link = `https://github.com/nomssi/axage`
|
||||
|
@ -76,10 +75,10 @@ CLASS lcl_github IMPLEMENTATION.
|
|||
) )
|
||||
(
|
||||
name = `Advent of Code`
|
||||
descr = `Advent of Code 2023 in ABAP`
|
||||
descr = `Template for the Advent of Code 2023 in ABAP`
|
||||
author_link = `https://github.com/joltdx`
|
||||
author_name = `joltdx`
|
||||
link = `https://github.com/joltdx/abap-advent-2023`
|
||||
link = `https://github.com/joltdx/abap-advent-2023-template`
|
||||
check_abap_for_cloud = abap_true
|
||||
min_release = `750`
|
||||
t_app = VALUE #(
|
||||
|
|
Loading…
Reference in New Issue
Block a user