Skip to content

Commit 54b6a6a

Browse files
New Sample: Select - Wrapping text (#400)
1 parent 42c917f commit 54b6a6a

File tree

4 files changed

+177
-1
lines changed

4 files changed

+177
-1
lines changed

src/z2ui5_cl_demo_app_000.clas.abap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,14 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
773773
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
774774
).
775775

776+
panel->generic_tile(
777+
header = 'Select'
778+
subheader = 'Wrapping text'
779+
press = client->_event( 'Z2UI5_CL_DEMO_APP_299' )
780+
mode = 'LineMode'
781+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
782+
).
783+
776784
panel = page->panel(
777785
expandable = abap_false
778786
expanded = abap_true

src/z2ui5_cl_demo_app_298.clas.abap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ CLASS z2ui5_cl_demo_app_298 IMPLEMENTATION.
6060
)->link(
6161
text = 'UI5 Demo Kit'
6262
target = '_blank'
63-
href = 'https://openui5.hana.ondemand.com/entity/sap.m.Select/sample/sap.m.sample.SelectValueState' ).
63+
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.Select/sample/sap.m.sample.SelectValueState' ).
6464

6565
page_01->page( showheader = abap_false
6666
)->content(

src/z2ui5_cl_demo_app_299.clas.abap

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
CLASS z2ui5_cl_demo_app_299 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 lt_product_collection TYPE TABLE OF ty_product_collection.
17+
DATA lt_product_collection2 TYPE TABLE OF ty_product_collection.
18+
19+
PROTECTED SECTION.
20+
21+
DATA client TYPE REF TO z2ui5_if_client.
22+
23+
METHODS z2ui5_set_data.
24+
METHODS display_view
25+
IMPORTING
26+
client TYPE REF TO z2ui5_if_client.
27+
METHODS on_event
28+
IMPORTING
29+
client TYPE REF TO z2ui5_if_client.
30+
METHODS z2ui5_display_popover
31+
IMPORTING
32+
id TYPE string.
33+
34+
PRIVATE SECTION.
35+
ENDCLASS.
36+
37+
38+
39+
CLASS z2ui5_cl_demo_app_299 IMPLEMENTATION.
40+
41+
42+
METHOD display_view.
43+
44+
DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell(
45+
)->page(
46+
title = `abap2UI5 - Sample: Select - Wrapping text`
47+
navbuttonpress = client->_event( 'BACK' )
48+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
49+
50+
page_01->header_content(
51+
)->button( id = `button_hint_id`
52+
icon = `sap-icon://hint`
53+
tooltip = `Sample information`
54+
press = client->_event( 'CLICK_HINT_ICON' ) ).
55+
56+
page_01->header_content(
57+
)->link(
58+
text = 'UI5 Demo Kit'
59+
target = '_blank'
60+
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.Select/sample/sap.m.sample.SelectWithWrappedItemText' ).
61+
62+
page_01->select(
63+
width = `300px`
64+
wrapitemstext = abap_true
65+
class = `sapUiLargeMargin`
66+
items = client->_bind( lt_product_collection )
67+
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
68+
)->get_parent(
69+
)->select(
70+
width = `300px`
71+
wrapitemstext = abap_true
72+
class = `sapUiLargeMargin`
73+
items = client->_bind( lt_product_collection2 )
74+
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
75+
)->get_parent(
76+
).
77+
78+
client->view_display( page_01->stringify( ) ).
79+
80+
ENDMETHOD.
81+
82+
83+
METHOD on_event.
84+
85+
CASE client->get( )-event.
86+
WHEN 'BACK'.
87+
client->nav_app_leave( ).
88+
WHEN 'CLICK_HINT_ICON'.
89+
z2ui5_display_popover( `button_hint_id` ).
90+
ENDCASE.
91+
92+
ENDMETHOD.
93+
94+
95+
METHOD z2ui5_display_popover.
96+
97+
DATA(view) = z2ui5_cl_xml_view=>factory_popup( ).
98+
view->quick_view( placement = `Bottom` width = `auto`
99+
)->quick_view_page( pageid = `sampleInformationId`
100+
header = `Sample information`
101+
description = `Illustrates how the text in items wrap.` ).
102+
103+
client->popover_display(
104+
xml = view->stringify( )
105+
by_id = id
106+
).
107+
108+
ENDMETHOD.
109+
110+
111+
METHOD z2ui5_if_app~main.
112+
113+
me->client = client.
114+
115+
IF check_initialized = abap_false.
116+
check_initialized = abap_true.
117+
display_view( client ).
118+
z2ui5_set_data( ).
119+
ENDIF.
120+
121+
on_event( client ).
122+
123+
ENDMETHOD.
124+
125+
126+
METHOD z2ui5_set_data.
127+
128+
CLEAR lt_product_collection.
129+
CLEAR lt_Product_collection2.
130+
131+
" Populating lt_product_collection
132+
lt_product_collection = VALUE #(
133+
( product_id = 'HT-1001' Name = 'Select option 1' )
134+
( product_id = 'HT-1002' Name = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.' )
135+
( product_id = 'HT-1003' Name = 'Select option 3' )
136+
( product_id = 'HT-1007' Name = 'Select option 4' )
137+
( product_id = 'HT-1010' Name = 'Select option 5' )
138+
).
139+
SORT lt_product_collection BY name.
140+
141+
" Populating lt_product_collection2
142+
lt_Product_collection2 = VALUE #(
143+
( product_id = 'key1' Name = 'Select option 1' )
144+
( product_id = 'key2' Name = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.' )
145+
( product_id = 'key3' Name = 'Select option 3' )
146+
( product_id = 'key4' Name = 'Select option 4' )
147+
( product_id = 'key5' Name = 'Select option 5' )
148+
).
149+
SORT lt_Product_collection2 BY name.
150+
151+
ENDMETHOD.
152+
ENDCLASS.

src/z2ui5_cl_demo_app_299.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_299</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Select - Wrapping text</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)