Skip to content

Commit 994347f

Browse files
author
Nestor Lara
committed
refactoring
1 parent 9652b2b commit 994347f

5 files changed

+148
-53
lines changed

src/z2ui5_cl_demo_app_000.clas.abap

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
154154
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
155155
).
156156

157-
panel->generic_tile(
158-
header = 'Browser Title'
159-
press = client->_event( 'z2ui5_cl_demo_app_125' )
160-
mode = 'LineMode'
161-
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
162-
).
163-
164157
panel->generic_tile(
165158
header = 'New Tab'
166159
subheader = 'Open an URL in a new tab'
@@ -1011,6 +1004,20 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
10111004
headertext = `Custom Control - More`
10121005
).
10131006

1007+
panel->generic_tile(
1008+
header = 'Tab Title'
1009+
press = client->_event( 'z2ui5_cl_demo_app_125' )
1010+
mode = 'LineMode'
1011+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
1012+
).
1013+
1014+
panel->generic_tile(
1015+
header = 'Tab Favicon'
1016+
press = client->_event( 'z2ui5_cl_demo_app_171' )
1017+
mode = 'LineMode'
1018+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
1019+
).
1020+
10141021
panel->generic_tile(
10151022
header = 'Spreadsheet Control'
10161023
subheader = 'Export Table as XLSX'

src/z2ui5_cl_demo_app_052.clas.abap

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
CLASS Z2UI5_CL_DEMO_APP_052 DEFINITION PUBLIC.
1+
CLASS z2ui5_cl_demo_app_052 DEFINITION PUBLIC.
22

33
PUBLIC SECTION.
44

5-
INTERFACES Z2UI5_if_app.
5+
INTERFACES z2ui5_if_app.
66

77
TYPES:
88
BEGIN OF ty_s_tab,
9+
index TYPE string,
910
selkz TYPE abap_bool,
1011
product TYPE string,
1112
create_date TYPE string,
@@ -15,16 +16,16 @@ CLASS Z2UI5_CL_DEMO_APP_052 DEFINITION PUBLIC.
1516
END OF ty_s_tab.
1617
TYPES ty_t_table TYPE STANDARD TABLE OF ty_s_tab WITH EMPTY KEY.
1718

18-
DATA mt_table TYPE ty_T_table.
19+
DATA mt_table TYPE ty_t_table.
1920
DATA check_initialized TYPE abap_bool.
20-
DATA client TYPE REF TO Z2UI5_if_client.
21+
DATA client TYPE REF TO z2ui5_if_client.
2122

2223
DATA mv_check_popover TYPE abap_bool.
2324
DATA mv_product TYPE string.
2425

25-
METHODS Z2UI5_set_data.
26-
METHODS Z2UI5_display_view.
27-
METHODS Z2UI5_display_popover
26+
METHODS z2ui5_set_data.
27+
METHODS z2ui5_display_view.
28+
METHODS z2ui5_display_popover
2829
IMPORTING
2930
id TYPE string.
3031

@@ -34,12 +35,12 @@ ENDCLASS.
3435

3536

3637

37-
CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
38+
CLASS z2ui5_cl_demo_app_052 IMPLEMENTATION.
3839

3940

40-
METHOD Z2UI5_display_popover.
41+
METHOD z2ui5_display_popover.
4142

42-
DATA(lo_popover) = Z2UI5_cl_xml_view=>factory_popup( ).
43+
DATA(lo_popover) = z2ui5_cl_xml_view=>factory_popup( ).
4344

4445
lo_popover->popover( placement = `Right` title = `abap2UI5 - Popover - ` && mv_product contentwidth = `50%`
4546
)->simple_form( editable = abap_true
@@ -66,11 +67,11 @@ CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
6667
ENDMETHOD.
6768

6869

69-
METHOD Z2UI5_display_view.
70+
METHOD z2ui5_display_view.
7071

7172
DATA(view) = z2ui5_cl_xml_view=>factory( ).
7273

73-
data(page) = view->page( id = `page_main`
74+
DATA(page) = view->page( id = `page_main`
7475
title = 'abap2UI5 - List Report Features'
7576
navbuttonpress = client->_event( 'BACK' )
7677
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
@@ -84,30 +85,30 @@ CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
8485

8586
page = page->dynamic_page( headerexpanded = abap_true headerpinned = abap_true ).
8687

87-
DATA(header_title) = page->title( ns = 'f' )->get( )->dynamic_page_title( ).
88-
header_title->heading( ns = 'f' )->hbox( )->title( `Item Popover` ).
89-
header_title->expanded_content( 'f' ).
90-
header_title->snapped_content( ns = 'f' ).
91-
92-
DATA(lo_box) = page->header( )->dynamic_page_header( pinnable = abap_true
93-
)->flex_box( alignitems = `Start` justifycontent = `SpaceBetween` )->flex_box( alignItems = `Start` ).
94-
95-
lo_box->get_parent( )->hbox( justifycontent = `End` )->button(
96-
text = `Go`
97-
press = client->_event( `BUTTON_START` )
98-
type = `Emphasized` ).
88+
* DATA(header_title) = page->title( ns = 'f' )->get( )->dynamic_page_title( ).
89+
* header_title->heading( ns = 'f' )->hbox( )->title( `Item Popover` ).
90+
* header_title->expanded_content( 'f' ).
91+
* header_title->snapped_content( ns = 'f' ).
92+
*
93+
* DATA(lo_box) = page->header( )->dynamic_page_header( pinnable = abap_true
94+
* )->flex_box( alignitems = `Start` justifycontent = `SpaceBetween` )->flex_box( alignItems = `Start` ).
95+
*
96+
* lo_box->get_parent( )->hbox( justifycontent = `End` )->button(
97+
* text = `Go`
98+
* press = client->_event( `BUTTON_START` )
99+
* type = `Emphasized` ).
99100

100101
DATA(cont) = page->content( ns = 'f' ).
101102

102-
DATA(tab) = cont->table( items = client->_bind_edit( val = mt_table ) ).
103+
DATA(tab) = cont->table( id = `tab` items = client->_bind_edit( val = mt_table ) ).
103104

104-
tab->header_toolbar(
105-
)->toolbar(
106-
)->toolbar_spacer(
107-
)->button(
108-
icon = 'sap-icon://download'
109-
press = client->_event( 'BUTTON_DOWNLOAD' )
110-
).
105+
* tab->header_toolbar(
106+
* )->toolbar(
107+
* )->toolbar_spacer(
108+
* )->button(
109+
* icon = 'sap-icon://download'
110+
* press = client->_event( 'BUTTON_DOWNLOAD' )
111+
* ).
111112

112113
DATA(lo_columns) = tab->columns( ).
113114
lo_columns->column( )->text( text = `Product` ).
@@ -116,8 +117,8 @@ CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
116117
lo_columns->column( )->text( text = `Location` ).
117118
lo_columns->column( )->text( text = `Quantity` ).
118119

119-
DATA(lo_cells) = tab->items( )->column_list_item( ).
120-
lo_cells->link( text = '{PRODUCT}' press = client->_event( val = `POPOVER_DETAIL` t_arg = VALUE #( ( `${$source>/id}` ) ( `${PRODUCT}` ) ) ) ).
120+
DATA(lo_cells) = tab->items( )->column_list_item( id = `item` ).
121+
lo_cells->link( id = `link` text = '{PRODUCT}' press = client->_event( val = `POPOVER_DETAIL` t_arg = VALUE #( ( `${$source>/id}` ) ( `${PRODUCT}` ) ) ) ).
121122
lo_cells->text( `{CREATE_DATE}` ).
122123
lo_cells->text( `{CREATE_BY}` ).
123124
lo_cells->text( `{STORAGE_LOCATION}` ).
@@ -128,31 +129,32 @@ CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
128129
ENDMETHOD.
129130

130131

131-
METHOD Z2UI5_if_app~main.
132+
METHOD z2ui5_if_app~main.
132133

133134
me->client = client.
134135

135136
IF check_initialized = abap_false.
136137
check_initialized = abap_true.
137-
Z2UI5_display_view( ).
138+
z2ui5_display_view( ).
139+
z2ui5_set_data( ).
138140
RETURN.
139141
ENDIF.
140142

141143
CASE client->get( )-event.
142144

143-
when `BUTTON_DETAILS`.
145+
WHEN `BUTTON_DETAILS`.
144146
client->popover_destroy( ).
145147

146148
WHEN `POPOVER_DETAIL`.
147149
DATA(lt_arg) = client->get( )-t_event_arg.
148150
DATA(lv_open_by_id) = lt_arg[ 1 ].
149151
mv_check_popover = abap_true.
150152
mv_product = lt_arg[ 2 ].
151-
Z2UI5_display_popover( lv_open_by_id ).
153+
z2ui5_display_popover( lv_open_by_id ).
152154

153-
WHEN 'BUTTON_START'.
154-
Z2UI5_set_data( ).
155-
client->view_model_update( ).
155+
* WHEN 'BUTTON_START'.
156+
*
157+
* client->view_model_update( ).
156158

157159
WHEN 'BACK'.
158160
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
@@ -163,7 +165,7 @@ CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
163165
ENDMETHOD.
164166

165167

166-
METHOD Z2UI5_set_data.
168+
METHOD z2ui5_set_data.
167169

168170
mt_table = VALUE #(
169171
( product = 'table' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
@@ -216,6 +218,9 @@ CLASS Z2UI5_CL_DEMO_APP_052 IMPLEMENTATION.
216218
( product = 'table2' create_date = `01.01.2023` create_by = `Julia` storage_location = `AREA_001` quantity = 110 )
217219
).
218220

221+
LOOP AT mt_table REFERENCE INTO DATA(lr_tab).
222+
lr_tab->index = sy-tabix.
223+
ENDLOOP.
219224

220225
ENDMETHOD.
221226
ENDCLASS.

src/z2ui5_cl_demo_app_125.clas.abap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ CLASS Z2UI5_CL_DEMO_APP_125 IMPLEMENTATION.
2424
DATA(view) = z2ui5_cl_xml_view=>factory( ).
2525

2626
DATA(tmp) = view->_z2ui5( )->title( client->_bind_edit( title )
27-
)->_z2ui5( )->favicon( favicon = client->_bind_edit( favicon )
2827
)->shell(
2928
)->page(
3029
title = 'abap2UI5 - Change Browser Title'
@@ -41,8 +40,6 @@ CLASS Z2UI5_CL_DEMO_APP_125 IMPLEMENTATION.
4140
)->title( 'Input'
4241
)->label( 'title'
4342
)->input( client->_bind_edit( title )
44-
)->label( 'favicon'
45-
)->input( client->_bind_edit( favicon )
4643
).
4744

4845
client->view_display( tmp->stringify( ) ).
@@ -57,7 +54,6 @@ CLASS Z2UI5_CL_DEMO_APP_125 IMPLEMENTATION.
5754
IF check_initialized = abap_false.
5855
check_initialized = abap_true.
5956
title = `my title`.
60-
favicon = `https://cdn.jsdelivr.net/gh/choper725/resources/123/abap2ui5.png`.
6157

6258
display_view( ).
6359

src/z2ui5_cl_demo_app_171.clas.abap

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
CLASS z2ui5_cl_demo_app_171 DEFINITION PUBLIC.
2+
3+
PUBLIC SECTION.
4+
5+
INTERFACES z2ui5_if_app.
6+
7+
DATA favicon TYPE string.
8+
DATA check_initialized TYPE abap_bool.
9+
10+
PROTECTED SECTION.
11+
data client type ref to z2ui5_if_client.
12+
METHODS display_view.
13+
PRIVATE SECTION.
14+
ENDCLASS.
15+
16+
17+
18+
CLASS Z2UI5_CL_DEMO_APP_171 IMPLEMENTATION.
19+
20+
21+
METHOD display_view.
22+
23+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
24+
25+
DATA(tmp) = view->_z2ui5( )->favicon( favicon = client->_bind_edit( favicon )
26+
)->shell(
27+
)->page(
28+
title = 'abap2UI5 - Change Tab Favicon'
29+
navbuttonpress = client->_event( val = 'BACK' check_view_destroy = abap_true )
30+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
31+
)->header_content(
32+
)->link(
33+
text = 'Source_Code'
34+
href = z2ui5_cl_demo_utility=>factory( client )->app_get_url_source_code( )
35+
target = '_blank'
36+
)->get_parent(
37+
)->simple_form( title = 'Form Title' editable = abap_true
38+
)->content( 'form'
39+
)->label( 'favicon'
40+
)->input( client->_bind_edit( favicon )
41+
).
42+
43+
client->view_display( tmp->stringify( ) ).
44+
45+
ENDMETHOD.
46+
47+
48+
METHOD z2ui5_if_app~main.
49+
50+
me->client = client.
51+
52+
IF check_initialized = abap_false.
53+
check_initialized = abap_true.
54+
favicon = `https://cdn.jsdelivr.net/gh/choper725/resources/123/abap2ui5.png`.
55+
56+
display_view( ).
57+
58+
ENDIF.
59+
60+
CASE client->get( )-event.
61+
62+
WHEN 'SET_VIEW'.
63+
display_view( ).
64+
65+
WHEN 'BACK'.
66+
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
67+
68+
ENDCASE.
69+
70+
ENDMETHOD.
71+
ENDCLASS.

src/z2ui5_cl_demo_app_171.clas.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<VSEOCLASS>
6+
<CLSNAME>Z2UI5_CL_DEMO_APP_171</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>basic - favicon</DESCRIPT>
9+
<STATE>1</STATE>
10+
<CLSCCINCL>X</CLSCCINCL>
11+
<FIXPT>X</FIXPT>
12+
<UNICODE>X</UNICODE>
13+
</VSEOCLASS>
14+
</asx:values>
15+
</asx:abap>
16+
</abapGit>

0 commit comments

Comments
 (0)