Progress Indicator With Announcement
Announce the progress of the ProgressIndicator.
Z2UI5_CL_SMPC_APP_435
Controls
sap.m
UI5 1.78
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_435- Source file
z2ui5_cl_smpc_app_435.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.ProgressIndicator- Demo kit sample
sap.m.sample.ProgressIndicatorWithAnnouncement- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.78
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: progressindicator, progress, indicator, sap.m, progressindicatorwithannouncement, verticallayout, text, flexbox, button
Controls it builds
- sap.m.Button
- sap.m.FlexBox
- sap.m.ProgressIndicator
- sap.m.Text
- sap.ui.core.mvc.View
- sap.ui.layout.VerticalLayout
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smpc_app_435.clas.abap — 152 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords progressindicator progress indicator sap.m progressindicatorwithannouncement verticallayout text flexbox button
" @summary Announce the progress of the ProgressIndicator.
CLASS z2ui5_cl_smpc_app_435 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA value_animated TYPE i.
DATA display_animated TYPE string VALUE `0%`.
DATA value_plain TYPE i.
DATA display_plain TYPE string VALUE `0%`.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_435 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_navigated( ).
view_display( ).
ELSEIF client->check_on_event( ).
on_event( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns:l` v = `sap.ui.layout`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns` v = `sap.m`
)->ele( n = `VerticalLayout` ns = `l`
)->a( n = `class` v = `sapUiContentPadding`
)->a( n = `width` v = `100%`
)->ele( n = `content` ns = `l`
)->tag( `Text`
)->a( n = `text` v = `Set the ProgressIndicator to 100% with animation`
)->a( n = `class` v = `sapUiSmallMarginBottom`
" the original sets displayValue and percentValue imperatively in
" onPIChangeValueButtonPressed - both are bound here and written in ABAP
)->tag( `ProgressIndicator`
)->a( n = `id` v = `pi-with-animation`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `displayValue` v = client->_bind( display_animated )
)->a( n = `percentValue` v = client->_bind( value_animated )
)->a( n = `state` v = `Success`
)->a( n = `displayOnly` v = `true`
)->ele( `FlexBox`
)->tag( `Button`
)->a( n = `id` v = `pi-with-animation-button0`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->a( n = `text` v = `Set to 0%`
)->a( n = `press` v = client->_event( val = `SET_VALUE` arg = `$event.oSource.sId` )
)->tag( `Button`
)->a( n = `id` v = `pi-with-animation-button50`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->a( n = `text` v = `Set to 50%`
)->a( n = `press` v = client->_event( val = `SET_VALUE` arg = `$event.oSource.sId` )
)->tag( `Button`
)->a( n = `id` v = `pi-with-animation-button100`
)->a( n = `text` v = `Set to 100%`
)->a( n = `press` v = client->_event( val = `SET_VALUE` arg = `$event.oSource.sId` )
)->end(
)->tag( `Text`
)->a( n = `text` v = `Set the ProgressIndicator to 100% without animation`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->tag( `ProgressIndicator`
)->a( n = `id` v = `pi-without-animation`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `displayValue` v = client->_bind( display_plain )
)->a( n = `percentValue` v = client->_bind( value_plain )
)->a( n = `state` v = `Success`
)->a( n = `displayOnly` v = `true`
)->a( n = `displayAnimation` v = `false`
)->ele( `FlexBox`
)->tag( `Button`
)->a( n = `id` v = `pi-without-animation-button0`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->a( n = `text` v = `Set to 0%`
)->a( n = `press` v = client->_event( val = `SET_VALUE` arg = `$event.oSource.sId` )
)->tag( `Button`
)->a( n = `id` v = `pi-without-animation-button50`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->a( n = `text` v = `Set to 50%`
)->a( n = `press` v = client->_event( val = `SET_VALUE` arg = `$event.oSource.sId` )
)->tag( `Button`
)->a( n = `id` v = `pi-without-animation-button100`
)->a( n = `text` v = `Set to 100%`
)->a( n = `press` v = client->_event( val = `SET_VALUE` arg = `$event.oSource.sId` ) ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `SET_VALUE`.
" the original reads the pressed button's id and splits it into the
" ProgressIndicator id and the value - the same split, done in ABAP
DATA(source_id) = client->get_event_arg( ).
DATA(offset) = find( val = source_id sub = `button` ).
IF offset < 0.
RETURN.
ENDIF.
DATA(indicator) = substring( val = source_id len = offset - 1 ).
DATA(value) = CONV i( substring( val = source_id off = offset + 6 ) ).
DATA(previous) = COND string( WHEN indicator CS `pi-with-animation` THEN display_animated ELSE display_plain ).
IF indicator CS `pi-with-animation`.
value_animated = value.
display_animated = |{ value }%|.
ELSE.
value_plain = value.
display_plain = |{ value }%|.
ENDIF.
" InvisibleMessage.getInstance().announce( ... ) - a singleton with no
" control id, so the announcement goes through the global target
client->follow_up_action( val = client->cs_event-control_global
t_arg = VALUE #( ( `INVISIBLE_MESSAGE` )
( `announce` )
( |Previous value was { previous }. New value is { value }%.| ) ) ).
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.m
- OverflowToolbar - Enabled — The Enabled property can be used to enable or disable all the controls inside the Overflo…
- Flex Box - Equal Height Cols — You can create balanced areas with Flex Box, such as these columns with equal height rega…
- Carousel Without Pages — When the carousel has no pages loaded or provided illustrated message will be shown.
- Header Container Without Dividers — The Header Container without divider lines.
- List - Navigation Indication — If only a subset of the list items are navigable you should indicate those by setting the…
- Tokenizer Multi-line and Clear All — Tokenizer with Multi-line support and Clear All button
- Tree - Icon & Context Menu — Tree item with icon. This example also shows the context menu for the items in the Tree c…
- Tree - Selection — This example shows different selection modes of Tree.
- Responsive Refresh — An 'Responsive Refresh' can be achieved by the combination of a Search Field's refresh bu…
- Text - Empty Indicator — The Text control has a property allowing an empty text indicator to be displayed.
- Menu with EndContent Items — EndContent (Button and/or Icon) can be added to some of the menu items.
- Breadcrumbs sample without current page — The breadcrumb shows the position of the object page in the application hiearchy, without…
On this page