net.xoetrope.xui
Class XPageManager

java.lang.Object
  extended by net.xoetrope.xui.XPageManager

public class XPageManager
extends java.lang.Object

    

A class for loading and displaying XPages. 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) Xoetrope Ltd., 2002-2003

License: see license.txt

$Revision: 2.16 $


Field Summary
protected  java.lang.String packageName
          The component package being used in this XProject instance (AWT or Swing)
protected  XPageDisplay pageDisplay
          XPageDisplay interface for showing pages
protected  java.util.Stack pageHistory
          The pageHistory Stack used to go 'back'
protected  java.util.Hashtable pages
          Hashtable cache of used XPage Objects
protected  XPageLoader secondaryLoader
          Used to load pages from XML definition
 
Constructor Summary
XPageManager()
          Constructor which creates a hastable to store the pages
 
Method Summary
 void addHistory(java.lang.String className)
          Add the page to the pageHistory stack
 PageSupport getCurrentPage(java.lang.String target)
          Get the page currently displayed by a particular target container
 XPageManager getInstance()
          Deprecated. since 1.0.3 use XProjectManager.getCurrentProject().getPageManager() or XProjectManager.getPageManager()
 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.
protected  void logPageCreationError(java.lang.String className, java.lang.String message, java.lang.Exception e)
          Log the page creation error message
 void reset()
          Reset the page history and dump any loaded pages.
 void setPackageName(java.lang.String pkgName)
          Set the package name.
 void setPageDisplay(XPageDisplay pgDisplay)
          Set the interface to invoke when a page has been displayed.
 void setSecondaryLoader(XPageLoader pl)
          Set the page loader class.
 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 showPrevious()
          Show the previously displayed page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pages

protected java.util.Hashtable pages
Hashtable cache of used XPage Objects


packageName

protected java.lang.String packageName
The component package being used in this XProject instance (AWT or Swing)


pageHistory

protected java.util.Stack pageHistory
The pageHistory Stack used to go 'back'


pageDisplay

protected XPageDisplay pageDisplay
XPageDisplay interface for showing pages


secondaryLoader

protected XPageLoader secondaryLoader
Used to load pages from XML definition

Constructor Detail

XPageManager

public XPageManager()
Constructor which creates a hastable to store the pages

Method Detail

setPackageName

public void setPackageName(java.lang.String pkgName)
Set the package name.

Parameters:
pkgName - the name of the package we're running from.

setPageDisplay

public void setPageDisplay(XPageDisplay pgDisplay)
Set the interface to invoke when a page has been displayed. Reads the startup parameters Frames and UsesFrames to control loading of the frame set. If Frames is not specified it defaults to "frames", and if UsesFrames is not specified it defaults to "true".

Parameters:
pgDisplay - The XPageDisplay interface

loadPage

public PageSupport loadPage(java.lang.String className)
Load a page. Check first to see if we have it in the Hashtable

Parameters:
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
Returns:
The created or cached page

loadPage

public PageSupport loadPage(java.lang.String className,
                            boolean cache)
Load a page. Check first to see if we have it in the Hashtable when the cache flag is set to true.

Parameters:
className - the name of the class we want to load.
cache - whether or not to cache the page, or check the class being cached
Returns:
the cached page or the newly created page.

logPageCreationError

protected void logPageCreationError(java.lang.String className,
                                    java.lang.String message,
                                    java.lang.Exception e)
Log the page creation error message

Parameters:
message - the error message
e - the exception

loadFrames

public void loadFrames(java.lang.String frameSetName,
                       boolean useFrames)
Loads a frameset. Check first to see if we have it in the Hashtable

Parameters:
frameSetName - the name of the frameSet we want to load.
useFrames - true to setup the frameset or false to add just a single target area

getInstance

public XPageManager getInstance()
Deprecated. since 1.0.3 use XProjectManager.getCurrentProject().getPageManager() or XProjectManager.getPageManager()

Return the instance. This class now delegates to the project manager.


getPage

public PageSupport getPage(java.lang.String className)
Get a page

Parameters:
className - the page name
Returns:
the page or else null if the page hasn't been loaded yet.

getCurrentPage

public PageSupport getCurrentPage(java.lang.String target)
Get the page currently displayed by a particular target container

Parameters:
target - the target container name
Returns:
the page or else null if the page hasn't been loaded yet.

getPreviousPage

public PageSupport getPreviousPage()
Get the page previously displayed by the 'content' target container

Returns:
the page or else null if there wasn't a previous page

showPage

public PageSupport showPage(java.lang.String className)
Load and show a page.

Parameters:
className - The name, without package info, of the page to be displayed
Returns:
the page being displayed

showPage

public PageSupport showPage(java.lang.String className,
                            java.lang.String target)
Load and show a page.

Parameters:
className - The name, without package info, of the page to be displayed
target - the area to update
Returns:
the page being displayed

showPrevious

public PageSupport showPrevious()
Show the previously displayed page.

Returns:
The previous XPage

setSecondaryLoader

public void setSecondaryLoader(XPageLoader pl)
Set the page loader class. XuiBuilder is an example of a secondary page loader that loads pages from an XML description.

Parameters:
pl - the page loader instance

getTarget

public java.lang.Object getTarget(java.lang.String name)
Get a named frame/target from the current frameset

Parameters:
name - the name of the frame
Returns:
the target frame

getNumTargets

public int getNumTargets()
Get the number of frame/target from the current frameset

Returns:
the number of target frames

getTarget

public java.lang.Object getTarget(int idx)
Get the target for a page display request

Parameters:
idx - the target area
Returns:
the container to be updated

addHistory

public void addHistory(java.lang.String className)
Add the page to the pageHistory stack

Parameters:
className - The name, without package info, of the page to be displayed

reset

public void reset()
Reset the page history and dump any loaded pages.