com.pepper.platform.page
Interface Page

All Known Implementing Classes:
PepperPage, ProxyPage, SectionPage

public interface Page

An interface used by packages and the binder to access and pass around package-specific XML data.


Method Summary
 boolean exists()
          Returns true if the Page exists either in the original jar file or on disk
 boolean getBackup()
          Returns true if the Page is marked to for backup.
 File getBaseDir()
          Returns the base directory used when constructing absolute paths from a Page's name.
 Date getCreateDate()
          Returns the page's create date.
 String getDefaultType()
          Returns the defaultPageType of this page, usually a section.
 boolean getForceAutoSave()
          Get the state of the forceAutoSave flag.
 String getId()
          Returns the id of this Page.
 long getLastSaveTime()
          Gets the timestamp that the Page was last saved via the save() method.
 String getName()
          Returns the name of this Page.
 int getNoCache()
          Get the value which controls how the page will be redisplayed when it has been previously loaded into a tab.
 String getPackageName()
          Returns the package name of this Page.
 String getPackageVersion()
          Returns the package version of this Page.
 org.jdom.Document getPageData()
          Returns the application specific XML page data.
 String getRootAttrValue(String attrName)
          Returns the value of the specified attribute on the root element (ie page, section) in the document
 List getSupportedPageTypes()
          Returns a list of supported page types that this page may contain.
 String getTemplate()
          Returns the XSLT template of this Page.
 String getType()
          Returns the type of this page.
 boolean isAutoSaveEnabled()
          Returns true if the Page has autoSave enabled.
 boolean isDeletable()
          Returns true if the Page is marked as deletable.
 boolean isHidden()
          Returns true if the Page is marked as hidden.
 boolean isLoaded()
          Returns true if the Page has been loaded from disk, or has had it's XML page data set directly by a call to setPageData().
 boolean isPageTypeSupported(String pageType)
          Indicates whether the specified page type may be contained by this page.
 boolean isReadOnly()
          Returns true if the Page is marked as read-only.
 boolean isSecure()
          Returns true if the Page is marked as secure.
 org.jdom.Document load()
          Loads the Page from disk.
 void save()
          Causes the Page to be serialized to disk.
 void setAutoSaveEnabled(boolean autoSaveEnabled)
          Sets the state of the autoStateEnabled flag
 void setBackup(boolean backup)
          Sets or clears the backup attribute.
 void setBaseDir(String baseDir)
          Sets the base directory used when constructing absolute paths from a Page's name.
 void setClassLoader(ClassLoader cl)
          Sets the class loader of this page.
 void setDeletable(boolean isDeletable)
          Sets or clears the deletable attribute.
 void setForceAutoSave(boolean state)
          If true, this will force the auto save and program framework to save the page the next time such an event is triggered, regardless if other criteria (such as modified components) is met or not.
 void setHidden(boolean isHidden)
          Sets or clears the hidden attribute.
 void setId(String id)
          Sets the id of this Page.
 void setLastSaveTime(long time)
          Sets the timestamp when the page was last saved.
 void setName(String name)
          Sets the name of this Page.
 void setNoCache(int options)
          Set the value which controls how the page will be redisplayed when it has been previously loaded into a tab.
 void setPackageName(String name)
          Sets the package name of this Page.
 void setPackageVersion(String version)
          Sets the package version of this Page.
 void setPageData(org.jdom.Document pageData)
          Sets the application specific XML page data.
 void setReadOnly(boolean isReadOnly)
          Sets or clears the read-only attribute.
 void setSecure(boolean isSecure)
          Sets or clears the secure attribute.
 void setSupportedPageTypes(List supportedPageTypes)
          Sets the supported page types this page may contain.
 void setTemplate(String template)
          Sets the XSLT template of this Page.
 void setTemplateOverride(String template)
          Sets a temporary template that overrides the value found in the Page.
 void setType(String type)
          Sets the type element of this page.
 void unload()
          Causes the page to unload it's page data so that it can be freed during GC.
 

Method Detail

exists

boolean exists()
Returns true if the Page exists either in the original jar file or on disk


getBackup

boolean getBackup()
Returns true if the Page is marked to for backup.

Returns:
a boolean indicating whether or not the Page should be backed up.

getBaseDir

File getBaseDir()
Returns the base directory used when constructing absolute paths from a Page's name.

Returns:
a File object which points at the current Page's base directory.

getCreateDate

Date getCreateDate()
Returns the page's create date.

Returns:
A Date specifying the create date of the page.

getId

String getId()
Returns the id of this Page. In serialized form, the id is stored as an attribute of the top-level element of the page data.

Returns:
a String containing the Page's id.

getLastSaveTime

long getLastSaveTime()
Gets the timestamp that the Page was last saved via the save() method. Note - this is not the same as the xml file's timestamp. If the page has never been saved via save(), this method will return 0. If the page has been loaded and saved, it will return the timestamp when the save() last occurred.

Returns:
a long value

setLastSaveTime

void setLastSaveTime(long time)
Sets the timestamp when the page was last saved. Last save time automatically gets set when save() is called. This method provides another way to set the time if the caller does not want to call save()

Parameters:
time - a long value

getName

String getName()
Returns the name of this Page. In serialized form, the name is stored as an attribute of the top-level element of the page data.

Returns:
a String containing the Page's name.

getPackageName

String getPackageName()
Returns the package name of this Page.

Returns:
a String containing the package name.

getPackageVersion

String getPackageVersion()
Returns the package version of this Page.

Returns:
a String containing the version.

getPageData

org.jdom.Document getPageData()
Returns the application specific XML page data.

Returns:
a JDOM Document containing the application-specific XML page data. The Document returned is a live document, and changes made to it will be reflected in the Page's copy.

getRootAttrValue

String getRootAttrValue(String attrName)
Returns the value of the specified attribute on the root element (ie page, section) in the document


getTemplate

String getTemplate()
Returns the XSLT template of this Page.

Returns:
a String containing the relative path of the template.

getType

String getType()
Returns the type of this page. In serialized form, type is stored as an attribute of the top-level element of the page data.

Returns:
a String containing the value of the root element's type attribute, or null if the the root element does not contain a type attribute.

getDefaultType

String getDefaultType()
Returns the defaultPageType of this page, usually a section.

Returns:
a String containing the defaultPageType

getSupportedPageTypes

List getSupportedPageTypes()
Returns a list of supported page types that this page may contain.

Returns:
a List containing the page types this page may contain.

isAutoSaveEnabled

boolean isAutoSaveEnabled()
Returns true if the Page has autoSave enabled. Default value is true

Returns:
a boolean value

isDeletable

boolean isDeletable()
Returns true if the Page is marked as deletable. This indicates that the Page can be deleted.

Returns:
a boolean indicating whether or not the Page is deletable.

isLoaded

boolean isLoaded()
Returns true if the Page has been loaded from disk, or has had it's XML page data set directly by a call to setPageData().

Returns:
a boolean indicating whether or not the Page's XML page data has been loaded.

isPageTypeSupported

boolean isPageTypeSupported(String pageType)
Indicates whether the specified page type may be contained by this page.

Parameters:
pageType - a String containing the specified page type.

isReadOnly

boolean isReadOnly()
Returns true if the Page is marked as read-only. This indicates that the Page should not be modified. If save() is called on a page marked as read-only, the page will only be saved if it does not yet exist on disk; all subsequent save() calls are no-ops.

Returns:
a boolean indicating whether or not the Page is read-only.

isHidden

boolean isHidden()
Returns true if the Page is marked as hidden. This indicates that the Page should never be shown

Returns:
a boolean indicating whether or not the Page is hidden.

isSecure

boolean isSecure()
Returns true if the Page is marked as secure. This indicates that the Page <body> will be encrypted when saved to disk.

Returns:
a boolean indicating whether or not the Page is secure.

load

org.jdom.Document load()
                       throws Exception
Loads the Page from disk.

Returns:
a reference to the Page's page data JDOM Document, or null if the page has not yet been loaded.
Throws:
Exception - if the page data is corrupted, or if the file cannot be read from disk.

save

void save()
          throws Exception
Causes the Page to be serialized to disk. Any elements with encrypt=true attributes are encrypted, and any elements with index=true attributes are indexed. The result is written to name.xml.

Throws:
Exception - if the Page cannot be saved to disk.

setAutoSaveEnabled

void setAutoSaveEnabled(boolean autoSaveEnabled)
Sets the state of the autoStateEnabled flag

Parameters:
autoSaveEnabled - a boolean value

setBackup

void setBackup(boolean backup)
Sets or clears the backup attribute.

Parameters:
backup - a boolean indicating whether or not the page should be automatically backed up to a .bak file.

setBaseDir

void setBaseDir(String baseDir)
Sets the base directory used when constructing absolute paths from a Page's name.

Parameters:
baseDir - String representing the base directory

setClassLoader

void setClassLoader(ClassLoader cl)
Sets the class loader of this page.

Parameters:
cl - a ClassLoader instance.

setDeletable

void setDeletable(boolean isDeletable)
Sets or clears the deletable attribute.

Parameters:
isDeletable - a boolean indicating whether or not the page is deletable.

setId

void setId(String id)
Sets the id of this Page. In serialized form, the id is stored as an attribute of the top-level element of the page data.

Parameters:
id - a String containing the id of the page; id is also used as the relative path of the serialized page on disk.

setName

void setName(String name)
Sets the name of this Page. In serialized form, the name is stored as an attribute of the top-level element of the page data.

Parameters:
name - a String containing the name.

setPackageName

void setPackageName(String name)
Sets the package name of this Page.

Parameters:
name - a String containing the package name.

setPackageVersion

void setPackageVersion(String version)
Sets the package version of this Page.

Parameters:
version - a String containing the name.

setPageData

void setPageData(org.jdom.Document pageData)
Sets the application specific XML page data.

Parameters:
pageData - a JDOM Document containing the application specific XML page data. The Page keeps a live reference to this Document; it is not copied.

setReadOnly

void setReadOnly(boolean isReadOnly)
Sets or clears the read-only attribute. If set to true, then this Page will only be saved to disk once, if it does not yet exist. Subsquent calls to save() will do nothing.

Parameters:
isReadOnly - a boolean indicating whether or not the page is read-only.

setHidden

void setHidden(boolean isHidden)
Sets or clears the hidden attribute.

Parameters:
isHidden - a boolean indicating whether or not the page is hidden.

setSecure

void setSecure(boolean isSecure)
Sets or clears the secure attribute. If set to true, then the <body> of this page will be encrypted before it is written to disk.

Parameters:
isSecure - a boolean indicating whether or not the page is secure.

setSupportedPageTypes

void setSupportedPageTypes(List supportedPageTypes)
Sets the supported page types this page may contain.

Parameters:
supportedPageTypes - a List containing the the page types supported by this page.

setTemplate

void setTemplate(String template)
Sets the XSLT template of this Page.

Parameters:
template - a String containing the the relative path of the page template.

setTemplateOverride

void setTemplateOverride(String template)
Sets a temporary template that overrides the value found in the Page. The template override will not be saved with the page, but will be returned by calls to getTemplate

Parameters:
template - a String containing the the relative path of the page template.

setType

void setType(String type)
Sets the type element of this page. In serialized form, type is stored as an attribute of the top-level element of the page data.

Parameters:
type - a String containing the the page type.

unload

void unload()
Causes the page to unload it's page data so that it can be freed during GC.


getForceAutoSave

boolean getForceAutoSave()
Get the state of the forceAutoSave flag. If true, this will force the auto save and program framework to save the page the next time such an event is triggered, regardless if other criteria (such as modified components) is met or not.

Returns:
a boolean value

setForceAutoSave

void setForceAutoSave(boolean state)
If true, this will force the auto save and program framework to save the page the next time such an event is triggered, regardless if other criteria (such as modified components) is met or not.

Parameters:
state - a boolean value

getNoCache

int getNoCache()
Get the value which controls how the page will be redisplayed when it has been previously loaded into a tab.

Returns:
0 = always use cached version of page if page not modified (default), 1 = never use cached version of page, force reload on display 2 = force re-init of JavaScript bridge on page display

setNoCache

void setNoCache(int options)
Set the value which controls how the page will be redisplayed when it has been previously loaded into a tab.

Parameters:
options - an int value 0 = always use cached version of page if page not modified (default), 1 = never use cached version of page, force reload on display 2 = force re-init of JavaScript bridge on page display


Copyright © 2006-2007 Pepper Computer, Inc. All Rights Reserved.