org.meshcms.core
Class SiteInfo

java.lang.Object
  extended byorg.meshcms.core.SiteInfo

public class SiteInfo
extends java.lang.Object

Contains data about site menu customization and theme mappings.


Field Summary
static java.lang.String HIDESUBMENU
          Prefix of the submenu codes.
static java.lang.String SCORE
          Prefix of the score codes.
static java.lang.String THEME
          Prefix of the theme codes.
static java.lang.String TITLE
          Prefix of the title codes.
 
Constructor Summary
protected SiteInfo()
           
 
Method Summary
 boolean getHideSubmenu(Path pagePath)
          Returns the hide submenu for the given path (false if not available).
 java.lang.String getHideSubmenuAsString(Path pagePath)
          Returns the hide submenu as a string for the given path.
static java.lang.String getHideSubmenuCode(Path pagePath)
          Returns the code for the show submenu field of the given path.
 int getPageScore(Path pagePath)
          Returns the page score for the given path (0 if not available).
 java.lang.String getPageScoreAsString(Path pagePath)
          Returns the page score as a string for the given path.
 java.lang.String getPageTheme(Path pagePath)
          Returns the theme to be applied to the given path.
 java.lang.String getPageTitle(PageInfo pageInfo)
          Returns the menu title for a page.
 java.lang.String getPageTitle(Path pagePath)
          Returns the menu title for the given path (null if not available).
static java.lang.String getScoreCode(Path pagePath)
          Returns the code for the score field of the given path.
static java.lang.String getThemeCode(Path pagePath)
          Returns the code for the theme field of the given path.
protected  Path getThemePath(Path pagePath)
           
 Path getThemeRoot(Path pagePath)
          Returns the path of the page whose theme is inherited.
static java.lang.String getTitleCode(Path pagePath)
          Returns the code for the title field of the given path.
 WebSite getWebSite()
           
static SiteInfo load(WebSite webSite)
          Loads configuration from the config file (if found).
 void setHideSubmenu(Path pagePath, boolean hide)
          Sets the hide submenu for the given path.
 void setHideSubmenu(Path pagePath, java.lang.String hide)
          Sets the hide submenu for the given path.
 void setPageScore(Path pagePath, int score)
          Sets the page score for the given path.
 void setPageScore(Path pagePath, java.lang.String score)
          Sets the page score for the given path.
 void setPageTheme(Path pagePath, java.lang.String theme)
          Sets the theme to be applied to the given path.
 void setPageTitle(Path pagePath, java.lang.String title)
          Sets the menu title for the given path.
 boolean setValue(java.lang.String fieldName, java.lang.String value)
          Sets a generic value.
 void setWebSite(WebSite webSite)
           
 boolean store()
          Saves the configuration to file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE

public static final java.lang.String TITLE
Prefix of the title codes.

See Also:
Constant Field Values

SCORE

public static final java.lang.String SCORE
Prefix of the score codes.

See Also:
Constant Field Values

THEME

public static final java.lang.String THEME
Prefix of the theme codes.

See Also:
Constant Field Values

HIDESUBMENU

public static final java.lang.String HIDESUBMENU
Prefix of the submenu codes.

See Also:
Constant Field Values
Constructor Detail

SiteInfo

protected SiteInfo()
Method Detail

load

public static SiteInfo load(WebSite webSite)
Loads configuration from the config file (if found).

Returns:
true if the configuration has been loaded, false otherwise

store

public boolean store()
Saves the configuration to file.

Returns:
true if the configuration has been saved, false otherwise

getPageTheme

public java.lang.String getPageTheme(Path pagePath)
Returns the theme to be applied to the given path.


setPageTheme

public void setPageTheme(Path pagePath,
                         java.lang.String theme)
Sets the theme to be applied to the given path. If the value is null or empty, the theme is removed.


getPageTitle

public java.lang.String getPageTitle(PageInfo pageInfo)
Returns the menu title for a page. If the menu configuration does not contain a value for this page, the page title itself is returned.


getPageTitle

public java.lang.String getPageTitle(Path pagePath)
Returns the menu title for the given path (null if not available).


setPageTitle

public void setPageTitle(Path pagePath,
                         java.lang.String title)
Sets the menu title for the given path. If the value is null or empty, the title is removed.


getPageScore

public int getPageScore(Path pagePath)
Returns the page score for the given path (0 if not available).


getPageScoreAsString

public java.lang.String getPageScoreAsString(Path pagePath)
Returns the page score as a string for the given path. An empty string is returned if the page score is 0.


setPageScore

public void setPageScore(Path pagePath,
                         java.lang.String score)
Sets the page score for the given path.


setPageScore

public void setPageScore(Path pagePath,
                         int score)
Sets the page score for the given path. If the score is 0, it is removed since 0 is the default.


getHideSubmenu

public boolean getHideSubmenu(Path pagePath)
Returns the hide submenu for the given path (false if not available).


getHideSubmenuAsString

public java.lang.String getHideSubmenuAsString(Path pagePath)
Returns the hide submenu as a string for the given path. An empty string is returned if the hide submenu is false.


setHideSubmenu

public void setHideSubmenu(Path pagePath,
                           java.lang.String hide)
Sets the hide submenu for the given path.


setHideSubmenu

public void setHideSubmenu(Path pagePath,
                           boolean hide)
Sets the hide submenu for the given path. If the submenu is shown, it is removed since false is the default.


getScoreCode

public static java.lang.String getScoreCode(Path pagePath)
Returns the code for the score field of the given path. This code is used in the HTML configuration form and in the config file.


getTitleCode

public static java.lang.String getTitleCode(Path pagePath)
Returns the code for the title field of the given path. This code is used in the HTML configuration form and in the config file.


getThemeCode

public static java.lang.String getThemeCode(Path pagePath)
Returns the code for the theme field of the given path. This code is used in the HTML configuration form and in the config file.


getHideSubmenuCode

public static java.lang.String getHideSubmenuCode(Path pagePath)
Returns the code for the show submenu field of the given path. This code is used in the HTML configuration form and in the config file.


setValue

public boolean setValue(java.lang.String fieldName,
                        java.lang.String value)
Sets a generic value. The fieldName parameter is analyzed to guess what value is going to be set. This is used to save all form fields.

Returns:
true if the fieldName has been recognized as a valid one, false otherwise

getThemePath

protected Path getThemePath(Path pagePath)

getThemeRoot

public Path getThemeRoot(Path pagePath)
Returns the path of the page whose theme is inherited.


getWebSite

public WebSite getWebSite()

setWebSite

public void setWebSite(WebSite webSite)