Skip to content

Commit 7bf5485

Browse files
committed
update demo popup layout
1 parent e0f056a commit 7bf5485

File tree

4 files changed

+169
-1
lines changed

4 files changed

+169
-1
lines changed

src/z2ui5_cl_demo_app_000.clas.abap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,15 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
483483
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
484484
).
485485

486+
panel->generic_tile(
487+
header = 'Popup Display Layout'
488+
subheader = ''
489+
press = client->_event( 'z2ui5_cl_demo_app_165' )
490+
mode = 'LineMode'
491+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
492+
).
493+
494+
486495
panel = page->panel(
487496
expandable = abap_false
488497
expanded = abap_true

src/z2ui5_cl_demo_app_164.clas.abap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ CLASS z2ui5_cl_demo_app_164 IMPLEMENTATION.
6666
DATA(view) = z2ui5_cl_xml_view=>factory( ).
6767

6868
view = view->shell( )->page( id = `page_main`
69-
title = 'abap2UI5 - Select-Options'
69+
title = 'abap2UI5 - Popup Display Table'
7070
navbuttonpress = client->_event( 'BACK' )
7171
shownavbutton = abap_true
7272
)->header_content(
@@ -110,6 +110,7 @@ CLASS z2ui5_cl_demo_app_164 IMPLEMENTATION.
110110

111111
IF mv_check_initialized = abap_false.
112112
mv_check_initialized = abap_true.
113+
set_data( ).
113114
view_display( ).
114115
RETURN.
115116
ENDIF.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
CLASS z2ui5_cl_demo_app_165 DEFINITION PUBLIC.
2+
3+
PUBLIC SECTION.
4+
5+
INTERFACES z2ui5_if_app.
6+
7+
TYPES:
8+
BEGIN OF ty_s_tab,
9+
selkz TYPE abap_bool,
10+
product TYPE string,
11+
create_date TYPE string,
12+
create_by TYPE string,
13+
storage_location TYPE string,
14+
quantity TYPE i,
15+
END OF ty_s_tab.
16+
TYPES ty_t_table TYPE STANDARD TABLE OF ty_s_tab WITH EMPTY KEY.
17+
18+
DATA mt_table TYPE ty_t_table.
19+
DATA mt_layout TYPE z2ui5_cl_popup_layout=>ty_t_layout.
20+
21+
PROTECTED SECTION.
22+
DATA client TYPE REF TO z2ui5_if_client.
23+
DATA mv_check_initialized TYPE abap_bool.
24+
METHODS on_event.
25+
METHODS view_display.
26+
METHODS set_data.
27+
28+
PRIVATE SECTION.
29+
30+
ENDCLASS.
31+
32+
33+
34+
CLASS z2ui5_cl_demo_app_165 IMPLEMENTATION.
35+
36+
37+
METHOD on_event.
38+
39+
CASE client->get( )-event.
40+
41+
WHEN `BUTTON_START`.
42+
client->nav_app_call( z2ui5_cl_popup_layout=>factory( i_tab = mt_table t_layout = mt_layout ) ).
43+
44+
WHEN 'BACK'.
45+
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
46+
ENDCASE.
47+
48+
ENDMETHOD.
49+
50+
51+
METHOD set_data.
52+
53+
"replace this with a db select here...
54+
mt_table = VALUE #(
55+
( product = 'table' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
56+
( product = 'chair' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
57+
( product = 'sofa' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
58+
( product = 'sofa' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
59+
( product = 'sofa' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
60+
( product = 'computer' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
61+
( product = 'oven' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
62+
( product = 'table2' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
63+
).
64+
65+
ENDMETHOD.
66+
67+
68+
METHOD view_display.
69+
70+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
71+
72+
view = view->shell( )->page( id = `page_main`
73+
title = 'abap2UI5 - Popup Layout'
74+
navbuttonpress = client->_event( 'BACK' )
75+
shownavbutton = abap_true
76+
)->header_content(
77+
)->link(
78+
text = 'Source_Code' target = '_blank' href = z2ui5_cl_demo_utility=>factory( client )->app_get_url_source_code( )
79+
)->get_parent( ).
80+
81+
DATA(vbox) = view->vbox( ).
82+
83+
DATA(tab) = vbox->table(
84+
items = client->_bind( val = mt_table )
85+
)->header_toolbar(
86+
)->overflow_toolbar(
87+
)->toolbar_spacer(
88+
)->button( text = `Popup Layout` press = client->_event( `BUTTON_START` ) type = `Emphasized`
89+
)->get_parent( )->get_parent( ).
90+
91+
DATA(lo_columns) = tab->columns( ).
92+
LOOP AT mt_layout REFERENCE INTO DATA(lr_layout).
93+
DATA(lv_index) = sy-tabix.
94+
95+
DATA(lo_col) = lo_columns->column(
96+
visible = client->_bind( val = lr_layout->visible tab = mt_layout tab_index = lv_index )
97+
mergeduplicates = client->_bind( val = lr_layout->mergeduplicates tab = mt_layout tab_index = lv_index ) ).
98+
99+
lo_col->text( text = lr_layout->name ).
100+
101+
ENDLOOP.
102+
103+
DATA(lo_cells) = tab->items( )->column_list_item( ).
104+
LOOP AT mt_layout REFERENCE INTO lr_layout.
105+
lo_cells->text( `{` && lr_layout->name && `}` ).
106+
ENDLOOP.
107+
108+
client->view_display( view->stringify( ) ).
109+
110+
ENDMETHOD.
111+
112+
113+
METHOD z2ui5_if_app~main.
114+
115+
me->client = client.
116+
117+
IF mv_check_initialized = abap_false.
118+
mv_check_initialized = abap_true.
119+
mt_layout = z2ui5_cl_popup_layout=>factory( i_tab = mt_table )->ms_result-t_layout.
120+
set_data( ).
121+
view_display( ).
122+
RETURN.
123+
ENDIF.
124+
125+
IF client->get( )-check_on_navigated = abap_true.
126+
TRY.
127+
DATA(lo_popup_layout) = CAST z2ui5_cl_popup_layout( client->get_app( client->get( )-s_draft-id_prev_app ) ).
128+
mt_layout = lo_popup_layout->result( )-t_layout.
129+
client->view_model_update( ).
130+
CATCH cx_root.
131+
ENDTRY.
132+
RETURN.
133+
ENDIF.
134+
135+
IF client->get( )-event IS NOT INITIAL.
136+
on_event( ).
137+
ENDIF.
138+
139+
ENDMETHOD.
140+
141+
142+
ENDCLASS.

src/z2ui5_cl_demo_app_165.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_165</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>popup - popup layout</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)