org.jboss.errai.workspaces.client.api
Interface WidgetProvider
- All Known Subinterfaces:
- Tool
- All Known Implementing Classes:
- ToolImpl, WSLoginPanel
public interface WidgetProvider
Main interface for workspace tools.
A workspace instance demands a widget from a provider when necessary.
The callback allows for both synchronous and asynchronous creation of widgets
when needed.
A typical pattern, leveraging the GWT 2.0 code spitting features looks like this:
AT LoadTool(name="MyTool", group="MyToolsetGroup")
class MyModule implements WidgetProvider {
private static Widget instance = null;
public void provideWidget(final ProvisioningCallback callback)
{
GWT.runAsync(
new RunAsyncCallback()
{
public void onFailure(Throwable err)
{
GWT.log("Failed to load tool", err);
}
public void onSuccess()
{
if (null == instance) {
instance = new HTML(""); // create your widget here
}
callback.onSuccess(instance);
}
}
);
}
}
provideWidget
void provideWidget(ProvisioningCallback callback)
Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.