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

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

public final class GadgetImpl
extends Object
implements Gadget

Basic Gadget implementation.


Constructor Summary
GadgetImpl(GadgetState state, GadgetSpec gadgetSpec)
          Constructor.
GadgetImpl(GadgetState stateOnLoadAttempt, String errorMessage)
          Constructor used by the dashboard when there is an error loading the gadget.
 
Method Summary
 Color getColor()
           
 String getErrorMessage()
          Returns an error message if the gadget was constructed with one, which should be the case when isLoaded() returns false
 String getGadgetSpecUrl()
           
 Integer getHeight()
           
 GadgetId getId()
           
 GadgetState getState()
           
 String getTitle()
           
 URI getTitleUrl()
          Returns an optional URL that the gagdget's title will link to
 Iterable<UserPref> getUserPrefs()
           
 Integer getWidth()
           
 boolean hasNonHiddenUserPrefs()
          Returns true if the gadget contains at least one pref that isn't hidden.
 boolean isLoaded()
          Tells if the gadget has been loaded successfully
 boolean isMaximizable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GadgetImpl

public GadgetImpl(GadgetState state,
                  GadgetSpec gadgetSpec)
Constructor.

Parameters:
state - the GadgetState for this instance
gadgetSpec - the Shindig GadgetSpec to build this instance from

GadgetImpl

public GadgetImpl(GadgetState stateOnLoadAttempt,
                  String errorMessage)
Constructor used by the dashboard when there is an error loading the gadget.

Parameters:
stateOnLoadAttempt - the GadgetState when the gadget failed to load
errorMessage - the error message explaining why the gadget failed to load
Method Detail

getId

public GadgetId getId()
Specified by:
getId in interface Gadget

getTitle

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

getTitleUrl

public URI getTitleUrl()
Description copied from interface: Gadget
Returns an optional URL that the gagdget's title will link to

Specified by:
getTitleUrl in interface Gadget

getGadgetSpecUrl

public String getGadgetSpecUrl()
Specified by:
getGadgetSpecUrl in interface Gadget

getHeight

public Integer getHeight()
Specified by:
getHeight in interface Gadget

getWidth

public Integer getWidth()
Specified by:
getWidth in interface Gadget

getColor

public Color getColor()
Specified by:
getColor in interface Gadget

isMaximizable

public boolean isMaximizable()
Specified by:
isMaximizable in interface Gadget

hasNonHiddenUserPrefs

public boolean hasNonHiddenUserPrefs()
Description copied from interface: Gadget
Returns true if the gadget contains at least one pref that isn't hidden. If the gadget has no prefs of any sort, this will return false.

Specified by:
hasNonHiddenUserPrefs in interface Gadget
Returns:
true if the gadget contains at least one non-hidden pref

getUserPrefs

public Iterable<UserPref> getUserPrefs()
Specified by:
getUserPrefs in interface Gadget

getState

public GadgetState getState()
Specified by:
getState in interface Gadget

getErrorMessage

public String getErrorMessage()
Description copied from interface: Gadget
Returns an error message if the gadget was constructed with one, which should be the case when isLoaded() returns false

Specified by:
getErrorMessage in interface Gadget

isLoaded

public boolean isLoaded()
Description copied from interface: Gadget
Tells if the gadget has been loaded successfully

Specified by:
isLoaded in interface Gadget


Copyright © 2010 Atlassian. All Rights Reserved.