com.atlassian.gadgets.embedded.internal
Class GadgetViewFactoryImpl

java.lang.Object
  extended by com.atlassian.gadgets.embedded.internal.GadgetViewFactoryImpl
All Implemented Interfaces:
GadgetViewFactory

public class GadgetViewFactoryImpl
extends Object
implements GadgetViewFactory

Default implementation of GadgetViewFactory. Uses RenderedGadgetUriBuilder to render gadget views.


Constructor Summary
GadgetViewFactoryImpl(GadgetSpecFactory specFactory, RenderedGadgetUriBuilder renderedUriBuilder)
           
 
Method Summary
 boolean canRenderInViewType(GadgetState state, ViewType viewType, GadgetRequestContext gadgetRequestContext)
          Returns true if the gadget represented by state can be rendered with the given ViewType for the locale specified in the GadgetRequestContext.
 ViewComponent createGadgetView(GadgetState state, View view, GadgetRequestContext gadgetRequestContext)
          Returns a ViewComponent that will render the GadgetState, customizing the view based on the Locale specified in the GadgetRequestContext and the desired ViewType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GadgetViewFactoryImpl

public GadgetViewFactoryImpl(GadgetSpecFactory specFactory,
                             RenderedGadgetUriBuilder renderedUriBuilder)
Method Detail

createGadgetView

public ViewComponent createGadgetView(GadgetState state,
                                      View view,
                                      GadgetRequestContext gadgetRequestContext)
                               throws GadgetParsingException,
                                      GadgetRenderingException
Description copied from interface: GadgetViewFactory

Returns a ViewComponent that will render the GadgetState, customizing the view based on the Locale specified in the GadgetRequestContext and the desired ViewType.

This can be used by host applications to place gadgets anywhere they choose.

Specified by:
createGadgetView in interface GadgetViewFactory
Parameters:
state - state of the gadget to be rendered by the ViewComponent
view - desired View to use when rendering the gadget
gadgetRequestContext - context info for this request to make changes to the gadget state; false if the gadget is read-only for the current viewer
Returns:
a ViewComponent that will render the GadgetState
Throws:
GadgetParsingException - thrown if there is a problem parsing the gadget spec
GadgetRenderingException - thrown if the gadget does not define a <Content> section for the view

canRenderInViewType

public boolean canRenderInViewType(GadgetState state,
                                   ViewType viewType,
                                   GadgetRequestContext gadgetRequestContext)
Description copied from interface: GadgetViewFactory
Returns true if the gadget represented by state can be rendered with the given ViewType for the locale specified in the GadgetRequestContext.

Specified by:
canRenderInViewType in interface GadgetViewFactory
Parameters:
state - state of the gadget to check if we can render
viewType - view type to check the gadget can be rendered in
gadgetRequestContext - the context of this request
Returns:
true if the gadget can be rendered with the view in the locale, false otherwise


Copyright © 2009 Atlassian. All Rights Reserved.