Introduction
This blog will help to understand the GWT UIobject class that is one of the most necessary classes to know in order to implement various widgets. We will get to know various methods that we can include in our code with the help of the UIObject class. But before some brief on GWT.

Google development toolkit also known as GWT, enables programmers to create internet or web applications. For typical web-app chores like bookmarking, UI abstraction, cross-browser compatibility, etc., GWT insists on reusable techniques.
It offers characteristics like:
- Because GWT solves browser incompatibilities through various bindings, developers do not need to be experts in this area.
- The client and server code bases for GWT are the same.
- Java was the platform of choice for GWT because it offers features like code navigation and refactoring that make development more efficient.
- GWT MVP (Model View Presenter) enables collaborative working and more rapid JUnit testing. By adding events to the event bus, the client side program can make several modifications.
- It enables the integration of numerous Java technologies, including hibernate via gilead.
UIObject class

All user-interface objects belong to the superclass UIObject. It cannot receive events and merely wraps a DOM element. Such direct child classes as Widget, MenuItem, MenuItemSeparator, and TreeItem are available.With CSS, any UIObject object may be stylized.
Each UIObject has a primary style name that designates the principal CSS style rule that must be used on it at all times. The secondary style names of an item can be changed to produce more intricate styling behaviour.
Class declaration
In order to utilise the UIObject class we need to import com.google.gwt.user.client.ui.UIObject in our code.
public abstract class UIObject
extends java.lang.Object
Constructors
Sr.no |
Constructors and Description |
1 |
UIObject()
A UIObject is created for the child classes as a result. |
Methods and Description
Sr.no |
Methods and Description |
1 |
void addStyleDependentName(java.lang.String styleSuffix) specifies the suffix of the style name to add a dependent style name. |
2 |
void addStyleName(java.lang.String style) gives this item a secondary or dependent style name. |
3 |
static void ensureDebugId(Element elem, java.lang.String id)
Make sure element has an ID attribute set so it can integrate with external libraries and testing software. |
4 |
protected static void ensureDebugId(Element elem, java.lang. String baseID, java.lang.String id)
An element's debug id should be set. |
5 |
ensureDebugId(java.lang.String id)
Make sure the ID attribute is set on the primary Element of this UIObject so it can interact with test tools and third-party libraries. |
6 |
int getAbsoluteLeft()
Gets the object's exact left location in pixels, as determined by the client area of the browser window. |
7 |
int getAbsoluteTop()
Gets the object's precise top position in pixels, as determined by the client area of the browser window.will occur when the link is selected). |
8 |
Element getElement()
Obtains a handle to the underlying DOM element of the object. |
9 |
int getOffsetHeight()
Obtains the offset height of the object in pixels. |
10 |
int getOffsetWidth()
Obtains the offset width in pixels for the object. |
11 |
protected Element getStyleElement()
returns the element to which style names will be applied in the template method. |
12 |
java.lang.String getStyleName()
Obtains a list with spaces between each style name for the object. |
13 |
protected static java.lang.String getStyleName(Element elem)
Obtains a list of space-separated style names for every element in the document. |
14 |
java.lang.String getStylePrimaryName()
Obtains the main style name connected to the object. |
15 |
protected static java.lang.String getStylePrimaryName(Element elem)
Obtains the element's main style name. |
16 |
java.lang.String getTitle() Retrieves the title connected to this object. |
17 |
boolean isVisible()
determines if this object is visible or not. |
18 |
static boolean isVisible(Element elem)
determines whether or not an element is visible. |




