Color Picker - displayMode: Simplified
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_112
Controls
sap.ui.unified
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_112- Source file
z2ui5_cl_smpc_app_112.clas.abap↗- Library
- sap.ui.unified
- UI5 entity
sap.ui.unified.ColorPicker- Demo kit sample
sap.ui.unified.sample.ColorPickerSimplified- 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, selection, 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_112.clas.abap — 106 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 selection 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_112 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_smpc_app_112 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.ui.unified`
)->a( n = `xmlns:m` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `height` v = `100%`
)->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 = `Simplified`
)->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`.
" original openPopover: a controller-built ResponsivePopover with an
" HSL/Simplified ColorPicker, opened by the pressed button; the
" Device.system.phone branch (Submit/Cancel buttons vs no header) is
" expressed via device> model bindings instead of a JS branch
DATA(popover) = z2ui5_cl_ui5_view_builder=>factory( ).
popover->ele( n = `FragmentDefinition` ns = `core`
)->a( n = `xmlns:core` v = `sap.ui.core`
)->a( n = `xmlns:u` v = `sap.ui.unified`
)->a( n = `xmlns` v = `sap.m`
)->ele( `ResponsivePopover`
)->a( n = `title` v = `Color Picker`
)->a( n = `showHeader` v = `{device>/system/phone}`
)->ele( `content`
)->tag( n = `ColorPicker` ns = `u`
)->a( n = `mode` v = `HSL`
)->a( n = `displayMode` v = `Simplified`
)->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( ) ).
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.ui.unified
- Basic — Basic File Uploader Example
- Single Day Selection — Calendar where the user can select a single day
- calendar type — islamic Calendar with secondary gregorian type
- Currency in Table — Display Currencies in Table
- simple example — CalendarDateInterval with 14 days and single day selection
- Currency — Display Currencies with proper Alignment
- calendar - min., max., disabled and show/hide week numbers — Calendar with minimum date 2000-01-01 and maximum date 2050-12-31, some disabled days (in…
- Item Eventing — Menu with Item Eventing
- 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…
On this page