Skip to content

Commit

Permalink
New Sample: Select - Wrapping text (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-milan authored Oct 8, 2024
1 parent 42c917f commit 54b6a6a
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/z2ui5_cl_demo_app_000.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,14 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
).

panel->generic_tile(
header = 'Select'
subheader = 'Wrapping text'
press = client->_event( 'Z2UI5_CL_DEMO_APP_299' )
mode = 'LineMode'
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
).

panel = page->panel(
expandable = abap_false
expanded = abap_true
Expand Down
2 changes: 1 addition & 1 deletion src/z2ui5_cl_demo_app_298.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CLASS z2ui5_cl_demo_app_298 IMPLEMENTATION.
)->link(
text = 'UI5 Demo Kit'
target = '_blank'
href = 'https://openui5.hana.ondemand.com/entity/sap.m.Select/sample/sap.m.sample.SelectValueState' ).
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.Select/sample/sap.m.sample.SelectValueState' ).

page_01->page( showheader = abap_false
)->content(
Expand Down
152 changes: 152 additions & 0 deletions src/z2ui5_cl_demo_app_299.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
CLASS z2ui5_cl_demo_app_299 DEFINITION
PUBLIC
CREATE PUBLIC.

PUBLIC SECTION.

INTERFACES z2ui5_if_app.

TYPES:
BEGIN OF ty_product_collection,
product_id TYPE string,
name TYPE string,
END OF ty_product_collection.

DATA check_initialized TYPE abap_bool.
DATA lt_product_collection TYPE TABLE OF ty_product_collection.
DATA lt_product_collection2 TYPE TABLE OF ty_product_collection.

PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client.

METHODS z2ui5_set_data.
METHODS display_view
IMPORTING
client TYPE REF TO z2ui5_if_client.
METHODS on_event
IMPORTING
client TYPE REF TO z2ui5_if_client.
METHODS z2ui5_display_popover
IMPORTING
id TYPE string.

PRIVATE SECTION.
ENDCLASS.



CLASS z2ui5_cl_demo_app_299 IMPLEMENTATION.


METHOD display_view.

DATA(page_01) = z2ui5_cl_xml_view=>factory( )->shell(
)->page(
title = `abap2UI5 - Sample: Select - Wrapping text`
navbuttonpress = client->_event( 'BACK' )
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).

page_01->header_content(
)->button( id = `button_hint_id`
icon = `sap-icon://hint`
tooltip = `Sample information`
press = client->_event( 'CLICK_HINT_ICON' ) ).

page_01->header_content(
)->link(
text = 'UI5 Demo Kit'
target = '_blank'
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.Select/sample/sap.m.sample.SelectWithWrappedItemText' ).

page_01->select(
width = `300px`
wrapitemstext = abap_true
class = `sapUiLargeMargin`
items = client->_bind( lt_product_collection )
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
)->get_parent(
)->select(
width = `300px`
wrapitemstext = abap_true
class = `sapUiLargeMargin`
items = client->_bind( lt_product_collection2 )
)->item( key = '{PRODUCT_ID}' text = '{NAME}'
)->get_parent(
).

client->view_display( page_01->stringify( ) ).

ENDMETHOD.


METHOD on_event.

CASE client->get( )-event.
WHEN 'BACK'.
client->nav_app_leave( ).
WHEN 'CLICK_HINT_ICON'.
z2ui5_display_popover( `button_hint_id` ).
ENDCASE.

ENDMETHOD.


METHOD z2ui5_display_popover.

DATA(view) = z2ui5_cl_xml_view=>factory_popup( ).
view->quick_view( placement = `Bottom` width = `auto`
)->quick_view_page( pageid = `sampleInformationId`
header = `Sample information`
description = `Illustrates how the text in items wrap.` ).

client->popover_display(
xml = view->stringify( )
by_id = id
).

ENDMETHOD.


METHOD z2ui5_if_app~main.

me->client = client.

IF check_initialized = abap_false.
check_initialized = abap_true.
display_view( client ).
z2ui5_set_data( ).
ENDIF.

on_event( client ).

ENDMETHOD.


METHOD z2ui5_set_data.

CLEAR lt_product_collection.
CLEAR lt_Product_collection2.

" Populating lt_product_collection
lt_product_collection = VALUE #(
( product_id = 'HT-1001' Name = 'Select option 1' )
( product_id = 'HT-1002' Name = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.' )
( product_id = 'HT-1003' Name = 'Select option 3' )
( product_id = 'HT-1007' Name = 'Select option 4' )
( product_id = 'HT-1010' Name = 'Select option 5' )
).
SORT lt_product_collection BY name.

" Populating lt_product_collection2
lt_Product_collection2 = VALUE #(
( product_id = 'key1' Name = 'Select option 1' )
( 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.' )
( product_id = 'key3' Name = 'Select option 3' )
( product_id = 'key4' Name = 'Select option 4' )
( product_id = 'key5' Name = 'Select option 5' )
).
SORT lt_Product_collection2 BY name.

ENDMETHOD.
ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_299.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_DEMO_APP_299</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Select - Wrapping text</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 54b6a6a

Please sign in to comment.