Color Picker - displayMode: Large
Basic example of Color Picker. Note that you have to set the Color Picker mode to HSL to take advantage of the responsiveness of the control on a mobile device.
Z2UI5_CL_SMPC_APP_310
Controls
sap.ui.unified
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_310- Source file
z2ui5_cl_smpc_app_310.clas.abap↗- Library
- sap.ui.unified
- UI5 entity
sap.ui.unified.ColorPicker- Demo kit sample
sap.ui.unified.sample.ColorPickerLarge- 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: colorpicker, color, picker, sap.ui.unified, colorpickerlarge, vbox, button, responsivepopover
Controls it builds
- sap.m.Button
- sap.m.Page
- sap.m.ResponsivePopover
- sap.m.VBox
- sap.ui.core.FragmentDefinition
- sap.ui.core.mvc.View
- sap.ui.unified.ColorPicker
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_310.clas.abap — 115 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords colorpicker color picker sap.ui.unified colorpickerlarge vbox button responsivepopover
" @summary Basic example of Color Picker. Note that you have to set the Color Picker mode to HSL to take advantage of the responsiveness of the control on a mobile device.
CLASS z2ui5_cl_smpc_app_310 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
METHODS popover_colorpicker_display.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_310 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 = `height` v = `100%`
)->a( n = `xmlns` v = `sap.ui.unified`
)->a( n = `xmlns:m` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->ele( n = `Page` ns = `m`
)->a( n = `showHeader` v = `false`
)->a( n = `class` v = `sapUiContentPadding`
)->a( n = `showNavButton` v = `false`
)->ele( n = `VBox` ns = `m`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `ColorPicker`
)->a( n = `id` v = `cp`
)->a( n = `mode` v = `HSL`
)->a( n = `displayMode` v = `Large`
)->tag( n = `Button` ns = `m`
)->a( n = `text` v = `Open ColorPicker in a ResponsivePopover`
)->a( n = `press` v = client->_event( val = `OPEN_POPOVER` arg = `$event.oSource.sId` ) ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `OPEN_POPOVER`.
popover_colorpicker_display( ).
ENDIF.
ENDMETHOD.
METHOD popover_colorpicker_display.
" openPopover builds the ResponsivePopover imperatively (new ResponsivePopover({...}).openBy(button));
" expressed as a core:FragmentDefinition shown anchored via popover_display( xml by_id )
DATA(popover) = z2ui5_cl_ui5_view_builder=>factory( ).
popover->ele( n = `FragmentDefinition` ns = `core`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:core` v = `sap.ui.core`
)->a( n = `xmlns:u` v = `sap.ui.unified`
)->ele( `ResponsivePopover`
)->a( n = `title` v = `Color Picker`
" the phone branch stays a branch: the device> model is served on every
" view slot, so showHeader and the two buttons follow the real device
)->a( n = `showHeader` v = `{= ${device>/system/phone}}`
)->ele( `content`
)->tag( n = `ColorPicker` ns = `u`
)->a( n = `mode` v = `HSL`
)->a( n = `displayMode` v = `Large`
)->end(
)->ele( `beginButton`
)->tag( `Button`
)->a( n = `text` v = `Submit`
)->a( n = `visible` v = `{= ${device>/system/phone}}`
)->a( n = `press` v = client->follow_up_action( client->cs_event-popover_close )
)->end(
)->ele( `endButton`
)->tag( `Button`
)->a( n = `text` v = `Cancel`
)->a( n = `visible` v = `{= ${device>/system/phone}}`
)->a( n = `press` v = client->follow_up_action( client->cs_event-popover_close ) ).
client->popover_display( xml = popover->stringify( )
by_id = client->get_event_arg( ) ).
ENDMETHOD.
ENDCLASS.
More in sap.ui.unified
- Menu Eventing — Menu with Menu Eventing
- Calendar with navigatable legend — An example of adding navigatable legend to the calendar.
- Complex — File Uploader Example with Parameters
- Color Picker Popover — Example of ColorPicker in a popover using the thin wrapper control sap.ui.unified.ColorPi…
- multiple months — Calendar with more than one month
- Date deselection with shortcut for today — An example of recommended implementation of deselection logic when the calendar is in sin…
- Single Interval Selection — Calendar where the user can select an interval or entire week (either by selecting its we…
- Multiple Day Selection — Calendar where the user can select multiple days, entire weeks (either by selecting its w…
- Special Days with Legend — Calendar with special days and legend
- Color Picker - displayMode: Default — Basic example of Color Picker. Note that you have to set the Color Picker mode to HSL to…
- Menu with Selectable Items — Some menu items can be added to groups to allow single or multiple item selection.
- Calendar with aria-haspopup on special day cells — Calendar demonstrating configurable aria-haspopup attribute on individual day cells via D…
On this page