org.riotfamily.pages.model
Class PageNode

java.lang.Object
  extended by org.riotfamily.pages.model.PageNode

public class PageNode
extends Object

Class that represents a node in the website's sitemap. Each PageNode has a set of pages that hold localized data for a Site. The PageNode itself holds the data that all pages have in common.

Since:
6.5
Author:
Felix Gnass [fgnass at neteye dot de], Jan-Frederic Linde [jfl at neteye dot de]

Constructor Summary
PageNode()
           
PageNode(Page page)
          Convenience constructor that adds the given Page.
 
Method Summary
 void addChildNode(PageNode node)
          Adds a child node.
 void addPage(Page page)
          Adds a localized page to the node.
 List<PageNode> getChildNodes()
          Returns the child nodes.
 List<Page> getChildPages(Site site)
          Returns an unmodifiable list of all child pages that are available in the given site.
 Collection<Page> getChildPagesWithFallback(Site site)
          Returns an unmodifiable list of all child pages available in the given site or its master site.
 Long getId()
          Returns the id of the PageNode.
 Page getPage(Site site)
          Returns the localized page for the given site or null if no translation is available.
 Set<Page> getPages()
          Returns the set of pages associated with this node.
 String getPageType()
          Returns the page type.
 PageNode getParent()
          Returns the parent node.
 boolean hasPages()
          Returns whether the node has any pages.
 boolean isHidden()
          Returns whether the page should be hidden in menus.
 boolean isSystemNode()
          Returns whether the node is a system node.
 void removePage(Page page)
          Removes the given page from the node.
 void setChildNodes(List<PageNode> childNodes)
           
 void setHidden(boolean hidden)
           
 void setId(Long id)
           
 void setPages(Set<Page> pages)
           
 void setPageType(String pageType)
           
protected  void setParent(PageNode parent)
          Sets the parent node.
 void setSystemNode(boolean systemNode)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageNode

public PageNode()

PageNode

public PageNode(Page page)
Convenience constructor that adds the given Page.

Method Detail

getId

public Long getId()
Returns the id of the PageNode.


setId

public void setId(Long id)

getParent

public PageNode getParent()
Returns the parent node. There must be exactly one PageNode without a parent. This node can be obtained via the getRootNode() method of the PageDao.


setParent

protected void setParent(PageNode parent)
Sets the parent node. To establish a parent-child use the addChildNode(PageNode) method.


getPages

public Set<Page> getPages()
Returns the set of pages associated with this node.


setPages

public void setPages(Set<Page> pages)

addChildNode

public void addChildNode(PageNode node)
Adds a child node. If the given node has no handlerName, it will be set to the childHandlerName.


getChildNodes

public List<PageNode> getChildNodes()
Returns the child nodes.


setChildNodes

public void setChildNodes(List<PageNode> childNodes)

getChildPages

public List<Page> getChildPages(Site site)
Returns an unmodifiable list of all child pages that are available in the given site.


getChildPagesWithFallback

public Collection<Page> getChildPagesWithFallback(Site site)
Returns an unmodifiable list of all child pages available in the given site or its master site. This method is used by the PageRiotDao to list all pages are already localized or can be translated.


getPage

public Page getPage(Site site)
Returns the localized page for the given site or null if no translation is available.


addPage

public void addPage(Page page)
Adds a localized page to the node.

Throws:
IllegalArgumentException - If the given page is null or the page is not associated with a site or another page with the same site is already present

removePage

public void removePage(Page page)
Removes the given page from the node.


hasPages

public boolean hasPages()
Returns whether the node has any pages.


getPageType

public String getPageType()
Returns the page type. The type is used to select an appropriate view.


setPageType

public void setPageType(String pageType)

isHidden

public boolean isHidden()
Returns whether the page should be hidden in menus.


setHidden

public void setHidden(boolean hidden)

isSystemNode

public boolean isSystemNode()
Returns whether the node is a system node. System nodes are usually created by a PageSetupBean and provide some kind of functionality (in contrast to nodes that only contain content) and must not be deleted.


setSystemNode

public void setSystemNode(boolean systemNode)

toString

public String toString()
Overrides:
toString in class Object