to.etc.domui.component.form
Class ControlFactoryRelationLookup

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

public class ControlFactoryRelationLookup
extends java.lang.Object
implements ControlFactory

Accepts any UP (parent) relation and scores 3, preferring this above the combobox-based lookup.

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
ControlFactoryRelationLookup()
           
 
Method Summary
 int accepts(PropertyMetaModel<?> pmm, boolean editable, java.lang.Class<?> controlClass, java.lang.Object context)
          Accept any UP relation.
<T> ControlFactoryResult
createControl(IReadOnlyModel<?> model, PropertyMetaModel<T> pmm, boolean editable, java.lang.Class<?> controlClass, java.lang.Object context)
          Create the lookup thingy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControlFactoryRelationLookup

public ControlFactoryRelationLookup()
Method Detail

accepts

public int accepts(PropertyMetaModel<?> pmm,
                   boolean editable,
                   java.lang.Class<?> controlClass,
                   java.lang.Object context)
Accept any UP relation.

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, boolean)

createControl

public <T> ControlFactoryResult createControl(IReadOnlyModel<?> model,
                                              PropertyMetaModel<T> pmm,
                                              boolean editable,
                                              java.lang.Class<?> controlClass,
                                              java.lang.Object context)
Create the lookup thingy.

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:
See Also:
to.etc.domui.component.form.ControlFactory#createControl(to.etc.domui.util.IReadOnlyModel, to.etc.domui.component.meta.PropertyMetaModel, boolean)