ToolHeader with IconTabHeader
ToolHeader can contain IconTabHeader. When both controls are combined, the IconTabHeader supports only inline text. No icons can be used.
Z2UI5_CL_SMPC_APP_221
Controls
sap.tnt
UI5 1.121
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_221- Source file
z2ui5_cl_smpc_app_221.clas.abap↗- Library
- sap.tnt
- UI5 entity
sap.tnt.ToolHeader- Demo kit sample
sap.tnt.sample.ToolHeaderIconTabHeader- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.121
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: toolheader, tool, header, sap.tnt, toolheadericontabheader, text, button, overflowtoolbarlayoutdata, icontabheader, icontabfilter, menubutton, menu
Controls it builds
- sap.m.Button
- sap.m.IconTabFilter
- sap.m.IconTabHeader
- sap.m.Menu
- sap.m.MenuButton
- sap.m.MenuItem
- sap.m.OverflowToolbarLayoutData
- sap.m.Text
- sap.tnt.ToolHeader
- sap.ui.core.mvc.View
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_221.clas.abap — 396 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords toolheader tool header sap.tnt toolheadericontabheader text button overflowtoolbarlayoutdata icontabheader icontabfilter menubutton menu
" @summary ToolHeader can contain IconTabHeader. When both controls are combined, the IconTabHeader supports only inline text. No icons can be used.
CLASS z2ui5_cl_smpc_app_221 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA selected_key1 TYPE string VALUE `invalidKey`.
DATA selected_key2 TYPE string VALUE `invalidKey`.
DATA selected_key3 TYPE string VALUE `invalidKey`.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_221 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` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:tnt` v = `sap.tnt`
)->a( n = `height` v = `100%`
)->tag( `Text`
)->a( n = `text` v = `Simple IconTabHeader`
)->a( n = `class` v = `sapUiTinyMarginTop sapUiSmallMarginBegin`
)->ele( n = `ToolHeader` ns = `tnt`
)->a( n = `class` v = `sapUiTinyMarginTop sapUiTinyMarginEnd sapUiTinyMarginBegin`
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://home`
" onHomePress resets the sibling IconTabHeader to 'invalidKey', i.e.
" deselects every tab. The original finds that header by walking the
" DOM; here each button knows it statically, and selectedKey is a
" BINDABLE property - so the reset is a bound value, not a frontend
" action (the recipe's "prefer a bindable property" rule)
)->a( n = `press` v = client->_event( val = `HOME_PRESS` arg = `1` )
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `IconTabHeader`
)->a( n = `id` v = `iconTabHeader`
)->a( n = `selectedKey` v = client->_bind( selected_key1 )
)->a( n = `backgroundDesign` v = `Transparent`
)->a( n = `mode` v = `Inline`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->a( n = `shrinkable` v = `true`
)->end(
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Documentation`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Explored`
)->tag( `IconTabFilter`
)->a( n = `text` v = `API Reference`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Demo Apps`
)->end(
)->end(
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://search`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://comment`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `MenuButton`
)->a( n = `icon` v = `sap-icon://hint`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->ele( `Menu`
)->tag( `MenuItem`
)->a( n = `text` v = `Edit`
)->a( n = `icon` v = `sap-icon://edit`
)->tag( `MenuItem`
)->a( n = `text` v = `Save`
)->a( n = `icon` v = `sap-icon://save`
)->end(
)->end(
)->end(
)->tag( `Text`
)->a( n = `text` v = `IconTabHeader with one interaction for the tab - opening the sub-items list`
)->a( n = `class` v = `sapUiLargeMarginTop sapUiSmallMarginBegin`
)->ele( n = `ToolHeader` ns = `tnt`
)->a( n = `class` v = `sapUiTinyMargin sapUiTinyMarginTop`
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://home`
" onHomePress resets the sibling IconTabHeader to 'invalidKey', i.e.
" deselects every tab. The original finds that header by walking the
" DOM; here each button knows it statically, and selectedKey is a
" BINDABLE property - so the reset is a bound value, not a frontend
" action (the recipe's "prefer a bindable property" rule)
)->a( n = `press` v = client->_event( val = `HOME_PRESS` arg = `2` )
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `IconTabHeader`
)->a( n = `id` v = `iconTabHeaderOneClickArea`
)->a( n = `selectedKey` v = client->_bind( selected_key2 )
)->a( n = `backgroundDesign` v = `Transparent`
)->a( n = `mode` v = `Inline`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->a( n = `shrinkable` v = `true`
)->end(
)->ele( `items`
)->ele( `IconTabFilter`
)->a( n = `text` v = `Users`
)->a( n = `interactionMode` v = `SelectLeavesOnly`
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `User 1`
)->tag( `IconTabFilter`
)->a( n = `text` v = `User 2`
)->tag( `IconTabFilter`
)->a( n = `text` v = `User 3`
)->end(
)->end(
)->ele( `IconTabFilter`
)->a( n = `text` v = `Identity`
)->a( n = `interactionMode` v = `SelectLeavesOnly`
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 1`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 2`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 3`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 4`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 5`
)->end(
)->end(
)->ele( `IconTabFilter`
)->a( n = `text` v = `Monitoring`
)->a( n = `interactionMode` v = `SelectLeavesOnly`
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Monitoring 1`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Monitoring 2`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Monitoring 3`
)->end(
)->end(
)->end(
)->end(
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://search`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://comment`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `MenuButton`
)->a( n = `icon` v = `sap-icon://hint`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->ele( `Menu`
)->tag( `MenuItem`
)->a( n = `text` v = `Edit`
)->a( n = `icon` v = `sap-icon://edit`
)->tag( `MenuItem`
)->a( n = `text` v = `Save`
)->a( n = `icon` v = `sap-icon://save`
)->end(
)->end(
)->end(
)->tag( `Text`
)->a( n = `text` v = `IconTabHeader with two interaction areas for the tab - selecting it or opening the sub-items list`
)->a( n = `class` v = `sapUiLargeMarginTop sapUiSmallMarginBegin`
)->ele( n = `ToolHeader` ns = `tnt`
)->a( n = `class` v = `sapUiTinyMargin sapUiTinyMarginTop`
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://home`
" onHomePress resets the sibling IconTabHeader to 'invalidKey', i.e.
" deselects every tab. The original finds that header by walking the
" DOM; here each button knows it statically, and selectedKey is a
" BINDABLE property - so the reset is a bound value, not a frontend
" action (the recipe's "prefer a bindable property" rule)
)->a( n = `press` v = client->_event( val = `HOME_PRESS` arg = `3` )
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `IconTabHeader`
)->a( n = `id` v = `iconTabHeaderTwoClickArea`
)->a( n = `selectedKey` v = client->_bind( selected_key3 )
)->a( n = `backgroundDesign` v = `Transparent`
)->a( n = `mode` v = `Inline`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->a( n = `shrinkable` v = `true`
)->end(
)->ele( `items`
)->ele( `IconTabFilter`
)->a( n = `text` v = `Users`
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `User 1`
)->tag( `IconTabFilter`
)->a( n = `text` v = `User 2`
)->tag( `IconTabFilter`
)->a( n = `text` v = `User 3`
)->end(
)->end(
)->ele( `IconTabFilter`
)->a( n = `text` v = `Identity`
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 1`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 2`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 3`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 4`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Identity 5`
)->end(
)->end(
)->ele( `IconTabFilter`
)->a( n = `text` v = `Monitoring`
)->ele( `items`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Monitoring 1`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Monitoring 2`
)->tag( `IconTabFilter`
)->a( n = `text` v = `Monitoring 3`
)->end(
)->end(
)->end(
)->end(
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://search`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `Button`
)->a( n = `icon` v = `sap-icon://comment`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->end(
)->ele( `MenuButton`
)->a( n = `icon` v = `sap-icon://hint`
)->a( n = `type` v = `Transparent`
)->ele( `layoutData`
)->tag( `OverflowToolbarLayoutData`
)->a( n = `priority` v = `NeverOverflow`
)->end(
)->ele( `Menu`
)->tag( `MenuItem`
)->a( n = `text` v = `Edit`
)->a( n = `icon` v = `sap-icon://edit`
)->tag( `MenuItem`
)->a( n = `text` v = `Save`
)->a( n = `icon` v = `sap-icon://save`
)->end(
)->end(
)->end( ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `HOME_PRESS`.
CASE client->get_event_arg( ).
WHEN `1`.
selected_key1 = `invalidKey`.
WHEN `2`.
selected_key2 = `invalidKey`.
WHEN OTHERS.
selected_key3 = `invalidKey`.
ENDCASE.
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.tnt
- Side Navigation - Tags — SideNavigation with tags for status indicators and metadata.
- ToolHeader — ToolHeader that mimics the content of the Shell.
- InfoLabel in DynamicPage — InfoLabel used as subheader in DynamicPage
- Tool Page with Vertical Navigation — A tool page layout with vertical navigation
- Side Navigation - Unselectable Parent Items — SideNavigation with unselectable parent items.
- InfoLabel in Table — InfoLabel used in content of Table
- Side Navigation - Press Event — SideNavigation with press event parameters and preventDefault.
- Side Navigation - Actions — SideNavigation with a quick create action button.
- Side Navigation - Wrapping of long texts — SideNavigation with long texts that wrap.
- Side Navigation - Overlay Mode — SideNavigation in a responsive popover.
- Tool Page Horizontal and Vertical Navigation — A tool page layout with horizontal navigation (on desktop and tablet) and vertical naviga…
- Tool Page with Horizontal Navigation — A tool page layout with horizontal navigation
On this page