Class finesse.containerservices.ContainerServices
This class provides container-level services for gadget developers, exposing container events by
calling a set of exposed functions. Gadgets can utilize the container dialogs and
event handling (add/remove).
Defined in: finesse.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
Make a request to set this container's tab active.
|
|
activateTab(tabId)
Make a request to set a particular tab active.
|
|
addHandler(topic, callback)
Adds a handler for one of the supported topics provided by ContainerServices.
|
|
collapseMyGadget method allows the gadget to collapse itself.
|
|
expandMyGadget method allows the gadget to expand itself.
|
|
Gets the id of the gadget.
|
|
Get the tabId of my container/gadget.
|
|
Request to hide the Certificate Banner.
|
|
Hides the UI Dialog.
|
|
init(master)
Initialize ContainerServices for use in gadget.
|
|
Make a request to check the current tab.
|
|
publish(topic, data)
Wrapper API for publishing data on the Openajax hub
|
|
Reloads the current gadget.
|
|
Updates the url for this gadget and then reload it.
|
|
removeHandler(topic, callback)
Removes a previously-added handler for one of the supported topics.
|
|
showCertificateBanner(callback)
Shows the Certificate Banner with message "Gadget certificates are yet to be accepted.
|
|
showDialog(options)
Shows the UI Dialog with the specified parameters.
|
|
Returns the visibility of current gadget.
|
Class Detail
finesse.containerservices.ContainerServices()
containerServices = finesse.containerservices.ContainerServices.init(); containerServices.addHandler( finesse.containerservices.ContainerServices.Topics.ACTIVE_TAB, function() { clientLogs.log("Gadget is now visible"); // log to Finesse logger // automatically adjust the height of the gadget to show the html gadgets.window.adjustHeight(); }); containerServices.makeActiveTabReq();
Method Detail
activateMyTab()
Make a request to set this container's tab active.
This will sent request to activate the tab in which
gadget is present.
containerServices.activateMyTab();
activateTab(tabId)
Make a request to set a particular tab active.
containerServices.activateTab(tabId);
- Parameters:
- {String} tabId
- The tabId (not the label text) of the tab to make active. If the id is invalid, no action will occur.
addHandler(topic, callback)
Adds a handler for one of the supported topics provided by ContainerServices. The callbacks provided
will be invoked when that topic is notified.
containerServices.addHandler( finesse.containerservices.ContainerServices.Topics.ACTIVE_TAB, function() { clientLogs.log("Gadget is now visible"); // log to Finesse logger // automatically adjust the height of the gadget to show the html gadgets.window.adjustHeight(); });
- Parameters:
- {String} topic
- The Hub topic to which we are listening.
- {Function} callback
- The callback function to invoke.
- See:
- finesse.containerservices.ContainerServices.Topics
- finesse.containerservices.ContainerServices#removeHandler
collapseMyGadget()
collapseMyGadget method allows the gadget to collapse itself. In collapse state, only gadget header will be displayed.
To enable collapsible feature for any gadget add below gadget ModulePrefs inside the gadget code.
expandMyGadget()
expandMyGadget method allows the gadget to expand itself.
To enable collapsible feature for any gadget add below gadget ModulePrefs inside the gadget code.
{number}
getMyGadgetId()
Gets the id of the gadget.
containerServices.getMyGadgetId();
- Returns:
- {number} the id of the gadget
{String}
getMyTabId()
Get the tabId of my container/gadget.
containerServices.getMyTabId();
- Returns:
- {String} tabid : The tabid of this container/gadget.
hideCertificateBanner(id)
Request to hide the Certificate Banner.
The banner will be hidden when all gadgets which invoked showCertificateBanner
have made a corresponding invocation to hideCertificateBanner, or when the user closes the banner manually.
// For Gadgets // containerServices = finesse.containerservices.ContainerServices.init(); containerServices.hideCertificateBanner(); // For non gadget Client containerServices.hideCertificateBanner(id);
- Parameters:
- {String} id Optional
- Note : Gadgets do not need to send the id parameter. The id is used by the desktop in scenarios where the banner has to be invoked by a non-gadget client.
hideDialog()
Hides the UI Dialog.
// containerServices = finesse.containerservices.ContainerServices.init(); containerServices.hideDialog();
init(master)
Initialize ContainerServices for use in gadget.
- Parameters:
- {Boolean} master Optional, Default: false
- Do not use this parameter from your gadget.
- Returns:
- ContainerServices instance.
makeActiveTabReq()
Make a request to check the current tab. The
activeTab event will be invoked if on the active tab. The
handler for activeTab can be added using finesse.containerservices.ContainerServices#addHandler
with TOPIC 'ACTIVE_TAB'
Called by default when ContainerServices is initialized,
i.e. finesse.containerservices.ContainerServices.init();
containerServices.makeActiveTabReq();
publish(topic, data)
Wrapper API for publishing data on the Openajax hub
containerServices.publish('TOPIC_NAME',data);
- Parameters:
- {String} topic
- The Hub topic to which we are publishing.
- {Object} data
- The data to be published on the hub.
reloadMyGadget()
Reloads the current gadget.
For use from within a gadget only.
// containerServices = finesse.containerservices.ContainerServices.init(); containerServices.reloadMyGadget();
reloadMyGadgetFromUrl(url)
Updates the url for this gadget and then reload it.
This allows the gadget to be reloaded from a different location
than what is uploaded to the current server. For example, this
would be useful for 3rd party gadgets to implement their own failover
mechanisms.
For use from within a gadget only.
// containerServices = finesse.containerservices.ContainerServices.init(); containerServices.reloadMyGadgetFromUrl(url);
- Parameters:
- {String} url
- url from which to reload gadget
removeHandler(topic, callback)
Removes a previously-added handler for one of the supported topics.
containerServices.removeHandler( finesse.containerservices.ContainerServices.Topics.ACTIVE_TAB, function() { clientLogs.log("Gadget is now visible"); // log to Finesse logger // automatically adjust the height of the gadget to show the html gadgets.window.adjustHeight(); });
- Parameters:
- {String} topic
- The Hub topic from which we are removing the callback.
- {Function} callback
- The name of the callback function to remove.
- See:
- finesse.containerservices.ContainerServices.Topics
- finesse.containerservices.ContainerServices#addHandler
{String}
showCertificateBanner(callback)
Shows the Certificate Banner with message "Gadget certificates are yet to be accepted."
// For Gadgets // containerServices = finesse.containerservices.ContainerServices.init(); containerServices.showCertificateBanner(callback); // For non gadget Client , id is required to hide the certificate banner // which is returned when showCertificateBanner is called var id = containerServices.showCertificateBanner(callback);
- Parameters:
- {Function} callback Optional
- Callback is invoked when user closes the banner manually.
- Returns:
- {String} id Note : Gadgets calling showCertificateBanner can ignore the return value as it is not required.
showDialog(options)
Shows the UI Dialog with the specified parameters.
// containerServices = finesse.containerservices.ContainerServices.init(); containerServices.showDialog( {title:'Error Occurred',message: 'Something went wrong', close: {Function} }); NoteIn case of SPOG like containers, _container.showDialog will not be present. in this case fallback dialog is used
- Parameters:
- {Object} options
- An object containing additional options for the dialog.
- {String} options.title
- Title to use.
- {Function} options.close
- A function to invoke when the dialog is closed.
- {String} options.message
- The message to display in the dialog.
- {Boolean} options.isBlocking
- Flag indicating whether this dialog will block other dialogs from being shown (Modal).
{Boolean}
tabVisible()
Returns the visibility of current gadget. Note that this
will not be set until after the initialization of the gadget.
containerServices.tabVisible();
- Returns:
- {Boolean} The visibility of current gadget.