com.sencha.gxt.widget.core.client
Class ComponentHelper

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.ComponentHelper

public class ComponentHelper
extends java.lang.Object

Provides access to package protected methods of widget and convenience methods for easier widget bookkeeping.


Constructor Summary
ComponentHelper()
           
 
Method Summary
static void doAttach(Widget widget)
          Attach a widget
static void doDetach(Widget widget)
          Detaches a widget
static HandlerManager ensureHandlers(Widget widget)
          Returns the handler manager for the specified widget, creating it if necessary.
static java.lang.String getWidgetId(Widget widget)
          Retrieves the ID that has been set on a widget's element.
static Widget getWidgetWithElement(Element element)
          Find a the nearest widget that contains the given element.
static boolean hasElement(Widget widget)
          Determines if the widget has an Element
static
<H extends EventHandler>
void
removeHandler(Widget widget, GwtEvent.Type<H> type, H handler)
          Removes a handler from the widget
static void setParent(Widget parent, Widget child)
          Sets the child to the parent widget
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentHelper

public ComponentHelper()
Method Detail

getWidgetWithElement

public static Widget getWidgetWithElement(Element element)
Find a the nearest widget that contains the given element.

Parameters:
element - the element to start at
Returns:
the containing element, or null if there is no widget

doAttach

public static void doAttach(Widget widget)
Attach a widget

Parameters:
widget - the widget to attach

doDetach

public static void doDetach(Widget widget)
Detaches a widget

Parameters:
widget - the widget to detach

ensureHandlers

public static HandlerManager ensureHandlers(Widget widget)
Returns the handler manager for the specified widget, creating it if necessary.

Parameters:
widget - the widget
Returns:
the handler manager

getWidgetId

public static java.lang.String getWidgetId(Widget widget)
Retrieves the ID that has been set on a widget's element. If the widget's element does not already have an ID, one will be automatically generated, and that generated ID will be returned.

Parameters:
widget - The widget whose element's ID is to be retrieved. Must not be null.
Returns:
The ID on the widget's element

hasElement

public static boolean hasElement(Widget widget)
Determines if the widget has an Element

Parameters:
widget - the target Element
Returns:
true if has an Element

removeHandler

public static <H extends EventHandler> void removeHandler(Widget widget,
                                                          GwtEvent.Type<H> type,
                                                          H handler)
Removes a handler from the widget

Parameters:
widget - the target widget
type - the type
handler - the handler to remove

setParent

public static void setParent(Widget parent,
                             Widget child)
Sets the child to the parent widget

Parameters:
parent - the parent widget
child - the child widget


Copyright © 2012. All Rights Reserved.