-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
CLASS z2ui5_cl_demo_app_181 DEFINITION | ||
PUBLIC | ||
CREATE PUBLIC . | ||
|
||
PUBLIC SECTION. | ||
|
||
INTERFACES if_serializable_object . | ||
INTERFACES z2ui5_if_app . | ||
|
||
DATA mv_initialized TYPE abap_bool . | ||
DATA mv_url TYPE string . | ||
|
||
TYPES: | ||
BEGIN OF ty_cities, | ||
text TYPE string, | ||
key TYPE string, | ||
END OF ty_cities. | ||
|
||
TYPES t_cities TYPE STANDARD TABLE OF ty_cities WITH DEFAULT KEY. | ||
|
||
TYPES: | ||
BEGIN OF ty_product_items, | ||
title TYPE string, | ||
subtitle TYPE string, | ||
revenue TYPE string, | ||
status TYPE string, | ||
status_schema TYPE string, | ||
END OF ty_product_items. | ||
|
||
TYPES t_product_items TYPE STANDARD TABLE OF ty_product_items WITH DEFAULT KEY. | ||
|
||
|
||
METHODS on_event . | ||
METHODS view_display . | ||
PROTECTED SECTION. | ||
|
||
DATA client TYPE REF TO z2ui5_if_client. | ||
|
||
PRIVATE SECTION. | ||
ENDCLASS. | ||
|
||
|
||
|
||
CLASS Z2UI5_CL_DEMO_APP_181 IMPLEMENTATION. | ||
|
||
|
||
METHOD on_event. | ||
|
||
CASE client->get( )-event. | ||
WHEN 'BOOK'. | ||
client->message_toast_display( 'BOOKED !!! ENJOY' ). | ||
|
||
WHEN 'BACK'. | ||
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ). | ||
RETURN. | ||
ENDCASE. | ||
|
||
ENDMETHOD. | ||
|
||
|
||
METHOD view_display. | ||
|
||
DATA(view) = z2ui5_cl_xml_view=>factory( ). | ||
|
||
DATA(card_1) = view->card( width = `300px` class = `sapUiMediumMargin` | ||
)->header( ns = `f` | ||
)->card_header( title = `Buy bus ticket on-line` | ||
subtitle = `Buy a single-ride ticket for a date` | ||
iconsrc = `sap-icon://bus-public-transport` | ||
)->get_parent( )->get_parent( | ||
)->content( ns = `f` | ||
)->vbox( height = `110px` | ||
class = `sapUiSmallMargin` | ||
justifycontent = `SpaceBetween` | ||
)->hbox( justifycontent = `SpaceBetween` | ||
)->combobox( width = `120px` | ||
placeholder = `From City` | ||
items = `{path:'` && client->_bind_local( val = VALUE t_cities( ( text = `Berlin` key = `BR` ) | ||
( text = `London` key = `LN` ) | ||
( text = `Madrid` key = `MD` ) | ||
( text = `Prague` key = `PR` ) | ||
( text = `Paris` key = `PS` ) | ||
( text = `Sofia` key = `SF` ) | ||
( text = `Vienna` key = `VN` ) | ||
) path = abap_true ) && `', sorter: { path: 'TEXT' } }` | ||
)->get( )->item( key = `{KEY}` text = `{TEXT}` )->get_parent( | ||
)->combobox( width = `120px` | ||
placeholder = `To City` | ||
items = `{path:'` && client->_bind_local( val = VALUE t_cities( ( text = `Berlin` key = `BR` ) | ||
( text = `London` key = `LN` ) | ||
( text = `Madrid` key = `MD` ) | ||
( text = `Prague` key = `PR` ) | ||
( text = `Paris` key = `PS` ) | ||
( text = `Sofia` key = `SF` ) | ||
( text = `Vienna` key = `VN` ) | ||
) path = abap_true ) && `', sorter: { path: 'TEXT' } }` | ||
)->get( )->item( key = `{KEY}` text = `{TEXT}` )->get_parent( | ||
)->get_parent( | ||
)->hbox( rendertype = `Bare` justifycontent = `SpaceBetween` | ||
)->date_picker( width = `200px` | ||
placeholder = `Choose Date ...` | ||
)->button( text = `Book` | ||
type = `Emphasized` | ||
press = client->_event( `BOOK` ) | ||
class = `sapUiTinyMarginBegin` ). | ||
|
||
|
||
DATA(card_2) = view->card( width = `300px` class = `sapUiMediumMargin` | ||
)->header( ns = `f` | ||
)->card_header( title = `Project Cloud Transformation` | ||
subtitle = `Revenue per Product | EUR` | ||
)->get_parent( )->get_parent( | ||
)->content( ns = `f` | ||
)->list( class = `sapUiSmallMarginBottom` | ||
showseparators = `None` | ||
items = client->_bind_local( VALUE t_product_items( ( title = `Notebook HT` subtitle = `ID23452256-D44` revenue = `27.25K EUR` status = `success` status_schema = `Success` ) | ||
( title = `Notebook XT` subtitle = `ID27852256-D47` revenue = `7.35K EUR` status = `exceeded` status_schema = `Error` ) | ||
( title = `Notebook ST` subtitle = `ID123555587-I05` revenue = `22.89K EUR` status = `warning` status_schema = `Warning` ) | ||
|
||
) ) | ||
)->custom_list_item( | ||
)->hbox( alignitems = `Center` justifycontent = `SpaceBetween` | ||
)->vbox( class = `sapUiSmallMarginBegin sapUiSmallMarginTopBottom` | ||
)->title( level = `H4` text = `{TITLE}` | ||
)->text( text = `{SUBTITLE}` | ||
)->get_parent( | ||
)->object_status( class = `sapUiTinyMargin sapUiSmallMarginEnd` | ||
text = `{REVENUE}` | ||
state = `{STATUS_SCHEMA}` | ||
). | ||
|
||
client->view_display( view->stringify( ) ). | ||
|
||
ENDMETHOD. | ||
|
||
|
||
METHOD z2ui5_if_app~main. | ||
|
||
me->client = client. | ||
|
||
IF mv_initialized = abap_false. | ||
mv_initialized = abap_true. | ||
|
||
view_display( ). | ||
|
||
ENDIF. | ||
|
||
on_event( ). | ||
|
||
ENDMETHOD. | ||
ENDCLASS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_181</CLSNAME> | ||
<LANGU>E</LANGU> | ||
<DESCRIPT>cards demo</DESCRIPT> | ||
<STATE>1</STATE> | ||
<CLSCCINCL>X</CLSCCINCL> | ||
<FIXPT>X</FIXPT> | ||
<UNICODE>X</UNICODE> | ||
</VSEOCLASS> | ||
</asx:values> | ||
</asx:abap> | ||
</abapGit> |