GWT - UIObject Class



Introduction

The class UIObject is the superclass for all user-interface objects. It simply wraps a DOM element, and cannot receive events. It provides direct child classes like Widget, MenuItem, MenuItemSeparator, TreeItem.

  • All UIObject objects can be styled using CSS.

  • Every UIObject has a primary style name that identifies the key CSS style rule that should always be applied to it.

  • More complex styling behavior can be achieved by manipulating an object's secondary style names.

Class Declaration

Following is the declaration for com.google.gwt.user.client.ui.UIObject class −

public abstract class UIObject
   extends java.lang.Object

Field

Following are the fields for com.google.gwt.user.client.ui.UIObject 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.

Class Constructors

Sr.No. Constructor & Description
1

UIObject()

This creates a UIObject for the child classes.

Class Methods

Sr.No. Method & Description
1

void addStyleDependentName(java.lang.String styleSuffix)

Adds a dependent style name by specifying the style name's suffix.

2

void addStyleName(java.lang.String style)

Adds a secondary or dependent style name to this object.

3

static void ensureDebugId(Element elem, java.lang.String id)

Ensure that elem has an ID property set, which allows it to integrate with third-party libraries and test tools.

4

protected static void ensureDebugId(Element elem, java.lang.String baseID, java.lang.String id)

Set the debug id of a specific element.

5

ensureDebugId(java.lang.String id)

Ensure that the main Element for this UIObject has an ID property set, which allows it to integrate with third-party libraries and test tools.

6

int getAbsoluteLeft()

Gets the object's absolute left position in pixels, as measured from the browser window's client area.

7

int getAbsoluteTop()

Gets the object's absolute top position in pixels, as measured from the browser window's client area.

8

Element getElement()

Gets a handle to the object's underlying DOM element.

9

int getOffsetHeight()

Gets the object's offset height in pixels.

10

int getOffsetWidth()

Gets the object's offset width in pixels.

11

protected Element getStyleElement()

Template method that returns the element to which style names will be applied.

12

java.lang.String getStyleName()

Gets all of the object's style names, as a space-separated list.

13

protected static java.lang.String getStyleName(Element elem)

Gets all of the element's style names, as a space-separated list.

14

java.lang.String getStylePrimaryName()

Gets the primary style name associated with the object.

15

protected static java.lang.String getStylePrimaryName(Element elem)

Gets the element's primary style name.

16

java.lang.String getTitle()

Gets the title associated with this object.

17

boolean isVisible()

Determines whether or not this object is visible.

18

static boolean isVisible(Element elem)

Determines whether element is visible or not.

19

protected void onEnsureDebugId(java.lang.String baseID)

Called when the user sets the id using the ensureDebugId(String) method.

20

void removeStyleDependentName(java.lang.String styleSuffix)

Removes a dependent style name by specifying the style name's suffix.

21

void removeStyleName(java.lang.String style)

Removes a style name.

22

protected void setElement(Element elem)

Sets this object's browser element.

23

protected void setElement(Element elem)

Sets this object's browser element.

24

void setHeight(java.lang.String height)

Sets the object's height.

25

void setPixelSize(int width, int height)

Sets the object's size, in pixels, not including decorations such as border, margin, and padding.

26

void setSize(java.lang.String width, java.lang.String height)

Sets the object's size.

27

protected static void setStyleName(Element elem, java.lang.String styleName)

Clears all of the element's style names and sets it to the given style.

28

protected static void setStyleName(Element elem, java.lang.String style, boolean add)

This convenience method adds or removes a style name for a given element.

29

void setStyleName(java.lang.String style)

Clears all of the object's style names and sets it to the given style.

30

protected static void setStylePrimaryName(Element elem, java.lang.String style)

Sets the element's primary style name and updates all dependent style names.

31

void setStylePrimaryName(java.lang.String style)

Sets the object's primary style name and updates all dependent style names.

32

void setTitle(java.lang.String title)

Sets the title associated with this object.

33

void setVisible(boolean visible)

Sets whether this object is visible.

34

static void setVisible(Element elem, boolean visible)

Sets whether this element is visible

35

void setWidth(java.lang.String width)

Sets the object's width.

36

java.lang.String toString()

This method is overridden so that any object can be viewed in the debugger as an HTML snippet.

37

void unsinkEvents(int eventBitsToRemove)

Removes a set of events from this object's event list.

Methods Inherited

This class inherits methods from the following classes −

  • java.lang.Object

gwt_basic_widgets.htm
Advertisements