Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gui4j.core
Class Gui4jComponentFactory  view Gui4jComponentFactory download Gui4jComponentFactory.java

java.lang.Object
  extended byorg.gui4j.core.Gui4jComponentFactory
All Implemented Interfaces:
org.gui4j.exception.ErrorTags, java.io.Serializable

public abstract class Gui4jComponentFactory
extends java.lang.Object
implements org.gui4j.exception.ErrorTags, java.io.Serializable

Base class for all component factories. In order to provide a new component, a sub-class of Gui4jComponentFactory must be defined. During initialization, instances of the factories defined in an initialization property file are created. These instances are used to extract the necessary information from the corresponding part in a given xml resource file. The Gui4jComponentManager is responsible for these factory instance. One instance a Gui4jComponentManager contains always at most one instance of a given factory class and one instance of Gui4j contains exactly one instance of Gui4jComponentManager. Hence, if one instance of Gui4j is used, there is always only one instance of a defined factory class.


Nested Class Summary
static class Gui4jComponentFactory.SubElement
           
 
Field Summary
private static java.lang.String APPLY
           
private static org.gui4j.core.definition.Attribute[] ATTRIBUTE_ARRAY_TEMPLATE
           
private static java.lang.String BACKGROUND
           
protected static java.lang.String CDATA
           
static java.lang.String CONTEXT
           
private static java.lang.String CURSOR
           
protected static java.lang.String DTD_IMPLIED
           
protected static java.lang.String DTD_REQUIRED
           
static java.lang.String ELEMENT_COMPONENT
           
static java.lang.String ELEMENT_GUI4JREF
           
protected static java.lang.String ENABLED
           
protected static boolean EVENT_AWARE
           
static java.lang.String FIELD_Id
           
static java.lang.String FIELD_Style
           
static java.lang.String FIELDGui4jRef_Id
           
protected static java.lang.String FOCUSABLE
           
private static java.lang.String FONT
           
private static java.lang.String FOREGROUND
           
protected static boolean IMPLIED
           
private  Gui4jInternal mGui4j
           
private  Gui4jCallFactory mGui4jCallFactory
           
private static org.apache.commons.logging.Log mLog
           
protected static boolean NOT_EVENT_AWARE
           
private static java.lang.String ONCLICK
           
private static java.lang.String ONINIT
           
private static java.lang.String POPUP
           
protected static boolean REQUIRED
           
protected static java.lang.String VISIBLE
           
 
Fields inherited from interface org.gui4j.exception.ErrorTags
EXCEPTION_OCCURED, PROGRAMMING_ERROR, PROGRAMMING_ERROR_illegal_access_exception, PROGRAMMING_ERROR_instantiation_exception, PROGRAMMING_ERROR_invocation_target_exception, PROGRAMMING_ERROR_method_ambiguous, PROGRAMMING_ERROR_method_not_found, PROGRAMMING_ERROR_parameter_null, RESOURCE_ERROR, RESOURCE_ERROR_access_type_not_compatible, RESOURCE_ERROR_access_unexpected_character, RESOURCE_ERROR_access_unexpected_end, RESOURCE_ERROR_access_value_type_not_defined, RESOURCE_ERROR_alias_already_defined, RESOURCE_ERROR_alias_class_not_found, RESOURCE_ERROR_alias_not_defined_in_path, RESOURCE_ERROR_alias_undefined, RESOURCE_ERROR_attribute_editable_defined, RESOURCE_ERROR_attribute_listEditable_defined, RESOURCE_ERROR_attribute_not_defined, RESOURCE_ERROR_double_DataConversionException, RESOURCE_ERROR_element_at_row_col_already_defined, RESOURCE_ERROR_gui4jComponent_already_defined, RESOURCE_ERROR_gui4jComponent_already_registered, RESOURCE_ERROR_gui4jComponent_not_defined, RESOURCE_ERROR_gui4jComponent_not_registered, RESOURCE_ERROR_int_DataConversionException, RESOURCE_ERROR_invalid_column, RESOURCE_ERROR_invalid_defaultButton, RESOURCE_ERROR_invalid_keystroke, RESOURCE_ERROR_invalid_row, RESOURCE_ERROR_invalid_url, RESOURCE_ERROR_jdom_exception, RESOURCE_ERROR_labelform_column_conflict, RESOURCE_ERROR_placement_must_contain_gui4jComponent, RESOURCE_ERROR_property_getter_type_incompatible, RESOURCE_ERROR_style_defined_twice, RESOURCE_ERROR_style_not_defined, RESOURCE_ERROR_tableLayout_invalid_col_row_str, RESOURCE_ERROR_type_not_compatible, RESOURCE_ERROR_unexpected_gui4jStyle_end, RESOURCE_ERROR_unknown_param, RESOURCE_ERROR_unknown_param_in_include
 
Constructor Summary
Gui4jComponentFactory()
           
 
Method Summary
 void addToplevelAttributes(java.util.List attrList, org.gui4j.util.Filter filter)
           
protected static org.gui4j.core.definition.Attribute[] attrList2Arr(java.util.List attrList)
           
protected  void checkErrorList(java.util.List errorList)
           
protected static java.lang.String constructAttributeType(java.util.Collection collection)
           
abstract  Gui4jComponent defineBy(Gui4jComponentContainer gui4jComponentContainer, java.lang.String id, org.dom4j.LElement e)
          Generates a component by a given JDOM-Element
protected  void defineProperties(Gui4jAbstractComponent gui4jComponent, org.dom4j.LElement e)
           
protected  void definePropertyEnabled(Gui4jAbstractComponent gui4jComponent, org.dom4j.LElement e)
           
protected  void definePropertyVisible(Gui4jAbstractComponent gui4jComponent, org.dom4j.LElement e)
           
 double getDoubleValue(Gui4jComponentContainer gui4jComponentContainer, org.dom4j.LElement e, java.lang.String field, double defaultValue)
           
protected  Gui4jInternal getGui4j()
           
 Gui4jCall getGui4jAccessInstance(java.lang.Class expectedType, java.lang.Class valueType, Gui4jComponent gui4jComponent, org.dom4j.LElement e, java.lang.String field)
           
 Gui4jCall getGui4jAccessInstance(java.lang.Class expectedType, Gui4jComponent gui4jComponent, org.dom4j.LElement e, java.lang.String field)
           
 Gui4jCall getGui4jAccessInstance(java.lang.Class expectedType, java.util.Map valueClassMap, Gui4jComponent gui4jComponent, org.dom4j.LElement e, java.lang.String field)
          Creates a Gui4jCall from the method call declaration in an XML file.
 java.lang.String[] getInnerElements()
          Returns an array with all inner elements that are defined by this component.
 int getIntValue(Gui4jComponentContainer gui4jComponentContainer, org.dom4j.LElement e, java.lang.String field)
           
 int getIntValue(Gui4jComponentContainer gui4jComponentContainer, org.dom4j.LElement e, java.lang.String field, int defaultValue)
           
protected  int getMapValue(Gui4jComponentContainer gui4jComponentContainer, org.dom4j.LElement e, java.lang.String attrName, java.util.Map valueMap, int defaultValue)
           
abstract  java.lang.String getName()
          Returns the name of the component
 void setGui4j(Gui4jInternal gui4j)
           
 void setGui4jCallFactory(Gui4jCallFactory gui4jCallFactory)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
abstract  void writeDTD(java.io.PrintWriter out)
          Writes the DTD of this component to the given stream
protected  void writeElement(java.io.PrintWriter out, java.lang.String elementName, Gui4jComponentFactory.SubElement subElement, org.gui4j.core.definition.Attribute[] attributes)
           
protected  void writeToplevelElement(java.io.PrintWriter out, Gui4jComponentFactory.SubElement subElement)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mLog

private static final org.apache.commons.logging.Log mLog

FIELD_Id

public static final java.lang.String FIELD_Id
See Also:
Constant Field Values

FIELDGui4jRef_Id

public static final java.lang.String FIELDGui4jRef_Id
See Also:
Constant Field Values

FIELD_Style

public static final java.lang.String FIELD_Style
See Also:
Constant Field Values

IMPLIED

protected static final boolean IMPLIED
See Also:
Constant Field Values

REQUIRED

protected static final boolean REQUIRED
See Also:
Constant Field Values

NOT_EVENT_AWARE

protected static final boolean NOT_EVENT_AWARE
See Also:
Constant Field Values

EVENT_AWARE

protected static final boolean EVENT_AWARE
See Also:
Constant Field Values

DTD_IMPLIED

protected static final java.lang.String DTD_IMPLIED
See Also:
Constant Field Values

DTD_REQUIRED

protected static final java.lang.String DTD_REQUIRED
See Also:
Constant Field Values

CDATA

protected static final java.lang.String CDATA
See Also:
Constant Field Values

ELEMENT_GUI4JREF

public static final java.lang.String ELEMENT_GUI4JREF
See Also:
Constant Field Values

ELEMENT_COMPONENT

public static final java.lang.String ELEMENT_COMPONENT
See Also:
Constant Field Values

BACKGROUND

private static final java.lang.String BACKGROUND
See Also:
Constant Field Values

APPLY

private static final java.lang.String APPLY
See Also:
Constant Field Values

ONINIT

private static final java.lang.String ONINIT
See Also:
Constant Field Values

CURSOR

private static final java.lang.String CURSOR
See Also:
Constant Field Values

ENABLED

protected static final java.lang.String ENABLED
See Also:
Constant Field Values

VISIBLE

protected static final java.lang.String VISIBLE
See Also:
Constant Field Values

FOCUSABLE

protected static final java.lang.String FOCUSABLE
See Also:
Constant Field Values

FONT

private static final java.lang.String FONT
See Also:
Constant Field Values

FOREGROUND

private static final java.lang.String FOREGROUND
See Also:
Constant Field Values

ONCLICK

private static final java.lang.String ONCLICK
See Also:
Constant Field Values

POPUP

private static final java.lang.String POPUP
See Also:
Constant Field Values

CONTEXT

public static final java.lang.String CONTEXT
See Also:
Constant Field Values

ATTRIBUTE_ARRAY_TEMPLATE

private static final org.gui4j.core.definition.Attribute[] ATTRIBUTE_ARRAY_TEMPLATE

mGui4j

private Gui4jInternal mGui4j

mGui4jCallFactory

private Gui4jCallFactory mGui4jCallFactory
Constructor Detail

Gui4jComponentFactory

public Gui4jComponentFactory()
Method Detail

writeDTD

public abstract void writeDTD(java.io.PrintWriter out)
Writes the DTD of this component to the given stream


defineBy

public abstract Gui4jComponent defineBy(Gui4jComponentContainer gui4jComponentContainer,
                                        java.lang.String id,
                                        org.dom4j.LElement e)
Generates a component by a given JDOM-Element


getName

public abstract java.lang.String getName()
Returns the name of the component


setGui4j

public void setGui4j(Gui4jInternal gui4j)

setGui4jCallFactory

public void setGui4jCallFactory(Gui4jCallFactory gui4jCallFactory)

defineProperties

protected void defineProperties(Gui4jAbstractComponent gui4jComponent,
                                org.dom4j.LElement e)

definePropertyEnabled

protected void definePropertyEnabled(Gui4jAbstractComponent gui4jComponent,
                                     org.dom4j.LElement e)

definePropertyVisible

protected void definePropertyVisible(Gui4jAbstractComponent gui4jComponent,
                                     org.dom4j.LElement e)

writeToplevelElement

protected void writeToplevelElement(java.io.PrintWriter out,
                                    Gui4jComponentFactory.SubElement subElement)

addToplevelAttributes

public void addToplevelAttributes(java.util.List attrList,
                                  org.gui4j.util.Filter filter)

writeElement

protected void writeElement(java.io.PrintWriter out,
                            java.lang.String elementName,
                            Gui4jComponentFactory.SubElement subElement,
                            org.gui4j.core.definition.Attribute[] attributes)

getInnerElements

public java.lang.String[] getInnerElements()
Returns an array with all inner elements that are defined by this component. If other top level elements are allowed to be nested inside this component, they should NOT be included in the returned array.


getIntValue

public int getIntValue(Gui4jComponentContainer gui4jComponentContainer,
                       org.dom4j.LElement e,
                       java.lang.String field)

getIntValue

public int getIntValue(Gui4jComponentContainer gui4jComponentContainer,
                       org.dom4j.LElement e,
                       java.lang.String field,
                       int defaultValue)

getDoubleValue

public double getDoubleValue(Gui4jComponentContainer gui4jComponentContainer,
                             org.dom4j.LElement e,
                             java.lang.String field,
                             double defaultValue)

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getGui4jAccessInstance

public Gui4jCall getGui4jAccessInstance(java.lang.Class expectedType,
                                        Gui4jComponent gui4jComponent,
                                        org.dom4j.LElement e,
                                        java.lang.String field)

getGui4jAccessInstance

public Gui4jCall getGui4jAccessInstance(java.lang.Class expectedType,
                                        java.util.Map valueClassMap,
                                        Gui4jComponent gui4jComponent,
                                        org.dom4j.LElement e,
                                        java.lang.String field)
Creates a Gui4jCall from the method call declaration in an XML file. It searches for a method provided by the controller of the gui4jComponent that matches the method call declaration in the XML file.


getGui4jAccessInstance

public Gui4jCall getGui4jAccessInstance(java.lang.Class expectedType,
                                        java.lang.Class valueType,
                                        Gui4jComponent gui4jComponent,
                                        org.dom4j.LElement e,
                                        java.lang.String field)

getGui4j

protected Gui4jInternal getGui4j()

getMapValue

protected int getMapValue(Gui4jComponentContainer gui4jComponentContainer,
                          org.dom4j.LElement e,
                          java.lang.String attrName,
                          java.util.Map valueMap,
                          int defaultValue)

attrList2Arr

protected static org.gui4j.core.definition.Attribute[] attrList2Arr(java.util.List attrList)

constructAttributeType

protected static java.lang.String constructAttributeType(java.util.Collection collection)

checkErrorList

protected void checkErrorList(java.util.List errorList)