com.bea.netuix.servlets.controls.portlet.backing
Class PortletBackingContext

java.lang.Object
  extended by com.bea.netuix.servlets.controls.ControlContext
      extended by com.bea.netuix.servlets.controls.BackingContext
          extended by com.bea.netuix.servlets.controls.window.backing.WindowBackingContext
              extended by com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext
All Implemented Interfaces
Serializable
Direct Known Subclasses:
ProxyPortletBackingContext

public class PortletBackingContext
extends WindowBackingContext

This is the BackingContext for a portlet. This PortletBackingContext can only be referenced from a backing file. If you think you need to reference this from a JSP you should look at PortletPresentationContext.

To get a handle to the BackingContext just call the following:
PortletBackingContext.getPortletBackingContext(request);

See Also
JspBacking, Serialized Form

Field Summary
static String CLASS_NAME
           
 
Method Summary
 void fireCustomEvent(QName name, Serializable payload)
          Fire a custom event with the specified QName.
 void fireCustomEvent(String eventName, Serializable payload)
          Fire a custom event with the default custom event namespace.
 String getAsyncContent()
          Get the value of the portlet's asyncContent property.
 String getDisabledClassifications()
          Returns classifications for which the underlying portlet is disabled.
 String getEnabledClassifications()
          Returns classifications for which the underlying portlet is enabled.
 String getInstanceId()
          Return the instance id of this portlet.
 String getInstanceLabel()
          Return the unique instance label for the portlet.
 String getLabel()
          Return the unique label for the portlet.
 String getLocalInstanceId()
          Return the local instance id of this portlet.
 PageBackingContext getPageBackingContext()
          Return the portlet's parent PageBackingContext.
static PortletBackingContext getPortletBackingContext(javax.servlet.http.HttpServletRequest request)
          A static helper to pull the current portlet's backing context out of the request.
 PortletPreferences getPortletPreferences(javax.servlet.http.HttpServletRequest request)
          Returns a copy of the preferences for this portlet.
 String getPortletUri()
          Get the portlet's URI.
example: /portlets/myportlet/myportlet.portlet
 PortletPreferences getPreferences(javax.servlet.http.HttpServletRequest request)
          Deprecated Use getPortletPreferences instead
 String getSharedParameterValue(String name)
          Gets the value of the specified shared parameter.
 String[] getSharedParameterValues(String name)
          Gets all values for the specified shared parameter.
 void invalidateCache()
          Invalidate this control's cache.
 boolean isAsyncContent()
          Is the portlet set up to render asynchronously?
 boolean isContentOnly()
          This field only applies to async portlets.
 boolean isDefaultMinimized()
          Returns true if the underlying portlet has defaultMinimized set to true.
 boolean isDeleted()
          Returns true if the portlet file is deleted.
 boolean isPortletRenderedByClient()
          Returns true if this portlet is being rendered via client-side frameworks (such as the PortletSource Disc API)
 boolean isRemote()
          This method returns true when the portlet is being invoked remotely via WSRP on a producer.
 void setRenderOnAjaxRequest(boolean render)
          Force the portlet to render/not render when the Desktop asyncMode="enabled".
 void setSharedParameterValue(String name, String value)
          Sets the value of the specified shared parameter to the specified value.
 void setSharedParameterValues(String name, String[] values)
          Sets the value of the specified shared parameter to the specified values.
 
Methods inherited from class com.bea.netuix.servlets.controls.window.backing.WindowBackingContext
getCapability, getCapabilityVisible, getDefinitionId, getDefinitionLabel, getDescription, getMetaData, getMetaDatas, getOrientation, getParentPageBackingContext, getParentWindowBackingContext, getPlacementId, getPreviousWindowMode, getPreviousWindowState, getRenderedChildrenWindowBackingContexts, getTitle, getWindowMode, getWindowState, isCapable, isPacked, setCapabilityVisible, setDescription, setTitle, setupModeChangeEvent, setupModeChangeEvent, setupPageChangeEvent, setupStateChangeEvent, setupStateChangeEventFromParent
 
Methods inherited from class com.bea.netuix.servlets.controls.BackingContext
ensureCurrentLifecycleStageLegalForOperation, getChildrenBackingContexts, getParentBackingContext, getParsedProperties, getProperties, getProperty, getProperty, getSendRedirectPath, getTopParentBackingContext, isBackingPhase, isVisible, sendRedirect, setBackingPhase, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final String CLASS_NAME
Method Detail

getLabel

public String getLabel()
Return the unique label for the portlet. For portlets this is the same as instanceLabel.

Specified by:
getLabel in class WindowBackingContext
Returns
the instance label.

getInstanceLabel

public String getInstanceLabel()
Return the unique instance label for the portlet. This is the property defined in the IDE as instance Label.

Returns
the instance label.

getPortletUri

public String getPortletUri()
Get the portlet's URI.
example: /portlets/myportlet/myportlet.portlet

Returns
A String containing the portlet's URI.

getInstanceId

public String getInstanceId()
Return the instance id of this portlet. Note: the instance id is only populated when in streaming mode, not single file mode. This can be used with the persistence API.

Overrides:
getInstanceId in class WindowBackingContext
Returns
A string representation of the portlet's instance id (this is NOT always a number)
See Also
getLocalInstanceId()

getLocalInstanceId

public String getLocalInstanceId()
Return the local instance id of this portlet. In non-WSRP this will return the same as getInstanceId(), in WSRP this will return the ID on the Producer. Note: the instance id is only populated when in streaming mode, not single file mode. This can be used with the persistence API.

Returns
A string representation of the portlet's instance id (this is always a number)
See Also
getInstanceId()

getPortletBackingContext

public static PortletBackingContext getPortletBackingContext(javax.servlet.http.HttpServletRequest request)
A static helper to pull the current portlet's backing context out of the request.

Parameters
request - the current HttpServletRequest
Returns
A reference to the currents windows backing context.

getPortletPreferences

public PortletPreferences getPortletPreferences(javax.servlet.http.HttpServletRequest request)
Returns a copy of the preferences for this portlet.

Parameters
request - The current HTTPServletRequest instance
Returns
The preferences instance

getPreferences

@Deprecated
public PortletPreferences getPreferences(javax.servlet.http.HttpServletRequest request)
Deprecated Use getPortletPreferences instead

Returns preferences for this portlet.

Parameters
request - HTTP request
Returns
preferences

isDefaultMinimized

public boolean isDefaultMinimized()
Returns true if the underlying portlet has defaultMinimized set to true.

Returns
true if the portlet is defaultMinimized

getDisabledClassifications

public String getDisabledClassifications()
Returns classifications for which the underlying portlet is disabled.

Returns
disabled classifications

getEnabledClassifications

public String getEnabledClassifications()
Returns classifications for which the underlying portlet is enabled.

Returns
enabled classifications

isDeleted

public boolean isDeleted()

Returns true if the portlet file is deleted. Portlets are marked deleted when they are removed from the files system but still in use. The .portlet file must either be restored or the portlet should be removed via the admin tools.

Returns
true if the portlet file is deleted

fireCustomEvent

public void fireCustomEvent(String eventName,
                            Serializable payload)
Fire a custom event with the default custom event namespace. This method should only be called in handlePostback or in an event handler.

Parameters
eventName - The name of the event. This will be matched against the 'name' or 'qname' attribute of the handleCustomEvent tag.
payload - The arbitrary payload that the event will carry.

fireCustomEvent

public void fireCustomEvent(QName name,
                            Serializable payload)
Fire a custom event with the specified QName. This method should only be called in handlePostback or in an event handler.

Parameters
name - The QName of the event. This will be matched against the 'name' or 'qname' attribute of the handleCustomEvent tag.
payload - The arbitrary payload that the event will carry.

getSharedParameterValue

public String getSharedParameterValue(String name)
Gets the value of the specified shared parameter. If there are multiple values for the specified shared parameter, the first value is returned. Shared parameter values are not available during the init lifecycle. Only the portlet targeted by a request will see the most up-to-date shared parameter values during handlePostback. During event handling, preRender and render all portlets will receive the most up-to-date shared parameter values.

Parameters
name - the parameterID of the parameter to get. If the name is not a registered shared parameter, null will be returned.
Returns
the first value of the specified shared parameter, or null if the parameter has no values or is not a registered shared parameter for this portlet.

getSharedParameterValues

public String[] getSharedParameterValues(String name)
Gets all values for the specified shared parameter. Shared parameter values are not available during the init lifecycle. Only the portlet targeted by a request will see the most up-to-date shared parameter values during handlePostback. During event handling, preRender and render all portlets will receive the most up-to-date shared parameter values.

Parameters
name - the parameterID of the parameter to get. If the name is not a registered shared parameter, null will be returned.
Returns
the values of the specified shared parameter, or null if the parameter has no values or is not a registered shared parameter for this portlet.

setSharedParameterValue

public void setSharedParameterValue(String name,
                                    String value)
Sets the value of the specified shared parameter to the specified value. This method should only be called in handlePostback or in an event handler. During handlePostback, it is recommended that only the portlet targeted by the request set shared parameter values, or non-deterministic behavior can result.

Parameters
name - the parameterID of the parameter to set. If the name is not a registered shared parameter, an error is logged and nothing else is done.
value - the new value for the parameter. If null, the shared parameter will be removed.

setSharedParameterValues

public void setSharedParameterValues(String name,
                                     String[] values)
Sets the value of the specified shared parameter to the specified values. This method should only be called in handlePostback or in an event handler. During handlePostback, it is recommended that only the portlet targeted by the request set shared parameter values, or non-deterministic behavior can result.

Parameters
name - the parameterID of the parameter to set. If the name is not a registered shared parameter, an error is logged and nothing else is done.
values - the new values for the parameter. If null, the shared parameter will be removed.

isAsyncContent

public boolean isAsyncContent()
Is the portlet set up to render asynchronously?

Returns
true if the asyncContent property on the portlet is configured to anything besides "none".

getAsyncContent

public String getAsyncContent()
Get the value of the portlet's asyncContent property.

Returns
the value of the asyncContent property on the portlet.

isContentOnly

public boolean isContentOnly()
This field only applies to async portlets. This method returns true for the async request that actually renders the portlet content, and false for the "original" portal request that renders the main portal and portlet outline.


getPageBackingContext

public PageBackingContext getPageBackingContext()
Return the portlet's parent PageBackingContext.

Returns
If this portlet is placed on a page then a reference to the pages backing context, otherwise null.

invalidateCache

public void invalidateCache()
Invalidate this control's cache.


setRenderOnAjaxRequest

public void setRenderOnAjaxRequest(boolean render)

Force the portlet to render/not render when the Desktop asyncMode="enabled". Note: This method must be called before preRender(), therfore, call in init() or handlePostbackData().

Parameters
render - this portlet whether changed or not.

isPortletRenderedByClient

public boolean isPortletRenderedByClient()
Returns true if this portlet is being rendered via client-side frameworks (such as the PortletSource Disc API)

Returns
whether or not this portlet is rendered on the client side

isRemote

public boolean isRemote()
This method returns true when the portlet is being invoked remotely via WSRP on a producer. This method returns false for local portlets.

Returns
whether or not this portlet is remote


Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.