Class: PortletInit

PortletInit()

PortletInit

Constructor

new PortletInit()

Source:

Methods

(protected) _executeAction(parameters, element)

Performs the actual action.
Parameters:
Name Type Description
parameters Object Additional parameters to be set.
element HTMLFormElement Form to be submitted. May be null.
Source:

(protected) _hasListener(portletId) → {boolean}

Returns true if an onStateChange listener is registered for the portlet.
Parameters:
Name Type Description
portletId string The portlet ID.
Source:
Returns:
Returns true if a listener is registered.
Type
boolean

(protected) _reportError(portletId, err)

Sends an onError event to all registered error event handlers for a given portlet.
Parameters:
Name Type Description
portletId string The portlet ID.
err string The error message.
Source:

(protected) _setPageState(portletId, updateString)

Callback function that must be called after a partial action has been started. The page state is generated by the portal and transmitted to the client by the portlet. The portlet client that initiated the partial action must pass the page state string to this function. The callback should only be called once to conclude a partial action sequence.
Parameters:
Name Type Description
portletId string The portlet ID.
updateString string The new page state in string form.
Source:
Throws:
Thrown if the parameter is not a string.
Type
TypeError

(protected) _setState(state) → {Array}

Sets state for the portlet. returns array of IDs for portlets that were affected by the change, taking into account the public render parameters.
Parameters:
Name Type Description
state Object The state to be set.
Source:
Returns:
Type
Array

(protected) _setupAction(parameters, element)

Sets up for the action.
Parameters:
Name Type Description
parameters Object Additional parameters. May be null.
element HTMLFormElement Form to be submitted May be null.
Source:
Throws:
  • Thrown if a blocking operation is already in progress.
    Type
    AccessDeniedException
  • Thrown if a portlet ID is provided, but no onStateChange listener has been registered.
    Type
    NotInitializedException

(protected) _updateHistory(replace)

Called when the page state has been updated to allow the browser history to be taken care of.
Parameters:
Name Type Description
replace boolean Replace the state rather than pushing.
Source:

_updatePageState(updateString)

Update page state passed in after partial action. The list of ID's of updated portlets is passed back through a promise in order to decouple the layers.
Parameters:
Name Type Description
updateString string The updated render state string.
Source:

(protected) _updatePageStateFromString(updateString, portletId)

Updates page state from string and returns array of portlet IDs to be updated.
Parameters:
Name Type Description
updateString string The update string.
portletId string The portlet ID.
Source:

(protected) _updatePortletStates(updatedIds) → {Promsise.<string>}

Accepts an object containing changed render states. Updates the state for each portlet present.
Parameters:
Name Type Description
updatedIds Array Array of portlet IDs to be updated.
Source:
Returns:
Type
Promsise.<string>

(protected) _updateState(state)

Updates the page render state
Parameters:
Name Type Description
state Object The new state to be set.
Source:

(protected) _updateStateForPortlet(portletId)

Calls the portlet onStateChange method in an asynchronous manner in order to decouple the public API. This method is intended for use after portlet client registers an onStateChange listener.
Parameters:
Name Type Description
portletId string The portlet ID.
Source:

action(parameters, element) → {Promise}

Initiates a portlet action using the specified action parameters and element arguments.
Parameters:
Name Type Description
parameters PortletParameters Action parameters to be added to the URL
element HTMLFormElement DOM element of form to be submitted
Source:
Throws:
  • Thrown if the input parameters are invalid
    Type
    TypeError
  • Thrown if a blocking operation is already in progress.
    Type
    AccessDeniedException
  • Thrown if a portlet ID is provided, but no onStateChange listener has been registered.
    Type
    NotInitializedException
Returns:
A Promise object that is resolved with no argument when the action request has completed.
Type
Promise

addEventListener(type, handler) → {Object}

Adds a listener function for specified event type.
Parameters:
Name Type Description
type string The type of listener
handler function Function called when event occurs
Source:
Throws:
Thrown if the input parameters are invalid
Type
TypeError
Returns:
A handle that can be used to remove the event listener
Type
Object

createResourceUrl(parameters, cache, resourceId) → {Promise}

Returns a promise for a resource URL with parameters set appropriately for the page state according to the resource parameters, cacheability option, and resource ID provided.
Parameters:
Name Type Description
parameters Object Resource parameters to be added to the URL
cache string Cacheability option. The strings defined under PortletConstants should be used to specifiy cacheability.
resourceId string Resource ID.
Source:
Throws:
Thrown if the input parameters are invalid
Type
TypeError
Returns:
A Promise object. Returns a string representing the resource URL on successful resolution. Returns an Error object containing a descriptive message on failure.
Type
Promise

dispatchClientEvent(type, payload) → {number}

Dispatches a client event.
Parameters:
Name Type Description
type string The type of listener.
payload any The payload to be delivered.
Source:
Throws:
Thrown if the type is a system event type.
Type
TypeError
Returns:
The number of events queued for delivery.
Type
number

isInProgress() → {boolean}

Tests whether a blocking operation is in progress.
Source:
Returns:
Type
boolean

newParameters(optParametersnullable) → {Object}

Creates and returns a new PortletParameters object.
Parameters:
Name Type Attributes Description
optParameters Object <nullable>
The optional parameters to be copied.
Source:
Returns:
The new parameters object.
Type
Object

newState(optStatenullable) → {RenderState}

Creates and returns a new RenderState object.
Parameters:
Name Type Attributes Description
optState RenderState <nullable>
An optional RenderState object to be copied.
Source:
Returns:
The new RenderState object.
Type
RenderState

removeEventListener(handle)

Removes a previously added listener function designated by the handle. The handle must be the same object previously returned by the addEventListener function.
Parameters:
Name Type Description
handle Object The handle of the listener to be removed.
Source:
Throws:
  • Thrown if the input parameters are invalid.
    Type
    TypeError
  • Thrown if the event listener associated with this handle was registered by a different portlet.
    Type
    AccessDeniedException

setRenderState(state)

Sets the render state, which consists of the public and private render parameters, the portlet mode, and the window state.
Parameters:
Name Type Description
state RenderState The new state to be set.
Source:
Throws:
  • Thrown if the input parameters are invalid.
    Type
    TypeError
  • Thrown if a blocking operation is already in progress.
    Type
    AccessDeniedException
  • Thrown if a portlet ID is provided, but no onStateChange listener has been registered.
    Type
    NotInitializedException

startPartialAction(actionParameters) → {Promise}

Starts partial action processing and returns a PartialActionInit object to the caller.
Parameters:
Name Type Description
actionParameters PortletParameters Action parameters to be added to the URL.
Source:
Throws:
  • Thrown if the input parameters are invalid.
    Type
    TypeError
  • Thrown if a blocking operation is already in progress.
    Type
    AccessDeniedException
  • Thrown if a portlet ID is provided, but no onStateChange listener has been registered.
    Type
    NotInitializedException
Returns:
A Promise. Returns a PortletActionInit object containing a partial action URL and the _setPageState callback function on successful resolution. Returns an Error object containing a descriptive message on failure.
Type
Promise