Jive API (4.5.7.0) Core Javadocs

com.jivesoftware.community.widget
Class BaseWidgetContext

java.lang.Object
  extended by com.jivesoftware.community.widget.BaseWidgetContext
All Implemented Interfaces:
com.jivesoftware.community.widget.WidgetContext
Direct Known Subclasses:
CommunityWidgetContext, HomepageWidgetContext, PersonalizedHomepageWidgetContext, ProjectWidgetContext

public class BaseWidgetContext
extends java.lang.Object
implements com.jivesoftware.community.widget.WidgetContext

The widget context is passed to all Widgets when the render method is invoked. The context contains key information about the container of the widget, providing widget authors access the the information required to render the widget appropriately. By default the BaseWidgetContext is used, widgets may also use subclasses BlogWidgetContext, UserProfileWidgetContext, and ProjectWidgetContext.


Constructor Summary
BaseWidgetContext(User user, AuthToken authToken, HttpServletRequest request, HttpServletResponse response)
          Creates a BaseWidgetContext whose type is WidgetType.COMMUNITY with all the necessary information for a widget author to render their widget.
BaseWidgetContext(com.jivesoftware.community.widget.WidgetTypeDescriptor type, User user, AuthToken authToken, HttpServletRequest request, HttpServletResponse response, boolean edit)
          Creates a BaseWidgetContext of a given type with all the necessary information for a widget author to render their widget.
BaseWidgetContext(com.jivesoftware.community.widget.WidgetTypeDescriptor type, User user, AuthToken authToken, HttpServletRequest request, HttpServletResponse response, boolean edit, boolean remote)
          Creates a BaseWidgetContext of a given type with all the necessary information for a widget author to render their widget.
BaseWidgetContext(com.jivesoftware.community.widget.WidgetTypeDescriptor type, User user, AuthToken authToken, HttpServletRequest request, HttpServletResponse response, boolean edit, boolean remote, java.util.Locale locale)
          Creates a BaseWidgetContext of a given type with all the necessary information for a widget author to render their widget.
 
Method Summary
 AuthToken getAuthToken()
          Gets the current page user's auth token
 JiveContainer getContainer()
          Subclasses should override this method to provide their container.
 java.util.Locale getLocale()
          Returns the locale if this context requires special logic for locale, otherwise null.
 HttpServletRequest getRequest()
          Gets the http servlet request object
 HttpServletResponse getResponse()
          Gets the http servlet response object
 User getUser()
          Gets the current page user, or null if annonymous
 com.jivesoftware.community.widget.WidgetTypeDescriptor getWidgetType()
          Gets the widget type for the current context.
 boolean isEdit()
          Returns true if the parent container is currently in edit mode and false if it is not.
 boolean isRemote()
          Returns true if the context is remote, otherwise false if local.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseWidgetContext

public BaseWidgetContext(com.jivesoftware.community.widget.WidgetTypeDescriptor type,
                         User user,
                         AuthToken authToken,
                         HttpServletRequest request,
                         HttpServletResponse response,
                         boolean edit,
                         boolean remote,
                         java.util.Locale locale)
Creates a BaseWidgetContext of a given type with all the necessary information for a widget author to render their widget.

Parameters:
type - the type of widget
user - the page user
authToken - the auth token of the page user
request - the http servlet request object
response - the http servlet response object
edit - specifies wether the parent container is currently in edit mode.
remote - specifies whether the context is remote

BaseWidgetContext

public BaseWidgetContext(com.jivesoftware.community.widget.WidgetTypeDescriptor type,
                         User user,
                         AuthToken authToken,
                         HttpServletRequest request,
                         HttpServletResponse response,
                         boolean edit,
                         boolean remote)
Creates a BaseWidgetContext of a given type with all the necessary information for a widget author to render their widget.

Parameters:
type - the type of widget
user - the page user
authToken - the auth token of the page user
request - the http servlet request object
response - the http servlet response object
edit - specifies wether the parent container is currently in edit mode.
remote - specifies whether the context is remote

BaseWidgetContext

public BaseWidgetContext(com.jivesoftware.community.widget.WidgetTypeDescriptor type,
                         User user,
                         AuthToken authToken,
                         HttpServletRequest request,
                         HttpServletResponse response,
                         boolean edit)
Creates a BaseWidgetContext of a given type with all the necessary information for a widget author to render their widget.

Parameters:
type - the type of widget
user - the page user
authToken - the auth token of the page user
request - the http servlet request object
response - the http servlet response object
edit - specifies wether the parent container is currently in edit mode.

BaseWidgetContext

public BaseWidgetContext(User user,
                         AuthToken authToken,
                         HttpServletRequest request,
                         HttpServletResponse response)
Creates a BaseWidgetContext whose type is WidgetType.COMMUNITY with all the necessary information for a widget author to render their widget.

Parameters:
user - the page user
authToken - the auth token of the page user
request - the http servlet request object
response - the http servlet response object
Method Detail

getWidgetType

public com.jivesoftware.community.widget.WidgetTypeDescriptor getWidgetType()
Gets the widget type for the current context.

Specified by:
getWidgetType in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the widget type for the current context

getUser

public User getUser()
Gets the current page user, or null if annonymous

Specified by:
getUser in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the current page user, or null if annonymous

getAuthToken

public AuthToken getAuthToken()
Gets the current page user's auth token

Specified by:
getAuthToken in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the current page user's auth token

getRequest

public HttpServletRequest getRequest()
Gets the http servlet request object

Specified by:
getRequest in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the http servlet request object

getResponse

public HttpServletResponse getResponse()
Gets the http servlet response object

Specified by:
getResponse in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the http servlet response object

isEdit

public boolean isEdit()
Returns true if the parent container is currently in edit mode and false if it is not.

Specified by:
isEdit in interface com.jivesoftware.community.widget.WidgetContext
Returns:
true if the parent container is currently in edit mode and false if it is not.

isRemote

public boolean isRemote()
Returns true if the context is remote, otherwise false if local.

Specified by:
isRemote in interface com.jivesoftware.community.widget.WidgetContext
Returns:
true if the context is remote, otherwise false if local.

getLocale

public java.util.Locale getLocale()
Returns the locale if this context requires special logic for locale, otherwise null.

Specified by:
getLocale in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the locale if this context requires special logic for locale, otherwise null.

getContainer

public JiveContainer getContainer()
Subclasses should override this method to provide their container.

Specified by:
getContainer in interface com.jivesoftware.community.widget.WidgetContext
Returns:
the container associated with this widget context.

Jive Product Page

Copyright © 1999-2007 Jive Software.