Interface BeanFactory.CanvasMetaFactory

Enclosing class:
BeanFactory<BeanClass>

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

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

 GWT.create(BeanFactory.CanvasMetaFactory.class);

 String className = "com.smartgwt.client.widgets.Button"; 
 Canvas canvas = (Canvas) BeanFactory.newInstance(className);

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

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

Alternatively if only specific Canvas 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 annotation 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: