- GWT Tutorial
- GWT - Home
- GWT - Overview
- GWT - Environment Setup
- GWT - Applications
- GWT - Create Application
- GWT - Deploy Application
- GWT - Style with CSS
- GWT - Basic Widgets
- GWT - Form Widgets
- GWT - Complex widgets
- GWT - Layout Panels
- GWT - Event Handling
- GWT - Custom Widgets
- GWT - UIBinder
- GWT - RPC Communication
- GWT - JUnit Integration
- GWT - Debugging Application
- GWT - Internationalization
- GWT - History Class
- GWT - Bookmark Support
- GWT - Logging Framework
- GWT Useful Resources
- GWT - Questions and Answers
- GWT - Quick Guide
- GWT - Useful Resources
- GWT - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
GWT - Widget Class
The class Widget is the base class for the majority of user-interface objects. Widget adds support for receiving events from the browser and being added directly to panels.
Following is the declaration for com.google.gwt.user.client.ui.Widget class −
public class Widget extends UIObject implements EventListener
Following are the fields for com.google.gwt.user.client.ui.Widget class −
public static final java.lang.String DEBUG_ID_PREFIX − The element ID that you specify will be prefixed by the static string DEBUG_ID_PREFIX.
|Sr.No.||Constructor & Description|
This creates a Widget for the child classes.
|Sr.No.||Method & Description|
protected <H extends EventHandler> HandlerRegistration addDomHandler(H handler, DomEvent.Type<H> type)
Adds a native event handler to the widget and sinks the corresponding native event.
protected <H extends EventHandler> HandlerRegistration addHandler(H handler, GwtEvent.Type<H> type)
Adds this handler to the widget.
protected void delegateEvent(Widget target, GwtEvent<?> event)
Fires an event on a child widget.
protected void doAttachChildren()
If a widget implements HasWidgets, it must override this method and call onAttach() for each of its child widgets.
protected void doDetachChildren()
If a widget implements HasWidgets, it must override this method and call onDetach() for each of its child widgets.
void fireEvent(GwtEvent<?> event)
Fires the given event to all the appropriate handlers.
protected int getHandlerCount(GwtEvent.Type<?> type)
Gets the number of handlers listening to the event type.
Gets this widget's parent panel.
Determines whether this widget is currently attached to the browser's document (i.e., there is an unbroken chain of widgets between this widget and the underlying browser document).
protected boolean isOrWasAttached()
Has this widget ever been attached?
protected void onAttach()
This method is called when a widget is attached to the browser's document.
void onBrowserEvent(Event event)
Fired whenever a browser event is received.
protected void onDetach()
This method is called when a widget is detached from the browser's document.
protected void onLoad()
Gets a handle to the object's underlying DOM element.
protected void onUnload()
This method is called immediately before a widget will be detached from the browser's document.
Removes this widget from its parent widget.
void sinkEvents(int eventBitsToAdd)
Overridden to defer the call to super.sinkEvents until the first time this widget is attached to the dom, as a performance enhancement.
This class inherits methods from the following classes −