|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.aria.PageManager
public class PageManager
A class for loading and displaying Pages. This class manages access to individual pages and coordinates update of the dispaly area. Pages can also be displayed as part of a frameset. The page manager caches the pages to improve performance and maintain state.
Copyright (c) Formaria Ltd., 2008
License: see license.txt
$Revision: 2.16 $
| Field Summary | |
|---|---|
protected static IPageAnnotationProcessor |
annotationProcessor
A processor for page annotations |
protected Project |
currentProject
The owner project and the context in which this object operates. |
protected java.lang.String |
packageName
The component package being used in this Project instance (AWT or Swing) |
protected PageDisplay |
pageDisplay
PageDisplay interface for showing pages |
protected java.util.Stack |
pageHistory
The pageHistory Stack used to go 'back' |
protected java.util.Hashtable |
pageNameMap
|
protected java.util.Hashtable |
pages
Hashtable cache of used Page Objects |
protected java.util.Hashtable |
pageStates
Hashtable cache of page states |
protected java.util.Vector |
secondaryLoaders
Used to load pages from XML definition |
protected boolean |
triggerValidations
A flag that controls whether or not validations are triggered on page transition |
| Constructor Summary | |
|---|---|
PageManager(Project project)
Constructor which creates a hastable to store the pages |
|
| Method Summary | |
|---|---|
void |
addHistory(java.lang.String className)
Add the page to the pageHistory stack |
void |
addSecondaryLoader(PageLoader pl)
Set the page loader class. |
PageSupport |
attachPage(PageSupport page,
boolean requirePageAnnotation)
Attach a page file to a page class. |
void |
cachePage(java.lang.String cacheName,
PageSupport ps)
Cache a page |
protected boolean |
checkValidations(java.lang.String target)
Check that the validations pass, provided that the validateOnPageTransition flag is set to true |
void |
dumpPageNames()
Dump the page names to the console (debug build only) |
PageSupport |
getCurrentPage(java.lang.String target)
Get the page currently displayed by a particular target container |
int |
getNumTargets()
Get the number of frame/target from the current frameset |
PageSupport |
getPage(java.lang.String className)
Get a page |
PageSupport |
getPreviousPage()
Get the page previously displayed by the 'content' target container |
java.lang.Object |
getTarget(int idx)
Get the target for a page display request |
java.lang.Object |
getTarget(java.lang.String name)
Get a named frame/target from the current frameset |
void |
loadFrames(java.lang.String frameSetName,
boolean useFrames)
Loads a frameset. |
PageSupport |
loadPage(java.lang.String className)
Load a page. |
PageSupport |
loadPage(java.lang.String className,
boolean cache)
Load a page. |
PageSupport |
loadPageAs(java.lang.String cacheName,
java.lang.String className,
boolean cache)
Load a page and cache it under a name other than its page name. |
protected void |
logPageCreationError(java.lang.String className,
java.lang.String message,
java.lang.Exception e)
Log the page creation error message |
void |
mapPageName(java.lang.String key,
java.lang.String pageName)
Set the page name used for a particular key. |
void |
reset()
Reset the page history and dump any loaded pages. |
void |
restoreState(XmlElement root)
Restore the application state |
XmlElement |
saveState()
Save the application state |
void |
setPackageName(java.lang.String pkgName)
Set the package name. |
void |
setPageDisplay(PageDisplay pgDisplay)
Set the interface to invoke when a page has been displayed. |
void |
setTriggerValidations(boolean state)
|
PageSupport |
showDialog(java.lang.Object parent,
java.lang.String className,
java.lang.String title,
int x,
int y)
Load and show a dialog. |
PageSupport |
showPage(java.lang.String className)
Load and show a page. |
PageSupport |
showPage(java.lang.String className,
java.lang.String target)
Load and show a page. |
PageSupport |
showPage(java.lang.String className,
java.lang.String target,
java.util.Hashtable attribs)
Load and show a page. |
PageSupport |
showPrevious()
Show the previously displayed page. |
void |
unloadPage(java.lang.String className)
Remove a page from page cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable pages
protected java.util.Hashtable pageStates
protected java.lang.String packageName
protected java.util.Stack pageHistory
protected PageDisplay pageDisplay
protected java.util.Vector secondaryLoaders
protected Project currentProject
protected boolean triggerValidations
protected static IPageAnnotationProcessor annotationProcessor
protected java.util.Hashtable pageNameMap
| Constructor Detail |
|---|
public PageManager(Project project)
project - the owner project| Method Detail |
|---|
public void setPackageName(java.lang.String pkgName)
pkgName - the name of the package we're running from.public void setPageDisplay(PageDisplay pgDisplay)
pgDisplay - The PageDisplay interfacepublic PageSupport loadPage(java.lang.String className)
className - the name of the class we want to load. If the new page is
a dialog or a dialog derivative it is not cached
public PageSupport loadPage(java.lang.String className,
boolean cache)
className - the name of the class we want to load.cache - whether or not to cache the page, or check the class being cached
public PageSupport loadPageAs(java.lang.String cacheName,
java.lang.String className,
boolean cache)
cacheName - the name by which the page will be known in the cacheclassName - the name of the class we want to load.cache - whether or not to cache the page, or check the class being cached
public void cachePage(java.lang.String cacheName,
PageSupport ps)
cacheName - ps - public void unloadPage(java.lang.String className)
className - the name of the class we want to remove.
public PageSupport attachPage(PageSupport page,
boolean requirePageAnnotation)
page - the page class objectrequirePageAnnotation - true if the page must have a page annotation
to be processed. The page annotation pulls in the page xml in the case a
Java file has been processed rather than XML.
protected void logPageCreationError(java.lang.String className,
java.lang.String message,
java.lang.Exception e)
message - the error messagee - the exception
public void loadFrames(java.lang.String frameSetName,
boolean useFrames)
frameSetName - the name of the frameSet we want to load.useFrames - true to setup the frameset or false to add just a single target areapublic PageSupport getPage(java.lang.String className)
className - the page name
public PageSupport getCurrentPage(java.lang.String target)
target - the target container name
public PageSupport getPreviousPage()
public PageSupport showPage(java.lang.String className)
className - The name, without package info, of the page to be displayed
public PageSupport showPage(java.lang.String className,
java.lang.String target)
className - The name, without package info, of the page to be displayedtarget - the area to update
public PageSupport showPage(java.lang.String className,
java.lang.String target,
java.util.Hashtable attribs)
className - The name, without package info, of the page to be displayedtarget - the area to updateattribs - attributes for use by the new page / taregt
public PageSupport showPrevious()
public PageSupport showDialog(java.lang.Object parent,
java.lang.String className,
java.lang.String title,
int x,
int y)
parent - the parent of this dialog or null.className - The name, without package info, of the page to be displayedtitle - the the dialog titlex - the x coordinate, or -1 for ignore/default location. Some
widget set implementations may also support values of -2 for centered on
screeny - the location of the dialog on screen
location is to be used. To centre the dialog on the
mouse location, if the dialog is displayed in response to say a mouse event,
the following code can be added:
Point pt = (( MouseEvent )getCurrentEvent() ).getPoint();
Point topLeft = myObject.getLocationOnScreen();
pt.translate( topLeft.x, topLeft.y );
pageMgr.showDialog( "MyDialog", translate( "MYDIALOG_TITLE" ), pt.x, pt.y );
protected boolean checkValidations(java.lang.String target)
target - the target container name
public void setTriggerValidations(boolean state)
public void addSecondaryLoader(PageLoader pl)
pl - the page loader instancepublic java.lang.Object getTarget(java.lang.String name)
name - the name of the frame
public int getNumTargets()
public java.lang.Object getTarget(int idx)
idx - the target area
public void addHistory(java.lang.String className)
className - The name, without package info, of the page to be displayedpublic void reset()
public void mapPageName(java.lang.String key,
java.lang.String pageName)
key - the lookup keypageName - the mapped namepublic XmlElement saveState()
public void restoreState(XmlElement root)
public void dumpPageNames()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||