Provides application-level functions and services to an integration card.
Examples may include, but are not limited to options like: share a card, remove a card.
Constructor for a new Host
.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.ui.integration.Host(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new host, generated automatically if no ID is given. |
|
mSettings? | object | Initial settings for the new host. |
Name | Type | Default Value | Description |
---|---|---|---|
actions | sap.ui.integration.CardMenuAction[] | The actions configuration. Visibility: public |
|
resolveDestination | function | A function that resolves the given destination name to a URL. The Card calls this function when it needs to send a request to a destination. Function returns the URL to which the request is sent. If a card depends on a destination, but this callback is not implemented, an error will be logged. The callback receives |
Event | Description |
---|---|
action |
Fired when an action is triggered. Listeners may prevent the default action of this event by calling the |
cardConfigurationChange |
Fired when some card configuration settings are changed as a result of user interaction. For example - filter value is changed. |
message |
Fired when a message from channels like navigator.serviceWorker is received. |
Fired when an action is triggered.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
card | sap.ui.core.Control |
The card the action is fired from. |
actionConfig | object |
The action configuration. |
actionSource | sap.ui.core.Control |
The action source. |
parameters | object |
The parameters related to the triggered action. |
type | sap.ui.integration.CardActionType |
The type of the action. |
Fired when some card configuration settings are changed as a result of user interaction. For example - filter value is changed.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
card | sap.ui.core.Control |
The card the changes are fired from. |
changes | object |
Changed configuration settings. Example: { "/sap.card/configuration/filters/shipper/value": "key3", "/sap.card/configuration/filters/item/value": "key2" } |
Method | Description |
---|---|
attachAction |
Attaches event handler When called, the context of the event handler (its Fired when an action is triggered. |
attachCardConfigurationChange |
Attaches event handler When called, the context of the event handler (its Fired when some card configuration settings are changed as a result of user interaction. For example - filter value is changed. |
attachMessage |
Attaches event handler When called, the context of the event handler (its Fired when a message from channels like navigator.serviceWorker is received. |
detachAction |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachCardConfigurationChange |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachMessage |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.integration.Host.extend |
Creates a new subclass of class sap.ui.integration.Host with name
|
fireAction |
Fires event action to attached listeners. Listeners may prevent the default action of this event by calling the |
fireCardConfigurationChange |
Fires event cardConfigurationChange to attached listeners. |
fireMessage |
Fires event message to attached listeners. |
getActions |
Gets current value of property actions. The actions configuration. |
getContexts |
Returns the context object for the Card Editor design-time environment Contexts can be used to configure Cards with information available in the host environment. Each entry in the list should contain design-time information. A label, placeholder, and description should be provided. Example Context Structure: { "sap.workzone": { "currentUser: { "id": { "label": "Id of the Work Zone user", "placeholder": "Work Zone user id", "description": "The value will change based on the logged on user" } } } ... } The context information and texts should be translated as they appear in the design-time UI of the Card Editor. |
getContextValue |
Resolves the value for a given path in the context of the host Contexts can be used to configure Cards with information available in the host environment. Example Context Structure: { "sap.workzone": { "currentUser: { "id": { "label": "Id of the Work Zone user", "placeholder": "Work Zone user id", "description": "The value will change based on the logged on user" } } } ... } Example path to the current user id of the context sPath = "sap.workzone/currentUser/id" parameter: { userId: { value: "{context>sap.workzone/currentUser/id}" resolves to UserId } } |
getDestination |
Resolves the destination and returns its URL. |
getDestinations |
Returns the list of destinations for the Card Editor design-time environment List entries are objects that contain at least the name. { "name": "DestinationName" } |
sap.ui.integration.Host.getMetadata |
Returns a metadata object for class sap.ui.integration.Host. |
getResolveDestination |
Gets current value of property resolveDestination. A function that resolves the given destination name to a URL. The Card calls this function when it needs to send a request to a destination. Function returns the URL to which the request is sent. If a card depends on a destination, but this callback is not implemented, an error will be logged. The callback receives |
modifyRequestHeaders |
Modify request headers before sending a data request. Override if you need to change the default cache headers behavior. |
setActions |
Sets a new value for property actions. The actions configuration. When called with a value of |
setResolveDestination |
Sets a new value for property resolveDestination. A function that resolves the given destination name to a URL. The Card calls this function when it needs to send a request to a destination. Function returns the URL to which the request is sent. If a card depends on a destination, but this callback is not implemented, an error will be logged. The callback receives When called with a value of |
stopUsingExperimentalCaching |
Stops the usage of the experimental caching for all cards. |
subscribeForMessages |
By default subscribes to navigator.serviceWorker messages. Override to subscribe to different channels. |
unsubscribeForMessages |
Unsubscribes from navigator.serviceWorker messages. |
useExperimentalCaching |
Call this method if you want to use the experimental caching for all cards. |
Attaches event handler fnFunction
to the action event of this sap.ui.integration.Host
.
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.integration.Host
itself.
Fired when an action is triggered.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Attaches event handler fnFunction
to the cardConfigurationChange event of this sap.ui.integration.Host
.
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.integration.Host
itself.
Fired when some card configuration settings are changed as a result of user interaction. For example - filter value is changed.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Attaches event handler fnFunction
to the message event of this sap.ui.integration.Host
.
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.integration.Host
itself.
Fired when a message from channels like navigator.serviceWorker is received.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Detaches event handler fnFunction
from the action event of this sap.ui.integration.Host
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches event handler fnFunction
from the cardConfigurationChange event of this sap.ui.integration.Host
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches event handler fnFunction
from the message event of this sap.ui.integration.Host
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.ui.integration.Host with name 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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event action to attached listeners.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object. The return value of this method indicates whether the default action should be executed.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
card | sap.ui.core.Control |
The card the action is fired from. |
|
actionConfig | object |
The action configuration. |
|
actionSource | sap.ui.core.Control |
The action source. |
|
parameters | object |
The parameters related to the triggered action. |
|
type | sap.ui.integration.CardActionType |
The type of the action. |
Fires event cardConfigurationChange to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
card | sap.ui.core.Control |
The card the changes are fired from. |
|
changes | object |
Changed configuration settings. Example: { "/sap.card/configuration/filters/shipper/value": "key3", "/sap.card/configuration/filters/item/value": "key2" } |
Fires event message to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
data | object |
Returns the context object for the Card Editor design-time environment Contexts can be used to configure Cards with information available in the host environment. Each entry in the list should contain design-time information. A label, placeholder, and description should be provided.
Example Context Structure: { "sap.workzone": { "currentUser: { "id": { "label": "Id of the Work Zone user", "placeholder": "Work Zone user id", "description": "The value will change based on the logged on user" } } } ... }
The context information and texts should be translated as they appear in the design-time UI of the Card Editor.
Resolves the value for a given path in the context of the host Contexts can be used to configure Cards with information available in the host environment.
Example Context Structure: { "sap.workzone": { "currentUser: { "id": { "label": "Id of the Work Zone user", "placeholder": "Work Zone user id", "description": "The value will change based on the logged on user" } } } ... }
Example path to the current user id of the context sPath = "sap.workzone/currentUser/id" parameter: { userId: { value: "{context>sap.workzone/currentUser/id}" resolves to UserId } }
Param | Type | DefaultValue | Description |
---|---|---|---|
sPath | string |
The path to a context |
Resolves the destination and returns its URL.
Param | Type | DefaultValue | Description |
---|---|---|---|
sDestinationName | string |
The name of the destination. Most often the name which is used in the SAP Cloud Platform. |
Returns the list of destinations for the Card Editor design-time environment List entries are objects that contain at least the name. { "name": "DestinationName" }
Gets current value of property resolveDestination.
A function that resolves the given destination name to a URL.
The Card calls this function when it needs to send a request to a destination. Function returns the URL to which the request is sent.
If a card depends on a destination, but this callback is not implemented, an error will be logged.
The callback receives destinationName
as parameter and returns a string with the URL. Or alternatively the callback may return a Promise
with the URL as an argument.
Modify request headers before sending a data request. Override if you need to change the default cache headers behavior.
Param | Type | DefaultValue | Description |
---|---|---|---|
mHeaders | Object<string,any> |
The current map of headers. |
|
mSettings | Object<string,any> |
The map of request settings defined in the card manifest. |
|
oCard | sap.ui.integration.widgets.Card |
The card for which the request is made. |
Sets a new value for property actions.
The actions configuration.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sActions | sap.ui.integration.CardMenuAction[] |
New value for property |
Sets a new value for property resolveDestination.
A function that resolves the given destination name to a URL.
The Card calls this function when it needs to send a request to a destination. Function returns the URL to which the request is sent.
If a card depends on a destination, but this callback is not implemented, an error will be logged.
The callback receives destinationName
as parameter and returns a string with the URL. Or alternatively the callback may return a Promise
with the URL as an argument.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnResolveDestination | function |
New value for property |