net.xoetrope.xui.style
Class XStyleFactory

java.lang.Object
  extended by net.xoetrope.xui.XComponentFactory
      extended by net.xoetrope.xui.style.XStyleFactory

public class XStyleFactory
extends XComponentFactory

    

Extends the basic component factory by adding style information. As the component are added the styles are applied.

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt $Revision: 2.5 $


Field Summary
protected  XStyleManager styleManager
          The project XStyleManager
 
Fields inherited from class net.xoetrope.xui.XComponentFactory
adapter, basePackageName, componentFactories, currentMenu, currentMenuBar, currentProject, layoutHelper, parentH, parentPanel, parentW, requiresParent, translator, typeNames, XANNOTATEDIMAGE, XBUTTON, XCHECK, XCOMBO, XEDIT, XGROUP, XHOTSPOTIMAGE, XIMAGE, XIMAGEMAP, XLABEL, XLIST, XMENU, XMENUBAR, XMENUITEM, XMETACONTENT, XPANEL, XPASSWORD, XRADIO, XSCROLLABLEMETACONTENT, XSCROLLPANE, XSPLITPANE, XTABLE, XTABPANEL, XTEXTAREA, XUNKNOWN, XWMF
 
Constructor Summary
XStyleFactory(XProject project, java.lang.String packageName)
          Create the StyleFactory and initialise with an XStyleManager.
 
Method Summary
 java.lang.Object addComponent(java.lang.String type, int x, int y, int w, int h)
          Pass the addNamedComponent call to the XStyleFactory base Class
 java.lang.Object addComponent(java.lang.String type, int x, int y, int w, int h, java.lang.String txt)
          Overloading method with the same signature in XComponentFactory.
 java.lang.Object addComponent(java.lang.String type, int x, int y, int w, int h, java.lang.String txt, java.lang.String style)
          Pass the addNamedComponent call to the XStyleFactory base Class
 java.lang.Object addComponent(java.lang.String type, java.lang.Object constraint, java.lang.String txt, java.lang.String style)
          Pass the addNamedComponent call to the XStyleFactory base Class
 java.awt.LayoutManager addLayout(java.lang.Object cont, int type, java.util.Hashtable attribs)
          Sets a LayoutManager for the panel
 void applyStyle(java.lang.Object c, java.lang.String style)
          Called after a new component is created.
 void applyStyle(java.lang.Object c, java.lang.String style, boolean lookupComp)
          Apply a style to a component, looking up the style name if necessary
 void applyStyle(java.lang.Object c, XStyle xstyle)
          Apply a style to a component.
protected  void setup()
          moved from the ctor so as to allow subclassed XStyleFactories to do the initialisation in the getInstance().
 
Methods inherited from class net.xoetrope.xui.XComponentFactory
addComponent, addComponent, addComponent, addElement, addLayout, buildRegisteredComponent, constructComponent, getComponentAdapter, getFactories, getLayoutHelper, getParentComponent, getTypeCode, instantiate, registerComponentFactory, setLayoutHelper, setParentComponent, setRequiresParent, setResourceBundle, setupTypeNames, translate, updateComponentFactories
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

styleManager

protected XStyleManager styleManager
The project XStyleManager

Constructor Detail

XStyleFactory

public XStyleFactory(XProject project,
                     java.lang.String packageName)
Create the StyleFactory and initialise with an XStyleManager.

Parameters:
project - The current project
packageName - The package being used in the project AWT/Swing
Method Detail

setup

protected void setup()
moved from the ctor so as to allow subclassed XStyleFactories to do the initialisation in the getInstance().


addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     java.lang.Object constraint,
                                     java.lang.String txt,
                                     java.lang.String style)
Pass the addNamedComponent call to the XStyleFactory base Class

Parameters:
type - The type of object being constructed
constraint - the layout constraint
txt - The content to display
style - The name of the style to apply
Returns:
The created component

addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String txt,
                                     java.lang.String style)
Pass the addNamedComponent call to the XStyleFactory base Class

Parameters:
txt - The content to be applied to the component
type - The type of object being constructed
x - The x coordinate of the new component
y - The y coordinate of the new component
w - The width of the new component
h - The height of the new component
style - The name of the style to apply
Returns:
The created component

addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String txt)
Overloading method with the same signature in XComponentFactory.

Overrides:
addComponent in class XComponentFactory
Parameters:
type - The type of object being constructed
x - The x coordinate of the new component
y - The y coordinate of the new component
w - The width of the new component
h - The height of the new component
txt - The text/caption of the component
Returns:
The created component

addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     int x,
                                     int y,
                                     int w,
                                     int h)
Pass the addNamedComponent call to the XStyleFactory base Class

Parameters:
type - The type of object being constructed
x - The x coordinate of the new component
y - The y coordinate of the new component
w - The width of the new component
h - The height of the new component
Returns:
The created component

addLayout

public java.awt.LayoutManager addLayout(java.lang.Object cont,
                                        int type,
                                        java.util.Hashtable attribs)
Sets a LayoutManager for the panel

Parameters:
attribs - Hashtable of layout attributes
cont - the container whose layout manager is being set or null to set the parent panel's layout manager
type - the layout manager as defined in the XLayoutHelper class
Returns:
The created LayoutManager

applyStyle

public void applyStyle(java.lang.Object c,
                       java.lang.String style,
                       boolean lookupComp)
Apply a style to a component, looking up the style name if necessary

Parameters:
c - the component to style
style - the style name
lookupComp - true to lookup the style based on the component class

applyStyle

public void applyStyle(java.lang.Object c,
                       XStyle xstyle)
Apply a style to a component. Set the font and foreground/background color.

Parameters:
c - The component to style
xstyle - The XStyle object whose style is to be applied to the component

applyStyle

public void applyStyle(java.lang.Object c,
                       java.lang.String style)
Called after a new component is created. Append the style to the base and then append the component classname with '/' delimiters.

Parameters:
c - Component to apply the style to.
style - the name of the style to apply.