Skip to content

Commit 6235bd0

Browse files
New Sample: Numeric Content of Different Colors (#309)
1 parent 5608f9a commit 6235bd0

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

src/z2ui5_cl_demo_app_000.clas.abap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,14 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
607607
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
608608
).
609609

610+
panel->generic_tile(
611+
header = 'Tile'
612+
subheader = 'Numeric Content of Different Colors'
613+
press = client->_event( 'Z2UI5_CL_DEMO_APP_262' )
614+
mode = 'LineMode'
615+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
616+
).
617+
610618
page = page2->panel(
611619
expandable = abap_true
612620
expanded = client->_bind_edit( ms_check_expanded-more )
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
class z2ui5_cl_demo_app_262 definition
2+
public
3+
create public .
4+
5+
public section.
6+
7+
interfaces Z2UI5_IF_APP .
8+
9+
data CHECK_INITIALIZED type ABAP_BOOL .
10+
PROTECTED SECTION.
11+
12+
DATA client TYPE REF TO z2ui5_if_client.
13+
14+
METHODS display_view
15+
IMPORTING
16+
client TYPE REF TO z2ui5_if_client.
17+
METHODS on_event
18+
IMPORTING
19+
client TYPE REF TO z2ui5_if_client.
20+
METHODS z2ui5_display_popover
21+
IMPORTING
22+
id TYPE string.
23+
24+
PRIVATE SECTION.
25+
ENDCLASS.
26+
27+
28+
29+
CLASS z2ui5_cl_demo_app_262 IMPLEMENTATION.
30+
31+
32+
METHOD DISPLAY_VIEW.
33+
34+
DATA(page) = z2ui5_cl_xml_view=>factory( )->shell(
35+
)->page(
36+
title = 'abap2UI5 - Sample: Numeric Content of Different Colors'
37+
navbuttonpress = client->_event( 'BACK' )
38+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
39+
40+
page->header_content(
41+
)->button( id = `hint_icon`
42+
icon = `sap-icon://hint`
43+
tooltip = `Sample information`
44+
press = client->_event( 'POPOVER' ) ).
45+
46+
page->header_content(
47+
)->link(
48+
text = 'UI5 Demo Kit'
49+
target = '_blank'
50+
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.NumericContent/sample/sap.m.sample.NumericContentDifColors' ).
51+
52+
page->numeric_content( value = `888.8` scale = `MM` class = `sapUiSmallMargin`
53+
press = client->_event( 'press' ) truncatevalueto = `4` ).
54+
page->numeric_content( value = `65.5` scale = `MM`
55+
valueColor = `Good` indicator = `Up` class = `sapUiSmallMargin`
56+
press = client->_event( 'press' ) ).
57+
page->numeric_content( value = `6666` scale = `MM`
58+
valueColor = `Critical` indicator = `Up` class = `sapUiSmallMargin`
59+
press = client->_event( 'press' ) ).
60+
page->numeric_content( value = `65.5` scale = `MMill`
61+
valueColor = `Error` indicator = `Down` class = `sapUiSmallMargin`
62+
press = client->_event( 'press' ) ).
63+
page->generic_tile( class = `sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout` header = `Country-Specific Profit Margin` subheader = `Expenses` press = client->_event( 'press' )
64+
)->tile_content( unit = `EUR` footer = `Current Quarter`
65+
)->numeric_content( scale = `M` value = `1.96` valueColor = `Error` indicator = `Up` withMargin = abap_false ).
66+
67+
client->view_display( page->stringify( ) ).
68+
69+
ENDMETHOD.
70+
71+
72+
METHOD ON_EVENT.
73+
74+
CASE client->get( )-event.
75+
WHEN 'BACK'.
76+
client->nav_app_leave( ).
77+
WHEN 'press'.
78+
client->message_toast_display( `The numeric content is pressed.` ).
79+
WHEN 'POPOVER'.
80+
z2ui5_display_popover( `hint_icon` ).
81+
ENDCASE.
82+
83+
ENDMETHOD.
84+
85+
86+
METHOD Z2UI5_DISPLAY_POPOVER.
87+
88+
DATA(view) = z2ui5_cl_xml_view=>factory_popup( ).
89+
view->quick_view( placement = `Bottom` width = `auto`
90+
)->quick_view_page( pageid = `sampleInformationId`
91+
header = `Sample information`
92+
description = `Shows NumericContent including numbers, units of measurement, and status arrows indicating a trend. ` &&
93+
`The numbers can be colored according to their meaning.` ).
94+
95+
client->popover_display(
96+
xml = view->stringify( )
97+
by_id = id
98+
).
99+
100+
ENDMETHOD.
101+
102+
103+
METHOD Z2UI5_IF_APP~MAIN.
104+
105+
me->client = client.
106+
107+
IF check_initialized = abap_false.
108+
check_initialized = abap_true.
109+
display_view( client ).
110+
ENDIF.
111+
112+
on_event( client ).
113+
114+
ENDMETHOD.
115+
ENDCLASS.

src/z2ui5_cl_demo_app_262.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_262</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Numeric Content of Different Colors</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)