public class BaseWidget extends com.google.gwt.user.client.ui.Widget implements com.google.gwt.event.shared.HasHandlers, LogicalStructure
Modifier and Type | Field and Description |
---|---|
protected com.google.gwt.core.client.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 |
Constructor and Description |
---|
BaseWidget() |
BaseWidget(com.google.gwt.core.client.JavaScriptObject jsObj) |
BaseWidget(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addDrawHandler(DrawHandler handler) |
void |
applyFactoryProperties() |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
Canvas defaults)
Changes the defaults for Canvas AutoChildren named
autoChildName . |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
FormItem defaults)
Changes the defaults for FormItem AutoChildren named
autoChildName . |
void |
completeCreation()
Commits a widget to being an actual live instance instead of being used as a
configuration template with various APIs that accept a properties object.
|
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> |
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) |
static BaseWidget |
getById(java.lang.String ID)
Retrieve a Canvas by its global
ID . |
static BaseWidget |
getByJSObject(com.google.gwt.core.client.JavaScriptObject jsObj)
Retrieve a Canvas from its
JavaScriptObject . |
java.lang.String |
getClassName()
Returns the javascript class name.
|
com.google.gwt.core.client.JavaScriptObject |
getConfig() |
com.google.gwt.user.client.Element |
getDOM() |
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()
Getter implementing the
LogicalStructure interface,
which supports Eclipse's logical structure debugging facility. |
com.google.gwt.core.client.JavaScriptObject |
getOrCreateJsObj() |
static BaseWidget |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
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() |
static boolean |
hasAutoAssignedID(com.google.gwt.core.client.JavaScriptObject jsObj) |
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() |
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,
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) |
static void |
setDefaultProperties(BaseWidget baseWidgetProperties)
Class level method to set the default properties of this class.
|
protected boolean |
setDragTracker() |
void |
setFactoryCreated(boolean createdByBeanFactory) |
void |
setHtmlElement(com.google.gwt.user.client.Element element) |
void |
setID(java.lang.String id) |
void |
setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj) |
com.smartgwt.logicalstructure.core.LogicalStructureObject |
setLogicalStructure(com.smartgwt.logicalstructure.widgets.BaseWidgetLogicalStructure s)
Setter implementing the
LogicalStructure interface,
which supports Eclipse's logical structure debugging facility. |
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() |
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
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
protected java.lang.String id
protected com.google.gwt.core.client.JavaScriptObject config
protected java.lang.String scClassName
protected boolean configOnly
protected java.util.Map<java.lang.String,java.lang.Object> factoryProperties
protected boolean factoryCreated
public NativeObject nativeObject
public BaseWidget()
public BaseWidget(com.google.gwt.core.client.JavaScriptObject jsObj)
public BaseWidget(java.lang.String id)
public static BaseWidget getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static void changeAutoChildDefaults(java.lang.String autoChildName, Canvas defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- Canvas defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public static void changeAutoChildDefaults(java.lang.String autoChildName, FormItem defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- FormItem defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
protected com.google.gwt.core.client.JavaScriptObject create()
public static void setDefaultProperties(BaseWidget baseWidgetProperties)
Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.
baseWidgetProperties
- properties that should be used as new defaults when instances of this class are createdSGWTProperties
public static BaseWidget getById(java.lang.String ID)
ID
.ID
- global ID of the Canvaspublic static BaseWidget getByJSObject(com.google.gwt.core.client.JavaScriptObject jsObj)
JavaScriptObject
.jsObj
- SmartClient object associated with Canvaspublic void setFactoryCreated(boolean createdByBeanFactory)
public boolean isFactoryCreated()
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)
H
- the type of handler to addtype
- the event typehandler
- the handlerHandlerRegistration
used to remove the handlerpublic int getHandlerCount(com.google.gwt.event.shared.GwtEvent.Type<?> type)
getHandlerCount
in class com.google.gwt.user.client.ui.Widget
public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
public static BaseWidget getRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static boolean hasAutoAssignedID(com.google.gwt.core.client.JavaScriptObject jsObj)
public java.lang.String getClassName()
public java.lang.String getScClassName()
public void setScClassName(java.lang.String scClassName)
scClassName
- the SmartClient classprotected final void doInit()
protected void onInit()
protected void onBind()
public boolean isConfigOnly()
public void setConfigOnly(boolean configOnly)
protected boolean setDragTracker()
public java.lang.String getInnerHTML()
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.
public void draw()
public void destroy()
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
public void doOnRender(Function function)
public com.google.gwt.event.shared.HandlerRegistration addDrawHandler(DrawHandler handler)
protected void onDraw()
protected void onDestroy()
public void setPosition(java.lang.String position)
public void setHtmlElement(com.google.gwt.user.client.Element element)
public com.google.gwt.user.client.Element getDOM()
public java.lang.String getID()
protected final void internalSetID(com.google.gwt.core.client.JavaScriptObject jsObj)
protected final void internalSetID(java.lang.String id, boolean autoAssigned)
public void setID(java.lang.String id)
public com.google.gwt.core.client.JavaScriptObject getConfig()
public void setConfig(com.google.gwt.core.client.JavaScriptObject config)
public boolean isCreated()
protected java.lang.Boolean isDrawn()
public com.google.gwt.core.client.JavaScriptObject getJsObj()
public com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()
public void completeCreation()
A widget will be automatically instantiated in some circumstances, such as:
Layout
or child of a parent widget
listGrid.fetchData()
, etc.)
In general, completeCreation() will also occur automatically as a result of methods that require the object to derive or calculate any kind of value. The object will remain in the uncreated state (still usable as just a configuration object) as long as the only methods that are called either set properties or retrieve properties previously set.
Note that if the object has already been used as a configuration template, say by being
passed to a method such as Canvas.changeAutoChildDfaults()
as the properties object argument, then it is an error to call this method.
For a discussion of when a widget should be treated as a properties object rather than a
live instance, see SmartGWT Properties
.
public void applyFactoryProperties()
public java.lang.String getAttribute(java.lang.String attribute)
protected java.lang.String getAttributeAsString(java.lang.String property)
protected java.lang.String[] getAttributeAsStringArray(java.lang.String property)
protected int[] getAttributeAsIntArray(java.lang.String property)
protected java.lang.Float[] getAttributeAsFloatArray(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.Integer getAttributeAsInt(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 com.google.gwt.core.client.JavaScriptObject getAttributeAsJavaScriptObject(java.lang.String property)
protected java.lang.Float getAttributeAsFloat(java.lang.String property)
protected java.lang.Boolean getAttributeAsBoolean(java.lang.String property)
protected java.util.Map getAttributeAsMap(java.lang.String property)
protected Record getAttributeAsRecord(java.lang.String property)
protected void errorIfNotCreated(java.lang.String property) throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected void error(java.lang.String message) throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected void setAttribute(java.lang.String attribute, java.lang.String value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, ValueEnum value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, BaseWidget value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, java.util.Map value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, int[] value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, float[] value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, double[] value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, java.lang.Float[] 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, com.google.gwt.core.client.JavaScriptObject[] value, boolean allowPostCreate)
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, float value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, double value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, java.lang.Integer value, boolean allowPostCreate)
public void setNullProperty(java.lang.String property)
public void setProperty(java.lang.String property, java.lang.String value)
public void setProperty(java.lang.String property, boolean value)
public void setProperty(java.lang.String property, int value)
public void setProperty(java.lang.String property, float value)
public void setProperty(java.lang.String property, double value)
public void setProperty(java.lang.String property, com.google.gwt.user.client.Element value)
public void setProperty(java.lang.String property, com.google.gwt.core.client.JavaScriptObject value)
protected void setAttribute(java.lang.String attribute, java.util.Date 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.lang.String[] 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.Boolean value, boolean allowPostCreate)
protected void setAttribute(java.lang.String attribute, com.google.gwt.user.client.Element value, boolean allowPostCreate)
public void setTitle(java.lang.String title)
setTitle
in class com.google.gwt.user.client.ui.UIObject
public java.lang.String getTitle()
getTitle
in class com.google.gwt.user.client.ui.UIObject
public java.lang.String toString()
toString
in class com.google.gwt.user.client.ui.UIObject
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public com.smartgwt.logicalstructure.core.LogicalStructureObject setLogicalStructure(com.smartgwt.logicalstructure.core.LogicalStructureObject s)
setLogicalStructure
in interface LogicalStructure
public void initNativeObject()
initNativeObject
in interface LogicalStructure
public com.smartgwt.logicalstructure.core.LogicalStructureObject setLogicalStructure(com.smartgwt.logicalstructure.widgets.BaseWidgetLogicalStructure s)
LogicalStructure
interface,
which supports Eclipse's logical structure debugging facility.public com.smartgwt.logicalstructure.core.LogicalStructureObject getLogicalStructure()
LogicalStructure
interface,
which supports Eclipse's logical structure debugging facility.getLogicalStructure
in interface LogicalStructure