Abstract Class sap.ui.core.ControlModule: sap/ui/core/Control
Base Class for Controls.
sId
and settings.fieldGroupIds
of a control was left or the user explicitly pressed a validation key combination.sClassName
and enriches it with the information contained in oClassInfo
.fnFunction
to the validateFieldGroup
event of this sap.ui.core.Control
.fnFunction
from the validateFieldGroup
event of this sap.ui.core.Control
.this
control into the specified container (oRef
) at the given position (oPosition
).sId
and settings. The set of allowed entries in the mSettings
object depends on the concrete subclass and is described there. See sap.ui.core.Element for a general description of this argument.
The settings supported by Control are:
- Properties
- busy : boolean (default: false)
- busyIndicatorDelay : int (default: 1000)
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- busy : boolean (default: false)
- busyIndicatorDelay : int (default: 1000)
- visible : boolean (default: true)
- fieldGroupIds : string[] (default: [])
- Events
- validateFieldGroup : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Element can be used as well.
{string} | sId? | optional id for the new control; generated automatically if no non-empty id is given Note: this can be omitted, no matter whether mSettings will be given or not! |
{object} | mSettings? | optional map/JSON-object with initial settings for the new control |
fieldGroupIds
of a control was left or the user explicitly pressed a validation key combination. Use this event to validate data of the controls belonging to a field group. {sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{string[]} | oControlEvent.getParameters.fieldGroupIds | field group IDs of the logical field groups to validate |
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.core.Element.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
This method is intended to be used to mark controls as being of a special type for which special styling can be provided using CSS selectors that reference this style class name.
Example: myButton.addStyleClass("myRedTextButton"); // add a CSS class to one button instance ...and in CSS: .myRedTextButton { color: red; }
This will add the CSS class "myRedTextButton" to the Button HTML and the CSS code above will then make the text in this particular button red.
Only characters allowed inside HTML attributes are allowed. Quotes are not allowed and this method will ignore any strings containing quotes. Strings containing spaces are interpreted as multiple custom style classes which are split by space and can be removed individually later by calling removeStyleClass. Multiple calls with the same sStyleClass will have no different effect than calling once. If sStyleClass is null, empty string or it contains quotes, the call is ignored.
{string} | sStyleClass | the CSS class name to be added |
{sap.ui.core.Control} | Returns this to allow method chaining |
true
as long as this method has not been called. Note:This only works in IE and Safari; for Firefox the element's style must be set to:
-moz-user-select: none;in order to prevent text selection.
{boolean} | bAllow | whether to allow text selection or not |
{sap.ui.core.Control} | Returns this to allow method chaining |
IMPORTANT: This should be only used as FALLBACK when the Control events do not cover a specific use-case! Always try using SAPUI5 control events, as e.g. accessibility-related functionality is then provided automatically. E.g. when working with a sap.ui.commons.Button, always use the Button's "press" event, not the native "click" event, because "press" is also guaranteed to be fired when certain keyboard activity is supposed to trigger the Button.
In the event handler, "this" refers to the Control - not to the root DOM element like in jQuery. While the DOM element can be used and modified, the general caveats for working with SAPUI5 control DOM elements apply. In particular the DOM element may be destroyed and replaced by a new one at any time, so modifications that are required to have permanent effect may not be done. E.g. use Control.addStyleClass() instead if the modification is of visual nature.
Use detachBrowserEvent() to remove the event handler(s) again.
{string} | sEventType? | A string containing one or more JavaScript event types, such as "click" or "blur". |
{function} | fnHandler? | A function to execute each time the event is triggered. |
{object} | oListener? | The object, that wants to be notified, when the event occurs |
{sap.ui.core.Control} | Returns this to allow method chaining |
fnFunction
to the validateFieldGroup
event of this sap.ui.core.Control
. When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.Control
itself.
Event is fired if a logical field group defined by fieldGroupIds
of a control was left or the user explicitly pressed a validation key combination. Use this event to validate data of the controls belonging to a field group.
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.Control itself |
{sap.ui.core.Control} | Reference to this in order to allow method chaining |
vFieldGroupIds
is not given it checks whether at least one field group ID is given for this control. If vFieldGroupIds
is an empty array or empty string, true is returned if there is no field group ID set for this control. If vFieldGroupIds
is a string array or a string all expected field group IDs are checked and true is returned if all are contained for given for this control. The comma delimiter can be used to seperate multiple field group IDs in one string. {string|string[]} | vFieldGroupIds? | ID of the field group or an array of field group IDs to match |
{boolean} | true if a field group ID matches |
The additionally cloned information contains:
- browser event handlers attached with attachBrowserEvent
- text selection behavior
- style classes added with addStyleClass
{string} | sIdSuffix? | a suffix to be appended to the cloned element id |
{string[]} | aLocalIds? | an array of local IDs within the cloned hierarchy (internally used) |
{sap.ui.core.Element} | reference to the newly created clone |
Note: listeners are only removed, if the same combination of event type, callback function and context object is given as in the call to attachBrowserEvent
.
{string} | sEventType? | A string containing one or more JavaScript event types, such as "click" or "blur". |
{function} | fnHandler? | The function that is to be no longer executed. |
{object} | oListener? | The context object that was given in the call to attachBrowserEvent. |
fnFunction
from the validateFieldGroup
event of this sap.ui.core.Control
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
{sap.ui.core.Control} | Reference to this in order to allow method chaining |
validateFieldGroup
to attached listeners. Expects the following event parameters:
fieldGroupIds
of typestring[]
field group IDs of the logical field groups to validate
{Map} | mArguments? | The arguments to pass along with the event |
{sap.ui.core.Control} | Reference to this in order to allow method chaining |
Applications must not call this hook method directly, it is called by the framework.
Subclasses of Control should implement this hook to provide any necessary accessibility information:
MyControl.prototype.getAccessibilityInfo = function() { return { role: "textbox", // String which represents the WAI-ARIA role which is implemented by the control. type: "date input", // String which represents the control type (Must be a translated text). Might correlate with // the role. description: "value", // String which describes the most relevant control state (e.g. the inputs value). Must be a // translated text. // Note: The type and the enabled/editable state must not be handled here. focusable: true, // Boolean which describes whether the control can get the focus. enabled: true, // Boolean which describes whether the control is enabled. If not relevant it must not be set or //null
can be provided. editable: true, // Boolean which describes whether the control is editable. If not relevant it must not be set or //null
can be provided. children: [] // Array of accessibility info objects of children of the given control (e.g. when the control is a layout). // Note: Children should only be provided when it is helpful to understand the accessibility context // (e.g. a form control must not provide details of its internals (fields, labels, ...) but a // layout should). }; };
Note: The returned object provides the accessibility state of the control at the point in time when this function is called.
- Since:
- 1.37.0
{object} | Current accessibility state of the control. |
busy
. Whether the control is currently in busy state.
Default value is false
.
{boolean} | Value of property busy |
busyIndicatorDelay
. The delay in milliseconds, after which the busy indicator will show up for this control.
Default value is 1000
.
{int} | Value of property busyIndicatorDelay |
vFieldGroupIds
parameter. Associated controls are not taken into account. {string|string[]} | vFieldGroupIds? | ID of the field group or an array of field group IDs to match |
{sap.ui.core.Control[]} | The list of controls with a field group ID |
{string[]} | copy of the field group IDs |
By default, this is the Id of the control itself.
{string} | Id to be used for the labelFor |
It is retrieved using the RenderManager as done during rendering.
{object} | a Renderer suitable for this Control instance. |
visible
. Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control
Default value is true
.
{boolean} | Value of property visible |
{string} | sStyleClass | the style to check for |
{boolean} |
As sap.ui.core.Element
"bubbles up" the invalidate, changes to children potentially result in rerendering of the whole sub tree.
{object} | oOrigin |
Applications must not call this hook method directly, it is called by the framework.
Subclasses of Control should override this hook to implement any necessary actions after the rendering.
Applications must not call this hook method directly, it is called by the framework.
Subclasses of Control should override this hook to implement any necessary actions before the rendering.
this
control into the specified container (oRef
) at the given position (oPosition
). First it is checked whether oRef
is a container element / control (has a multiple aggregation with type sap.ui.core.Control
and name 'content') or is an Id String of such an container. If this is not the case oRef
can either be a Dom Reference or Id String of the UIArea (if it does not yet exist implicitly a new UIArea is created),
The oPosition
can be one of the following:
- "first": The control is added as the first element to the container.
- "last": The control is added as the last element to the container (default).
- "only": All existing children of the container are removed (not destroyed!) and the control is added as new child.
- index: The control is added at the specified index to the container.
{string|Element|sap.ui.core.Control} | oRef | container into which the control should be put |
{string|int} | oPosition | Describes the position where the control should be put into the container |
{sap.ui.core.Control} | Returns this to allow method chaining |
{string} | sStyleClass | the style to be removed |
{sap.ui.core.Control} | Returns this to allow method chaining |
{boolean} | bBusy | The new busy state to be set |
{sap.ui.core.Control} | this to allow method chaining |
{int} | iDelay | The delay in ms |
{sap.ui.core.Control} | this to allow method chaining |
fieldGroupIds
. The IDs of a logical field group that this control belongs to. All fields in a logical field group should share the same fieldGroupId
. Once a logical field group is left, the validateFieldGroup event is raised.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is []
.
{string[]} | sFieldGroupIds | New value for property fieldGroupIds |
- Since:
- 1.31
{sap.ui.core.Control} | Reference to this in order to allow method chaining |
visible
. Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bVisible | New value for property visible |
{sap.ui.core.Control} | Reference to this in order to allow method chaining |
See addStyleClass and removeStyleClass for further documentation.
{string} | sStyleClass | the CSS class name to be added or removed |
{boolean} | bAdd | whether sStyleClass should be added (or removed); when this parameter is not given, sStyleClass will be toggled (removed, if present, and added if not present) |
{sap.ui.core.Control} | Returns this to allow method chaining |
UIArea._oFieldGroupValidationKey
{sap.ui.core.Control.attachValidateFieldGroup} |