Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions src/01/02/z2ui5_cl_demo_app_465.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
CLASS z2ui5_cl_demo_app_465 DEFINITION PUBLIC.

PUBLIC SECTION.
INTERFACES z2ui5_if_app.

PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.

METHODS view_display.
METHODS on_event.

PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_demo_app_465 IMPLEMENTATION.

METHOD z2ui5_if_app~main.

me->client = client.
IF client->check_on_init( ).
view_display( ).
ELSE.
on_event( ).
ENDIF.

ENDMETHOD.


METHOD on_event.

CASE client->get( )-event.

WHEN `TOGGLE`.
" toggle the popover open/closed, anchored to the pressed button's DOM
" ref - the whitelisted toggleBy opens it if closed, closes it if open
" (the controller pattern oPopover.openBy(oButton) / oPopover.close()).
" t_arg is positional: id, view (`` = global lookup), method, anchor id
client->follow_up_action( val = z2ui5_if_client=>cs_event-control_by_id
t_arg = VALUE #( ( `demoPopover` )
( `` )
( `toggleBy` )
( client->get_event_arg( ) ) ) ).

ENDCASE.

ENDMETHOD.


METHOD view_display.

DATA(view) = z2ui5_cl_xml_view=>factory( ).

DATA(page) = view->shell(
)->page(
title = `abap2UI5 - Popover - Toggle via CONTROL_BY_ID`
navbuttonpress = client->_event_nav_app_leave( )
shownavbutton = client->check_app_prev_stack( ) ).

" the popover kept as a dependent of the page; opened and closed
" imperatively from the backend, anchored to the button that fired
page->dependents(
)->popover( id = `demoPopover`
title = `Details`
placement = `Bottom`
contentwidth = `18rem`
)->text( `Toggled open and closed from the backend - the same button opens ` &&
`it when closed and closes it when open, no view rebuild and no payload.`
)->get_parent( ).

page->message_strip(
text = `The button toggles the popover via the whitelisted toggleBy method ` &&
`(follow_up_action with cs_event-control_by_id), anchored to the button's DOM ref ` &&
`passed as $event.oSource.sId - open-if-closed, close-if-open, client-side after render.`
type = `Information`
showicon = abap_true
class = `sapUiSmallMargin` ).

page->vbox( `sapUiSmallMargin`
)->button( text = `Toggle popover`
icon = `sap-icon://email`
press = client->_event( val = `TOGGLE`
t_arg = VALUE #( ( `$event.oSource.sId` ) ) ) ).

client->view_display( view->stringify( ) ).

ENDMETHOD.

ENDCLASS.
16 changes: 16 additions & 0 deletions src/01/02/z2ui5_cl_demo_app_465.clas.xml
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_465</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>More - Popover Toggle (A)</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>
74 changes: 74 additions & 0 deletions src/01/02/z2ui5_cl_demo_app_466.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
CLASS z2ui5_cl_demo_app_466 DEFINITION PUBLIC.

PUBLIC SECTION.
INTERFACES z2ui5_if_app.

DATA status_text TYPE string.

PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.

METHODS view_display.

PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_demo_app_466 IMPLEMENTATION.

METHOD z2ui5_if_app~main.

me->client = client.
IF client->check_on_init( ).

status_text = `<strong>Deployment successful!</strong> %%icon:sap-icon://message-success%% All services ` &&
`%%icon:sap-icon://sys-enter-2%% are running. <em>Check status</em> ` &&
`%%icon:sap-icon://stethoscope%%`.

view_display( ).

ENDIF.

ENDMETHOD.


METHOD view_display.

DATA(view) = z2ui5_cl_xml_view=>factory( ).

" require the framework's curated formatter module into the view -
" expandInlineIcons is the sap.m.MessageStripUtilities.getInlineIcon()
" equivalent: a whole-string formatter that replaces every
" %%icon:sap-icon://<name>%% placeholder with inline-icon markup (the
" glyph resolved via IconPool), so the app never hardcodes icon-font
" codepoints. Rendered by MessageStrip with enableFormattedText.
view->_generic_property( VALUE #( n = `core:require`
v = `{Formatter: 'z2ui5/model/formatter'}` ) ).

DATA(page) = view->shell(
)->page(
title = `abap2UI5 - MessageStrip - inline icons via Formatter`
navbuttonpress = client->_event_nav_app_leave( )
shownavbutton = client->check_app_prev_stack( ) ).

page->message_strip(
text = `The status line below binds a plain string carrying %%icon:sap-icon://...%% placeholders ` &&
`through Formatter.expandInlineIcons - each placeholder becomes an inline icon glyph, ` &&
`no codepoints in the app.`
type = `Information`
showicon = abap_true
class = `sapUiSmallMargin` ).

page->message_strip(
text = |\{ path: '{ client->_bind( val = status_text path = abap_true ) }', | &&
|formatter: 'Formatter.expandInlineIcons' \}|
type = `Success`
enableformattedtext = abap_true
showicon = abap_true
class = `sapUiSmallMargin` ).

client->view_display( view->stringify( ) ).

ENDMETHOD.

ENDCLASS.
16 changes: 16 additions & 0 deletions src/01/02/z2ui5_cl_demo_app_466.clas.xml
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_466</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>More - MessageStrip Inline Icons</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>
97 changes: 97 additions & 0 deletions src/01/02/z2ui5_cl_demo_app_467.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
CLASS z2ui5_cl_demo_app_467 DEFINITION PUBLIC.

PUBLIC SECTION.
INTERFACES z2ui5_if_app.

TYPES:
BEGIN OF ty_s_message,
message TYPE string,
description TYPE string,
type TYPE string,
target TYPE string,
additionaltext TYPE string,
END OF ty_s_message.
DATA t_messages TYPE STANDARD TABLE OF ty_s_message WITH EMPTY KEY.
DATA name TYPE string.

PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.

METHODS view_display.

PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_demo_app_467 IMPLEMENTATION.

METHOD z2ui5_if_app~main.

me->client = client.
IF client->check_on_init( ).

" app-authored messages - the controller's MessageManager.addMessages
" equivalent. The z2ui5.cc.MessageManager companion reconciles this
" table into the central message manager: each row becomes a
" sap.ui.core.message.Message with the view's model as processor, so a
" row with a target sets that field's valueState too.
t_messages = VALUE #(
( message = `Please enter a valid name`
type = `Error`
additionaltext = `Name`
target = `/NAME` )
( message = `Draft saved automatically`
type = `Information`
additionaltext = `Autosave` ) ).

view_display( ).

ENDIF.

ENDMETHOD.


METHOD view_display.

DATA(view) = z2ui5_cl_xml_view=>factory( ).

DATA(page) = view->shell(
)->page(
title = `abap2UI5 - Messages - app-authored via z2ui5.cc.MessageManager`
navbuttonpress = client->_event_nav_app_leave( )
shownavbutton = client->check_app_prev_stack( ) ).

page->message_strip(
text = `The messages below are authored by the app (not collected from control validation) ` &&
`and pushed into the central message model by the invisible z2ui5.cc.MessageManager ` &&
`companion bound to an ABAP table - the Error targets the Name field and colours it.`
type = `Information`
showicon = abap_true
class = `sapUiSmallMargin` ).

" invisible companion control: reconciles /T_MESSAGES into the message
" manager (adds the app's messages, removes its own when they drop out,
" leaves auto-collected validation untouched)
page->_generic( name = `MessageManager`
ns = `z2ui5`
t_prop = VALUE #( ( n = `items` v = client->_bind( t_messages ) ) ) ).

page->simple_form( title = `Registration`
editable = abap_true
class = `sapUiSmallMargin`
)->content(
)->label( `Name`
)->input( client->_bind_edit( name ) ).

page->list( headertext = `Collected messages (message> model)`
items = `{message>/}`
class = `sapUiSmallMargin`
)->standard_list_item( title = `{message>message}`
description = `{message>additionalText}`
info = `{message>type}` ).

client->view_display( view->stringify( ) ).

ENDMETHOD.

ENDCLASS.
16 changes: 16 additions & 0 deletions src/01/02/z2ui5_cl_demo_app_467.clas.xml
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_467</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>More - Message Manager (C)</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>
3 changes: 3 additions & 0 deletions src/01/z2ui5_cl_demo_app_g00.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,12 @@ CLASS z2ui5_cl_demo_app_g00 IMPLEMENTATION.
( group = `Basic II` header = `More` sub = `Data Loss Protection (C)` app = `z2ui5_cl_demo_app_279` )
( group = `Basic II` header = `More` sub = `File Uploader (C)` app = `z2ui5_cl_demo_app_074` )
( group = `Basic II` header = `More` sub = `Geoloaction (C)` app = `z2ui5_cl_demo_app_120` )
( group = `Basic II` header = `More` sub = `Message Manager (C)` app = `z2ui5_cl_demo_app_467` )
( group = `Basic II` header = `More` sub = `MessageStrip Inline Icons` app = `z2ui5_cl_demo_app_466` )
( group = `Basic II` header = `More` sub = `Multi Input (C)` app = `z2ui5_cl_demo_app_078` )
( group = `Basic II` header = `More` sub = `Panel, setExpanded (A)` app = `z2ui5_cl_demo_app_448` )
( group = `Basic II` header = `More` sub = `PDF Viewer Display (A)` app = `z2ui5_cl_demo_app_449` )
( group = `Basic II` header = `More` sub = `Popover Toggle (A)` app = `z2ui5_cl_demo_app_465` )
( group = `Basic II` header = `More` sub = `Wizard Control (A)` app = `z2ui5_cl_demo_app_202` )
( group = `Basic II` header = `NavContainer` sub = `Popup (A)` app = `z2ui5_cl_demo_app_170` )
( group = `Basic II` header = `NavContainer` sub = `Simple (A)` app = `z2ui5_cl_demo_app_088` )
Expand Down