Container Services
Class finesse.containerservices.ContainerServices
Provides container level services for gadget developers. Gadgets can utilize the container dialogs and event handling to add or remove a service.
Example
Methods
activateMyTab()
Activates the tab in the container in which the gadget is present.
activateTab(tabId)
Activates a particular tab in the container.
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
tabId |
String |
The Id (not the label text) of the tab is activated. If the Id is invalid, no action occurs. |
Yes |
addHandler(topic, callback)
Adds a handler for the specific Container Services topic. For more information on topics, see Container Services Topics.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
topic |
String |
Hub topic that the gadget wants to listen to. For more information on topics, see Container Services Topics. |
Yes |
callback |
Function |
An asynchronous callback function that is invoked when the hub topic is notified. |
Yes |
collapseMyGadget()
Collapses the gadget by hiding its contents for gadgets that are collapsible. In the collapsed state, only the gadget header is displayed.
Example
To make the gadget collapsible, add <Optional feature="collapsible"
/>
in to the ModulePrefs inside the gadget XML.
Note | Ensure that the gadget height is set using
|
enableTitleBar()
Displays the title bar for a page-level gadget which is not visible by default. This is not applicable for a tab-level gadget and can be used within a gadget.
Example
expandMyGadget()
Expands the gadget which is collapsed to display its contents.
Example
Note | Ensure that the gadget height is set using
|
getMyGadgetId()
Retrieves the Id of the gadget.
Returns
{Number}
Id of the gadget
getMyGadgetView()
Returns the current view details of the gadget. To identify if the gadget is in canvas (maximized) or default (restored) state, you must use this at the gadget inital load time. In all the other scenarios, gadget can use finesse.containerservices.ContainerServices.Topics.GADGET_VIEW_CHANGED_EVENT
to get to the gadget view change events.
Example
Returns
{Object}
The gadget details that include the following:
-
gadgetId—The Finesse gadget ID
-
tabId—The tab ID of the container or the gadget
-
maxAvailableHeight—Maximum available height that can be used by the gadget iframe
-
view—'canvas' or 'default', where canvas is maximized and default is restored state of a gadget
getMyTabId()
Retrieves the tabId
of the container or gadget.
Returns
{String}
The tabId
of the container or gadget.
hideCertificateBanner(id)
Hides the Certificate Banner. The banner is hidden when all the gadgets that invoked showCertificateBanner
have made a corresponding invocation to hideCertificateBanner
, or when the user closes the banner manually.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
id |
String |
System generated unique ID to identify a banner. This |
Yes, when invoked by a non-gadget client |
hideDialog()
Hides the user interface modal dialog.
Example
hideMyGadget()
Makes the current gadget inaccessible by hiding it from the Multi-Tab gadget header.
Note | This operation has no effect and does not cause any errors when the gadget is not hosted within a Multi-Tab gadget. |
hideMyGadgetNotification()
Removes the current gadget's notifications from the Multi-Tab gadget header.
Note | This operation has no effect and does not cause any errors when the gadget is not hosted within a Multi-Tab gadget. |
init()
Initiates the ContainerServices module.
Note | The init method must be called before using the ContainerServices object for invoking any other functionality. |
Example
Returns
{finesse.containerServices.ContainerServices}
The initiated finesse.containerServices.ContainerServices reference.
isTabbedGadget()
Checks if the gadget is configured inside a multi-tab gadget.
Example
Returns
{Boolean}
True if the gadget is hosted inside a multi-tab gadget.
makeActiveTabReq()
Requests to activate the tab in which the gadget is present.
Example
publish(topic, data)
Publishes data to the specified topic on the OpenAjax hub. Since gadgets reside in different iFrames, message publication is the only way to communicate with each other. This method gives a mechanism for the gadgets to have their data published through custom topics, which in turn can be used by other gadgets by subscribing to the same topic.
For example, OnClick is an element in one gadget which triggers an action in another gadget that is achieved by using this method.
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
topic |
String |
Hub topic that the gadget wants to listen to. For more information on topics, see Container Services Topics. |
Yes |
data |
Object |
The data to be published for the specified topic on the OpenAjax hub. |
Yes |
reloadMyGadget()
Reloads the current gadget. This method is useful when the gadget encounters an error.
Example
reloadMyGadgetFromUrl(url)
Updates the URL for this gadget and reloads the gadget. This method allows the gadget to be reloaded from a different URL which can be useful for third-party gadgets implementing a failover mechanism.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
url |
String |
The URL that the gadget should reload from. |
Yes |
removeHandler(topic, callback)
Removes previously added handler for the specified Container Services topic.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
topic |
String |
Hub topic that the gadget wants to listen to. For more information on topics, see Container Services Topics. |
Yes |
callback |
Function |
An asynchronous callback function to be removed for the specified Container Services topic. |
No |
setMyGadgetTitle(title)
Sets the title of the current gadget.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
title |
String |
The title of the current gadget. |
Yes |
showCertificateBanner(callback)
Displays the Certificate Banner with the message Gadget certificates are yet to be accepted.
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
callback |
Function |
Callback is invoked when user closes the banner manually. |
Yes |
Returns
{String}
id—System generated unique ID to identify a banner. This id
parameter is used by the desktop when the banner has to be invoked by a non-gadget client. Gadgets do not send this parameter.
showDialog(options)
Shows the user interface modal dialog with the specified parameters. The parameters are:
-
Title of the modal dialog
-
Message inside the modal dialog
-
Label for the button to close the modal dialog
-
If the modal dialog should block other dialogs
-
If the modal dialog is draggable
-
If the modal dialog is fixed-size

Note | Custom JavaScript-based modal dialogs and alerts negatively affects the functionality of the Finesse desktop and is not recommended to be used. |
Example
Parameters
Name |
Type |
Description |
Required |
---|---|---|---|
title |
String |
Title of the modal dialog. |
Yes |
options |
Object |
Options for the modal dialog.
|
Yes |
Returns
{Object}
The modal dialog object of the modal dialog DOM (Document
Object Model) element.
showMyGadget()
If hidden, makes the tab corresponding to this gadget visible in the Multi-Tab gadget.
Note | This operation has no effect and does not cause any errors, when the gadget is not hosted within a Multi-Tab gadget. |
Example
showMyGadgetNotification(messageDetails)
When hosted in a Multi-Tab gadget, a notification will appear on the tab corresponding to this gadget.
Note | This operation has no effect and does not cause any errors, when the gadget is not hosted within a Multi-Tab gadget. |
Example
With the parameter
This method shows a visual indication that some new notifications are available in the non-active gadgets. The behavior of the notifications for the non-active gadgets are as follows:
If the navigation pane is not pinned: |
Popover notifications are displayed at the top-right corner of the Task window. |
If the navigation pane is pinned: |
Displays a red dot next to the non-active gadget in the navigation pane. |
If the non-active gadget is part of a multi-tab: |
A red dot is displayed on top of the non-active gadget inside the multi-tab. |
Click on the notified tab or navigation bar to clear the visual indication.
Example:
messageDetails is a method that has the following parameters:
messageFrom, message, isDismissable, timeout, icon, type, pristine
For parameter details see the Notification Popover Service section.
tabVisible()
Retrieves the visibility of the current gadget only after the initialization of the gadget.
Example
Returns
{Boolean}
The visibility of the gadget.