Package com.atlassian.gadgets.view
Interface GadgetViewFactory
public interface GadgetViewFactory
A factory which provides a way to create
ViewComponents for gadgets. A host
application should use this for embedding individual gadgets in the desired locations by
creating a view and then calling the ViewComponent.writeTo(java.io.Writer) method.-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRenderInViewType(GadgetState state, ViewType viewType, GadgetRequestContext gadgetRequestContext) Returnstrueif the gadget represented bystatecan be rendered with the givenViewTypefor thelocalespecified in theGadgetRequestContext.createGadgetView(GadgetState state, ModuleId moduleId, View view, GadgetRequestContext gadgetRequestContext) Returns aViewComponentthat will render theGadgetState, customizing the view based on theLocalespecified in theGadgetRequestContextand the desiredViewType.createGadgetView(GadgetState state, View view, GadgetRequestContext gadgetRequestContext) Deprecated.
-
Method Details
-
createGadgetView
@Deprecated ViewComponent createGadgetView(GadgetState state, View view, GadgetRequestContext gadgetRequestContext) throws GadgetParsingException, GadgetRenderingException Deprecated.Returns a
ViewComponentthat will render theGadgetState, customizing the view based on theLocalespecified in theGadgetRequestContextand the desiredViewType.This can be used by host applications to place gadgets anywhere they choose.
- Parameters:
state- state of the gadget to be rendered by theViewComponentview- desiredViewto use when rendering the gadgetgadgetRequestContext- context info for this request to make changes to the gadget state;falseif the gadget is read-only for the current viewer- Returns:
- a
ViewComponentthat will render theGadgetState - Throws:
GadgetParsingException- thrown if there is a problem parsing the gadget specGadgetRenderingException- thrown if the gadget does not define a <Content> section for theview
-
createGadgetView
ViewComponent createGadgetView(GadgetState state, ModuleId moduleId, View view, GadgetRequestContext gadgetRequestContext) throws GadgetParsingException, GadgetRenderingException Returns aViewComponentthat will render theGadgetState, customizing the view based on theLocalespecified in theGadgetRequestContextand the desiredViewType.
This can be used by host applications to place gadgets anywhere they choose.- Parameters:
state- state of the gadget to be rendered by theViewComponentmoduleId- the moduleId to use in the gadget view. Should be unique for the HTML page that the gadget will be rendered inview- desiredViewto use when rendering the gadgetgadgetRequestContext- context info for this request to make changes to the gadget state;falseif the gadget is read-only for the current viewer- Returns:
- a
ViewComponentthat will render theGadgetState - Throws:
GadgetParsingException- thrown if there is a problem parsing the gadget specGadgetRenderingException- thrown if the gadget does not define a <Content> section for theview- Since:
- 2.0
-
canRenderInViewType
boolean canRenderInViewType(GadgetState state, ViewType viewType, GadgetRequestContext gadgetRequestContext) throws GadgetParsingException Returnstrueif the gadget represented bystatecan be rendered with the givenViewTypefor thelocalespecified in theGadgetRequestContext.- Parameters:
state- state of the gadget to check if we can renderviewType- view type to check the gadget can be rendered ingadgetRequestContext- the context of this request- Returns:
trueif the gadget can be rendered with theviewin thelocale,falseotherwise- Throws:
GadgetParsingException- thrown if there is a problem parsing the gadget spec
-
createGadgetView(com.atlassian.gadgets.GadgetState, ModuleId, View, com.atlassian.gadgets.GadgetRequestContext)