org.sakaiproject.component.legacy.site
Class BaseSitePage

java.lang.Object
  extended byorg.sakaiproject.component.legacy.site.BaseSitePage
All Implemented Interfaces:
Edit, Entity, Identifiable, Serializable, SitePage

public class BaseSitePage
extends Object
implements SitePage, Identifiable

BaseSitePage is an implementation of the Site API SitePage.

Author:
Sakai Software Development Team
See Also:
Serialized Form

Field Summary
protected  boolean m_active
          Active flag.
protected  String m_id
          The site id.
protected  int m_layout
          The layout.
protected  boolean m_popup
          The popup setting.
protected  ResourcePropertiesEdit m_properties
          The properties.
protected  Site m_site
          The site I belong to.
protected  String m_siteId
          The site id I belong to, in case I have no m_site.
protected  String m_skin
          The site skin, in case I have no m_site.
protected  String m_title
          The title.
protected  ResourceVector m_tools
          the list of tool configurations for this SitePage
protected  boolean m_toolsLazy
          false while the page's tools have not yet been read in.
 
Fields inherited from interface org.sakaiproject.service.legacy.site.SitePage
LAYOUT_DOUBLE_COL, LAYOUT_NAMES, LAYOUT_SINGLE_COL, rb
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
protected BaseSitePage(Element el, Site site)
          Construct from XML element.
protected BaseSitePage(Site site)
          Construct.
protected BaseSitePage(SitePage other, Site site, boolean exact)
          Construct as a copy of another.
protected BaseSitePage(Site site, String id, String title, String layout, boolean popup)
          ReConstruct
protected BaseSitePage(String pageId, String title, String layout, boolean popup, String siteId, String skin)
          ReConstruct - if we don't have a site to follow up to get to certain site info.
 
Method Summary
protected  void activate()
          Enable editing.
 ToolConfiguration addTool()
          Add a new tool to the page.
 ToolConfiguration addTool(Tool reg)
          Add a new tool to the page, initialized to the tool registration information provided.
protected  void closeEdit()
          Close the edit object - it cannot be used after this.
 Site getContainingSite()
          Access the site in which this page lives.
 String getId()
          Access the id.
 int getLayout()
           
 String getLayoutTitle()
           
 ResourceProperties getProperties()
          Access the entity's properties.
 ResourcePropertiesEdit getPropertiesEdit()
          Access the resource's properties for modification
 String getReference()
          Access the internal reference which can be used to access the entity from within the system.
 String getReference(String rootProperty)
          Access the alternate internal reference which can be used to access the entity from within the system.
 String getSiteId()
           
 String getSkin()
           
 String getTitle()
           
 ToolConfiguration getTool(String id)
          Access a tool on this page by id.
 List getTools()
           
 List getTools(int col)
           
 Collection getTools(String[] toolIds)
          Get all the tools placed in the site on this page that are of any of these tool ids.
 String getUrl()
          Access the URL which can be used to access the entity.
 String getUrl(String rootProperty)
          Access the alternate URL which can be used to access the entity.
 boolean isActiveEdit()
          Check to see if the edit is still active, or has already been closed.
 boolean isPopUp()
           
 void moveDown()
          Move this page one step towards the end of the order of pages in this site.
 void moveUp()
          Move this page one step towards the start of the order of pages in this site.
 void removeTool(ToolConfiguration tool)
          Remove a tool from this page.
 void setLayout(int layout)
          Set the layout for this page.
 void setPopup(boolean popup)
          Set the popup status for this page.
 void setTitle(String title)
          Set the display title of this page.
 Element toXml(Document doc, Stack stack)
          Serialize the entity into XML, adding an element to the doc under the top of the stack element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_title

protected String m_title
The title.


m_layout

protected int m_layout
The layout.


m_popup

protected boolean m_popup
The popup setting.


m_id

protected String m_id
The site id.


m_properties

protected ResourcePropertiesEdit m_properties
The properties.


m_tools

protected ResourceVector m_tools
the list of tool configurations for this SitePage


m_toolsLazy

protected boolean m_toolsLazy
false while the page's tools have not yet been read in.


m_active

protected boolean m_active
Active flag.


m_site

protected Site m_site
The site I belong to.


m_siteId

protected String m_siteId
The site id I belong to, in case I have no m_site.


m_skin

protected String m_skin
The site skin, in case I have no m_site.

Constructor Detail

BaseSitePage

protected BaseSitePage(Site site)
Construct. Auto-generate the id.

Parameters:
site - The site in which this page lives.

BaseSitePage

protected BaseSitePage(Site site,
                       String id,
                       String title,
                       String layout,
                       boolean popup)
ReConstruct

Parameters:
site - The site in which this page lives.
id - The page id.
title - The page title.
layout - The layout as a string ("0" or not currently supported).
popup - The page popup setting.

BaseSitePage

protected BaseSitePage(String pageId,
                       String title,
                       String layout,
                       boolean popup,
                       String siteId,
                       String skin)
ReConstruct - if we don't have a site to follow up to get to certain site info.

Parameters:
pageId - The page id.
title - The page title.
layout - The layout as a string ("0" or not currently supported).
popup - The page popup setting.
siteId - The page's site's id.
skin - The page's site's skin.

BaseSitePage

protected BaseSitePage(SitePage other,
                       Site site,
                       boolean exact)
Construct as a copy of another.

Parameters:
other - The other to copy.
site - The site in which this page lives.
exact - If true, we copy ids - else we generate new ones for page and tools.

BaseSitePage

protected BaseSitePage(Element el,
                       Site site)
Construct from XML element.

Parameters:
el - The XML element.
site - The site in which this page lives.
Method Detail

getTitle

public String getTitle()
Specified by:
getTitle in interface SitePage
Returns:
The human readable Title of this SitePage.

getLayout

public int getLayout()
Specified by:
getLayout in interface SitePage
Returns:
the layout for this page.

getSkin

public String getSkin()
Specified by:
getSkin in interface SitePage
Returns:
the skin to use for this page.

getSiteId

public String getSiteId()
Specified by:
getSiteId in interface SitePage
Returns:
the site id for this page.

isPopUp

public boolean isPopUp()
Specified by:
isPopUp in interface SitePage
Returns:
true if page should open in new window.

getLayoutTitle

public String getLayoutTitle()
Specified by:
getLayoutTitle in interface SitePage
Returns:
the layout title for this page.

getTools

public List getTools()
Specified by:
getTools in interface SitePage
Returns:
The List (ToolConfiguration) of tools on this page.

getTools

public Collection getTools(String[] toolIds)
Description copied from interface: SitePage
Get all the tools placed in the site on this page that are of any of these tool ids.

Specified by:
getTools in interface SitePage
Returns:
A Collection (ToolConfiguration) of all the tools placed in the site on this page that are of this tool id (may be empty).

getTools

public List getTools(int col)
Specified by:
getTools in interface SitePage
Returns:
The List (ToolConfiguration) of tools on this column (0 based) of this page.

getTool

public ToolConfiguration getTool(String id)
Description copied from interface: SitePage
Access a tool on this page by id.

Specified by:
getTool in interface SitePage
Parameters:
id - The tool id.
Returns:
The tool on this page with this id, or null if not found.

setTitle

public void setTitle(String title)
Description copied from interface: SitePage
Set the display title of this page.

Specified by:
setTitle in interface SitePage
Parameters:
title - The new title.

setLayout

public void setLayout(int layout)
Description copied from interface: SitePage
Set the layout for this page.

Specified by:
setLayout in interface SitePage
Parameters:
layout - The new layout.

setPopup

public void setPopup(boolean popup)
Description copied from interface: SitePage
Set the popup status for this page.

Specified by:
setPopup in interface SitePage
Parameters:
popup - The new popup status.

addTool

public ToolConfiguration addTool()
Description copied from interface: SitePage
Add a new tool to the page.

Specified by:
addTool in interface SitePage
Returns:
the ToolConfigurationEdit object for the new tool.

addTool

public ToolConfiguration addTool(Tool reg)
Description copied from interface: SitePage
Add a new tool to the page, initialized to the tool registration information provided.

Specified by:
addTool in interface SitePage
Parameters:
reg - The tool registration information used to initialize the tool.
Returns:
the ToolConfigurationEdit object for the new tool.

removeTool

public void removeTool(ToolConfiguration tool)
Description copied from interface: SitePage
Remove a tool from this page.

Specified by:
removeTool in interface SitePage
Parameters:
tool - The tool to remove.

moveUp

public void moveUp()
Description copied from interface: SitePage
Move this page one step towards the start of the order of pages in this site.

Specified by:
moveUp in interface SitePage

moveDown

public void moveDown()
Description copied from interface: SitePage
Move this page one step towards the end of the order of pages in this site.

Specified by:
moveDown in interface SitePage

getPropertiesEdit

public ResourcePropertiesEdit getPropertiesEdit()
Description copied from interface: Edit
Access the resource's properties for modification

Specified by:
getPropertiesEdit in interface Edit
Returns:
The resource's properties.

activate

protected void activate()
Enable editing.


isActiveEdit

public boolean isActiveEdit()
Description copied from interface: Edit
Check to see if the edit is still active, or has already been closed.

Specified by:
isActiveEdit in interface Edit
Returns:
true if the edit is active, false if it's been closed.

closeEdit

protected void closeEdit()
Close the edit object - it cannot be used after this.


getUrl

public String getUrl()
Description copied from interface: Entity
Access the URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Returns:
The URL which can be used to access the entity.

getReference

public String getReference()
Description copied from interface: Entity
Access the internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Returns:
The the internal reference which can be used to access the entity from within the system.

getReference

public String getReference(String rootProperty)
Description copied from interface: Entity
Access the alternate internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference is requested. If null, the native 'raw' reference is requested.
Returns:
The the alternate internal reference which can be used to access the entity from within the system.

getUrl

public String getUrl(String rootProperty)
Description copied from interface: Entity
Access the alternate URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference URL is requested. If null, the native 'raw' URL is requested.
Returns:
The alternate URL which can be used to access the entity.

getId

public String getId()
Description copied from interface: Identifiable
Access the id.

Specified by:
getId in interface Entity
Returns:
The id.

getContainingSite

public Site getContainingSite()
Description copied from interface: SitePage
Access the site in which this page lives.

Specified by:
getContainingSite in interface SitePage
Returns:
the site in which this page lives.

getProperties

public ResourceProperties getProperties()
Description copied from interface: Entity
Access the entity's properties.

Specified by:
getProperties in interface Entity
Returns:
The entity's properties.

toXml

public Element toXml(Document doc,
                     Stack stack)
Description copied from interface: Entity
Serialize the entity into XML, adding an element to the doc under the top of the stack element.

Specified by:
toXml in interface Entity
Parameters:
doc - The DOM doc to contain the XML (or null for a string return).
stack - The DOM elements, the top of which is the containing element of the new "entity" element.
Returns:
The newly added element.