JavaGantt 2011.1 API

eu.beesoft.gaia.swing.builder
Class ComponentBuilder<T extends java.awt.Component>

java.lang.Object
  extended by eu.beesoft.gaia.util.ObjectBuilder<T>
      extended by eu.beesoft.gaia.swing.builder.SwingBuilder<T>
          extended by eu.beesoft.gaia.swing.builder.ComponentBuilder<T>
Type Parameters:
T - class of object created by this builder
Direct Known Subclasses:
AbstractButtonBuilder, ComboBoxBuilder, ContainerBuilder, DateFieldBuilder, FillerBuilder, LabelBuilder, ListBuilder, SeparatorBuilder, TableBuilder, TextComponentBuilder, TreeBuilder

public abstract class ComponentBuilder<T extends java.awt.Component>
extends SwingBuilder<T>

Abstract superclass of all Swing component builders. Supports these properties:


Constructor Summary
ComponentBuilder()
           
 
Method Summary
protected  void addChild(ObjectBuilder<?> builder)
          Adds the given builder to the children of this builder.
protected  void addSwingChild(ObjectBuilder<?> builder)
          This implementation processes just instances of LayoutConstraintsBuilder to remember layout constraints for component of this builder.
protected  java.lang.Object convertValue(java.lang.Object value, java.lang.Class<?> targetClass, java.lang.String fullBinding)
          Converts given value to the class of given type.
protected  java.lang.Object createBoundData(java.lang.String binding)
          Creates a new data object for given binding path.
protected  java.lang.Object findBoundData(java.lang.String binding, SwingBuilder<?> caller)
          Finds a data object for given binding path.
 java.lang.Object getLayoutConstraints()
          Returns layout constraints for the component built by this builder.
protected  void initBackground(java.lang.String value)
           
protected  void initBorder(java.lang.String value)
          Initializes the border property from given value.
protected  void initEnabled(java.lang.String value)
           
protected  void initFont(java.lang.String value)
           
protected  void initForeground(java.lang.String value)
           
protected  void initId(java.lang.String value)
          Initializes property ID for this value.
protected  void initLayoutConstraint(java.lang.String value)
          Initializes layout constraint for the component of this builder.
protected  void initName(java.lang.String value)
           
protected  void initOpaque(java.lang.String value)
           
protected  void initSize(java.lang.String value)
           
protected  void initToolTipText(java.lang.String value)
          Initializes property toolTipText.
protected  void initVisible(java.lang.String value)
           
protected  java.awt.Color parseColor(java.lang.String value)
          Helper method to parse given String to the Color instance.
protected  javax.swing.Icon parseIcon(java.lang.String value)
          Helper method to parse given value to icon.
 void setLayoutConstraints(java.lang.Object object)
          Sets layout constraints for the component built by this builder.
 
Methods inherited from class eu.beesoft.gaia.swing.builder.SwingBuilder
getBindableChildren, getBinding, getBoundData, getBoundValueFromComponent, getPropertyFromResourceBundle, getValueFromBoundObject, initBinding, isBindable, parseDimension, setBoundData, setBoundValueToComponent, setValueToBoundObject
 
Methods inherited from class eu.beesoft.gaia.util.ObjectBuilder
createObject, createObject, getFactory, getChildren, getId, getObject, getParent, getProperties, getProperty, initClass, initObjectProperties, initObjectProperty, parseBoolean, parseClass, parseConstant, parseConstructor, parseDouble, parseInstance, parseInstance, parseInt, parseInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentBuilder

public ComponentBuilder()
Method Detail

addChild

protected void addChild(ObjectBuilder<?> builder)
Adds the given builder to the children of this builder. Then invokes addSwingChild(ObjectBuilder) method.

Overrides:
addChild in class ObjectBuilder<T extends java.awt.Component>
Parameters:
builder - - the builder to add

addSwingChild

protected void addSwingChild(ObjectBuilder<?> builder)
This implementation processes just instances of LayoutConstraintsBuilder to remember layout constraints for component of this builder.

Parameters:
builder - - the builder which object should be added to swing component

initId

protected void initId(java.lang.String value)
Description copied from class: ObjectBuilder
Initializes property ID for this value. Sets property to instance variable.

Overrides:
initId in class ObjectBuilder<T extends java.awt.Component>
Parameters:
value - - id to set

initName

protected void initName(java.lang.String value)

initLayoutConstraint

protected void initLayoutConstraint(java.lang.String value)
Initializes layout constraint for the component of this builder. Enabled value is an integer or the constant name from the parent's layout manager class.

Parameters:
value - - value from according attribute in XML to initialize the layout constraints

setLayoutConstraints

public void setLayoutConstraints(java.lang.Object object)
Sets layout constraints for the component built by this builder.

Parameters:
object - - the layout constraints to set

getLayoutConstraints

public java.lang.Object getLayoutConstraints()
Returns layout constraints for the component built by this builder.

Returns:
the layout constraints

initForeground

protected void initForeground(java.lang.String value)

initBackground

protected void initBackground(java.lang.String value)

parseColor

protected java.awt.Color parseColor(java.lang.String value)
Helper method to parse given String to the Color instance. The argument value can be:

Parameters:
value - - string to parse
Returns:
the Color instance created for given string value

initSize

protected void initSize(java.lang.String value)

initOpaque

protected void initOpaque(java.lang.String value)

initFont

protected void initFont(java.lang.String value)

initBorder

protected void initBorder(java.lang.String value)
Initializes the border property from given value. This method currently supports just limited set of borders from javax.swing.border package. You can use these:

where:

Please, note, the color value you can write in 3 different ways, and this can change the real number of arguments in your XML attribute. For example, the LineBorder(color, int) you can write:

Each of these notations is equal and this method will parse it.

Parameters:
value - - the value to initialize border property

initToolTipText

protected void initToolTipText(java.lang.String value)
Initializes property toolTipText.

Parameters:
value - - value from according attribute in XML to initialize this property

parseIcon

protected javax.swing.Icon parseIcon(java.lang.String value)
Helper method to parse given value to icon.

Parameters:
value - - icon resource name
Returns:
icon from given file

initEnabled

protected void initEnabled(java.lang.String value)

initVisible

protected void initVisible(java.lang.String value)

convertValue

protected java.lang.Object convertValue(java.lang.Object value,
                                        java.lang.Class<?> targetClass,
                                        java.lang.String fullBinding)
Converts given value to the class of given type. Overriden to forward the convert request to the parent builder, if exists.

Overrides:
convertValue in class SwingBuilder<T extends java.awt.Component>
Parameters:
value - - value to convert
targetClass - - the type to value has be converted
fullBinding - - binding path from the root data object
Returns:
value converted to the requested type

createBoundData

protected java.lang.Object createBoundData(java.lang.String binding)
Creates a new data object for given binding path. Overriden to forward the creation request to the parent builder, if exists. If not, it returns the new empty instance of ValueObject.

Overrides:
createBoundData in class SwingBuilder<T extends java.awt.Component>
Parameters:
binding - - binding for which should be created new object
Returns:
new created object for given binding

findBoundData

protected java.lang.Object findBoundData(java.lang.String binding,
                                         SwingBuilder<?> caller)
Finds a data object for given binding path. Overriden to forward the find request to the parent builder, if exists.

Overrides:
findBoundData in class SwingBuilder<T extends java.awt.Component>
Parameters:
binding - - binding for which should be created new object
caller - - the builder which invokes this method
Returns:
the data object found for given binding

JavaGantt 2011.1 API