|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.xoetrope.xui.XProject
public class XProject
A holder for references to the objects and resources used by a Xui project
Copyright (c) Xoetrope Ltd., 2002-2003
$Revision: 2.40 $
License: see License.txt
Field Summary | |
---|---|
protected java.applet.Applet |
app The XProject XApplet Object |
protected java.awt.Frame |
appFrame The XProject Frame Object |
protected java.awt.Window |
appWindow The XProject Window Object |
protected java.lang.String |
basePackageName The package where event hadlers can be found |
protected java.util.Vector |
bindingFactories Stores a Vector of XDataBindingFactory Object for this XProject instance |
static int |
CLOSING |
static int |
CREATED |
protected java.util.Vector |
customClassLoaders Vector of classloaders used to locate resources for this XProject instance |
protected java.lang.String |
defaultEncoding Encoding with which to read and write XML files. |
protected java.lang.String |
defaultFile |
protected java.lang.Class |
defaultModelClass The default XModel based class to be used in this XProject instance. |
protected java.net.URL |
documentBase The path to the startup directory for this XProject instance |
protected java.lang.String |
eventHandlerClassName The name of the event handler class which is to be used |
protected XExceptionHandler |
exceptionHandler A generic handler for exceptions |
protected java.util.Hashtable |
imageCache Hashtable of images already accessed |
static int |
INITIALIZED |
protected java.util.Hashtable |
managerObjects Hashtable for storing other non-XUI object such as Routes and Services |
protected MessageHelper |
messageHelper Store a reference to the MessageHelper utility class |
protected XModel |
modelRoot The root XModel for this XProject instance |
protected XPageManager |
pageManager The XPageManager for this XProject instance |
protected ResourceBundleLoader |
resourceBundleLoader ResourceBundleLoader used to load ResourceBundles |
static int |
STARTED |
protected java.util.Properties |
startSettings Properties Object created from the statup properties |
protected java.lang.String |
startupFile The name of the startup file for this XProject instance |
protected int |
status |
protected XStyleManager |
styleManager The XStyleManager for this XProject instance |
static int |
TERMINATED |
static int |
UNKNOWN |
protected java.lang.String |
widgetPackageName The package name of the components to be used (AWT or Swing) |
protected XmlParserFactory |
xmlParserFactory The XmlParserFactory to be used by this XProject instance |
Constructor Summary | |
---|---|
protected |
XProject() Create a new project |
Method Summary | |
---|---|
void |
addCustomClassLoader(java.lang.ClassLoader c) Add a custom class loader. |
XuiEventHandler |
createEventHandler(java.lang.Object owner, XValidationHandler validationHandler) Create the XuiEventHandler for the passed owner (XPage) and set it's XValidationHandler |
protected java.awt.Image |
createImage(java.io.InputStream imgStream) Returns an Image, or null if the path was invalid. |
java.net.URL |
findResource(java.lang.String fileName) Find a resource |
java.lang.String |
findResourceAsString(java.lang.String fileName) Find a resource and get its filename (unencoded) |
void |
fixError(java.lang.String errorName, java.lang.Object sourceObj, java.lang.Throwable t) Attempt to fix an error when running a XUI application |
java.awt.Frame |
getAppFrame() Get a areference to the applet's Frame |
java.applet.Applet |
getApplet() Get a reference to the applet object |
java.awt.Window |
getAppWindow() Get a reference to the application's main Window |
java.util.Vector |
getBindingsFactories() Get the binding factories. |
java.io.BufferedInputStream |
getBufferedInputStream(java.io.File file) Gets a buffered stream for a file |
java.io.BufferedInputStream |
getBufferedInputStream(java.lang.String s) Gets a buffered stream for a resource |
java.io.BufferedOutputStream |
getBufferedOutputStream(java.lang.String file) Gets a buffered stream for a file |
java.io.BufferedOutputStream |
getBufferedOutputStream(java.lang.String file, boolean useProjectParent) Gets a buffered stream for a file |
java.io.BufferedReader |
getBufferedReader(java.io.File file, java.lang.String encoding) Gets a BufferedReader for a resource |
java.io.BufferedReader |
getBufferedReader(java.lang.String file) Gets a BufferedReader for a resource |
java.io.BufferedReader |
getBufferedReader(java.lang.String file, java.lang.String encoding) Gets a BufferedReader for a resource |
java.lang.String |
getDefaultEncoding() Get the default file encoding (UTF8 unless modified) |
java.net.URL |
getDocumentBase() Get the applet document base. |
XExceptionHandler |
getExceptionHandler() Set an exception handler for unhandled errors during method response method invocation |
java.lang.Object |
getIcon(java.lang.String name) Loads an image icon |
java.awt.Image |
getImage(java.lang.String name) Loads an image resource |
void |
getImage(XImageHolder holder, java.lang.String name) Loads an image resource in a background thread |
java.io.InputStream |
getInputStream(java.io.File file) Gets a stream for a file |
java.io.InputStream |
getInputStream(java.lang.String fileName) Gets a stream for a resource |
MessageHelper |
getMessageHelper() Get the message helper (for formatting messages) |
XModel |
getModel() Get the root instance of the model. |
java.lang.Object |
getObject(java.lang.String key) Get a manager object |
java.io.OutputStream |
getOutputStream(java.lang.String file) Gets a stream for a file |
java.io.OutputStream |
getOutputStream(java.lang.String file, boolean useProjectParent) Gets a stream for a file |
java.lang.String |
getPackageName() Get the default package name |
XPageManager |
getPageManager() Gets an instance of the page manager. |
java.util.ResourceBundle |
getResourceBundle(java.lang.String name) Get a resource bundle |
ResourceBundleLoader |
getResourceBundleLoader() Get the resource bundle loader |
java.lang.String |
getStartupFile() Get the name of the startup file. |
java.lang.String |
getStartupParam(java.lang.String name) Gets a startup parameter |
int |
getStartupParamAsInt(java.lang.String name) Gets a startup parameter |
int |
getStatus() Get the project status |
XStyleManager |
getStyleManager() Get a reference to the XStyleManager. |
XTranslator |
getTranslator() Get the default translation object |
XTranslator |
getTranslator(java.lang.String name) Get the translation object for the named bundle. |
java.net.URL |
getUrl(java.lang.String fileName) Gets a URL for a resource |
java.lang.String |
getWidgetPackageName() Get the default widget package name |
XmlParserFactory |
getXmlParserFactory() Get the XML parser factory |
void |
initialise(java.lang.String startFile) Setup the project and configure its resources |
void |
registerBindingFactory(XDataBindingFactory fact) Register a binding factory with the project. |
void |
registerBindingFactory(XDataBindingFactory fact, int pos) Register a binding factory with the project. |
void |
removeObject(java.lang.String key) Remove a manager object value |
void |
resetModel() Reset the model to its initial state. |
void |
setAppFrame(java.awt.Frame frame) Set the main Frame reference |
void |
setApplet(java.applet.Applet applet) Set tbe applet reference |
void |
setAppWindow(java.awt.Window window) Set the main Window reference |
void |
setDefaultEncoding(java.lang.String encoding) Set the default file encoding (UTF8 unless modified) see http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html |
void |
setDefaultFile(java.lang.String file) Set the default file/directory specification used to locate files by the getOutputStream( String file, boolean useProjectParent ) method |
void |
setDefaultModel(java.lang.String className) Sets the default model class. |
void |
setDocumentBase(java.net.URL u) Set/Record the URL from which the applet was loaded |
void |
setEventHandlerClass(java.lang.String className) Set the name of the class which will handle events for this XProject instance |
void |
setExceptionHandler(XExceptionHandler eh) Set an exception handler for unhandled errors during method response method invocation |
void |
setObject(java.lang.String key, java.lang.Object obj) Set an manager object value |
void |
setPackageName(java.lang.String pn) Set the default package name. |
void |
setResourceBundleLoader(ResourceBundleLoader loader) Set the object to load language resource bundles |
void |
setStartupFile(java.lang.String fileName) Sets the startup file and loads the associated resource. |
void |
setStartupParam(java.lang.String name, java.lang.String value) Sets a startup parameter |
void |
setStatus(int newStatus) Set the application status |
void |
setWidgetPackageName(java.lang.String pn) Set the default widget package name. |
protected java.lang.String |
slashify(java.lang.String path, boolean isDirectory) Taken from java.io.File in JDK 1.4 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNKNOWN
public static final int CREATED
public static final int INITIALIZED
public static final int STARTED
public static final int CLOSING
public static final int TERMINATED
protected XStyleManager styleManager
protected XPageManager pageManager
protected XModel modelRoot
protected XmlParserFactory xmlParserFactory
protected MessageHelper messageHelper
protected java.util.Vector bindingFactories
protected java.lang.String startupFile
protected java.util.Properties startSettings
protected java.net.URL documentBase
protected java.util.Hashtable managerObjects
protected java.lang.Class defaultModelClass
protected java.lang.String eventHandlerClassName
protected java.lang.String defaultFile
protected java.lang.String defaultEncoding
protected java.lang.String basePackageName
protected java.lang.String widgetPackageName
protected java.applet.Applet app
protected java.awt.Window appWindow
protected java.awt.Frame appFrame
protected java.util.Vector customClassLoaders
protected ResourceBundleLoader resourceBundleLoader
protected java.util.Hashtable imageCache
protected XExceptionHandler exceptionHandler
protected int status
Constructor Detail |
---|
protected XProject()
Method Detail |
---|
public void initialise(java.lang.String startFile)
startFile
- the startup filepublic XStyleManager getStyleManager()
public XPageManager getPageManager()
public XModel getModel()
public void setDefaultModel(java.lang.String className)
className
- the name of the model class e.g. net.xoetrope.xui.data.XBaseModelpublic void resetModel()
public XmlParserFactory getXmlParserFactory()
public XuiEventHandler createEventHandler(java.lang.Object owner, XValidationHandler validationHandler)
owner
- The XPage for which the passed XValidationHandler is workingvalidationHandler
- The XValidationHandler for this XProject instancepublic void setEventHandlerClass(java.lang.String className)
className
- The name of the event handler classpublic XExceptionHandler getExceptionHandler()
public void setExceptionHandler(XExceptionHandler eh)
eh
- the exception handlerpublic MessageHelper getMessageHelper()
public java.util.Vector getBindingsFactories()
public void registerBindingFactory(XDataBindingFactory fact, int pos)
fact
- the new factorypos
- the postion in the array at which to add the factory.public void registerBindingFactory(XDataBindingFactory fact)
fact
- the new factorypublic java.lang.String getStartupFile()
public void setStartupFile(java.lang.String fileName)
fileName
- the name of the startup resource file.public java.lang.String getStartupParam(java.lang.String name)
name
- the paramenter namepublic void setStartupParam(java.lang.String name, java.lang.String value)
name
- the paramenter namevalue
- the new valuepublic int getStartupParamAsInt(java.lang.String name)
name
- the paramenter namepublic int getStatus()
public void setStatus(int newStatus)
newStatus
- the new statuspublic java.lang.Object getObject(java.lang.String key)
key
- the name of the object e.g. "Routes", "Services"public void setObject(java.lang.String key, java.lang.Object obj)
key
- the name of the object e.g. "Routes", "Services"obj
- the object instancepublic void removeObject(java.lang.String key)
key
- the name of the object e.g. "Routes", "Services"public java.lang.Object getIcon(java.lang.String name)
name
- the image resource namepublic java.awt.Image getImage(java.lang.String name)
name
- the image resource namepublic void getImage(XImageHolder holder, java.lang.String name)
holder
- the component containing to display the imagename
- the image resource namepublic java.io.InputStream getInputStream(java.lang.String fileName)
fileName
- the resource file namepublic java.lang.String findResourceAsString(java.lang.String fileName)
fileName
- the resource file namepublic java.net.URL findResource(java.lang.String fileName)
fileName
- the resource file namepublic java.io.BufferedInputStream getBufferedInputStream(java.lang.String s)
s
- the resource namepublic java.net.URL getUrl(java.lang.String fileName)
fileName
- the resource file namepublic void addCustomClassLoader(java.lang.ClassLoader c)
c
- the classloaderpublic java.io.InputStream getInputStream(java.io.File file)
file
- the filepublic java.io.BufferedInputStream getBufferedInputStream(java.io.File file)
file
- the filepublic java.io.BufferedReader getBufferedReader(java.lang.String file) throws java.lang.Exception
file
- the resource file namejava.lang.Exception
- throw an exception if there's a problempublic java.io.BufferedReader getBufferedReader(java.lang.String file, java.lang.String encoding) throws java.lang.Exception
file
- the resource file nameencoding
- the input encoding e.g. "UTF8" or null for the default encoding (UTF8 unless it has been changed)java.lang.Exception
- throw an exception if there's a problempublic java.io.BufferedReader getBufferedReader(java.io.File file, java.lang.String encoding) throws java.lang.Exception
file
- the resource fileencoding
- the input encoding e.g. "UTF8" or null for the default encoding (UTF8 unless it has been changed)java.lang.Exception
- throw an exception if there a problempublic java.io.OutputStream getOutputStream(java.lang.String file)
file
- the filepublic java.io.BufferedOutputStream getBufferedOutputStream(java.lang.String file)
file
- the filepublic java.io.OutputStream getOutputStream(java.lang.String file, boolean useProjectParent)
file
- the fileuseProjectParent
- use the projects default file specification to locate the filepublic java.io.BufferedOutputStream getBufferedOutputStream(java.lang.String file, boolean useProjectParent)
file
- the fileuseProjectParent
- use the projects default file specification to locate the filepublic void setPackageName(java.lang.String pn)
pn
- The name of the package to be usedpublic java.lang.String getPackageName()
public void setWidgetPackageName(java.lang.String pn)
pn
- The name of the widget package to be usedpublic java.lang.String getWidgetPackageName()
public java.net.URL getDocumentBase()
public void setDocumentBase(java.net.URL u)
u
- The path to the start directorypublic void setApplet(java.applet.Applet applet)
applet
- The XAppletpublic void setAppFrame(java.awt.Frame frame)
frame
- The main application framepublic void setAppWindow(java.awt.Window window)
window
- The main application windowpublic java.applet.Applet getApplet()
public java.awt.Frame getAppFrame()
public java.awt.Window getAppWindow()
protected java.lang.String slashify(java.lang.String path, boolean isDirectory)
path
- The path to be correctedisDirectory
- Does the path lead to a directory?protected java.awt.Image createImage(java.io.InputStream imgStream)
imgStream
- The InputStream from which the image is to be readpublic java.lang.String getDefaultEncoding()
public void setDefaultEncoding(java.lang.String encoding)
encoding
- the encoding e.g. "UTF8" or "ISO-8859-1"public void setResourceBundleLoader(ResourceBundleLoader loader)
loader
- the new loaderpublic ResourceBundleLoader getResourceBundleLoader()
public java.util.ResourceBundle getResourceBundle(java.lang.String name)
name
- the unqualified name of the resource bundlepublic XTranslator getTranslator()
public XTranslator getTranslator(java.lang.String name)
name
- the name of the resource used for translationpublic void setDefaultFile(java.lang.String file)
file
- the file or directory specificationpublic void fixError(java.lang.String errorName, java.lang.Object sourceObj, java.lang.Throwable t)
errorName
- the name of the error, this should correzpond to a fully qualified class name or a class within the net.xoetrope.selfhealing packagesourceObj
- the instance of the class from which the error handler was invoked, or the object being repairedt
- throwable the exception that was trapped, or null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |