Skip to content

Commit 8f607f0

Browse files
Refactoring Demo 283 and Demo 266 (#386)
* Refactoring Demo 283 * Refactoring Demo 266 * Refactor Demo 266 (2)
1 parent 04aa74c commit 8f607f0

File tree

2 files changed

+70
-62
lines changed

2 files changed

+70
-62
lines changed

src/z2ui5_cl_demo_app_266.clas.abap

Lines changed: 60 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ CLASS z2ui5_cl_demo_app_266 DEFINITION
22
PUBLIC
33
CREATE PUBLIC.
44

5-
PUBLIC SECTION.
5+
PUBLIC SECTION.
66

7-
INTERFACES z2ui5_if_app.
7+
INTERFACES z2ui5_if_app.
8+
9+
DATA check_initialized TYPE abap_bool.
810

9-
DATA check_initialized TYPE abap_bool.
1011
PROTECTED SECTION.
1112

1213
DATA client TYPE REF TO z2ui5_if_client.
@@ -49,57 +50,57 @@ CLASS z2ui5_cl_demo_app_266 IMPLEMENTATION.
4950
target = '_blank'
5051
href = 'https://sapui5.hana.ondemand.com/#/entity/sap.m.ToggleButton/sample/sap.m.sample.ToggleButton' ).
5152

52-
page_01->_generic_property( VALUE #( n = `core:require` v = `{ MessageToast: 'sap/m/MessageToast' }` ) ).
53-
5453
DATA(page_02) = page_01->page(
55-
title = `Page`
56-
class = `sapUiContentPadding`
57-
)->custom_header(
58-
)->bar(
59-
)->content_middle(
60-
)->title( level = `H2` text = `Title` )->get_parent(
61-
)->content_right(
62-
)->toggle_button( icon = `sap-icon://edit`
63-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
64-
)->get_parent( )->get_parent( )->get_parent(
65-
66-
67-
)->sub_header(
68-
)->bar(
69-
)->content_left(
70-
)->toggle_button( text = `Pressed` enabled = abap_true pressed = abap_true
71-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
72-
)->toggle_button( text = `Pressed & Disabled` enabled = abap_false pressed = abap_true
73-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
74-
)->get_parent(
75-
)->content_right(
76-
)->toggle_button( icon = `sap-icon://action`
77-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
78-
)->toggle_button( icon = `sap-icon://home` enabled = abap_false
79-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
80-
)->get_parent( )->get_parent( )->get_parent(
81-
)->hbox(
82-
)->toggle_button( text = `Disabled` enabled = `false`
83-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')` )->get(
84-
)->layout_data(
85-
)->flex_item_data( growfactor = `1` )->get_parent( )->get_parent(
86-
)->toggle_button( text = `Pressed` enabled = abap_true pressed = abap_true
87-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')` )->get(
88-
)->layout_data(
89-
)->flex_item_data( growfactor = `1` )->get_parent( )->get_parent(
90-
)->toggle_button( icon = `sap-icon://action` enabled = abap_true pressed = abap_true
91-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')` )->get(
92-
)->layout_data(
93-
)->flex_item_data( growfactor = `1` )->get_parent( )->get_parent( )->get_parent(
94-
)->footer(
54+
title = `Page`
55+
class = `sapUiContentPadding`
56+
)->custom_header(
9557
)->bar(
58+
)->content_middle(
59+
)->title( level = `H2` text = `Title`
60+
)->get_parent(
9661
)->content_right(
97-
)->toggle_button( text = `Pressed & Disabled` enabled = abap_false pressed = abap_true
98-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
99-
)->toggle_button( icon = `sap-icon://action`
100-
press = `MessageToast.show(${$source>/pressed} ? ${$source>/id} + ' Pressed' : ${$source>/id} + ' Unpressed')`
101-
).
102-
62+
)->toggle_button( icon = `sap-icon://edit` press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
63+
)->get_parent(
64+
)->get_parent(
65+
)->get_parent(
66+
)->sub_header(
67+
)->bar(
68+
)->content_left(
69+
)->toggle_button( text = `Pressed` enabled = abap_true pressed = abap_true press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
70+
)->toggle_button( text = `Pressed & Disabled` enabled = abap_false pressed = abap_true press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
71+
)->get_parent(
72+
)->content_right(
73+
)->toggle_button( icon = `sap-icon://action` press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
74+
)->toggle_button( icon = `sap-icon://home` enabled = abap_false press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
75+
)->get_parent(
76+
)->get_parent(
77+
)->get_parent(
78+
)->hbox(
79+
)->toggle_button( text = `Disabled` enabled = `false` press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) ) )->get(
80+
)->layout_data(
81+
)->flex_item_data( growfactor = `1`
82+
)->get_parent(
83+
)->get_parent(
84+
)->toggle_button( text = `Pressed` enabled = abap_true pressed = abap_true press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) ) )->get(
85+
)->layout_data(
86+
)->flex_item_data( growfactor = `1`
87+
)->get_parent(
88+
)->get_parent(
89+
)->toggle_button( icon = `sap-icon://action` enabled = abap_true pressed = abap_true press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) ) )->get(
90+
)->layout_data(
91+
)->flex_item_data( growfactor = `1`
92+
)->get_parent(
93+
)->get_parent(
94+
)->get_parent(
95+
)->footer(
96+
)->bar(
97+
)->content_right(
98+
)->toggle_button( text = `Pressed & Disabled` enabled = abap_false pressed = abap_true press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
99+
)->toggle_button( icon = `sap-icon://action` press = client->_event( val = `onPress` t_arg = VALUE #( ( `${$source>/pressed}` ) ( `${$source>/id}` ) ) )
100+
)->get_parent(
101+
)->get_parent(
102+
)->get_parent(
103+
).
103104
client->view_display( page_02->stringify( ) ).
104105

105106
ENDMETHOD.
@@ -112,7 +113,14 @@ CLASS z2ui5_cl_demo_app_266 IMPLEMENTATION.
112113
client->nav_app_leave( ).
113114
WHEN 'CLICK_HINT_ICON'.
114115
z2ui5_display_popover( `button_hint_id` ).
115-
ENDCASE.
116+
WHEN 'onPress'.
117+
IF client->get_event_arg( 1 ) = 'X'.
118+
client->message_toast_display( client->get_event_arg( 2 ) && ` Pressed` ).
119+
ELSE.
120+
client->message_toast_display( client->get_event_arg( 2 ) && ` Unpressed` ).
121+
ENDIF.
122+
ENDCASE.
123+
116124

117125
ENDMETHOD.
118126

src/z2ui5_cl_demo_app_283.clas.abap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CLASS z2ui5_cl_demo_app_283 DEFINITION
1+
CLASS z2ui5_cl_demo_app_283 DEFINITION
22
PUBLIC
33
CREATE PUBLIC.
44

@@ -52,45 +52,43 @@ CLASS z2ui5_cl_demo_app_283 IMPLEMENTATION.
5252
target = '_blank'
5353
href = base_url && 'sdk/#/entity/sap.m.FeedInput/sample/sap.m.sample.FeedInput' ).
5454

55-
page->_generic_property( VALUE #( n = `core:require` v = `{ MessageToast: 'sap/m/MessageToast' }` ) ).
56-
5755
page->label( text = `Without Icon` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
5856
page->feed_input(
59-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
57+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
6058
showicon = abap_false ).
6159

6260
page->label( text = `With Icon Placeholder` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
6361
page->feed_input(
64-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
62+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
6563
showicon = abap_true ).
6664

6765
page->label( text = `With Icon Placeholder` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
6866
page->feed_input(
69-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
67+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
7068
showicon = abap_true
7169
icon = base_url && `test-resources/sap/m/images/george_washington.jpg` ).
7270

7371
page->label( text = `Disabled` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
7472
page->feed_input(
75-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
73+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
7674
enabled = abap_false
7775
showicon = abap_true
7876
icon = base_url && `test-resources/sap/m/images/george_washington.jpg` ).
7977

8078
page->label( text = `Rows Set to 5` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
8179
page->feed_input(
82-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
80+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
8381
rows = `5` ).
8482

8583
page->label( text = `With Exceeded Text` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
8684
page->feed_input(
87-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
85+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
8886
maxlength = `20`
8987
showexceededtext = abap_true ).
9088

9189
page->label( text = `With Growing` class = `sapUiSmallMarginTop sapUiTinyMarginBottom` ).
9290
page->feed_input(
93-
post = `MessageToast.show( 'Posted new feed entry: ' + ${$source>/value} )`
91+
post = client->_event( val = `onPost` t_arg = VALUE #( ( `${$source>/value}` ) ) )
9492
growing = abap_true ).
9593

9694
client->view_display( page->stringify( ) ).
@@ -105,6 +103,8 @@ CLASS z2ui5_cl_demo_app_283 IMPLEMENTATION.
105103
client->nav_app_leave( ).
106104
WHEN 'CLICK_HINT_ICON'.
107105
z2ui5_display_popover( `button_hint_id` ).
106+
WHEN 'onPost'.
107+
client->message_toast_display( `Posted new feed entry: ` && client->get_event_arg( 1 ) ).
108108
ENDCASE.
109109

110110
ENDMETHOD.

0 commit comments

Comments
 (0)