Skip to content

Commit 4b6d6f8

Browse files
New Sample: Select (#379)
1 parent af695f4 commit 4b6d6f8

3 files changed

+213
-0
lines changed

Diff for: src/z2ui5_cl_demo_app_000.clas.abap

+6
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,12 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
721721
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
722722
).
723723

724+
panel->generic_tile(
725+
header = 'Select'
726+
press = client->_event( 'Z2UI5_CL_DEMO_APP_288' )
727+
mode = 'LineMode'
728+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
729+
).
724730

725731
panel = page->panel(
726732
expandable = abap_false

Diff for: src/z2ui5_cl_demo_app_288.clas.abap

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
CLASS z2ui5_cl_demo_app_288 DEFINITION
2+
PUBLIC
3+
CREATE PUBLIC.
4+
5+
PUBLIC SECTION.
6+
7+
INTERFACES z2ui5_if_app .
8+
9+
TYPES:
10+
BEGIN OF ty_product_collection,
11+
product_id TYPE string,
12+
name TYPE string,
13+
END OF ty_product_collection .
14+
15+
DATA check_initialized TYPE abap_bool.
16+
DATA editable TYPE abap_bool.
17+
DATA enabled TYPE abap_bool.
18+
DATA lt_product_collection TYPE TABLE OF ty_product_collection.
19+
DATA lt_product_collection2 TYPE TABLE OF ty_product_collection.
20+
DATA lt_product_collection3 TYPE TABLE OF ty_product_collection.
21+
DATA selected_product TYPE string.
22+
DATA selected_product2 TYPE string.
23+
DATA selected_product3 TYPE string.
24+
25+
PROTECTED SECTION.
26+
27+
DATA client TYPE REF TO z2ui5_if_client.
28+
29+
METHODS display_view
30+
IMPORTING
31+
client TYPE REF TO z2ui5_if_client.
32+
METHODS on_event
33+
IMPORTING
34+
client TYPE REF TO z2ui5_if_client.
35+
METHODS z2ui5_display_popover
36+
IMPORTING
37+
id TYPE string.
38+
39+
PRIVATE SECTION.
40+
ENDCLASS.
41+
42+
43+
44+
CLASS z2ui5_cl_demo_app_288 IMPLEMENTATION.
45+
46+
47+
METHOD display_view.
48+
49+
DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell(
50+
)->page(
51+
title = `abap2UI5 - Sample: Select`
52+
navbuttonpress = client->_event( 'BACK' )
53+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
54+
55+
page_01->header_content(
56+
)->button( id = `button_hint_id`
57+
icon = `sap-icon://hint`
58+
tooltip = `Sample information`
59+
press = client->_event( 'CLICK_HINT_ICON' ) ).
60+
61+
page_01->header_content(
62+
)->link(
63+
text = 'UI5 Demo Kit'
64+
target = '_blank'
65+
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.Select/sample/sap.m.sample.Select' ).
66+
67+
DATA(page_02) = page_01->page(
68+
showheader = abap_false
69+
class = `sapUiContentPadding`
70+
)->sub_header(
71+
)->toolbar(
72+
)->toolbar_spacer(
73+
)->select(
74+
forceselection = abap_false
75+
selectedkey = client->_bind( selected_product )
76+
items = client->_bind( lt_product_collection )
77+
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
78+
)->get_parent(
79+
)->get_parent(
80+
)->get_parent(
81+
)->content(
82+
)->hbox( justifyContent = `SpaceAround`
83+
)->select(
84+
enabled = client->_bind( enabled )
85+
editable = client->_bind( editable )
86+
forceselection = abap_false
87+
selectedkey = client->_bind( selected_product2 )
88+
items = client->_bind( lt_product_collection2 )
89+
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
90+
)->get_parent(
91+
)->vbox(
92+
)->hbox( alignitems = `Center`
93+
)->label( text = `Enabled:` class = `sapUiTinyMarginEnd`
94+
)->switch( type = `AcceptReject` state = client->_bind( enabled )
95+
)->get_parent(
96+
)->hbox( alignitems = `Center`
97+
)->label( text = `Editable:` class = `sapUiTinyMarginEnd`
98+
)->switch( type = `AcceptReject` state = client->_bind( editable )
99+
)->get_parent(
100+
)->get_parent(
101+
)->get_parent(
102+
)->get_parent(
103+
)->footer(
104+
)->toolbar(
105+
)->toolbar_spacer(
106+
)->select(
107+
forceselection = abap_false
108+
selectedkey = client->_bind( selected_product3 )
109+
type = `IconOnly`
110+
icon = `sap-icon://filter`
111+
autoadjustwidth = abap_true
112+
items = client->_bind( lt_product_collection3 )
113+
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
114+
).
115+
116+
client->view_display( page_02->stringify( ) ).
117+
118+
ENDMETHOD.
119+
120+
121+
METHOD on_event.
122+
123+
CASE client->get( )-event.
124+
WHEN 'BACK'.
125+
client->nav_app_leave( ).
126+
WHEN 'CLICK_HINT_ICON'.
127+
z2ui5_display_popover( `button_hint_id` ).
128+
ENDCASE.
129+
130+
ENDMETHOD.
131+
132+
133+
METHOD z2ui5_display_popover.
134+
135+
DATA(view) = z2ui5_cl_xml_view=>factory_popup( ).
136+
view->quick_view( placement = `Bottom` width = `auto`
137+
)->quick_view_page( pageid = `sampleInformationId`
138+
header = `Sample information`
139+
description = `Illustrates the usage of a Select in header, footer and content of a page. Note the different display options.` ).
140+
141+
client->popover_display(
142+
xml = view->stringify( )
143+
by_id = id
144+
).
145+
146+
ENDMETHOD.
147+
148+
149+
METHOD z2ui5_if_app~main.
150+
151+
me->client = client.
152+
153+
IF check_initialized = abap_false.
154+
check_initialized = abap_true.
155+
display_view( client ).
156+
157+
selected_product = `HT-1001`.
158+
selected_product2 = `HT-1001`.
159+
selected_product3 = `HT-1001`.
160+
161+
" Populate the internal tables
162+
lt_product_collection = VALUE #( ( product_id = 'HT-1000' name = 'Notebook Basic 15' )
163+
( product_id = 'HT-1001' name = 'Notebook Basic 17' )
164+
( product_id = 'HT-1002' name = 'Notebook Basic 18' )
165+
( product_id = 'HT-1003' name = 'Notebook Basic 19' )
166+
( product_id = 'HT-1007' name = 'ITelO Vault' ) ).
167+
SORT lt_product_collection BY name.
168+
169+
lt_product_collection2 = VALUE #( ( product_id = 'HT-1000' name = 'Notebook Basic 15' )
170+
( product_id = 'HT-1001' name = 'Notebook Basic 17' )
171+
( product_id = 'HT-1002' name = 'Notebook Basic 18' )
172+
( product_id = 'HT-1003' name = 'Notebook Basic 19' )
173+
( product_id = 'HT-1007' name = 'ITelO Vault' ) ).
174+
SORT lt_product_collection2 BY name.
175+
176+
lt_product_collection3 = VALUE #( ( product_id = 'HT-1000' name = 'Notebook Basic 15' )
177+
( product_id = 'HT-1001' name = 'Notebook Basic 17' )
178+
( product_id = 'HT-1002' name = 'Notebook Basic 18' )
179+
( product_id = 'HT-1003' name = 'Notebook Basic 19' )
180+
( product_id = 'HT-1007' name = 'ITelO Vault' ) ).
181+
SORT lt_product_collection3 BY name.
182+
183+
editable = abap_true.
184+
enabled = abap_true.
185+
186+
ENDIF.
187+
188+
on_event( client ).
189+
190+
ENDMETHOD.
191+
ENDCLASS.

Diff for: src/z2ui5_cl_demo_app_288.clas.xml

+16
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_288</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Select</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)