abap2UI5

Icon

Built with an embedded font, icons scale well, and can be altered with CSS. They can also fire a press event. See the Icon Explorer for more icons.

Z2UI5_CL_SMPC_APP_122

Controls sap.ui.core UI5 1.71

The facts

Repository
abap2UI5/samples-controls
Class
Z2UI5_CL_SMPC_APP_122
Source file
z2ui5_cl_smpc_app_122.clas.abap
Library
sap.ui.core
UI5 entity
sap.ui.core.Icon
Demo kit sample
sap.ui.core.sample.Icon
SAP's own sample
running at sdk.openui5.org ↗
Minimum UI5
1.71 — the floor abap2UI5 holds its samples to
In the playground
runs in the browser, with no system and nothing installed

Keywords: icon, sap.ui.core, font, gallery, html, hbox, flexitemdata

Controls it builds

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_122.clas.abap — 118 lines Read it on GitHub ↗
" @keywords icon sap.ui.core font gallery html hbox flexitemdata
" @summary Built with an embedded font, icons scale well, and can be altered with CSS. They can also fire a press event. See the Icon Explorer for more icons.
CLASS z2ui5_cl_smpc_app_122 DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.

  PROTECTED SECTION.
    DATA client TYPE REF TO z2ui5_if_client.

    METHODS view_display.

  PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_smpc_app_122 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    me->client = client.
    IF client->check_on_navigated( ).
      view_display( ).
    ENDIF.

  ENDMETHOD.


  METHOD view_display.

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

    view->ele( n = `View` ns = `mvc`
        )->a( n = `xmlns:core` v = `sap.ui.core`
        )->a( n = `xmlns:mvc`  v = `sap.ui.core.mvc`
        )->a( n = `xmlns`      v = `sap.m`

        " the sample's style.css, injected via a core:HTML content attribute
        " (see CAPABILITIES.md) - the five size classes the Icons below carry,
        " including the <600px media query, verbatim. Literal braces are escaped
        " \{ \} in a backtick literal: the XMLView parser reads an unescaped
        " brace as a binding
        )->tag( n = `HTML` ns = `core`
            )->a( n = `content` v = `<style>` &&
                                    `.size1\{font-size:1.5rem\}` &&
                                    `.size2\{font-size:2.5rem\}` &&
                                    `.size3\{font-size:5rem\}` &&
                                    `.size4\{font-size:7.5rem\}` &&
                                    `.size5\{font-size:10rem\}` &&
                                    `@media (max-width:599px)\{` &&
                                    `.size1\{font-size:1rem\}` &&
                                    `.size2\{font-size:2rem\}` &&
                                    `.size3\{font-size:3rem\}` &&
                                    `.size4\{font-size:4rem\}` &&
                                    `.size5\{font-size:5rem\}\}` &&
                                    `</style>`

        )->ele( `HBox`
            )->a( n = `class` v = `sapUiSmallMargin`

            )->ele( n = `Icon` ns = `core`
                )->a( n = `src`   v = `sap-icon://syringe`
                )->a( n = `class` v = `size1`
                )->a( n = `color` v = `#031E48`
                )->ele( n = `layoutData` ns = `core`
                    )->tag( `FlexItemData`
                        )->a( n = `growFactor` v = `1`

                )->end(
            )->end(

            )->ele( n = `Icon` ns = `core`
                )->a( n = `src`   v = `sap-icon://pharmacy`
                )->a( n = `class` v = `size2`
                )->a( n = `color` v = `#64E4CE`
                )->ele( n = `layoutData` ns = `core`
                    )->tag( `FlexItemData`
                        )->a( n = `growFactor` v = `1`

                )->end(
            )->end(

            )->ele( n = `Icon` ns = `core`
                )->a( n = `src`   v = `sap-icon://electrocardiogram`
                )->a( n = `class` v = `size3`
                )->a( n = `color` v = `#E69A17`
                )->ele( n = `layoutData` ns = `core`
                    )->tag( `FlexItemData`
                        )->a( n = `growFactor` v = `1`

                )->end(
            )->end(

            )->ele( n = `Icon` ns = `core`
                )->a( n = `src`   v = `sap-icon://doctor`
                )->a( n = `class` v = `size4`
                )->a( n = `color` v = `#1C4C98`
                )->ele( n = `layoutData` ns = `core`
                    )->tag( `FlexItemData`
                        )->a( n = `growFactor` v = `1`

                )->end(
            )->end(

            )->ele( n = `Icon` ns = `core`
                )->a( n = `src`   v = `sap-icon://stethoscope`
                )->a( n = `class` v = `size5`
                )->a( n = `color` v = `#8875E7`
                )->a( n = `press` v = client->follow_up_action( val = client->cs_event-control_global t_arg = VALUE #( ( `MESSAGE_TOAST` ) ( `show` ) ( `Over budget!` ) ) )
                )->ele( n = `layoutData` ns = `core`
                    )->tag( `FlexItemData`
                        )->a( n = `growFactor` v = `1` ).

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

  ENDMETHOD.

ENDCLASS.

More in sap.ui.core

Search every abap2UI5 sample · the full list on one page

On this page