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:
- HasHandlers, EventListener
- Direct Known Subclasses:
- Canvas
public abstract class BaseWidget
- extends Widget
- implements HasHandlers
Method Summary |
HandlerRegistration |
addDrawHandler(DrawHandler handler)
|
protected JavaScriptObject |
create()
|
void |
destroy()
|
protected
|
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(Object obj)
|
protected void |
error(String message)
|
protected void |
errorIfNotCreated(String property)
|
void |
fireEvent(GwtEvent<?> event)
Fires the given event to all the appropriate handlers. |
protected String |
getAttribute(String attribute)
|
protected Boolean |
getAttributeAsBoolean(String property)
|
protected Date |
getAttributeAsDate(String property)
|
protected Double |
getAttributeAsDouble(String property)
|
protected Element |
getAttributeAsElement(String property)
|
protected Float |
getAttributeAsFloat(String property)
|
protected Integer |
getAttributeAsInt(String property)
|
protected JavaScriptObject |
getAttributeAsJavaScriptObject(String property)
|
protected Map |
getAttributeAsMap(String property)
|
protected String |
getAttributeAsString(String property)
|
protected String[] |
getAttributeAsStringArray(String property)
|
JavaScriptObject |
getConfig()
|
Element |
getDOM()
|
Element |
getElement()
|
Element |
getElement(boolean allowPreRender)
|
int |
getHandlerCount(GwtEvent.Type<?> type)
|
String |
getID()
|
String |
getInnerHTML()
Return the inner HTML for this canvas. |
JavaScriptObject |
getJsObj()
|
JavaScriptObject |
getOrCreateJsObj()
|
static BaseWidget |
getRef(JavaScriptObject jsObj)
|
String |
getTitle()
|
int |
hashCode()
|
boolean |
isConfigOnly()
|
boolean |
isCreated()
|
protected Boolean |
isDrawn()
|
protected void |
onDestroy()
|
protected void |
onDraw()
|
protected void |
onInit()
|
protected void |
setAttribute(String attribute,
BaseClass[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
BaseWidget[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
BaseWidget value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
Boolean value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
DataClass[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
DataClass value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
Date value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
double value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
Element value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
float value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
int[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
Integer value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
JavaScriptObject[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
JavaScriptObject value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
Map value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
Object[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
String[] value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
String value,
boolean allowPostCreate)
|
protected void |
setAttribute(String attribute,
ValueEnum value,
boolean allowPostCreate)
|
void |
setConfig(JavaScriptObject config)
|
void |
setConfigOnly(boolean configOnly)
|
protected boolean |
setDragTracker()
|
protected void |
setElement(Element elem)
|
void |
setHtmlElement(Element element)
|
void |
setID(String id)
|
void |
setNullProperty(String property)
|
void |
setPosition(String position)
|
void |
setProperty(String property,
boolean value)
|
void |
setProperty(String property,
double value)
|
void |
setProperty(String property,
Element value)
|
void |
setProperty(String property,
float value)
|
void |
setProperty(String property,
int value)
|
void |
setProperty(String property,
JavaScriptObject value)
|
void |
setProperty(String property,
String value)
|
void |
setTitle(String title)
|
String |
toString()
|
Methods inherited from class com.google.gwt.user.client.ui.Widget |
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, 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, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, unsinkEvents |
id
protected String id
config
protected JavaScriptObject config
isElementSet
protected boolean isElementSet
scClassName
protected String scClassName
configOnly
protected boolean configOnly
BaseWidget
public BaseWidget()
BaseWidget
protected BaseWidget(JavaScriptObject jsObj)
BaseWidget
public BaseWidget(String id)
fireEvent
public void fireEvent(GwtEvent<?> event)
- Description copied from interface:
HasHandlers
- Fires the given event to all the appropriate handlers.
- Specified by:
fireEvent
in interface HasHandlers
- Overrides:
fireEvent
in class Widget
- Parameters:
event
- the event to be fired
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 typehandler
- the handler
- Returns:
HandlerRegistration
used to remove the handler
getHandlerCount
public int getHandlerCount(GwtEvent.Type<?> type)
- Overrides:
getHandlerCount
in class Widget
getRef
public static BaseWidget getRef(JavaScriptObject jsObj)
setElement
protected void setElement(Element elem)
- Overrides:
setElement
in class UIObject
doInit
protected final void doInit()
onInit
protected void onInit()
isConfigOnly
public boolean isConfigOnly()
setConfigOnly
public void setConfigOnly(boolean configOnly)
setDragTracker
protected boolean setDragTracker()
getInnerHTML
public 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()
doOnRender
public void doOnRender(Function function)
addDrawHandler
public HandlerRegistration addDrawHandler(DrawHandler handler)
onDraw
protected void onDraw()
onDestroy
protected void onDestroy()
getElement
public Element getElement()
- Overrides:
getElement
in class UIObject
getElement
public Element getElement(boolean allowPreRender)
setPosition
public void setPosition(String position)
setHtmlElement
public void setHtmlElement(Element element)
getDOM
public Element getDOM()
getID
public String getID()
setID
public void setID(String id)
getConfig
public JavaScriptObject getConfig()
setConfig
public void setConfig(JavaScriptObject config)
isCreated
public boolean isCreated()
isDrawn
protected Boolean isDrawn()
getJsObj
public JavaScriptObject getJsObj()
getOrCreateJsObj
public JavaScriptObject getOrCreateJsObj()
create
protected JavaScriptObject create()
getAttribute
protected String getAttribute(String attribute)
getAttributeAsString
protected String getAttributeAsString(String property)
getAttributeAsStringArray
protected String[] getAttributeAsStringArray(String property)
getAttributeAsDate
protected Date getAttributeAsDate(String property)
getAttributeAsInt
protected Integer getAttributeAsInt(String property)
getAttributeAsDouble
protected Double getAttributeAsDouble(String property)
getAttributeAsElement
protected Element getAttributeAsElement(String property)
getAttributeAsJavaScriptObject
protected JavaScriptObject getAttributeAsJavaScriptObject(String property)
getAttributeAsFloat
protected Float getAttributeAsFloat(String property)
getAttributeAsBoolean
protected Boolean getAttributeAsBoolean(String property)
getAttributeAsMap
protected Map getAttributeAsMap(String property)
errorIfNotCreated
protected void errorIfNotCreated(String property)
throws IllegalStateException
- Throws:
IllegalStateException
error
protected void error(String message)
throws IllegalStateException
- Throws:
IllegalStateException
setAttribute
protected void setAttribute(String attribute,
String value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
ValueEnum value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
BaseWidget value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
Map value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
int[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
DataClass value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
DataClass[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
JavaScriptObject[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
BaseClass[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
BaseWidget[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
float value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
double value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
Integer value,
boolean allowPostCreate)
setNullProperty
public void setNullProperty(String property)
setProperty
public void setProperty(String property,
String value)
setProperty
public void setProperty(String property,
boolean value)
setProperty
public void setProperty(String property,
int value)
setProperty
public void setProperty(String property,
float value)
setProperty
public void setProperty(String property,
double value)
setProperty
public void setProperty(String property,
Element value)
setProperty
public void setProperty(String property,
JavaScriptObject value)
setAttribute
protected void setAttribute(String attribute,
Date value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
JavaScriptObject value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
String[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
Object[] value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
Boolean value,
boolean allowPostCreate)
setAttribute
protected void setAttribute(String attribute,
Element value,
boolean allowPostCreate)
setTitle
public void setTitle(String title)
- Overrides:
setTitle
in class UIObject
getTitle
public String getTitle()
- Overrides:
getTitle
in class UIObject
toString
public String toString()
- Overrides:
toString
in class UIObject
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object