diff --git a/src/01/02/z2ui5_cl_demo_app_465.clas.abap b/src/01/02/z2ui5_cl_demo_app_465.clas.abap new file mode 100644 index 00000000..9f904d00 --- /dev/null +++ b/src/01/02/z2ui5_cl_demo_app_465.clas.abap @@ -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. diff --git a/src/01/02/z2ui5_cl_demo_app_465.clas.xml b/src/01/02/z2ui5_cl_demo_app_465.clas.xml new file mode 100644 index 00000000..d4924b27 --- /dev/null +++ b/src/01/02/z2ui5_cl_demo_app_465.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_465 + E + More - Popover Toggle (A) + 1 + X + X + X + + + + diff --git a/src/01/02/z2ui5_cl_demo_app_466.clas.abap b/src/01/02/z2ui5_cl_demo_app_466.clas.abap new file mode 100644 index 00000000..9fcff0a8 --- /dev/null +++ b/src/01/02/z2ui5_cl_demo_app_466.clas.abap @@ -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 = `Deployment successful! %%icon:sap-icon://message-success%% All services ` && + `%%icon:sap-icon://sys-enter-2%% are running. Check status ` && + `%%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://%% 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. diff --git a/src/01/02/z2ui5_cl_demo_app_466.clas.xml b/src/01/02/z2ui5_cl_demo_app_466.clas.xml new file mode 100644 index 00000000..b2a2281d --- /dev/null +++ b/src/01/02/z2ui5_cl_demo_app_466.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_466 + E + More - MessageStrip Inline Icons + 1 + X + X + X + + + + diff --git a/src/01/02/z2ui5_cl_demo_app_467.clas.abap b/src/01/02/z2ui5_cl_demo_app_467.clas.abap new file mode 100644 index 00000000..a8bd215f --- /dev/null +++ b/src/01/02/z2ui5_cl_demo_app_467.clas.abap @@ -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. diff --git a/src/01/02/z2ui5_cl_demo_app_467.clas.xml b/src/01/02/z2ui5_cl_demo_app_467.clas.xml new file mode 100644 index 00000000..468e7917 --- /dev/null +++ b/src/01/02/z2ui5_cl_demo_app_467.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_467 + E + More - Message Manager (C) + 1 + X + X + X + + + + diff --git a/src/01/z2ui5_cl_demo_app_g00.clas.abap b/src/01/z2ui5_cl_demo_app_g00.clas.abap index f7e2caf8..69b4c274 100644 --- a/src/01/z2ui5_cl_demo_app_g00.clas.abap +++ b/src/01/z2ui5_cl_demo_app_g00.clas.abap @@ -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` )