Skip to content

Commit d10b209

Browse files
New Sample: Checkbox (#280)
* New Sample: Checkbox (1) * New Sample: Checkbox (2) * New Sample: Checkbox (3)
1 parent 769d599 commit d10b209

File tree

3 files changed

+161
-0
lines changed

3 files changed

+161
-0
lines changed

src/z2ui5_cl_demo_app_000.clas.abap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,13 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
461461
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
462462
).
463463

464+
panel->generic_tile(
465+
header = 'Checkbox'
466+
press = client->_event( 'Z2UI5_CL_DEMO_APP_239' )
467+
mode = 'LineMode'
468+
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
469+
).
470+
464471
panel = page->panel(
465472
expandable = abap_false
466473
expanded = abap_true
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
class z2ui5_cl_demo_app_239 definition
2+
public
3+
create public .
4+
5+
public section.
6+
7+
interfaces IF_SERIALIZABLE_OBJECT .
8+
interfaces Z2UI5_IF_APP .
9+
10+
data CHECK_INITIALIZED type ABAP_BOOL .
11+
PROTECTED SECTION.
12+
13+
DATA client TYPE REF TO z2ui5_if_client.
14+
15+
METHODS display_view
16+
IMPORTING
17+
client TYPE REF TO z2ui5_if_client.
18+
METHODS on_event
19+
IMPORTING
20+
client TYPE REF TO z2ui5_if_client.
21+
METHODS z2ui5_display_popover
22+
IMPORTING
23+
id TYPE string.
24+
25+
PRIVATE SECTION.
26+
ENDCLASS.
27+
28+
29+
30+
CLASS z2ui5_cl_demo_app_239 IMPLEMENTATION.
31+
32+
33+
METHOD DISPLAY_VIEW.
34+
35+
DATA(page) = z2ui5_cl_xml_view=>factory( )->shell(
36+
)->page(
37+
title = 'abap2UI5 - Sample: Check Box'
38+
navbuttonpress = client->_event( 'BACK' )
39+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
40+
41+
page->header_content(
42+
)->button( id = `hint_icon`
43+
icon = `sap-icon://hint`
44+
tooltip = `Sample information`
45+
press = client->_event( 'POPOVER' ) ).
46+
47+
page->header_content(
48+
)->link(
49+
text = 'UI5 Demo Kit'
50+
target = '_blank'
51+
href = 'https://sapui5.hana.ondemand.com/sdk/#/entity/sap.m.CheckBox/sample/sap.m.sample.CheckBox' ).
52+
53+
DATA(layout) = page->vbox(
54+
)->checkbox( text = `Option a` selected = abap_true
55+
)->checkbox( text = `Option b`
56+
)->checkbox( text = `Option c` selected = abap_true
57+
)->checkbox( text = `Option d`
58+
)->checkbox( text = `Option e` enabled = abap_false
59+
)->checkbox( text = `Option partially selected` selected = abap_true partiallyselected = abap_true
60+
)->checkbox( text = `Required option` required = abap_true
61+
)->checkbox( text = `Warning` valuestate = `Warning`
62+
)->checkbox( text = `Warning disabled` valuestate = `Warning` enabled = abap_false selected = abap_true
63+
)->checkbox( text = `Error` valuestate = `Error`
64+
)->checkbox( text = `Error disabled` valuestate = `Error` enabled = abap_false selected = abap_true
65+
)->checkbox( text = `Information` valuestate = `Information`
66+
)->checkbox( text = `Information disabled` valuestate = `Information` enabled = abap_false selected = abap_true
67+
)->checkbox( text = `Checkbox with wrapping='true' and long text` wrapping = abap_true width = `150px` ).
68+
layout->simple_form(
69+
editable = abap_true
70+
layout = `ResponsiveGridLayout`
71+
labelspanl = `4`
72+
labelspanm = `4`
73+
)->content( ns = `form`
74+
)->label( text = `Clearing with Customer`
75+
)->checkbox( text = `Option`
76+
)->checkbox( text = `Option 2` selected = abap_true )->get(
77+
)->layout_data(
78+
)->grid_data( linebreak = abap_true
79+
indentl = `4`
80+
indentm = `4` )->get_parent( )->get_parent(
81+
)->checkbox( id = `focusMe` text = `Option 3` )->get(
82+
)->layout_data(
83+
)->grid_data( linebreak = abap_true
84+
indentl = `4`
85+
indentm = `4` )->get_parent( )->get_parent(
86+
)->checkbox( text = `Checkbox with wrapping='true' and long text placed in a form` wrapping = abap_true width = `200px` )->get(
87+
)->layout_data(
88+
)->grid_data( linebreak = abap_true
89+
indentl = `4`
90+
indentm = `4`
91+
).
92+
93+
client->view_display( page->stringify( ) ).
94+
95+
ENDMETHOD.
96+
97+
98+
METHOD ON_EVENT.
99+
100+
CASE client->get( )-event.
101+
WHEN 'BACK'.
102+
client->nav_app_leave( ).
103+
WHEN 'POPOVER'.
104+
z2ui5_display_popover( `hint_icon` ).
105+
ENDCASE.
106+
107+
ENDMETHOD.
108+
109+
110+
METHOD Z2UI5_DISPLAY_POPOVER.
111+
112+
DATA(view) = z2ui5_cl_xml_view=>factory_popup( ).
113+
view->quick_view( placement = `Bottom` width = `auto`
114+
)->quick_view_page( pageid = `sampleInformationId`
115+
header = `Sample information`
116+
description = `Checkboxes allow users to select a subset of options. If you want to offer an off/on setting you should use the Switch control instead.` ).
117+
118+
client->popover_display(
119+
xml = view->stringify( )
120+
by_id = id
121+
).
122+
123+
ENDMETHOD.
124+
125+
126+
METHOD Z2UI5_IF_APP~MAIN.
127+
128+
me->client = client.
129+
130+
IF check_initialized = abap_false.
131+
check_initialized = abap_true.
132+
display_view( client ).
133+
ENDIF.
134+
135+
on_event( client ).
136+
137+
ENDMETHOD.
138+
ENDCLASS.

src/z2ui5_cl_demo_app_239.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_239</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Check Box</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)