Interface BeanFactory.FormItemMetaFactory

Enclosing class:
BeanFactory<BeanClass>

public static interface BeanFactory.FormItemMetaFactory
Interface used to trigger the generation and registration of reflection metadata for FormItem and all its subclasses found in the classpath (including your custom subclasses).

Usage is to simply call GWT.create(BeanFactory.FormItemMetaFactory.class); Note that the return value is not useful -- you would then simply use the BeanFactory API, like so:

 GWT.create(BeanFactory.FormItemMetaFactory.class);

 String className = "com.smartgwt.client.widgets.form.fields.TextItem"; 
 Object canvas = BeanFactory.newInstance(className);

 BeanFactory.setProperty(canvas, "title", "Hello World");
 BeanFactory.setProperty(canvas, "tooltip", "My tooltip");
 

Furthermore, the className can also be used as a Constructor in Component XML.

Alternatively if only specific FormItem types need to be instantiated and configured dynamically, you can generate specific factories by annotating classes with the BeanFactory.Generate annotation instead.

If there are only a limited number of types which require dynamic configuration, it will save code size to use the BeanFactory.Generate interface for those types. Once the metadata is generated, GWT's opportunities to prune dead code are more limited for those classes, since it cannot know what properties will be set or retrieved at run-time.

See Also: