com.atlassian.gadgets.dashboard.internal.impl
Class DashboardImpl

java.lang.Object
  extended by com.atlassian.gadgets.dashboard.internal.impl.DashboardImpl
All Implemented Interfaces:
Dashboard

public class DashboardImpl
extends Object
implements Dashboard

Implements methods for operating on a backing DashboardState object.


Constructor Summary
DashboardImpl(com.atlassian.gadgets.dashboard.DashboardState state, StateConverter stateConverter, com.atlassian.gadgets.GadgetRequestContext gadgetRequestContext)
           
 
Method Summary
 void addGadget(com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex column, Gadget gadget)
          Add a gadget to the first position of the specified column
 void addGadget(Gadget gadget)
           
 void appendGadget(com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex columnIndex, Gadget gadget)
          Add a gadget to the end of the specified column
 void appendGadget(Gadget gadget)
          Add a gadget to the default tab.
 void assertGadgetLayoutIsValid(com.atlassian.gadgets.dashboard.Layout layout, com.atlassian.gadgets.dashboard.spi.GadgetLayout gadgetLayout)
          Checks to make sure there are no gadgets in out of bounds columns.
 void changeGadgetColor(com.atlassian.gadgets.GadgetId gadgetId, com.atlassian.gadgets.dashboard.Color color)
          Change the color of the gadgets chrome.
 void changeLayout(com.atlassian.gadgets.dashboard.Layout layout, com.atlassian.gadgets.dashboard.spi.GadgetLayout gadgetLayout)
          Change the layout of the dashboard and use the gadget layout to update the gadget positioning.
 void clearChanges()
          Clears the stored list of changes that have been made to this Dashboard
 Gadget findGadget(com.atlassian.gadgets.GadgetId gadgetId)
          Lookup a Gadget in this Dashboard given the gadget's id.
 List<com.atlassian.gadgets.dashboard.spi.changes.DashboardChange> getChanges()
          Returns an immutable list of changes that have been made to this Dashboard, in the order that they occurred.
 Iterable<Gadget> getGadgetsInColumn(com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex column)
           
 com.atlassian.gadgets.dashboard.DashboardId getId()
           
 com.atlassian.gadgets.dashboard.Layout getLayout()
           
 int getNumberOfGadgets()
          Get the total number of gadgets on this dashboard
 com.atlassian.gadgets.dashboard.DashboardState getState()
           
 String getTitle()
           
 void rearrangeGadgets(com.atlassian.gadgets.dashboard.spi.GadgetLayout gadgetLayout)
          Rearrange and reposition the gadgets on the dashboard according to the specified layout.
 void removeGadget(com.atlassian.gadgets.GadgetId gadgetId)
          Remove the gadget with the provided id from the dashboard.
 void updateGadgetUserPrefs(com.atlassian.gadgets.GadgetId gadgetId, Map<String,String> prefValues)
          Save user prefs for a gadget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DashboardImpl

public DashboardImpl(com.atlassian.gadgets.dashboard.DashboardState state,
                     StateConverter stateConverter,
                     com.atlassian.gadgets.GadgetRequestContext gadgetRequestContext)
Method Detail

getId

public com.atlassian.gadgets.dashboard.DashboardId getId()
Specified by:
getId in interface Dashboard

getTitle

public String getTitle()
Specified by:
getTitle in interface Dashboard

getLayout

public com.atlassian.gadgets.dashboard.Layout getLayout()
Specified by:
getLayout in interface Dashboard

getGadgetsInColumn

public Iterable<Gadget> getGadgetsInColumn(com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex column)
Specified by:
getGadgetsInColumn in interface Dashboard

appendGadget

public void appendGadget(Gadget gadget)
Description copied from interface: Dashboard
Add a gadget to the default tab. Let the dashboard pick which column it should go in.

Specified by:
appendGadget in interface Dashboard
Parameters:
gadget - the gadget being added

appendGadget

public void appendGadget(com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex columnIndex,
                         Gadget gadget)
Description copied from interface: Dashboard
Add a gadget to the end of the specified column

Specified by:
appendGadget in interface Dashboard
Parameters:
columnIndex - index of column to append the gadget to
gadget - the gadget being added

addGadget

public void addGadget(Gadget gadget)
Specified by:
addGadget in interface Dashboard

addGadget

public void addGadget(com.atlassian.gadgets.dashboard.DashboardState.ColumnIndex column,
                      Gadget gadget)
Description copied from interface: Dashboard
Add a gadget to the first position of the specified column

Specified by:
addGadget in interface Dashboard
Parameters:
column - index of the column to add the gadget to
gadget - the gadget being added

changeLayout

public void changeLayout(com.atlassian.gadgets.dashboard.Layout layout,
                         com.atlassian.gadgets.dashboard.spi.GadgetLayout gadgetLayout)
                  throws GadgetLayoutException
Description copied from interface: Dashboard
Change the layout of the dashboard and use the gadget layout to update the gadget positioning.

Specified by:
changeLayout in interface Dashboard
Parameters:
layout - New layout to use for the dashboard
gadgetLayout - New positioning of the gadgets
Throws:
GadgetLayoutException - thrown if the positioning of the gadgets is not valid for the new layout - e.g. threre are gadgets in columns that don't exist in the new layout

rearrangeGadgets

public void rearrangeGadgets(com.atlassian.gadgets.dashboard.spi.GadgetLayout gadgetLayout)
                      throws GadgetLayoutException
Description copied from interface: Dashboard
Rearrange and reposition the gadgets on the dashboard according to the specified layout.

Specified by:
rearrangeGadgets in interface Dashboard
Parameters:
gadgetLayout - Layout to match
Throws:
GadgetLayoutException - thrown if the layout is invalid

changeGadgetColor

public void changeGadgetColor(com.atlassian.gadgets.GadgetId gadgetId,
                              com.atlassian.gadgets.dashboard.Color color)
Description copied from interface: Dashboard
Change the color of the gadgets chrome.

Specified by:
changeGadgetColor in interface Dashboard
Parameters:
gadgetId - Id of gadget to change the color of.
color - Color to change the chrome to

updateGadgetUserPrefs

public void updateGadgetUserPrefs(com.atlassian.gadgets.GadgetId gadgetId,
                                  Map<String,String> prefValues)
Description copied from interface: Dashboard
Save user prefs for a gadget

Specified by:
updateGadgetUserPrefs in interface Dashboard
Parameters:
gadgetId - Id of gadget to change the color of.
prefValues - preferences to save

removeGadget

public void removeGadget(com.atlassian.gadgets.GadgetId gadgetId)
Description copied from interface: Dashboard
Remove the gadget with the provided id from the dashboard.

Specified by:
removeGadget in interface Dashboard
Parameters:
gadgetId - id of the gadget to remove

getState

public com.atlassian.gadgets.dashboard.DashboardState getState()
Specified by:
getState in interface Dashboard

findGadget

public Gadget findGadget(com.atlassian.gadgets.GadgetId gadgetId)
Description copied from interface: Dashboard
Lookup a Gadget in this Dashboard given the gadget's id.

Specified by:
findGadget in interface Dashboard
Parameters:
gadgetId - The gadgetId of the gadget to lookup
Returns:
The Gadget or null if none could be found matching the id

getChanges

public List<com.atlassian.gadgets.dashboard.spi.changes.DashboardChange> getChanges()
Description copied from interface: Dashboard
Returns an immutable list of changes that have been made to this Dashboard, in the order that they occurred.

Specified by:
getChanges in interface Dashboard
Returns:
immutable list of changes that have been made to this Dashboard

clearChanges

public void clearChanges()
Description copied from interface: Dashboard
Clears the stored list of changes that have been made to this Dashboard

Specified by:
clearChanges in interface Dashboard

getNumberOfGadgets

public int getNumberOfGadgets()
Description copied from interface: Dashboard
Get the total number of gadgets on this dashboard

Specified by:
getNumberOfGadgets in interface Dashboard
Returns:
the total number of gadgets on the dashboard

assertGadgetLayoutIsValid

public void assertGadgetLayoutIsValid(com.atlassian.gadgets.dashboard.Layout layout,
                                      com.atlassian.gadgets.dashboard.spi.GadgetLayout gadgetLayout)
                               throws GadgetLayoutException
Checks to make sure there are no gadgets in out of bounds columns.

Parameters:
layout - the layout to verify against
gadgetLayout - the gadget layout to verify
Throws:
GadgetLayoutException - if the gadgetLayout contains more columns than this layout allows


Copyright © 2012 Atlassian. All Rights Reserved.