Skip to content

Commit e76af47

Browse files
authored
update
1 parent b3a6ad4 commit e76af47

20 files changed

+1199
-1
lines changed

src/01/package.devc.xml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<DEVC>
6+
<CTEXT>abap2UI5 - samples</CTEXT>
7+
</DEVC>
8+
</asx:values>
9+
</asx:abap>
10+
</abapGit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
CLASS z2ui5_cl_cc_sample_favicon DEFINITION PUBLIC.
2+
3+
PUBLIC SECTION.
4+
5+
INTERFACES z2ui5_if_app.
6+
7+
DATA favicon TYPE string.
8+
DATA check_initialized TYPE abap_bool.
9+
10+
PROTECTED SECTION.
11+
data client type ref to z2ui5_if_client.
12+
METHODS display_view.
13+
PRIVATE SECTION.
14+
ENDCLASS.
15+
16+
17+
18+
CLASS Z2UI5_CL_CC_SAMPLE_FAVICON IMPLEMENTATION.
19+
20+
21+
METHOD display_view.
22+
23+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
24+
25+
DATA(tmp) = view->_z2ui5( )->favicon( favicon = client->_bind_edit( favicon )
26+
)->shell(
27+
)->page(
28+
title = 'abap2UI5 - Change Tab Favicon'
29+
navbuttonpress = client->_event( val = 'BACK' )
30+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
31+
)->simple_form( title = 'Form Title' editable = abap_true
32+
)->content( 'form'
33+
)->label( 'favicon'
34+
)->input( client->_bind_edit( favicon )
35+
).
36+
37+
client->view_display( tmp->stringify( ) ).
38+
39+
ENDMETHOD.
40+
41+
42+
METHOD z2ui5_if_app~main.
43+
44+
me->client = client.
45+
46+
IF check_initialized = abap_false.
47+
check_initialized = abap_true.
48+
favicon = `https://cdn.jsdelivr.net/gh/abap2UI5/abap2UI5/resources/abap2ui5.png`.
49+
50+
display_view( ).
51+
52+
ENDIF.
53+
54+
CASE client->get( )-event.
55+
56+
WHEN 'SET_VIEW'.
57+
display_view( ).
58+
59+
WHEN 'BACK'.
60+
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
61+
62+
ENDCASE.
63+
64+
ENDMETHOD.
65+
ENDCLASS.
+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_CC_SAMPLE_FAVICON</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>basic - favicon</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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
CLASS z2ui5_cl_cc_sample_messaging DEFINITION
2+
PUBLIC
3+
CREATE PUBLIC .
4+
5+
PUBLIC SECTION.
6+
7+
INTERFACES z2ui5_if_app .
8+
9+
"string - constraints
10+
DATA: mv_maxlength_string TYPE string,
11+
mv_minlength_string TYPE string,
12+
mv_startswith_string TYPE string,
13+
mv_startswithignorecase_string TYPE string,
14+
mv_endswith_string TYPE string,
15+
mv_endswithignorecase_string TYPE string,
16+
mv_contains_string TYPE string,
17+
mv_equals_string TYPE string,
18+
mv_search_string TYPE string.
19+
20+
21+
"boolean
22+
DATA: mv_boolean TYPE abap_bool.
23+
DATA mt_messaging TYPE z2ui5_cl_cc_messaging=>ty_t_items.
24+
25+
DATA: mv_messages_count TYPE i.
26+
27+
28+
DATA check_initialized TYPE abap_bool .
29+
30+
METHODS z2ui5_display_view .
31+
METHODS z2ui5_display_popover
32+
IMPORTING
33+
!id TYPE string .
34+
PROTECTED SECTION.
35+
36+
DATA client TYPE REF TO z2ui5_if_client.
37+
38+
PRIVATE SECTION.
39+
ENDCLASS.
40+
41+
42+
43+
CLASS z2ui5_cl_cc_sample_messaging IMPLEMENTATION.
44+
45+
46+
METHOD z2ui5_display_popover.
47+
48+
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ).
49+
50+
popup = popup->message_popover(
51+
placement = `Top`
52+
items = client->_bind_edit( mt_messaging )
53+
groupitems = abap_true
54+
afterclose = client->_event( `POPOVER_CLOSE` )
55+
)->message_item(
56+
type = `{TYPE}`
57+
title = `{MESSAGE}`
58+
subtitle = `{MESSAGE}`
59+
description = `{DESCRIPTION}`
60+
groupname = `{GROUP}` ).
61+
62+
client->popover_display( xml = popup->stringify( ) by_id = id ).
63+
64+
ENDMETHOD.
65+
66+
67+
METHOD z2ui5_display_view.
68+
69+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
70+
71+
DATA(page) = view->_z2ui5( )->messaging( client->_bind_edit( mt_messaging )
72+
)->shell(
73+
)->page( class = `sapUiContentPadding `
74+
title = 'abap2UI5 - Messaging'
75+
navbuttonpress = client->_event( val = 'BACK' )
76+
shownavbutton = abap_true
77+
)->header_content(
78+
)->link(
79+
text = 'Demo' target = '_blank'
80+
href = `https://twitter.com/abap2UI5/status/1647246029828268032`
81+
)->link(
82+
83+
84+
)->get_parent( ).
85+
86+
"string
87+
page->flex_box( justifycontent = `SpaceAround` )->panel( headertext = `sap.ui.model.type.String`
88+
)->vbox(
89+
)->title( text = `CONSTRAINTS` level = `H3`
90+
)->vbox(
91+
)->hbox( class = `sapUiTinyMarginTopBottom` alignitems = `Center`
92+
)->label( text = `maxLength (5)`
93+
)->input( id = `testINPUT` value = `{path:'` && client->_bind_edit( val = mv_maxlength_string path = abap_true ) && `',type: 'sap.ui.model.type.String', constraints:{ maxLength: 5 } }`
94+
editable = abap_true
95+
class = `sapUiTinyMarginBeginEnd` )->get_parent(
96+
97+
)->hbox( class = `sapUiTinyMarginTopBottom` alignitems = `Center`
98+
)->label( text = `minLength (3)`
99+
)->input( value = `{path:'` && client->_bind_edit( val = mv_minlength_string path = abap_true ) && `',type: 'sap.ui.model.type.String', constraints:{ minLength: 3 } }`
100+
editable = abap_true
101+
class = `sapUiTinyMarginBeginEnd` )->get_parent(
102+
103+
)->hbox( class = `sapUiTinyMarginTopBottom` alignitems = `Center`
104+
)->label( text = `startsWith (a2ui5)`
105+
)->input( value = `{path:'` && client->_bind_edit( val = mv_startswith_string path = abap_true ) && `',type: 'sap.ui.model.type.String', constraints:{ startsWith: 'a2ui5' } }`
106+
editable = abap_true
107+
class = `sapUiTinyMarginBeginEnd` ).
108+
109+
page->footer( )->overflow_toolbar(
110+
)->button(
111+
id = 'test'
112+
* text = 'Messages'
113+
icon = 'sap-icon://message-popup'
114+
press = client->_event( 'POPOVER' )
115+
type = 'Default'
116+
* class = `sapUiSizeCozy`
117+
)->get( )->custom_data(
118+
)->badge_custom_data(
119+
value = '{= ${' && client->_bind_edit( val = mt_messaging path = abap_true ) && '}.length}'
120+
* value = client->_bind_edit( mv_messages_count )
121+
visible = abap_true
122+
key = 'badge' )->get_parent( )->get_parent(
123+
)->toolbar_spacer(
124+
)->button(
125+
text = 'REMOVE_MSG'
126+
press = client->_event( 'REMOVE_MSG' )
127+
type = 'Success'
128+
)->button(
129+
text = 'ADD_MSG'
130+
press = client->_event( 'ADD_MSG' )
131+
type = 'Success'
132+
)->button(
133+
text = 'Send to Server'
134+
press = client->_event( 'BUTTON_SEND' )
135+
type = 'Success' ).
136+
137+
client->view_display( view->stringify( ) ).
138+
139+
ENDMETHOD.
140+
141+
142+
METHOD z2ui5_if_app~main.
143+
144+
me->client = client.
145+
146+
IF check_initialized = abap_false.
147+
check_initialized = abap_true.
148+
149+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
150+
client->view_display(
151+
view->_generic( ns = `html` name = `script` )->_cc_plain_xml( z2ui5_cl_cc_messaging=>get_js( )
152+
)->_z2ui5( )->timer( client->_event( `ON_CC_LOADED` )
153+
)->stringify( ) ).
154+
RETURN.
155+
156+
ENDIF.
157+
158+
CASE client->get( )-event.
159+
160+
WHEN `ON_CC_LOADED`.
161+
z2ui5_display_view( ).
162+
163+
WHEN `REMOVE_MSG`.
164+
CLEAR mt_messaging.
165+
z2ui5_display_view( ).
166+
client->view_model_update( ).
167+
168+
WHEN `ADD_MSG`.
169+
INSERT VALUE #(
170+
message = `this is a message`
171+
type = `Error`
172+
target = `testINPUT/value`
173+
) INTO TABLE mt_messaging.
174+
client->view_model_update( ).
175+
176+
WHEN 'POPOVER_CLOSE'.
177+
client->message_toast_display( `POPOVER_CLOSE` ).
178+
179+
WHEN 'BUTTON_SEND'.
180+
DATA(lv_string) = `mt_messaging is filled with data`.
181+
182+
WHEN 'POPOVER'.
183+
z2ui5_display_popover( `test` ).
184+
185+
WHEN 'BACK'.
186+
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
187+
ENDCASE.
188+
189+
ENDMETHOD.
190+
ENDCLASS.
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_CC_SAMPLE_MESSAGING</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>basic - messaging</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)