org.hippoecm.hst.mock.core.sitemenu
Class MockHstSiteMenuItem

java.lang.Object
  extended by org.hippoecm.hst.mock.core.sitemenu.MockHstSiteMenuItem
All Implemented Interfaces:
CommonMenuItem, HstSiteMenuItem

public class MockHstSiteMenuItem
extends Object
implements HstSiteMenuItem

Mock implementation of HstSiteMenuItem.


Constructor Summary
MockHstSiteMenuItem()
           
MockHstSiteMenuItem(String name)
           
MockHstSiteMenuItem(String name, boolean isExpanded)
           
 
Method Summary
 void addLocalParameter(String name, String value)
           
 void addParameter(String name, String value)
           
 HstSiteMenuItem addSiteMenuItem(HstSiteMenuItem siteMenuItem)
           
 List<HstSiteMenuItem> getChildMenuItems()
           
 int getDepth()
           
 String getExternalLink()
          When this method does not return null, then by default will return null even if the sitemenu item has a sitemap reference path defined
 HstLink getHstLink()
           
 HstSiteMenu getHstSiteMenu()
           
 String getLocalParameter(String name)
          The value of the local (no parameters inherited from ancestor items) parameter with possible property placeholders substituted
 Map<String,String> getLocalParameters()
           
 String getName()
           
 String getParameter(String name)
          A HstSiteMenuItem can contain a Map of parameters.
 Map<String,String> getParameters()
          Parameters are inherited from ancestor sitemenu items.
 HstSiteMenuItem getParentItem()
           
 Map<String,Object> getProperties()
          When developers have customized SiteMenuItem configuration with extra properties, these properties can be accessed through this Map
 List<HstSiteMenuItem> getSiteMenuItems()
           
 boolean isExpanded()
          A sitemenu item is expanded if one of its descendants is selected or if it is selected itself
 boolean isRepositoryBased()
           
 boolean isSelected()
           
 void putAllProperties(Map<String,Object> properties)
           
 void removeLocalParameter(String name)
           
 void removeParameter(String name)
           
 ResolvedSiteMapItem resolveToSiteMapItem(HstRequest request)
           
 void setDepth(int depth)
           
 void setExpanded(boolean isExpanded)
           
 void setExternalLink(String externalLink)
           
 void setHstLink(HstLink hstLink)
           
 void setHstSiteMenu(HstSiteMenu hstSiteMenu)
           
 void setName(String name)
           
 void setParentItem(HstSiteMenuItem parentItem)
           
 void setRepositoryBased(boolean repositoryBased)
           
 void setSelected(boolean selected)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockHstSiteMenuItem

public MockHstSiteMenuItem()

MockHstSiteMenuItem

public MockHstSiteMenuItem(String name)

MockHstSiteMenuItem

public MockHstSiteMenuItem(String name,
                           boolean isExpanded)
Method Detail

getChildMenuItems

public List<HstSiteMenuItem> getChildMenuItems()
Specified by:
getChildMenuItems in interface HstSiteMenuItem
Returns:
all direct child SiteMenuItem's of this item

getName

public String getName()
Specified by:
getName in interface CommonMenuItem
Returns:
the name of this SiteMenuItem

resolveToSiteMapItem

public ResolvedSiteMapItem resolveToSiteMapItem(HstRequest request)
Specified by:
resolveToSiteMapItem in interface CommonMenuItem
Returns:
the ResolvedSiteMapItem belonging to this SiteMenuItem or null if it cannot be resolved in the HstSiteMap

getProperties

public Map<String,Object> getProperties()
Description copied from interface: CommonMenuItem
When developers have customized SiteMenuItem configuration with extra properties, these properties can be accessed through this Map

Specified by:
getProperties in interface CommonMenuItem
Returns:
a Map containing the value for every property in the backing content provider for this SiteMenuItem

putAllProperties

public void putAllProperties(Map<String,Object> properties)

addSiteMenuItem

public HstSiteMenuItem addSiteMenuItem(HstSiteMenuItem siteMenuItem)

isExpanded

public boolean isExpanded()
Description copied from interface: CommonMenuItem
A sitemenu item is expanded if one of its descendants is selected or if it is selected itself

Specified by:
isExpanded in interface CommonMenuItem
Returns:
true if the SiteMenuItem is expanded

setExpanded

public void setExpanded(boolean isExpanded)

getParentItem

public HstSiteMenuItem getParentItem()
Specified by:
getParentItem in interface HstSiteMenuItem
Returns:
parent HstSiteMenuItem or null if it is a root item

setParentItem

public void setParentItem(HstSiteMenuItem parentItem)

getHstSiteMenu

public HstSiteMenu getHstSiteMenu()
Specified by:
getHstSiteMenu in interface HstSiteMenuItem
Returns:
the container HstSiteMenu of this HstSiteMenuItem

setHstSiteMenu

public void setHstSiteMenu(HstSiteMenu hstSiteMenu)

getHstLink

public HstLink getHstLink()
Specified by:
getHstLink in interface CommonMenuItem
Returns:
a HstLink that contains a link for this SiteMenuItem

setHstLink

public void setHstLink(HstLink hstLink)

getExternalLink

public String getExternalLink()
Description copied from interface: CommonMenuItem
When this method does not return null, then by default will return null even if the sitemenu item has a sitemap reference path defined

Specified by:
getExternalLink in interface CommonMenuItem
Returns:
an external (http/https etc) link or null if no external link is defined

setExternalLink

public void setExternalLink(String externalLink)

isRepositoryBased

public boolean isRepositoryBased()
Specified by:
isRepositoryBased in interface CommonMenuItem
Returns:
true when below this sitemenu item repository based navigation is expected

setRepositoryBased

public void setRepositoryBased(boolean repositoryBased)

getDepth

public int getDepth()
Specified by:
getDepth in interface CommonMenuItem
Returns:
the depth of repository based items in case of repository based navigation

setDepth

public void setDepth(int depth)

isSelected

public boolean isSelected()
Specified by:
isSelected in interface CommonMenuItem
Returns:
true is the SiteMenuItem is selected

setSelected

public void setSelected(boolean selected)

getSiteMenuItems

public List<HstSiteMenuItem> getSiteMenuItems()

setName

public void setName(String name)

getParameter

public String getParameter(String name)
Description copied from interface: HstSiteMenuItem
A HstSiteMenuItem can contain a Map of parameters. A parameter from this Map can be accessed through this method. If it is not present, null will be returned. The parameters are fetched from the HstSiteMenuItemConfiguration.getParameter(String), but in the value possible property placeholders in the value are replaced by the wildcards from HstSiteMapItem that was matched. When there are property placeholders that can not be resolved, the value is set to null Parameters are inherited from ancestor HstSiteMenuItem's. When this HstSiteMenuItem configures the same parameter as an ancestor, the value from the ancestor is overwritten.

Specified by:
getParameter in interface HstSiteMenuItem
Parameters:
name - the name of the parameter
Returns:
the value of the parameter or null when not present or has unresolved property placeholders

getParameters

public Map<String,String> getParameters()
Description copied from interface: HstSiteMenuItem
Parameters are inherited from ancestor sitemenu items. When this sitemenu item configures the same parameter as an ancestor, the value from the ancestor is overwritten.

Specified by:
getParameters in interface HstSiteMenuItem
Returns:
the Map of parameters contained in this HstSiteMenu. If no parameters present, and empty map is returned
See Also:
#getParameter(String)}, only now the entire parameters map is returned.

addParameter

public void addParameter(String name,
                         String value)

removeParameter

public void removeParameter(String name)

getLocalParameter

public String getLocalParameter(String name)
Description copied from interface: HstSiteMenuItem
The value of the local (no parameters inherited from ancestor items) parameter with possible property placeholders substituted

Specified by:
getLocalParameter in interface HstSiteMenuItem
Parameters:
name - the name of the parameter
Returns:
the value of the parameter or null when not present or has unresolved property placeholders
See Also:
#getParameter(String)}, only this method returns parameters without inheritance

getLocalParameters

public Map<String,String> getLocalParameters()
Specified by:
getLocalParameters in interface HstSiteMenuItem
Returns:
the Map of parameters contained in this HstSiteMapItem. If no parameters present, and empty map is returned
See Also:
#getParameters()}, only this method returns parameters without inheritance

addLocalParameter

public void addLocalParameter(String name,
                              String value)

removeLocalParameter

public void removeLocalParameter(String name)


Copyright © 2008-2012 Hippo. All Rights Reserved.