Helper functionality for enhancement of a Label
with common label functionality.
Node | Description |
---|
Method | Description |
---|---|
sap.ui.core.LabelEnablement.enrich |
This function should be called on a label control to enrich its functionality. Usage: The function can be called with a control prototype: Preconditions: The given control must implement the interface sap.ui.core.Label and have an association 'labelFor' with cardinality 0..1. This function extends existing API functions. Ensure not to override these extensions AFTER calling this function. What does this function do? A mechanism is added that ensures that a bidirectional reference between the label and its labeled control is established: The label references the labeled control via the HTML 'for' attribute (@see sap.ui.core.LabelEnablement#writeLabelForAttribute). If the labeled control supports the aria-labelledby attribute, a reference to the label is added automatically. In addition an alternative to apply a 'for' reference without influencing the labelFor association of the API is applied (e.g. used by Form). For this purpose the functions setAlternativeLabelFor and getLabelForRendering are added. |
sap.ui.core.LabelEnablement.getReferencingLabels |
Returns an array of IDs of the labels referencing the given element. |
sap.ui.core.LabelEnablement.isRequired |
Returns |
sap.ui.core.LabelEnablement.writeLabelForAttribute |
Helper function for the This function should be called at the desired location in the renderer code of the As this method renders an attribute, it can only be called while a start tag is open. For the new semantic rendering API, this means it can only be called between an |
This function should be called on a label control to enrich its functionality.
Usage: The function can be called with a control prototype: sap.ui.core.LabelEnablement.enrich(my.Label.prototype);
Or the function can be called on instance level in the init function of a label control: my.Label.prototype.init: function(){ sap.ui.core.LabelEnablement.enrich(this); }
Preconditions: The given control must implement the interface sap.ui.core.Label and have an association 'labelFor' with cardinality 0..1. This function extends existing API functions. Ensure not to override these extensions AFTER calling this function.
What does this function do?
A mechanism is added that ensures that a bidirectional reference between the label and its labeled control is established: The label references the labeled control via the HTML 'for' attribute (@see sap.ui.core.LabelEnablement#writeLabelForAttribute). If the labeled control supports the aria-labelledby attribute, a reference to the label is added automatically.
In addition an alternative to apply a 'for' reference without influencing the labelFor association of the API is applied (e.g. used by Form). For this purpose the functions setAlternativeLabelFor and getLabelForRendering are added.
Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | sap.ui.core.Control |
the label control which should be enriched with further label functionality. |
Returns an array of IDs of the labels referencing the given element.
Param | Type | DefaultValue | Description |
---|---|---|---|
oElement | sap.ui.core.Element |
The element whose referencing labels should be returned |
Returns true
when the given control is required (property 'required') or one of its referencing labels, false
otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oElement | sap.ui.core.Element |
The element which should be checked for its required state |
Helper function for the Label
control to render the HTML 'for' attribute.
This function should be called at the desired location in the renderer code of the Label
control. It can be used with both rendering APIs, with the new semantic rendering API (apiVersion 2
) as well as with the old, string-based API.
As this method renders an attribute, it can only be called while a start tag is open. For the new semantic rendering API, this means it can only be called between an openStart/voidStart
call and the corresponding openEnd/voidEnd
call. In the context of the old rendering API, it can be called only after the prefix of a start tag has been written (e.g. after rm.write("<span id=\"foo\"");
), but before the start tag ended, e.g before the right-angle ">" of the start tag has been written.
Param | Type | DefaultValue | Description |
---|---|---|---|
oRenderManager | sap.ui.core.RenderManager |
The RenderManager that can be used for rendering. |
|
oLabel | sap.ui.core.Label |
The |