public abstract class Weblet
extends java.lang.Object
implements com.google.gwt.core.client.EntryPoint
This class should be subclassed to create a custom editor (Weblet) for a given Tasklet or to create a standalone application. This UI is considered a "design time" UI for customizing the Tasklets input JavaBean.
When used with a Tasklet to build a workflow/job, the Weblet allows the user the ability to manage a Tasklet's input JavaBean (if it has input JavaBean). If the Tasklet has an input JavaBean then the Weblet can read and write to this JavaBean. This class functions as the top level GUI container for all GUI components used in the Weblet. Note, that implementing this class is optional. If a Tasklet has no need for a GUI Weblet, where a user can maunally edit/view properties, then there is no need to implement this class.
Similarly when used with a standalone application (to build an application vs a workfow)
the Weblet is used to house all the GUI components for the application. And
optionally the application can use an input JavaBean to persist some or all of its
data. Check WebletContext
for more details on using a JavaBean
for persistence. In general the Weblet can use a any JavaBean that implements
IsSerializable
or any object that can be serialized into XML using
XMLStream. Simply define the input JavaBean in the
SFB's MANIFEST.MF and it will automically be persisted for you - that easy!
Modifier and Type | Class and Description |
---|---|
static class |
Weblet.Mode
Weblet can be in one of three modes.
|
Modifier | Constructor and Description |
---|---|
protected |
Weblet() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
buildUI()
Implement this to create all the widgets that will be housed in this
top level container.
|
WebletContext |
getContext() |
abstract com.google.gwt.user.client.ui.Panel |
getMainPanel()
This can return
RootPanel.get() or any other panel you want to house your UI. |
Weblet.Mode |
getMode()
Only the more advanced and complex implementations need to concern
themselves with what
mode the Weblet is in. |
void |
initUI(WebletContext context,
Weblet.Mode mode)
Initialize the Weblet including creating/populating the UI.
|
void |
onModuleLoad() |
void |
onSaveInputBean(SuccessFailCallback callback)
Override this method to save changes to the local
input JavaBean.
|
public final void initUI(WebletContext context, Weblet.Mode mode)
context
- mode
- Allows the Weblet to work under different modes. For example,
DEMO
mode typically applies when the Weblet is used to
demonstrate how the UI works. VIEWONLY
prevents the user
from using the GUI to make changes or edits. This can be useful
when viewing historically saved input JavaBeans for example or if the
user has limited rights.public abstract com.google.gwt.user.client.ui.Panel getMainPanel()
RootPanel.get()
or any other panel you want to house your UI.protected abstract void buildUI()
public final WebletContext getContext()
public void onSaveInputBean(SuccessFailCallback callback)
callback
- Used in this method to relay when the outside container
can safely save the input JavaBean. This is need in case
this method needs to perform an asynchronous call before
allowing the save to occur. Make sure to that callback.returnSuccess()
or callback.return.Failure()
are returned. It is highly
recommended to place this methods implementation in a try/catch/finally
to insure that returnSuccess or returnFailure is called.public final Weblet.Mode getMode()
mode
the Weblet is in. The average
Weblet will typically not care about this state.
A subclass of the specific Weblet can use this property
to control how the GUI functions.
It is up to the Weblet to use this property to determine
how to limit its functionality \of the Weblet.
For example, if your Weblet connects to a LDAP server
to pull up a list of users to select from, this LDAP connection
may not be necessary when the Weblet is in VIEWONLY
mode and in DEMO
mode. This allows the Weblet
to adapt its functionality based on what situation it has been
The possible modes are:
EDIT_MODE modepublic final void onModuleLoad()
onModuleLoad
in interface com.google.gwt.core.client.EntryPoint
Copyright © Grand Logic, Inc. All Rights Reserved.