| java.lang.Object net.xoetrope.xui.XComponentFactory
All known Subclasses: net.xoetrope.xui.style.XStyleFactory,
XComponentFactory | public class XComponentFactory (Code) | | A component factory. The factory is designed to create components
for a null layout. The factory will use an incrementing id to name each component.
When an XPanel is added it will automatically become the parent for subsequent
components added using the factory. If another parent component is needed then
the parent can be explicitly set.
When components are added their size is checked against that of the parent and
reduced if they extend beyond the bounds of the parent.
The component factory can be extended by registering new XComponentConstructors.
These constructors are invoked if the build in constructors cannot build the
specified type.
Components can be specified by a type name, an type constant or by a class name.
The type constants for the built-in components are specified in XPage so as
to make referencing the constants easier in the client code (subclasses of XPage).
Copyright (c) Xoetrope Ltd., 2002-2003
License: see license.txt
$Revision: 1.28 $
|
Method Summary | |
public Component | addClass(String className, int x, int y, int w, int h) A generic factory for adding Components. | public Component | addComponent(String type, int x, int y, int w, int h, String content) A generic factory for adding XComponents. | public Component | addComponent(String type, Object pos, String content) A generic factory for adding XComponents. | public void | addComponent(Component c) Add a component to the panel. | public void | addComponent(Component c, Object constraint) Add a component to the panel. | public Object | addElement(String type, String name, String content, Hashtable attribs) Add a non-component object to the panel or an element of the panel. | public LayoutManager | addLayout(Container cont, int type) | protected Component | buildRegisteredComponent(int type, String content) A generic factory for adding registered components via the
XComponentConstructor interface or component factories. | protected Component | buildRegisteredComponent(String type, String content) A generic factory for adding registered components via the
XComponentConstructor interface or component factories. | public Component | constructComponent(int type, String content) A generic factory for constructing XComponents. | public static Vector | getFactories() | public static XLayoutHelper | getLayoutHelper() | public Component | getParentComponent() | public static int | getTypeCode(String typeName) | public static void | registerComponentFactory(XComponentConstructor factory) | public static void | setLayoutHelper(XLayoutHelper newHelper) | public void | setParentComponent(Component c) Change the parent for new components. | public void | setResourceBundle(String resourceBundleName) | protected static void | setupTypeNames() Setup a hashtable of type names. | public String | translate(String key) | public static void | updateComponentFactories() |
componentFactories | protected static Vector componentFactories(Code) | | |
parentWparentH | protected int parentWparentH(Code) | | |
XComponentFactory | public XComponentFactory(String packageName)(Code) | | Constructs a Component factory
|
addClass | public Component addClass(String className, int x, int y, int w, int h)(Code) | | A generic factory for adding Components. The component is created dynamically
positioned and added to the parent panel if one exists. The component is
named with a counter value to uniquely identify the control.
Parameters: className - String value of the classname to be created Parameters: x - the left coordinate Parameters: y - the top coordinate Parameters: w - the width Parameters: h - the height |
addComponent | public Component addComponent(String type, int x, int y, int w, int h, String content)(Code) | | A generic factory for adding XComponents. The component is constructed,
positioned and added to the parent panel if one exists. This method
delegates to the registered component factories if any. All built in
components are constructed with an ID.
When a ScrollPane is addd it becomes the parent.
Parameters: type - a name identifying the type of component to be created Parameters: x - the left coordinate Parameters: y - the top coordinate Parameters: w - the width Parameters: h - the height Parameters: content - the component text/content |
addComponent | public Component addComponent(String type, Object pos, String content)(Code) | | A generic factory for adding XComponents. The component is constructed,
positioned and added to the parent panel if one exists. This method
delegates to the registered component factories if any. All built in
components are constructed with an ID.
When a ScrollPane is addd it becomes the parent.
Parameters: type - a name identifying the type of component to be created Parameters: x - the left coordinate Parameters: y - the top coordinate Parameters: w - the width Parameters: h - the height Parameters: content - the component text/content |
addComponent | public void addComponent(Component c)(Code) | | Add a component to the panel.
Parameters: c - the component to add |
addComponent | public void addComponent(Component c, Object constraint)(Code) | | Add a component to the panel.
Parameters: c - the component to add Parameters: constraint - the layout manager constraint |
addElement | public Object addElement(String type, String name, String content, Hashtable attribs)(Code) | | Add a non-component object to the panel or an element of the panel. This method
is invoked is the XuiBuilder fails to construct a component for an XML element
Parameters: type - the object type Parameters: name - a name identifying the element to be created Parameters: content - the component text/content Parameters: attribs - the element attributes if any |
addLayout | public LayoutManager addLayout(Container cont, int type)(Code) | | Sets a LayoutManager for the panel
Parameters: cont - the container whose layout manager is being set or null to set the parent panel's layout manager Parameters: type - the layout manager as defined in the XLayoutHelper class |
buildRegisteredComponent | protected Component buildRegisteredComponent(int type, String content)(Code) | | A generic factory for adding registered components via the
XComponentConstructor interface or component factories.
Parameters: type - a constant identifying the type of component to be created Parameters: x - the left coordinate Parameters: y - the top coordinate Parameters: w - the width Parameters: h - the height Parameters: content - the component text/content |
buildRegisteredComponent | protected Component buildRegisteredComponent(String type, String content)(Code) | | A generic factory for adding registered components via the
XComponentConstructor interface or component factories.
Parameters: type - a name identifying the type of component to be created Parameters: x - the left coordinate Parameters: y - the top coordinate Parameters: w - the width Parameters: h - the height Parameters: content - the component text/content |
constructComponent | public Component constructComponent(int type, String content)(Code) | | A generic factory for constructing XComponents.
Parameters: type - a constant identifying the type of component to be created Parameters: content - the component text/content |
getFactories | public static Vector getFactories()(Code) | | Get the component factories
a the factor store. |
getLayoutHelper | public static XLayoutHelper getLayoutHelper()(Code) | | Get the layout helper
the layout helper |
getParentComponent | public Component getParentComponent()(Code) | | Get the current parent component
the parent component. |
getTypeCode | public static int getTypeCode(String typeName)(Code) | | Get the type constant associated with a type name
Parameters: typeName - the type name the type constant |
registerComponentFactory | public static void registerComponentFactory(XComponentConstructor factory)(Code) | | Add a componentFactory to the static register of component constructors
Parameters: factory - the new componentFactory |
setLayoutHelper | public static void setLayoutHelper(XLayoutHelper newHelper)(Code) | | Set the layout helper
Parameters: newHelper - the new layout helper |
setParentComponent | public void setParentComponent(Component c)(Code) | | Change the parent for new components. This method will affect the next component added.
Parameters: c - the new parent, this should be an instance of java.awt.Container |
setResourceBundle | public void setResourceBundle(String resourceBundleName)(Code) | | Set the resource bundle for this component
Parameters: resourceBundleName - |
setupTypeNames | protected static void setupTypeNames()(Code) | | Setup a hashtable of type names. This will be moved to a helper class at some stage
|
translate | public String translate(String key)(Code) | | Look up the translation of a key using the current language resource
Parameters: key - the key string the translation |
updateComponentFactories | public static void updateComponentFactories()(Code) | | Notify the component factories that some of their settings may have changed
Parameters: factory - the new componentFactory |
|
|