01: package net.xoetrope.xui;
02:
03: import net.xoetrope.xml.XmlParserFactory;
04: import net.xoetrope.xui.data.XModel;
05: import net.xoetrope.xui.style.XStyleManager;
06:
07: /**
08: * A central repository for XProjects. Several projects may be run within a
09: * single VM instance, for example in the case of a browser where a shared VM is
10: * used with multiple applets. The project manager allows only one active or
11: * current project.
12: * @since 1.03
13: * <p> Copyright (c) Xoetrope Ltd., 2002-2003</p>
14: * <p> $Revision: 1.5 $</p>
15: * <p> License: see License.txt</p>
16: */
17: public class XProjectManager {
18: protected static XProject currentProject;
19:
20: public XProjectManager() {
21: }
22:
23: /**
24: * Get the current or active project
25: * @return the current project
26: */
27: public static XProject getCurrentProject() {
28: if (currentProject == null)
29: currentProject = new XProject();
30:
31: return currentProject;
32: }
33:
34: /**
35: * Get a reference to the XStyleManager in the current project
36: * @return the style manager
37: */
38: public static XStyleManager getStyleManager() {
39: return getCurrentProject().getStyleManager();
40: }
41:
42: /**
43: * Gets an instance of the resource manager in the current project
44: * @return the XResourceManager instance
45: */
46: public static XResourceManager getResourceManager() {
47: return getCurrentProject().getResourceManager();
48: }
49:
50: /**
51: * Reset the resourceManager
52: */
53: public static void resetResourceManager() {
54: getCurrentProject().resetResourceManager();
55: }
56:
57: /**
58: * Gets an instance of the page manager in the current project
59: * @return the XPageManager instance
60: */
61: public static XPageManager getPageManager() {
62: return getCurrentProject().getPageManager();
63: }
64:
65: /**
66: * Gets the root instance of the XModel in the current project
67: * @return the root XModel node
68: */
69: public static XModel getModel() {
70: return getCurrentProject().getModel();
71: }
72:
73: /**
74: * Gets the root instance of the XModel in the current project
75: * @return the root XModel node
76: */
77: public static XmlParserFactory getXmlParserFactory() {
78: return getCurrentProject().getXmlParserFactory();
79: }
80: }
|