net.xoetrope.xui
Class XProjectManager

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

public class XProjectManager
extends java.lang.Object

A central repository for XProjects. Several projects may be run within a single VM instance, for example in the case of a browser where a shared VM is used with multiple applets. The project manager allows only one active or current project.

Since:
1.03

Copyright (c) Xoetrope Ltd., 2002-2003

$Revision: 2.4 $

License: see License.txt


Field Summary
protected static XProject currentProject
          The current XProject being used
protected static java.util.Hashtable projects
          A store for projects.
 
Constructor Summary
XProjectManager()
          null ctor
 
Method Summary
static java.lang.String addProject(java.lang.String name, XProject proj)
          Add a new project
static XProject getCurrentProject()
          Get the current or active project, in most cases getCurrentProject( XStartupObject ) should be called instead of getCurrentProject.
static XProject getCurrentProject(XStartupObject so)
          Get the current or active project.
static XModel getModel()
          Deprecated. please use currentProject.getModel() instead
static XPageManager getPageManager()
          Deprecated. please use currentProject.getPageManager() instead
static XProject getProject(java.lang.String name)
          Get a named project, the project is then set as the current project.
 java.lang.String[] getProjectNames()
          Get the names of the projects currently loaded
static XStyleManager getStyleManager()
          Deprecated. please use currentProject.getStyleManager() instead
static XmlParserFactory getXmlParserFactory()
          Deprecated. please use currentProject.getXmlParserFactory() instead
static void setCurrentProject(XProject proj)
          Set the current project
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentProject

protected static XProject currentProject
The current XProject being used


projects

protected static java.util.Hashtable projects
A store for projects.

Constructor Detail

XProjectManager

public XProjectManager()
null ctor

Method Detail

getCurrentProject

public static XProject getCurrentProject()
Get the current or active project, in most cases getCurrentProject( XStartupObject ) should be called instead of getCurrentProject. Care should be taken when calling this project as the current project may not correspond to the project that 'owns' the calling object. The best point to call this method is when an object is being instantiated and thereafter the object should hold a reference to the project.

Returns:
the current project

getCurrentProject

public static XProject getCurrentProject(XStartupObject so)
Get the current or active project. This method will instantiate a new project if one down't already exist. Care should be taken when calling this project as the current project may not correspond to the project that 'owns' the calling object. The best point to call this method is when an object is being instantiated and thereafter the object should hold a reference to the project.

Parameters:
so - the startup object that initiates/owns the project
Returns:
the current project

setCurrentProject

public static void setCurrentProject(XProject proj)
Set the current project

Parameters:
proj - the new current project

getStyleManager

public static XStyleManager getStyleManager()
Deprecated. please use currentProject.getStyleManager() instead

Get a reference to the XStyleManager in the current project

Returns:
the style manager

getPageManager

public static XPageManager getPageManager()
Deprecated. please use currentProject.getPageManager() instead

Gets an instance of the page manager in the current project

Returns:
the XPageManager instance

getModel

public static XModel getModel()
Deprecated. please use currentProject.getModel() instead

Gets the root instance of the XModel in the current project

Returns:
the root XModel node

getXmlParserFactory

public static XmlParserFactory getXmlParserFactory()
Deprecated. please use currentProject.getXmlParserFactory() instead

Gets the root instance of the XModel in the current project

Returns:
the root XModel node

getProjectNames

public java.lang.String[] getProjectNames()
Get the names of the projects currently loaded

Returns:
an array of project names

getProject

public static XProject getProject(java.lang.String name)
Get a named project, the project is then set as the current project.

Returns:
the named project or null if it is not found

addProject

public static java.lang.String addProject(java.lang.String name,
                                          XProject proj)
Add a new project

Parameters:
name - the name by which the project will be know, if null is passed a name will be synthesized for the project.
proj - the project
Returns:
the name of the project