public static interface BeanFactory.CanvasMetaFactory
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 using the BeanFactory.MetaFactory
interface instead.
If there are only a limited number of types which require dynamic
configuration, it will save code size to use the
BeanFactory.MetaFactory
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.