com.smartgwt.client.widgets

## Class BaseWidget

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.client.ui.Widget
    - - com.smartgwt.client.widgets.BaseWidget

- All Implemented Interfaces:
    com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsWidget, LogicalStructure
  Direct Known Subclasses:
    Canvas

      public abstract class BaseWidget
      extends com.google.gwt.user.client.ui.Widget
      implements com.google.gwt.event.shared.HasHandlers, LogicalStructure

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

      `com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.google.gwt.core.client.JavaScriptObject` | `config`
    `protected boolean` | `configOnly`
    `protected java.lang.String` | `id`
    `protected boolean` | `isElementSet`
    `NativeObject` | `nativeObject`
    `protected java.lang.String` | `scClassName`

    - ### Fields inherited from class com.google.gwt.user.client.ui.UIObject

      `DEBUG_ID_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseWidget()`
    `BaseWidget(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `BaseWidget(java.lang.String id)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.google.gwt.event.shared.HandlerRegistration` | `addDrawHandler(DrawHandler handler)`
    `protected com.google.gwt.core.client.JavaScriptObject` | `create()`
    `void` | `destroy()` Permanently destroy a Canvas and all of it's children / members, recursively.
    `protected <H extends com.google.gwt.event.shared.EventHandler> com.google.gwt.event.shared.HandlerRegistration` | `doAddHandler(H handler, com.google.gwt.event.shared.GwtEvent.Type<H> type)` Adds this handler to the widget.
    `protected void` | `doInit()`
    `void` | `doOnRender(Function function)`
    `void` | `draw()` Draws the widget on the page.
    `boolean` | `equals(java.lang.Object obj)`
    `protected void` | `error(java.lang.String message)`
    `protected void` | `errorIfNotCreated(java.lang.String property)`
    `java.lang.String` | `getAttribute(java.lang.String attribute)`
    `protected java.lang.Boolean` | `getAttributeAsBoolean(java.lang.String property)`
    `protected java.util.Date` | `getAttributeAsDate(java.lang.String property)`
    `protected java.util.Date[]` | `getAttributeAsDateArray(java.lang.String property)`
    `protected java.lang.Double` | `getAttributeAsDouble(java.lang.String property)`
    `protected com.google.gwt.user.client.Element` | `getAttributeAsElement(java.lang.String property)`
    `protected java.lang.Float` | `getAttributeAsFloat(java.lang.String property)`
    `protected java.lang.Float[]` | `getAttributeAsFloatArray(java.lang.String property)`
    `protected java.lang.Integer` | `getAttributeAsInt(java.lang.String property)`
    `protected int[]` | `getAttributeAsIntArray(java.lang.String property)`
    `protected com.google.gwt.core.client.JavaScriptObject` | `getAttributeAsJavaScriptObject(java.lang.String property)`
    `protected java.util.Map` | `getAttributeAsMap(java.lang.String property)`
    `protected Record` | `getAttributeAsRecord(java.lang.String property)`
    `protected java.lang.String` | `getAttributeAsString(java.lang.String property)`
    `protected java.lang.String[]` | `getAttributeAsStringArray(java.lang.String property)`
    `java.lang.String` | `getClassName()` Returns the javascript class name.
    `com.google.gwt.core.client.JavaScriptObject` | `getConfig()`
    `com.google.gwt.user.client.Element` | `getDOM()`
    `com.google.gwt.user.client.Element` | `getElement()`
    `com.google.gwt.user.client.Element` | `getElement(boolean allowPreRender)`
    `int` | `getHandlerCount(com.google.gwt.event.shared.GwtEvent.Type<?> type)`
    `java.lang.String` | `getID()`
    `java.lang.String` | `getInnerHTML()` Return the inner HTML for this canvas.
    `com.google.gwt.core.client.JavaScriptObject` | `getJsObj()`
    `com.smartgwt.logicalstructure.core.LogicalStructureObject` | `getLogicalStructure()`
    `com.google.gwt.core.client.JavaScriptObject` | `getOrCreateJsObj()`
    `static BaseWidget` | `getRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `java.lang.String` | `getScClassName()` Get the name of the underlying SmartClient class
    `java.lang.String` | `getTitle()`
    `int` | `hashCode()`
    `void` | `initNativeObject()`
    `protected void` | `internalSetID(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `protected void` | `internalSetID(java.lang.String id, boolean autoAssigned)`
    `boolean` | `isConfigOnly()`
    `boolean` | `isCreated()`
    `protected java.lang.Boolean` | `isDrawn()`
    `protected void` | `onBind()`
    `protected void` | `onDestroy()`
    `protected void` | `onDraw()`
    `protected void` | `onInit()`
    `protected void` | `setAttribute(java.lang.String attribute, BaseClass[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, BaseWidget[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, BaseWidget value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.lang.Boolean value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, DataClass[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, DataClass value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.util.Date value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, double value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, com.google.gwt.user.client.Element value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, float[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.lang.Float[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, float value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, int[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.lang.Integer value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, com.google.gwt.core.client.JavaScriptObject[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, com.google.gwt.core.client.JavaScriptObject value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.util.Map value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.lang.Object[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.lang.String[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, java.lang.String value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, ValueEnum value, boolean allowPostCreate)`
    `void` | `setConfig(com.google.gwt.core.client.JavaScriptObject config)`
    `void` | `setConfigOnly(boolean configOnly)`
    `protected boolean` | `setDragTracker()`
    `protected void` | `setElement(com.google.gwt.user.client.Element elem)`
    `void` | `setHtmlElement(com.google.gwt.user.client.Element element)`
    `void` | `setID(java.lang.String id)`
    `com.smartgwt.logicalstructure.core.LogicalStructureObject` | `setLogicalStructure(com.smartgwt.logicalstructure.core.LogicalStructureObject s)`
    `void` | `setNullProperty(java.lang.String property)`
    `void` | `setPosition(java.lang.String position)`
    `void` | `setProperty(java.lang.String property, boolean value)`
    `void` | `setProperty(java.lang.String property, double value)`
    `void` | `setProperty(java.lang.String property, com.google.gwt.user.client.Element value)`
    `void` | `setProperty(java.lang.String property, float value)`
    `void` | `setProperty(java.lang.String property, int value)`
    `void` | `setProperty(java.lang.String property, com.google.gwt.core.client.JavaScriptObject value)`
    `void` | `setProperty(java.lang.String property, java.lang.String value)`
    `void` | `setScClassName(java.lang.String scClassName)` Set the name of the underlying SmartClient class.
    `void` | `setTitle(java.lang.String title)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class com.google.gwt.user.client.ui.Widget

      `addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents`

    - ### Methods inherited from class com.google.gwt.user.client.ui.UIObject

      `addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent, unsinkEvents`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

- - ### Field Detail

    - #### id

          protected java.lang.String id

    - #### config

          protected com.google.gwt.core.client.JavaScriptObject config

    - #### isElementSet

          protected boolean isElementSet

    - #### scClassName

          protected java.lang.String scClassName

    - #### configOnly

          protected boolean configOnly

    - #### nativeObject

          public NativeObject nativeObject

  - ### Constructor Detail

    - #### BaseWidget

          public BaseWidget()

    - #### BaseWidget

          public BaseWidget(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### BaseWidget

          public BaseWidget(java.lang.String id)

  - ### Method Detail

    - #### doAddHandler

          protected final <H extends com.google.gwt.event.shared.EventHandler> com.google.gwt.event.shared.HandlerRegistration doAddHandler(H handler,
                                                                                                                          com.google.gwt.event.shared.GwtEvent.Type<H> type)

      Adds this handler to the widget.
      Type Parameters:
        `H` - the type of handler to add
      Parameters:
        `type` - the event type
        `handler` - the handler
      Returns:
        `HandlerRegistration` used to remove the handler

    - #### getHandlerCount

          public int getHandlerCount(com.google.gwt.event.shared.GwtEvent.Type<?> type)

      Overrides:
        `getHandlerCount` in class `com.google.gwt.user.client.ui.Widget`

    - #### getRef

          public static BaseWidget getRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### setElement

          protected void setElement(com.google.gwt.user.client.Element elem)

      Overrides:
        `setElement` in class `com.google.gwt.user.client.ui.UIObject`

    - #### getClassName

          public java.lang.String getClassName()

      Returns the javascript class name.
      Returns:

    - #### getScClassName

          public java.lang.String getScClassName()

      Get the name of the underlying SmartClient class
      Returns:
        the SmartClient class name

    - #### setScClassName

          public void setScClassName(java.lang.String scClassName)

      Set the name of the underlying SmartClient class. This is an advanced setting.
      Parameters:
        `scClassName` - the SmartClient class

    - #### doInit

          protected final void doInit()

    - #### onInit

          protected void onInit()

    - #### onBind

          protected void onBind()

    - #### isConfigOnly

          public boolean isConfigOnly()

    - #### setConfigOnly

          public void setConfigOnly(boolean configOnly)

    - #### setDragTracker

          protected boolean setDragTracker()

    - #### getInnerHTML

          public java.lang.String getInnerHTML()

      Return the inner HTML for this canvas. Called when the canvas is drawn or redrawn; override to customize.

      Note : `Canvas.setRedrawOnResize(java.lang.Boolean)` should be set to true for components whose inner HTML will not automatically reflow to fit the component's new size.

      Returns:
        HTML contents of this canvas

    - #### draw

          public void draw()

      Draws the widget on the page.

    - #### destroy

          public void destroy()

      Permanently destroy a Canvas and all of it's children / members, recursively.

      Like `Canvas.clear()` calling `destroy()` removes all HTML for the component; unlike clear(), a destroyed Canvas is permanently unusable: it cannot be draw()'n again and cannot be referenced by its global ID. This method also removes all JavaScript references to the Canvas outside of application code, making it eligible for garbage collection (though developers will need to release any references to the canvas held in application code themselves).

      Any attempt to call a method on a destroyed Canvas will generally result in an error. If your application is forced to hold onto Canvas's that might be destroy()d without warning, you can avoid errors by checking for the `Canvas.getDestroyed()` property. If you override certain Canvas methods, your code may be called while a Canvas is being destroy()d; in this case you can avoid extra work (and possibly errors) by checking for the +`Canvas.getDestroying()` property.

      Note that `destroy()` should not be called directly in event handling code for this canvas. For this reason, wherever possible we recommend using `Canvas.markForDestroy()` instead of calling this method directly.

      Note: This is an override point

    - #### doOnRender

          public void doOnRender(Function function)

    - #### addDrawHandler

          public com.google.gwt.event.shared.HandlerRegistration addDrawHandler(DrawHandler handler)

    - #### onDraw

          protected void onDraw()

    - #### onDestroy

          protected void onDestroy()

    - #### getElement

          public com.google.gwt.user.client.Element getElement()

      Overrides:
        `getElement` in class `com.google.gwt.user.client.ui.UIObject`

    - #### getElement

          public com.google.gwt.user.client.Element getElement(boolean allowPreRender)

    - #### setPosition

          public void setPosition(java.lang.String position)

    - #### setHtmlElement

          public void setHtmlElement(com.google.gwt.user.client.Element element)

    - #### getDOM

          public com.google.gwt.user.client.Element getDOM()

    - #### getID

          public java.lang.String getID()

    - #### internalSetID

          protected void internalSetID(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### internalSetID

          protected void internalSetID(java.lang.String id,
                           boolean autoAssigned)

    - #### setID

          public void setID(java.lang.String id)

    - #### getConfig

          public com.google.gwt.core.client.JavaScriptObject getConfig()

    - #### setConfig

          public void setConfig(com.google.gwt.core.client.JavaScriptObject config)

    - #### isCreated

          public boolean isCreated()

    - #### isDrawn

          protected java.lang.Boolean isDrawn()

    - #### getJsObj

          public com.google.gwt.core.client.JavaScriptObject getJsObj()

    - #### getOrCreateJsObj

          public com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()

    - #### create

          protected com.google.gwt.core.client.JavaScriptObject create()

    - #### getAttribute

          public java.lang.String getAttribute(java.lang.String attribute)

    - #### getAttributeAsString

          protected java.lang.String getAttributeAsString(java.lang.String property)

    - #### getAttributeAsStringArray

          protected java.lang.String[] getAttributeAsStringArray(java.lang.String property)

    - #### getAttributeAsIntArray

          protected int[] getAttributeAsIntArray(java.lang.String property)

    - #### getAttributeAsFloatArray

          protected java.lang.Float[] getAttributeAsFloatArray(java.lang.String property)

    - #### getAttributeAsDate

          protected java.util.Date getAttributeAsDate(java.lang.String property)

    - #### getAttributeAsDateArray

          protected java.util.Date[] getAttributeAsDateArray(java.lang.String property)

    - #### getAttributeAsInt

          protected java.lang.Integer getAttributeAsInt(java.lang.String property)

    - #### getAttributeAsDouble

          protected java.lang.Double getAttributeAsDouble(java.lang.String property)

    - #### getAttributeAsElement

          protected com.google.gwt.user.client.Element getAttributeAsElement(java.lang.String property)

    - #### getAttributeAsJavaScriptObject

          protected com.google.gwt.core.client.JavaScriptObject getAttributeAsJavaScriptObject(java.lang.String property)

    - #### getAttributeAsFloat

          protected java.lang.Float getAttributeAsFloat(java.lang.String property)

    - #### getAttributeAsBoolean

          protected java.lang.Boolean getAttributeAsBoolean(java.lang.String property)

    - #### getAttributeAsMap

          protected java.util.Map getAttributeAsMap(java.lang.String property)

    - #### getAttributeAsRecord

          protected Record getAttributeAsRecord(java.lang.String property)

    - #### errorIfNotCreated

          protected void errorIfNotCreated(java.lang.String property)
                                    throws java.lang.IllegalStateException

      Throws:
        `java.lang.IllegalStateException`

    - #### error

          protected void error(java.lang.String message)
                        throws java.lang.IllegalStateException

      Throws:
        `java.lang.IllegalStateException`

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.lang.String value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          ValueEnum value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          BaseWidget value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.util.Map value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          int[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          float[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.lang.Float[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          DataClass value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          DataClass[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          com.google.gwt.core.client.JavaScriptObject[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          BaseClass[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          BaseWidget[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          float value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          double value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.lang.Integer value,
                          boolean allowPostCreate)

    - #### setNullProperty

          public void setNullProperty(java.lang.String property)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         java.lang.String value)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         boolean value)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         int value)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         float value)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         double value)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         com.google.gwt.user.client.Element value)

    - #### setProperty

          public void setProperty(java.lang.String property,
                         com.google.gwt.core.client.JavaScriptObject value)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.util.Date value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          com.google.gwt.core.client.JavaScriptObject value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.lang.String[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.lang.Object[] value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          java.lang.Boolean value,
                          boolean allowPostCreate)

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          com.google.gwt.user.client.Element value,
                          boolean allowPostCreate)

    - #### setTitle

          public void setTitle(java.lang.String title)

      Overrides:
        `setTitle` in class `com.google.gwt.user.client.ui.UIObject`

    - #### getTitle

          public java.lang.String getTitle()

      Overrides:
        `getTitle` in class `com.google.gwt.user.client.ui.UIObject`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `com.google.gwt.user.client.ui.UIObject`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### setLogicalStructure

          public com.smartgwt.logicalstructure.core.LogicalStructureObject setLogicalStructure(com.smartgwt.logicalstructure.core.LogicalStructureObject s)

      Specified by:
        `setLogicalStructure` in interface `LogicalStructure`

    - #### getLogicalStructure

          public com.smartgwt.logicalstructure.core.LogicalStructureObject getLogicalStructure()

      Specified by:
        `getLogicalStructure` in interface `LogicalStructure`

    - #### initNativeObject

          public void initNativeObject()

      Specified by:
        `initNativeObject` in interface `LogicalStructure`