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:
    HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure
  Direct Known Subclasses:
    Canvas

      public abstract class BaseWidget
      extends Widget
      implements HasHandlers, LogicalStructure

- - ### Nested Class Summary

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

      `UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JavaScriptObject` | `config`
    `protected boolean` | `configOnly`
    `protected boolean` | `factoryCreated`
    `protected java.util.Map<java.lang.String,java.lang.Object>` | `factoryProperties`
    `protected java.lang.String` | `id`
    `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(java.lang.String id)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HandlerRegistration` | `addDrawHandler(DrawHandler handler)`
    `void` | `applyFactoryProperties()`
    `protected JavaScriptObject` | `create()`
    `void` | `destroy()` Permanently destroy a Canvas and all of it's children / members, recursively.
    `protected <H extends EventHandler> HandlerRegistration` | `doAddHandler(H handler, 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 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 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.
    `JavaScriptObject` | `getConfig()`
    `Element` | `getDOM()`
    `int` | `getHandlerCount(GwtEvent.Type<?> type)`
    `java.lang.String` | `getID()`
    `java.lang.String` | `getInnerHTML()` Return the inner HTML for this canvas.
    `JavaScriptObject` | `getJsObj()`
    `com.smartgwt.logicalstructure.core.LogicalStructureObject` | `getLogicalStructure()`
    `JavaScriptObject` | `getOrCreateJsObj()`
    `static BaseWidget` | `getRef(JavaScriptObject jsObj)`
    `java.lang.String` | `getScClassName()` Get the name of the underlying SmartClient class
    `java.lang.String` | `getTitle()`
    `static boolean` | `hasAutoAssignedID(JavaScriptObject jsObj)`
    `int` | `hashCode()`
    `void` | `initNativeObject()`
    `protected void` | `internalSetID(JavaScriptObject jsObj)`
    `protected void` | `internalSetID(java.lang.String id, boolean autoAssigned)`
    `boolean` | `isConfigOnly()`
    `boolean` | `isCreated()`
    `protected java.lang.Boolean` | `isDrawn()`
    `boolean` | `isFactoryCreated()`
    `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, double value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, 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, JavaScriptObject[] value, boolean allowPostCreate)`
    `protected void` | `setAttribute(java.lang.String attribute, 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(JavaScriptObject config)`
    `void` | `setConfigOnly(boolean configOnly)`
    `protected boolean` | `setDragTracker()`
    `void` | `setFactoryCreated(boolean createdByBeanFactory)`
    `void` | `setHtmlElement(Element element)`
    `void` | `setID(java.lang.String id)`
    `void` | `setJavaScriptObject(JavaScriptObject jsObj)`
    `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, Element value)`
    `void` | `setProperty(java.lang.String property, float value)`
    `void` | `setProperty(java.lang.String property, int value)`
    `void` | `setProperty(java.lang.String property, 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, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, 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 JavaScriptObject config

    - #### scClassName

          protected java.lang.String scClassName

    - #### configOnly

          protected boolean configOnly

    - #### factoryProperties

          protected java.util.Map<java.lang.String,java.lang.Object> factoryProperties

    - #### factoryCreated

          protected boolean factoryCreated

    - #### nativeObject

          public NativeObject nativeObject

  - ### Constructor Detail

    - #### BaseWidget

          public BaseWidget()

    - #### BaseWidget

          public BaseWidget(java.lang.String id)

  - ### Method Detail

    - #### setFactoryCreated

          public void setFactoryCreated(boolean createdByBeanFactory)

    - #### isFactoryCreated

          public boolean isFactoryCreated()

    - #### doAddHandler

          protected final <H extends EventHandler> HandlerRegistration doAddHandler(H handler,
                                                                  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(GwtEvent.Type<?> type)

      Overrides:
        `getHandlerCount` in class `Widget`

    - #### setJavaScriptObject

          public void setJavaScriptObject(JavaScriptObject jsObj)

    - #### getRef

          public static BaseWidget getRef(JavaScriptObject jsObj)

    - #### hasAutoAssignedID

          public static boolean hasAutoAssignedID(JavaScriptObject jsObj)

    - #### 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 HandlerRegistration addDrawHandler(DrawHandler handler)

    - #### onDraw

          protected void onDraw()

    - #### onDestroy

          protected void onDestroy()

    - #### setPosition

          public void setPosition(java.lang.String position)

    - #### setHtmlElement

          public void setHtmlElement(Element element)

    - #### getDOM

          public Element getDOM()

    - #### getID

          public java.lang.String getID()

    - #### internalSetID

          protected final void internalSetID(JavaScriptObject jsObj)

    - #### internalSetID

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

    - #### setID

          public void setID(java.lang.String id)

    - #### getConfig

          public JavaScriptObject getConfig()

    - #### setConfig

          public void setConfig(JavaScriptObject config)

    - #### isCreated

          public boolean isCreated()

    - #### isDrawn

          protected java.lang.Boolean isDrawn()

    - #### getJsObj

          public JavaScriptObject getJsObj()

    - #### getOrCreateJsObj

          public JavaScriptObject getOrCreateJsObj()

    - #### create

          protected JavaScriptObject create()

    - #### applyFactoryProperties

          public void applyFactoryProperties()

    - #### 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 Element getAttributeAsElement(java.lang.String property)

    - #### getAttributeAsJavaScriptObject

          protected 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,
                          double[] 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,
                          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,
                         Element value)

    - #### setProperty

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

    - #### setAttribute

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

    - #### setAttribute

          protected void setAttribute(java.lang.String attribute,
                          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,
                          Element value,
                          boolean allowPostCreate)

    - #### setTitle

          public void setTitle(java.lang.String title)

      Overrides:
        `setTitle` in class `UIObject`

    - #### getTitle

          public java.lang.String getTitle()

      Overrides:
        `getTitle` in class `UIObject`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `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`