Jive API (3.0.13) Core Javadocs

com.jivesoftware.community.widget
Class BaseWidgetContext

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

public class BaseWidgetContext
extends Object

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(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(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(WidgetTypeDescriptor type, User user, AuthToken authToken, HttpServletRequest request, HttpServletResponse response, boolean edit, boolean remote, 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.
 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
 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(WidgetTypeDescriptor type,
                         User user,
                         AuthToken authToken,
                         HttpServletRequest request,
                         HttpServletResponse response,
                         boolean edit,
                         boolean remote,
                         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(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(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 WidgetTypeDescriptor getWidgetType()
Gets the widget type for the current context.

Returns:
the widget type for the current context

getUser

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

Returns:
the current page user, or null if annonymous

getAuthToken

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

Returns:
the current page user's auth token

getRequest

public HttpServletRequest getRequest()
Gets the http servlet request object

Returns:
the http servlet request object

getResponse

public HttpServletResponse getResponse()
Gets the http servlet response object

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.

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.

Returns:
true if the context is remote, otherwise false if local.

getLocale

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

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.

Returns:
the container associated with this widget context.

Jive Product Page

Copyright © 1999-2007 Jive Software.