org.formaria.aria.style
Class StyleFactory

java.lang.Object
  extended by org.formaria.aria.ComponentFactory
      extended by org.formaria.aria.style.StyleFactory
Direct Known Subclasses:
EditorComponentFactory, EditorStyleFactory

public class StyleFactory
extends ComponentFactory

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

Copyright (c) Formaria Ltd., 2008
License: see license.txt $Revision: 2.5 $


Field Summary
protected  StyleManager styleManager
          The project StyleManager
 
Fields inherited from class org.formaria.aria.ComponentFactory
adapter, ANNOTATEDIMAGE, basePackageName, BUTTON, CHECK, COMBO, componentFactories, currentMenu, currentMenuBar, currentProject, EDIT, GROUP, HOTSPOTIMAGE, IMAGE, IMAGEMAP, LABEL, layoutHelper, LIST, MENU, MENUBAR, MENUITEM, METACONTENT, PANEL, parentH, parentPanel, parentW, PASSWORD, RADIO, requiresParent, SCROLLABLEMETACONTENT, SCROLLPANE, SPLITPANE, TABLE, TABPANEL, TEXTAREA, translator, typeNames, UNKNOWN, WMF
 
Constructor Summary
StyleFactory(Project project, java.lang.String packageName)
          Create the StyleFactory and initialise with an StyleManager.
 
Method Summary
 java.lang.Object addComponent(java.lang.String type, java.lang.String nameStr, int x, int y, int w, int h)
          Pass the addNamedComponent call to the StyleFactory base Class
 java.lang.Object addComponent(java.lang.String type, java.lang.String nameStr, int x, int y, int w, int h, java.lang.String txt)
          Overloading method with the same signature in ComponentFactory.
 java.lang.Object addComponent(java.lang.String type, java.lang.String nameStr, int x, int y, int w, int h, java.lang.String txt, java.lang.String style)
          Pass the addNamedComponent call to the StyleFactory base Class
 java.lang.Object addComponent(java.lang.String type, java.lang.String nameStr, java.lang.Object constraint, java.lang.String txt, java.lang.String style)
          Pass the addNamedComponent call to the StyleFactory base Class
 java.lang.Object 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, java.lang.String style, boolean lookupComp, boolean sizeAlreadySet)
          Apply a style to a component, looking up the style name if necessary
 void applyStyle(java.lang.Object c, Style xstyle)
          Apply a style to a component.
 void applyStyle(java.lang.Object c, Style xstyle, boolean sizeAlreadySet)
          Apply a style to a component.
protected  void setup()
          moved from the ctor so as to allow subclassed StyleFactories to do the initialisation in the getInstance().
 
Methods inherited from class org.formaria.aria.ComponentFactory
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 StyleManager styleManager
The project StyleManager

Constructor Detail

StyleFactory

public StyleFactory(Project project,
                    java.lang.String packageName)
Create the StyleFactory and initialise with an StyleManager.

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 StyleFactories to do the initialisation in the getInstance().


addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     java.lang.String nameStr,
                                     java.lang.Object constraint,
                                     java.lang.String txt,
                                     java.lang.String style)
Pass the addNamedComponent call to the StyleFactory 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,
                                     java.lang.String nameStr,
                                     int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String txt,
                                     java.lang.String style)
Pass the addNamedComponent call to the StyleFactory 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,
                                     java.lang.String nameStr,
                                     int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String txt)
Overloading method with the same signature in ComponentFactory.

Overrides:
addComponent in class ComponentFactory
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,
                                     java.lang.String nameStr,
                                     int x,
                                     int y,
                                     int w,
                                     int h)
Pass the addNamedComponent call to the StyleFactory 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.lang.Object 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 LayoutHelper 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,
                       java.lang.String style,
                       boolean lookupComp,
                       boolean sizeAlreadySet)
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
sizeAlreadySet - specifies whether the preferred size can be set by the style

applyStyle

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

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

applyStyle

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

Parameters:
c - The component to style
xstyle - The Style 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.