|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.gadgets.dashboard.DashboardState
@Immutable public final class DashboardState
An immutable representation of a dashboard. A dashboard's state consists of
DashboardId
, used to uniquely identify the dashboard within the systemLayout
that describes how many columns appear on the dashboard and how large they should be with
respect to one anotherGadgetState
s that represent the gadgets in the dashboard represented by this DashboardState
are found in columnsDashboardState
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 DashboardState
s for other reasons. Serialization is not meant to be used as a means of
persisting DashboardState
objects between JVM restarts.
Nested Class Summary | |
---|---|
static class |
DashboardState.Builder
A builder that allows the Layout or the columns of the DashboardState under construction to
be set. |
static class |
DashboardState.ColumnIndex
There are a predetermined number of columns that a dashboard can contain, and ColumnIndex is the enumeration
of those columns. |
static class |
DashboardState.TitleBuilder
A builder that allows you to set the title of the DashboardState object under construction. |
Method Summary | |
---|---|
DashboardState |
appendGadgetToColumn(GadgetState gadgetState,
DashboardState.ColumnIndex index)
Returns a new DashboardState built with the same data as this , except that the column with index
index has had a new gadget added to its bottom |
static DashboardState.TitleBuilder |
dashboard(DashboardId id)
Factory method to create a new builder which can be used to create DashboardState objects. |
static DashboardState.Builder |
dashboard(DashboardState state)
Factory method which allows you to create a new DashboardState object based on an existing
DashboardState . |
boolean |
equals(Object o)
|
Iterable<? extends Iterable<GadgetState>> |
getColumns()
Returns an immutable Iterable of the columns in this DashboardState (which contain the
GadgetState s). |
Iterable<GadgetState> |
getGadgetsInColumn(DashboardState.ColumnIndex column)
Returns an immutable Iterable of the GadgetState s in the given column . |
DashboardId |
getId()
Returns the unique identifier, represented by a DashboardId , for the dashboard's state. |
Layout |
getLayout()
Returns the Layout of the dashboard. |
String |
getTitle()
Returns the title of the dashboard. |
long |
getVersion()
Returns this state's version so that it can be used by implementations when storing DashboardState s, to
make sure the same object is stored and retrieved |
int |
hashCode()
|
DashboardState |
prependGadgetToColumn(GadgetState gadgetState,
DashboardState.ColumnIndex index)
Returns a new DashboardState built with the same data as this , except that the column with index
index has had a new gadget added to its top |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public DashboardId getId()
DashboardId
, for the dashboard's state.
public String getTitle()
public Layout getLayout()
Layout
of the dashboard.
Layout
of the dashboardpublic Iterable<GadgetState> getGadgetsInColumn(DashboardState.ColumnIndex column)
Iterable
of the GadgetState
s in the given column
. They are
returned in the order that they appear on the dashboard from top to bottom.
column
- the index of the column to retrieve the GadgetState
s for
Iterable
of the GadgetState
in the column
public Iterable<? extends Iterable<GadgetState>> getColumns()
Iterable
of the columns in this DashboardState
(which contain the
GadgetState
s).
public long getVersion()
DashboardState
s, to
make sure the same object is stored and retrieved
public DashboardState prependGadgetToColumn(GadgetState gadgetState, DashboardState.ColumnIndex index)
this
, except that the column with index
index
has had a new gadget added to its top
gadgetState
- the new gadget to addindex
- the index of the column to add the new state to
public DashboardState appendGadgetToColumn(GadgetState gadgetState, DashboardState.ColumnIndex index)
this
, except that the column with index
index
has had a new gadget added to its bottom
gadgetState
- the new gadget to addindex
- the index of the column to add the new state to
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public static DashboardState.Builder dashboard(DashboardState state)
DashboardState
object based on an existing
DashboardState
.
state
- the DashboardState
to start with when building the new DashboardState
GadgetState.Builder
which allows you to set the layout or change the columnspublic static DashboardState.TitleBuilder dashboard(DashboardId id)
DashboardState
objects. It returns
a TitleBuilder
which only allows you to set the title. After setting the title, a Builder
will be
returned allowing other properties to be set.
id
- unique identifier for the new DashboardState
object
TitleBuilder
which can be used to set the title of the dashboard
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |