Package com.atlassian.gadgets.dashboard
Class DashboardState
java.lang.Object
com.atlassian.gadgets.dashboard.DashboardState
- All Implemented Interfaces:
Serializable
An immutable representation of a dashboard. A dashboard's state consists of
- a
DashboardId, used to uniquely identify the dashboard within the system - a title, the text that is displayed to the user
- a
Layoutthat describes how many columns appear on the dashboard and how large they should be with respect to one another GadgetStates that represent the gadgets in the dashboard represented by thisDashboardStateare found in columns
DashboardState objects should be built using the builders. At a minimum, the DashboardId
and the title are required.
By doing a static import of the dashboard(DashboardId) method, you can
create a DashboardState object with:
DashboardState state = dashboard(DashboardId.from(1000)).title("Menagerie").build();
Or you can create a new DashboardState object from an existing one:
DashboardState state = dashboard(originalState).layout(Layout.AAA).build();
DashboardState implements the Serializable marker interface. The marker is only implemented so that
DashboardState objects may be distributed among remote systems that might be sharing a cache or need to
transfer DashboardStates for other reasons. Serialization is not meant to be used as a means of
persisting DashboardState objects between JVM restarts.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder that allows theLayoutor the columns of theDashboardStateunder construction to be set.static enumThere are a predetermined number of columns that a dashboard can contain, andColumnIndexis the enumeration of those columns.static classA builder that allows you to set the title of theDashboardStateobject under construction. -
Method Summary
Modifier and TypeMethodDescriptionappendGadgetToColumn(GadgetState gadgetState, DashboardState.ColumnIndex index) Deprecated.appendItemToColumn(DashboardItemState itemState, DashboardState.ColumnIndex index) Returns a new DashboardState built with the same data asthis, except that the column with indexindexhas had a new gadget added to its bottomstatic DashboardState.TitleBuilderdashboard(DashboardId id) Factory method to create a new builder which can be used to createDashboardStateobjects.static DashboardState.Builderdashboard(DashboardState state) Factory method which allows you to create a newDashboardStateobject based on an existingDashboardState.booleanIterable<? extends Iterable<GadgetState>>Deprecated.Deprecated.getId()Returns the unique identifier, represented by aDashboardId, for the dashboard's state.Returns theLayoutof the dashboard.getTitle()Returns the title of the dashboard.longReturns this state's version so that it can be used by implementations when storingDashboardStates, to make sure the same object is stored and retrievedinthashCode()prependGadgetToColumn(GadgetState dashboardItemState, DashboardState.ColumnIndex index) Deprecated.prependItemToColumn(DashboardItemState itemState, DashboardState.ColumnIndex index) Returns a new DashboardState built with the same data asthis, except that the column with indexindexhas had a new gadget added to its toptoString()
-
Method Details
-
getId
Returns the unique identifier, represented by aDashboardId, for the dashboard's state.- Returns:
- the unique identifier for this dashboard's state.
-
getTitle
Returns the title of the dashboard.- Returns:
- the title of the dashboard
-
getLayout
Returns theLayoutof the dashboard.- Returns:
- the
Layoutof the dashboard
-
getGadgetsInColumn
Deprecated.Returns an immutableIterableof theGadgetStates in the givencolumn. They are returned in the order that they appear on the dashboard from top to bottom.- Parameters:
column- the index of the column to retrieve theGadgetStates for- Returns:
- an immutable
Iterableof theGadgetStatein thecolumndeprecated UsegetDashboardColumns()instead. Since v3.11.
-
getColumns
Deprecated.Returns an immutableIterableof the columns in thisDashboardState(which contain theGadgetStates). -
getDashboardColumns
-
getVersion
public long getVersion()Returns this state's version so that it can be used by implementations when storingDashboardStates, to make sure the same object is stored and retrieved- Returns:
- the version
-
prependGadgetToColumn
@Deprecated public DashboardState prependGadgetToColumn(GadgetState dashboardItemState, DashboardState.ColumnIndex index) Deprecated.Returns a new DashboardState built with the same data asthis, except that the column with indexindexhas had a new gadget added to its top- Parameters:
dashboardItemState- the new gadget to addindex- the index of the column to add the new state to- Returns:
- the new DashboardState
-
appendGadgetToColumn
@Deprecated public DashboardState appendGadgetToColumn(GadgetState gadgetState, DashboardState.ColumnIndex index) Deprecated.Returns a new DashboardState built with the same data asthis, except that the column with indexindexhas had a new gadget added to its bottom- Parameters:
gadgetState- the new gadget to addindex- the index of the column to add the new state to- Returns:
- the new DashboardState
deprecated Use
prependItemToColumn(com.atlassian.gadgets.DashboardItemState, com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex)instead. Since v3.11.
-
prependItemToColumn
public DashboardState prependItemToColumn(DashboardItemState itemState, DashboardState.ColumnIndex index) Returns a new DashboardState built with the same data asthis, except that the column with indexindexhas had a new gadget added to its top- Parameters:
itemState- the new dashboard item to addindex- the index of the column to add the new state to- Returns:
- the new DashboardState
-
appendItemToColumn
public DashboardState appendItemToColumn(DashboardItemState itemState, DashboardState.ColumnIndex index) Returns a new DashboardState built with the same data asthis, except that the column with indexindexhas had a new gadget added to its bottom- Parameters:
itemState- the new dashboard item to addindex- the index of the column to add the new state to- Returns:
- the new DashboardState
-
equals
-
hashCode
public int hashCode() -
toString
-
dashboard
Factory method which allows you to create a newDashboardStateobject based on an existingDashboardState.- Parameters:
state- theDashboardStateto start with when building the newDashboardState- Returns:
- a
GadgetState.Builderwhich allows you to set the layout or change the columns
-
dashboard
Factory method to create a new builder which can be used to createDashboardStateobjects. It returns aTitleBuilderwhich only allows you to set the title. After setting the title, aBuilderwill be returned allowing other properties to be set.- Parameters:
id- unique identifier for the newDashboardStateobject- Returns:
- a
TitleBuilderwhich can be used to set the title of the dashboard
-
prependItemToColumn(com.atlassian.gadgets.DashboardItemState, com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex)instead.