to.etc.domui.component.form
Class ControlFactoryString

java.lang.Object
  extended by to.etc.domui.component.form.ControlFactoryString
All Implemented Interfaces:
ControlFactory

public class ControlFactoryString
extends java.lang.Object
implements ControlFactory

This is a fallback factory; it accepts anything and shows a String edit component OR a DisplayValue component for it. It hopes that the control can convert the string input value to the actual type using the registered Converters. This is also the factory for regular Strings.

Author:
Frits Jalvingh Created on Jul 2, 2009

Field Summary
 
Fields inherited from interface to.etc.domui.component.form.ControlFactory
BOOLEAN_AND_ENUM_CF, DATE_CF, RELATION_COMBOBOX_CF, RELATION_LOOKUP_CF, STRING_CF, TEXTAREA_CF
 
Constructor Summary
ControlFactoryString()
           
 
Method Summary
 int accepts(PropertyMetaModel<?> pmm, boolean editable, java.lang.Class<?> controlClass, java.lang.Object context)
          Accept any type using a string.
<T> ControlFactoryResult
createControl(IReadOnlyModel<?> model, PropertyMetaModel<T> pmm, boolean editable, java.lang.Class<?> controlClass, java.lang.Object context)
          This MUST create all nodes necessary for a control to edit the specified item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControlFactoryString

public ControlFactoryString()
Method Detail

accepts

public int accepts(PropertyMetaModel<?> pmm,
                   boolean editable,
                   java.lang.Class<?> controlClass,
                   java.lang.Object context)
Accept any type using a string.

Specified by:
accepts in interface ControlFactory
controlClass - When set the control factory *must* be able to return a component which is assignment-compatible with this class type. If it cannot it MUST refuse to create the control.
context - TODO
Returns:
See Also:
to.etc.domui.component.form.ControlFactory#accepts(to.etc.domui.component.meta.PropertyMetaModel)

createControl

public <T> ControlFactoryResult createControl(IReadOnlyModel<?> model,
                                              PropertyMetaModel<T> pmm,
                                              boolean editable,
                                              java.lang.Class<?> controlClass,
                                              java.lang.Object context)
Description copied from interface: ControlFactory
This MUST create all nodes necessary for a control to edit the specified item. The nodes must be added to the container; this must return a ModelBinding to bind and unbind a value to the control created.

Specified by:
createControl in interface ControlFactory
controlClass - When set the control factory *must* return a component which is assignment-compatible with this class type. When this method is called it has already (by it's accept method) told us it can, so not creating the proper type is not an option.
context - TODO
Returns: