org.apache.shindig.gadgets.spec
Class ModulePrefs

java.lang.Object
  extended by org.apache.shindig.gadgets.spec.ModulePrefs

public class ModulePrefs
extends Object

Represents the ModulePrefs element of a gadget spec. This encapsulates most gadget meta data, including everything except for Content and UserPref nodes.


Constructor Summary
ModulePrefs(Element element, Uri base)
           
 
Method Summary
 String getAttribute(String name)
           
 String getAttribute(String name, String defaultValue)
           
 String getAuthor()
          ModulePrefs@author Message Bundles
 String getAuthorAboutme()
          ModulePrefs@author_aboutme Message Bundles
 String getAuthorAffiliation()
          ModulePrefs@author_affiliation Message Bundles
 String getAuthorEmail()
          ModulePrefs@author_email Message Bundles
 Uri getAuthorLink()
          ModulePrefs@author_link Message Bundles
 String getAuthorLocation()
          ModulePrefs@author_location Message Bundles
 Uri getAuthorPhoto()
          ModulePrefs@author_photo Message Bundles
 String getAuthorQuote()
          ModulePrefs@author_quote Message Bundles
 boolean getBoolAttribute(String name)
           
 List<String> getCategories()
           
 String getDescription()
          ModulePrefs@description Message Bundles
 String getDirectoryTitle()
          ModulePrefs@directory_title Message Bundles
 com.google.common.collect.Multimap<String,Node> getExtraElements()
           
 Map<String,Feature> getFeatures()
           
 int getHeight()
          ModuleSpec@height
 List<Icon> getIcons()
           
 int getIntAttribute(String name)
           
 Map<String,LinkSpec> getLinks()
           
 LocaleSpec getLocale(Locale locale)
          Gets the locale spec for the given locale, if any exists.
 Map<Locale,LocaleSpec> getLocales()
           
 OAuthSpec getOAuthSpec()
           
 List<Preload> getPreloads()
           
 boolean getScaling()
          ModulePrefs@scaling
 Uri getScreenshot()
          ModulePrefs@screenshot Message Bundles
 boolean getScrolling()
          ModulePrefs@scrolling
 boolean getShowInDirectory()
          ModulePrefs@show_in_directory
 boolean getShowStats()
          ModulePrefs@show_stats
 boolean getSingleton()
          ModulePrefs@singleton
 Uri getThumbnail()
          ModulePrefs@thumbnail Message Bundles
 String getTitle()
          ModulePrefs@title User Pref + Message Bundle + Bidi
 Uri getTitleUrl()
          ModulePrefs@title_url User Pref + Message Bundle + Bidi
 Uri getUriAttribute(String name)
           
 int getWidth()
          ModuleSpec@width
 boolean needsUserPrefSubstitution()
          Note: not part of the spec.
 ModulePrefs substitute(Substitutions substituter)
          Produces a new ModulePrefs by substituting hangman variables from substituter.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModulePrefs

public ModulePrefs(Element element,
                   Uri base)
            throws SpecParserException
Throws:
SpecParserException
Method Detail

getTitle

public String getTitle()
ModulePrefs@title User Pref + Message Bundle + Bidi


getTitleUrl

public Uri getTitleUrl()
ModulePrefs@title_url User Pref + Message Bundle + Bidi


getDescription

public String getDescription()
ModulePrefs@description Message Bundles


getAuthor

public String getAuthor()
ModulePrefs@author Message Bundles


getAuthorEmail

public String getAuthorEmail()
ModulePrefs@author_email Message Bundles


getScreenshot

public Uri getScreenshot()
ModulePrefs@screenshot Message Bundles


getThumbnail

public Uri getThumbnail()
ModulePrefs@thumbnail Message Bundles


getDirectoryTitle

public String getDirectoryTitle()
ModulePrefs@directory_title Message Bundles


getAuthorAffiliation

public String getAuthorAffiliation()
ModulePrefs@author_affiliation Message Bundles


getAuthorLocation

public String getAuthorLocation()
ModulePrefs@author_location Message Bundles


getAuthorPhoto

public Uri getAuthorPhoto()
ModulePrefs@author_photo Message Bundles


getAuthorAboutme

public String getAuthorAboutme()
ModulePrefs@author_aboutme Message Bundles


getAuthorQuote

public String getAuthorQuote()
ModulePrefs@author_quote Message Bundles


getAuthorLink

public Uri getAuthorLink()
ModulePrefs@author_link Message Bundles


getShowStats

public boolean getShowStats()
ModulePrefs@show_stats


getShowInDirectory

public boolean getShowInDirectory()
ModulePrefs@show_in_directory


getSingleton

public boolean getSingleton()
ModulePrefs@singleton


getScaling

public boolean getScaling()
ModulePrefs@scaling


getScrolling

public boolean getScrolling()
ModulePrefs@scrolling


getWidth

public int getWidth()
ModuleSpec@width


getHeight

public int getHeight()
ModuleSpec@height


getAttribute

public String getAttribute(String name)
Parameters:
name - the attribute name
Returns:
the value of an ModulePrefs attribute by name, or null if the attribute doesn't exist

getAttribute

public String getAttribute(String name,
                           String defaultValue)
Parameters:
name - the attribute name
defaultValue - the default Value
Returns:
the value of an ModulePrefs attribute by name, or the default value if the attribute doesn't exist

getUriAttribute

public Uri getUriAttribute(String name)
Parameters:
name - the attribute name
Returns:
the attribute by name converted to an URI, or the empty URI if the attribute couldn't be converted

getBoolAttribute

public boolean getBoolAttribute(String name)
Parameters:
name - the attribute name
Returns:
the attribute by name converted to a boolean (false if the attribute doesn't exist)

getIntAttribute

public int getIntAttribute(String name)
Parameters:
name - the attribute name
Returns:
the attribute by name converted to an integer, or 0 if the attribute doesn't exist or is not a valid number.

getCategories

public List<String> getCategories()
Returns:
Returns a list of flattened attributes for: ModuleSpec@category ModuleSpec@category2

getFeatures

public Map<String,Feature> getFeatures()
Returns:
a map of ModuleSpec/Require and ModuleSpec/Optional elements to Feature

getPreloads

public List<Preload> getPreloads()
Returns:
a list of Preloads from the ModuleSpec/Preload element

getIcons

public List<Icon> getIcons()
Returns:
a list of Icons from the ModuleSpec/Icon element

getLocales

public Map<Locale,LocaleSpec> getLocales()
Returns:
a map of Locales to LocalSpec from the ModuleSpec/Locale element

getLinks

public Map<String,LinkSpec> getLinks()
Returns:
a map of Link names to LinkSpec from the ModuleSpec/Link element

getOAuthSpec

public OAuthSpec getOAuthSpec()
Returns:
an OAuthSpec built from the ModuleSpec/OAuthSpec element

getExtraElements

public com.google.common.collect.Multimap<String,Node> getExtraElements()
Returns:
a Multimap of tagnames to child elements of the ModuleSpec element

needsUserPrefSubstitution

public boolean needsUserPrefSubstitution()
Note: not part of the spec.

Returns:
true when UserPref-substitutable fields in this prefs require __UP_ substitution.

getLocale

public LocaleSpec getLocale(Locale locale)
Gets the locale spec for the given locale, if any exists.

Returns:
The locale spec, if there is a matching one, or null.

substitute

public ModulePrefs substitute(Substitutions substituter)
Produces a new ModulePrefs by substituting hangman variables from substituter. See comments on individual fields to see what actually has substitutions performed.

Parameters:
substituter - the substituter to execute
Returns:
a substituted ModulePrefs

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2012. All Rights Reserved.