|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.xoetrope.registry.XRegisteredComponentFactory
public class XRegisteredComponentFactory
A component factory that builds components based upon some XML configuration files. This factory is designed to work with the KalIDEoscope which includes a graphical utility for selection and configuration of components. The XML configuration file may also be manipulated outside of the editor.
The factory works by reading a file specifying where a component can be loaded from and the methods within that component that can be used to get and set properties. The getter and setter methods do not need to follow the bean specification and can include various arguments and they can also use different naming schemes.
Copyright (c) Xoetrope Ltd., 2002-2004
$Revision: 1.21 $
License: see License.txt
| Field Summary | |
|---|---|
protected static int |
changeCounter
A counter for changes to the registry. |
protected static java.util.Hashtable |
configFiles
The config files used to build the set of component adapters |
protected XProject |
currentProject
|
protected int |
localChangeCounter
Used for tracking changes to the registry spec. |
protected java.util.Hashtable |
propertiesRegister
The register of component adapters for each component type |
protected java.lang.String |
urlBase
Location/spec of the jar file from which the resource are loaded. |
| Constructor Summary | |
|---|---|
XRegisteredComponentFactory(XProject project)
Create the new component factory |
|
| Method Summary | |
|---|---|
ComponentAdapter |
addComponentAdapter(java.lang.String owner,
java.lang.String componentName,
java.lang.String iconName,
java.lang.String clazz,
java.lang.String ui)
Create a new component adapter |
static void |
addConfigFile(java.lang.String key,
java.lang.Object resource,
boolean overwrite)
Add a configuration file. |
java.lang.Object |
addElement(XComponentFactory cf,
java.lang.String type,
java.lang.String name,
java.lang.String content,
java.util.Hashtable attribs)
A generic factory method for adding non component elements. |
ComponentAdapter |
addReflectionAdapter(java.lang.String owner,
java.lang.String componentName,
java.lang.String iconName,
java.lang.String clazz,
java.lang.String ui)
Create a new reflection component adapter, that is an adapter that uses reflection to find a suitable getter or setter. |
void |
checkRegistration()
Check that all the registered components are loaded |
java.lang.Object |
constructComponent(XComponentFactory cf,
java.lang.String type,
java.lang.String content)
A generic factory for adding XComponents. |
protected void |
doRead(java.lang.String key,
java.lang.Object configFile)
Read the component registry. |
protected void |
doRead(java.lang.String key,
java.lang.String configFile)
Read the component registry. |
protected void |
doRead(java.lang.String key,
java.net.URL configFileURL)
Read the component registry. |
ComponentAdapter |
getComponentAdapter(java.lang.String type)
Get the adapter for a particular component type. |
protected void |
read()
Read the component registry. |
void |
read(java.lang.String key,
java.io.Reader reader)
Read the component registry. |
protected void |
read(java.lang.String key,
java.lang.String configFile)
Read the component registry. |
void |
setPackageName(java.lang.String defPackage)
Set the package name for the factory's widgets. |
void |
update()
Notify the component factories that some of their settings may have changed |
void |
updateConfig()
Signal that the configuration has been updated. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable propertiesRegister
protected static java.util.Hashtable configFiles
protected static int changeCounter
protected int localChangeCounter
protected java.lang.String urlBase
protected XProject currentProject
| Constructor Detail |
|---|
public XRegisteredComponentFactory(XProject project)
project - the owner project| Method Detail |
|---|
public static void addConfigFile(java.lang.String key,
java.lang.Object resource,
boolean overwrite)
key - the name by which the configuration file is referencedresource - the name/path of the configuration file or the URL for the fileoverwrite - true to overwrite and existing entry matching the specified keypublic void updateConfig()
public java.lang.Object constructComponent(XComponentFactory cf,
java.lang.String type,
java.lang.String content)
constructComponent in interface XComponentConstructorcf - the calling component factorytype - a name identifying the type of component to be createdcontent - the component text/content
public java.lang.Object addElement(XComponentFactory cf,
java.lang.String type,
java.lang.String name,
java.lang.String content,
java.util.Hashtable attribs)
addElement in interface XComponentConstructorcf - the calling component factorytype - the object typename - a name identifying the element to be createdcontent - the component text/contentattribs - the element attributes if any
public void update()
update in interface XComponentConstructorpublic void setPackageName(java.lang.String defPackage)
setPackageName in interface XComponentConstructordefPackage - the default package namepublic ComponentAdapter getComponentAdapter(java.lang.String type)
getComponentAdapter in interface XComponentConstructortype - the name by which the component is specified and referenced
protected void read()
protected void read(java.lang.String key,
java.lang.String configFile)
configFile - the name of the configuration filekey - the name by which the configuration file is referenced
protected void doRead(java.lang.String key,
java.lang.Object configFile)
configFile - the name of the configuration filekey - the name by which the configuration file is referenced
protected void doRead(java.lang.String key,
java.lang.String configFile)
configFile - the name of the configuration filekey - the name by which the configuration file is referenced
protected void doRead(java.lang.String key,
java.net.URL configFileURL)
configFileURL - the URL of the configuration filekey - the name by which the configuration file is referenced
public void read(java.lang.String key,
java.io.Reader reader)
key - the name by which the configuration file is referencedreader - the reader from which to read the file
public ComponentAdapter addComponentAdapter(java.lang.String owner,
java.lang.String componentName,
java.lang.String iconName,
java.lang.String clazz,
java.lang.String ui)
throws java.lang.ClassNotFoundException
owner - the name ofthe owning modulecomponentName - the component nameiconName - the icon fileclazz - the class file nameui - the name of the ui
java.lang.ClassNotFoundException - problems finding the class
public ComponentAdapter addReflectionAdapter(java.lang.String owner,
java.lang.String componentName,
java.lang.String iconName,
java.lang.String clazz,
java.lang.String ui)
throws java.lang.ClassNotFoundException
owner - the name ofthe owning modulecomponentName - the component nameiconName - the icon fileclazz - the class file nameui - the name of the ui
java.lang.ClassNotFoundException - problems finding the classpublic void checkRegistration()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||