Package com.atlassian.gadgets
Class GadgetState
java.lang.Object
com.atlassian.gadgets.GadgetState
- All Implemented Interfaces:
DashboardItemState,Serializable
An immutable extension of DashboardItemState. GadgetState state extends the DashboardItemState
with:
- a spec URI, indicating where the gadget spec is located
- a
Mapof the user preference values
GadgetState objects should be built using the builders. At a minimum, the GadgetId
and spec URI are required.
By doing a static import of the gadget(GadgetId) method, you can
create a GadgetState object with:
GadgetState state = gadget(GadgetId.from(1000)).specUri("http://gadget/url").build();
Or you can build a new GadgetState object from an existing one with:
GadgetState state = gadget(originalState).color(color1).build();
GadgetState implements the Serializable marker interface. Serialization is only implemented so that
GadgetState objects may be distributed among remote systems that might be sharing a cache or need to
transfer GadgetStates for other reasons. Serialization is not meant to be used as a means of
persisting GadgetState objects between JVM restarts.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder that allows you to set theColorand the user preferences of theGadgetStateunder construction.static classA builder that allows you to set the spec URI of the gadget state under construction -
Method Summary
Modifier and TypeMethodDescription<V> Vaccept(DashboardItemStateVisitor<V> visitor) booleanstatic GadgetState.SpecUriBuilderFactory method to create a new builder which can be used to createGadgetStateobjects.static GadgetState.Buildergadget(GadgetState state) Factory method which allows you to create a newGadgetStateobject based on an existingGadgetState.getColor()Returns theColorscheme that should be used to decorate the chrome surrounding the gadget.Returns theURIof the gadget spec, which defines the gadget as described in the gadget spec reference.getId()Returns the unique identifier, represented by aGadgetId, for the gadget's state.An immutableMapof the user preference values for the gadget, keyed by the name of the user preference.inthashCode()toString()
-
Method Details
-
getId
Returns the unique identifier, represented by aGadgetId, for the gadget's state.- Specified by:
getIdin interfaceDashboardItemState- Returns:
- the unique identifier for this gadget's state.
-
getGadgetSpecUri
Returns theURIof the gadget spec, which defines the gadget as described in the gadget spec reference.- Returns:
URIof the gadget spec
-
getColor
Returns theColorscheme that should be used to decorate the chrome surrounding the gadget.- Specified by:
getColorin interfaceDashboardItemState- Returns:
- the
Colorscheme that should be used to decorate the chrome surrounding the gadget
-
getUserPrefs
An immutableMapof the user preference values for the gadget, keyed by the name of the user preference.- Returns:
- immutable
Mapof the user preference values for the gadget
-
accept
- Specified by:
acceptin interfaceDashboardItemState
-
equals
-
hashCode
public int hashCode() -
toString
-
gadget
Factory method which allows you to create a newGadgetStateobject based on an existingGadgetState.- Parameters:
state- theGadgetStateto start with when building the newGadgetState- Returns:
- a
Builderwhich allows you to set the color or change the user preference values
-
gadget
Factory method to create a new builder which can be used to createGadgetStateobjects. It returns aSpecUriBuilderwhich allows you to set the location of the gadget spec.- Parameters:
gadgetId- unique ID for the newGadgetStateobject- Returns:
- a
SpecUriBuilderwhich can be used to set the location of the gadget spec
-