org.formaria.editor.project.pages.components
Class EditorComponentFactory

java.lang.Object
  extended by org.formaria.aria.ComponentFactory
      extended by org.formaria.aria.style.StyleFactory
          extended by org.formaria.editor.project.pages.components.EditorComponentFactory

public class EditorComponentFactory
extends StyleFactory

A special component factory to build customized objects for use in the editor

Copyright: Copyright (c) Formaria Ltd., 1998-2003

Company: Formaria Ltd.


Field Summary
 
Fields inherited from class org.formaria.aria.style.StyleFactory
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
EditorComponentFactory(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, java.lang.String txt, java.lang.String style)
          A generic factory for adding Components.
 void applyStyle(java.awt.Component 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)
          Called after a new component is created.
protected  java.lang.Object buildRegisteredComponent(java.lang.String type, java.lang.String content)
          A generic factory for creating registered components via the ComponentConstructor interface or component factories.
 java.lang.Object constructComponent(java.lang.String type, java.lang.String content)
          A generic factory for constructing Components.
protected  boolean isComponentProxied(java.lang.Object c)
          Check to see if this component should be proxied for use in the editor
static void proxyComponent(java.lang.Class c)
          Adds a component to the list of proxied components
 
Methods inherited from class org.formaria.aria.style.StyleFactory
addComponent, addComponent, addComponent, addLayout, applyStyle, applyStyle, applyStyle, applyStyle, setup
 
Methods inherited from class org.formaria.aria.ComponentFactory
addComponent, addComponent, addComponent, addElement, addLayout, 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
 

Constructor Detail

EditorComponentFactory

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

Parameters:
manager - the StyleManager to initialise with
Method Detail

constructComponent

public java.lang.Object constructComponent(java.lang.String type,
                                           java.lang.String content)
A generic factory for constructing Components.

Overrides:
constructComponent in class ComponentFactory
Parameters:
type - a constant identifying the type of component to be created
content - the component text/content
Returns:
the new 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)
A generic factory for adding Components. 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.

Overrides:
addComponent in class StyleFactory
Parameters:
type - a name identifying the type of component to be created
x - the left coordinate
y - the top coordinate
w - the width
h - the height
content - the component text/content
Returns:
the new component

applyStyle

public void applyStyle(java.awt.Component 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)
Called after a new component is created. Append the style to the base and then append the component classname with '/' delimiters.

Overrides:
applyStyle in class StyleFactory
Parameters:
c - Component to apply the style to.
style - the name of the style to apply.

buildRegisteredComponent

protected java.lang.Object buildRegisteredComponent(java.lang.String type,
                                                    java.lang.String content)
A generic factory for creating registered components via the ComponentConstructor interface or component factories.

Overrides:
buildRegisteredComponent in class ComponentFactory
Parameters:
type - a name identifying the type of component to be created
x - the left coordinate
y - the top coordinate
w - the width
h - the height
content - the component text/content
Returns:
the new component

isComponentProxied

protected boolean isComponentProxied(java.lang.Object c)
Check to see if this component should be proxied for use in the editor

Parameters:
c - the component
Returns:
true if it is to be proxied

proxyComponent

public static void proxyComponent(java.lang.Class c)
Adds a component to the list of proxied components

Parameters:
c - the component.