Zimlet JavaScript API Reference - DwtControl

Class DwtControl


This class is the root class of the Dwt component hierarchy. All Dwt components either directly or indirectly inherit from this class.

A DwtControl may also be directly instantiated. In this case it is essentially a div into which any content may be "drawn"

A control may be created in "deferred" mode, meaning that the UI portion of the control will be created "Just In Time". This is useful for widgets which may want to defer construction of elements (e.g. DwtTreeItem) until such time as is needed, in the interest of efficiency. Note that if the control is a child of the shell, it won't become visible until its z-index is set.

Events

  • DwtEvent.CONTROL
  • DwtEvent.DISPOSE
  • DwtEvent.HOVEROVER
  • DwtEvent.HOVEROUT
  • DwtEvent.ONCONTEXTMENU
  • DwtEvent.ONCLICK
  • DwtEvent.ONDBLCLICK
  • DwtEvent.ONFOCUS
  • DwtEvent.ONBLUR
  • DwtEvent.ONMOUSEDOWN
  • DwtEvent.ONMOUSEENTER
  • DwtEvent.ONMOUSELEAVE
  • DwtEvent.ONMOUSEMOVE
  • DwtEvent.ONMOUSEOUT
  • DwtEvent.ONMOUSEOVER
  • DwtEvent.ONMOUSEUP
  • DwtEvent.ONMOUSEWHEEL
  • DwtEvent.ONSELECTSTART


Defined in: DwtControl.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
DwtControl(params, parent, className, posStyle, deferred, id, parentElement, index, isFocusable, role)
Creates a control.
Field Summary
Field Attributes Field Name and Description
<static>  
DwtControl.ABSOLUTE_STYLE
Defines the absolute position style.
<static>  
DwtControl.ACTIVE
Defines the "active" display state.
<static>  
DwtControl.CLIP
Defines clip on overflow.
<static>  
DwtControl.DEFAULT
Defines the "default" display state.
<static>  
DwtControl.DISABLED
Defines the "disabled" display state.
<static>  
DwtControl.ERROR
Defines the "error" display state.
<static>  
DwtControl.FIXED_SCROLL
Defines always have scrollbars whether content overflows or not.
<static>  
DwtControl.FIXED_STYLE
Defines the fixed position style.
<static>  
DwtControl.FOCUSED
Defines the "focused" display state.
<static>  
DwtControl.HOVER
Defines the "hover" display state.
<static>  
DwtControl.NORMAL
Defines the "normal" display state.
<static>  
DwtControl.RELATIVE_STYLE
Defines the relative position style.
<static>  
DwtControl.SCROLL
Defines automatically create scrollbars if content overflows.
<static>  
DwtControl.SELECTED
Defines the "selected" display state.
<static>  
DwtControl.STATIC_STYLE
Defines the static position style.
<static>  
DwtControl.VISIBLE
Defines allow overflow to be visible.
Method Summary
Method Attributes Method Name and Description
 
addClassName(className)
Adds a class name to this control HTML element.
 
Adds a control event listener for control events.
 
Registers a dispose listener for control events.
 
addListener(eventType, listener, index)
Adds a listener to the control.
 
appendElement(elemOrId)
Appends this control element to the specified element.
 
blur()
Takes browser and keyboard focus away from this control.
 
Clears the content of the control HTML element.
 
clearHandler(eventType)
Clears the event handling function for a given event type.
 
condClassName(condition, classWhenTrue, classWhenFalse)
Conditionally adds or removes a class name to this control HTML element.
 
delClassName(delClass, addClass)
Removes a class name from this control's HTML element.
 
Disposes of the control.
<static>  
DwtControl.findControl(htmlEl)
Finds a control and starts the search at the given element and works up the element chain until it finds one with an ID that maps to a DwtControl.
 
Sets browser and keyboard focus to this control.
<static>  
DwtControl.fromElement(htmlEl)
Returns the control associated with the given element, if any.
<static>  
DwtControl.fromElementId(htmlElId)
Returns the control associated with the given element ID, if any.
 
Gets the bounds of the component.
 
Gets the class name of this control.
 
Returns the content of the control HTML element.
 
Gets the control cursor.
 
getData(key)
Gets the data associated with the specified key.
 
Gets the control drag box.
 
Gets the control drag source.
 
Gets the control drop target.
 
Gets the enabled state.
 
Returns the element that should get browser focus when this control is focused.
 
getH()
Gets the height of the control.
 
Gets the control containing HTML element.
 
Gets the ID of the control containing HTML element.
 
Gets the inset bounds of the component.
 
Gets the insets of the component, i.e.
 
Gets the location of the control.
 
Gets the margins of the component.
 
Gets the opacity of the control HTML element.
 
Gets the outer size -- that is, the size including margins, padding, and borders -- of an HTML element.
 
Returns the positioning style
 
Returns the element that this control scrolls within.
 
Gets the control scroll style.
 
getSize(getFromStyle)
Gets the size of the control.
 
Gets the tab group member for this control.
<static>  
DwtControl.getTargetControl(ev, useRelatedTarget)
Returns the control associated with the given event.
 
getTooltipBase(hoverEv)
Returns the element that should be used as a base for positioning the tooltip.
 
Gets the tooltip content (typically set using #setToolTipContent).
 
Gets the visibility of the control HTML element.
 
Gets the visible state of the control.
 
getW()
Gets the width of the control.
 
getX()
Gets the X coordinate of the control (if absolutely positioned).
 
Gets the horizontal extent of the control (if absolutely positioned).
 
getY()
Gets the Y coordinate of the control (if it is absolutely positioned).
 
Gets the vertical extent of the control (if it is absolutely positioned).
 
getZIndex(getFromStyle)
Gets the control z-index value.
 
Checks if this control has focus.
<static>  
DwtControl.hideToolTip()
A helper method to hide the toolTip.
 
Checks if the control is showing an alert.
 
Checks if the control is disposed.
 
Checks if the control is initialized.
 
Checks if there are any listeners registered for a particular event type.
 
notifyListeners(eventType, event)
Notifies all listeners of type eventType with event.
 
Prevents a context menu on the specified element.
 
preventSelection(targetEl)
Prevents selection on the specified element.
 
removeAllListeners(eventType)
Removes all listeners for a particular event type.
 
Removes a control event listener for control events.
 
Removes a dispose event listener for control events.
 
removeListener(eventType, listener)
Removes a listener from the control.
 
reparent(newParent, index)
Re-parents the control within the component hierarchy.
 
reparentHtmlElement(htmlEl, position)
Re-parents the HTML element of the control to the html element supplied as the parameter to this method.
 
replaceElement(elemOrId, inheritClass, inheritStyle)
Replaces the specified element with this control element.
 
setBounds(x, y, width, height)
Sets the bounds of a control.
 
setClassName(className)
Sets the control class name.
 
setContent(content)
Sets the content of the control HTML element to the provided content.
 
setCursor(cursorName)
Sets the control cursor.
 
setData(key, value)
Sets the data for a given key.
 
setDisplay(value)
Sets the display.
 
Sets the display state.
 
setDragBox(dragBox)
Set the control drag box.
 
setDragSource(dragSource)
Set the control drag source.
 
setDropTarget(dropTarget)
Sets the drop target for the control.
 
setEnabled(enabled, setHtmlElement)
Sets the control enabled state.
 
setEventPropagation(propagate, events)
Set the default behavior for whether an event will propagate (bubble up).
 
Sets the "focus element" if this control is focusable.
 
setHandler(eventType, hdlrFunc)
Sets the event handling function for a given event type.
 
Sets the control HTML element id attribute.
 
Sets the location of the control.
 
setOpacity(opacity)
Sets the opacity of the control HTML element.
 
setPosition(position)
Sets the control position.
 
setScrollStyle(scrollStyle)
Sets the control scroll style.
 
setSize(width, height)
Sets the size of the control
 
setToolTipContent(toolTip, useBrowser)
Sets tooltip content for the control.
 
setVisibility(visible)
Sets the visibility of the control HTML element.
 
setVisible(visible)
Sets the the visible state of the control HTML element.
 
setZIndex(idx)
Sets the z-index for the control HTML element.
 
showAlert(alert)
Shows an alert in the control.
<static>  
DwtControl.showToolTip(content, x, y, obj, hoverEv)
A helper method to show the toolTips.
 
zShow(show)
Convenience function to toggle visibility using z-index.
Class Detail
DwtControl(params, parent, className, posStyle, deferred, id, parentElement, index, isFocusable, role)
Creates a control.
Author: Ross Dargahi.
Parameters:
{hash} params
a hash of parameters
{DwtComposite} parent
the parent widget, except in the case of DwtShell, the parent will be a control that is a subclass of DwtComposite
{string} className
the CSS class
{constant} posStyle
the positioning style (absolute, static, or relative). Defaults to DwtControl.STATIC_STYLE.
{boolean} deferred
if true, postpone initialization until needed
{string} id
an explicit ID to use for the control's HTML element. If not provided, defaults to an auto-generated ID.
{string|HTMLElement} parentElement
the parent element
{number} index
the index at which to add this control among parent's children
{boolean} isFocusable
if false, this control does not take browser focus (its element will not have a tabindex); defaults to true
{string} role
ARIA role for this control
Field Detail
<static> DwtControl.ABSOLUTE_STYLE
Defines the absolute position style.
See:
Dwt.ABSOLUTE_STYLE

<static> DwtControl.ACTIVE
Defines the "active" display state.

<static> DwtControl.CLIP
Defines clip on overflow.
See:
Dwt.CLIP

<static> DwtControl.DEFAULT
Defines the "default" display state.

<static> DwtControl.DISABLED
Defines the "disabled" display state.

<static> DwtControl.ERROR
Defines the "error" display state.

<static> DwtControl.FIXED_SCROLL
Defines always have scrollbars whether content overflows or not.
See:
Dwt.FIXED_SCROLL

<static> DwtControl.FIXED_STYLE
Defines the fixed position style.
See:
Dwt.FIXED_STYLE

<static> DwtControl.FOCUSED
Defines the "focused" display state.

<static> DwtControl.HOVER
Defines the "hover" display state.

<static> DwtControl.NORMAL
Defines the "normal" display state.

<static> DwtControl.RELATIVE_STYLE
Defines the relative position style.
See:
Dwt.RELATIVE_STYLE

<static> DwtControl.SCROLL
Defines automatically create scrollbars if content overflows.
See:
Dwt.SCROLL

<static> DwtControl.SELECTED
Defines the "selected" display state.

<static> DwtControl.STATIC_STYLE
Defines the static position style.
See:
Dwt.STATIC_STYLE

<static> DwtControl.VISIBLE
Defines allow overflow to be visible.
See:
Dwt.VISIBLE
Method Detail
addClassName(className)
Adds a class name to this control HTML element.
Parameters:
{string} className
the class name to add

addControlListener(listener)
Adds a control event listener for control events. Control events are essentially resize and coordinate change events.
Parameters:
{AjxListener} listener
the listener to be registered (may not be null)
See:
DwtControlEvent
#removeControlListener
#removeAllListeners

addDisposeListener(listener)
Registers a dispose listener for control events. Dispose events are fired when a control is "destroyed" via the #dispose call.
Parameters:
{AjxListener} listener
the listener to be registered (may not be null)
See:
DwtDisposeEvent
#removeDisposeListener
#removeAllListeners
#dispose
#isDisposed

addListener(eventType, listener, index)
Adds a listener to the control. The listener will be call when events of type eventType fire.
Parameters:
{string} eventType
the event type for which to listen (may not be null)
{AjxListener} listener
the listener to register (may not be null)
{number} index
the index at which to add listener
See:
DwtEvent
#removeListener
#removeAllListeners
#notifyListeners

appendElement(elemOrId)
Appends this control element to the specified element.
Parameters:
{Element|string} elemOrId
the DOM element or an element id

{DwtControl|Element} blur()
Takes browser and keyboard focus away from this control.
Returns:
{DwtControl|Element} control or element that actually got blurred

clearContent()
Clears the content of the control HTML element. Care should be taken when using this method as it can blow away all the content of the control which can be particularly bad if the control is a DwtComposite with children. Generally this method should be used controls which are being directly instantiated and used as a canvas.

clearHandler(eventType)
Clears the event handling function for a given event type. This method should be used judiciously as it can lead to unexpected results (for example if overriding the control's mouse handlers)
Parameters:
{string} eventType
the event type (defined in {@see DwtEvent}) to override
See:
DwtEvent

condClassName(condition, classWhenTrue, classWhenFalse)
Conditionally adds or removes a class name to this control HTML element. The class names are used exclusively, that is: when condition is true, classWhenTrue is added and classWhenFalse is removed (if present and specified). When condition is false, classWhenTrue is removed and classWhenFalse is added (again, if present and specified).
Parameters:
{string} condition
the condition
{string} classWhenTrue
the class name to add when condition is true
{string} classWhenFalse
the class name to add when contition is false (may be null)

delClassName(delClass, addClass)
Removes a class name from this control's HTML element. Optionally adds a new class name, if specified.
Parameters:
{string} delClass
the class to remove
{string} addClass
the class to add (may be null)

dispose()
Disposes of the control. This method will remove the control from under the control of its parent and release any resources associate with the component it will also notify any event listeners on registered DwtEvent.DISPOSE event type.

Subclasses may override this method to perform their own dispose functionality but should generally call up to the parent method.

See:
#isDisposed
#addDisposeListener
#removeDisposeListener

<static> {DwtControl} DwtControl.findControl(htmlEl)
Finds a control and starts the search at the given element and works up the element chain until it finds one with an ID that maps to a DwtControl.
Parameters:
{Element} htmlEl
an HTML element
Returns:
{DwtControl} the control or null for none

{DwtControl|Element} focus()
Sets browser and keyboard focus to this control.
Returns:
{DwtControl|Element} control or element that actually got focused

<static> {DwtControl} DwtControl.fromElement(htmlEl)
Returns the control associated with the given element, if any.
Parameters:
{Element} htmlEl
an HTML element
Returns:
{DwtControl} the control element or null for none

<static> {DwtControl} DwtControl.fromElementId(htmlElId)
Returns the control associated with the given element ID, if any.
Parameters:
{string} htmlElId
an HTML element Id
Returns:
{DwtControl} the control element or null for none

{DwtRectangle} getBounds()
Gets the bounds of the component. Bounds includes the location (not relevant for statically position elements) and dimensions of the control (i.e. the <div> element).
Returns:
{DwtRectangle} the control bounds
See:
DwtRectangle
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{string} getClassName()
Gets the class name of this control. The class name may be set when constructing the control. If it is not passed into the constructor, it defaults to the control's class name. The class name is generally used as the CSS class name for the control, although control's that change visual behaviour based on state may append (or even use different) class names. See the documentation of the specific component for details.
Returns:
{string} the control class name
See:
#setClassName

{string} getContent()
Returns the content of the control HTML element.
Returns:
{string} HTML content

{string} getCursor()
Gets the control cursor.
Returns:
{string} the control cursor
See:
#setCursor

{Object} getData(key)
Gets the data associated with the specified key.
Parameters:
{string} key
the key
Returns:
{Object} the associated data
See:
#setData

{DwtDragBox} getDragBox()
Gets the control drag box.
Returns:
{DwtDragBox} the control drag box or null for none
See:
#setDragBox

{DwtDragSource} getDragSource()
Gets the control drag source.
Returns:
{DwtDragSource} the control drag source or null for none
See:
#setDragSource

{DwtDropTarget} getDropTarget()
Gets the control drop target.
Returns:
{DwtDropTarget} the control drop target or null for none
See:
#setDropTarget

{boolean} getEnabled()
Gets the enabled state.
Returns:
{boolean} true if the control is enabled; false otherwise
See:
#setEnabled

{HTMLElement} getFocusElement()
Returns the element that should get browser focus when this control is focused.
Returns:
{HTMLElement}

{number} getH()
Gets the height of the control.
Returns:
{number} the height of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getW
#getX
#getXW
#getY
#getYH
#setBounds
#setLocation
#setSize

{HTMLElement} getHtmlElement()
Gets the control containing HTML element. By default this is a div element
Returns:
{HTMLElement} the control containing HTML element

{string} getHTMLElId()
Gets the ID of the control containing HTML element.
Returns:
{string} the ID of the control containing HTML element

{DwtRectangle} getInsetBounds()
Gets the inset bounds of the component. Similar to the bounds, but excluding borders and paddings.
Returns:
{DwtRectangle} the control inset bounds
See:
DwtRectangle
#getBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{DwtRectangle} getInsets()
Gets the insets of the component, i.e. the width of borders and paddings.
Returns:
{DwtRectangle} the control insets
See:
DwtRectangle
#getBounds
#getInsetBounds
#getMargins
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{DwtPoint} getLocation()
Gets the location of the control.
Returns:
{DwtPoint} the location of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#setLocation
#getH
#getW
#getX
#getXW
#getY
#setBounds
#setSize
Dwt

{DwtRectangle} getMargins()
Gets the margins of the component.
Returns:
{DwtRectangle} the control margins
See:
DwtRectangle
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{Number} getOpacity()
Gets the opacity of the control HTML element.
Returns:
{Number} opacity, as a percentage between 0 and 100
See:
Dwt#getOpacity

{DwtPoint} getOuterSize()
Gets the outer size -- that is, the size including margins, padding, and borders -- of an HTML element.
Returns:
{DwtPoint} the elements size, margins, padding, and borders included

getPosition()
Returns the positioning style

{HTMLElement} getScrollContainer()
Returns the element that this control scrolls within.
Returns:
{HTMLElement}

{number} getScrollStyle()
Gets the control scroll style. The scroll style determines the control behavior when content overflows its div's boundaries. Possible values are:
Returns:
{number} the control scroll style

{DwtPoint} getSize(getFromStyle)
Gets the size of the control. The x value of the returned point is the width and the y is the height.
Parameters:
getFromStyle
Returns:
{DwtPoint} the control size
See:
#getBounds
#getInsetBounds
#getInsets
#getLocation
#getH
#getW
#getX
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{DwtControl} getTabGroupMember()
Gets the tab group member for this control. Tab group members can be a native HTML form element, a DwtControl, or a DwtTabGroup (for more complex or explicit tab-ordering.
Returns:
{DwtControl} by default, returns this object

<static> {DwtControl} DwtControl.getTargetControl(ev, useRelatedTarget)
Returns the control associated with the given event. Starts with the event target and works its way up the element chain until it finds one with an ID that maps to a DwtControl.
Parameters:
{Event} ev
the DHTML event
{boolean} useRelatedTarget
if true, use element that was related to this event
Returns:
{DwtControl} the control or null for none

getTooltipBase(hoverEv)
Returns the element that should be used as a base for positioning the tooltip. If overridden to return null, the cursor position will be used as the base.
Parameters:
{DwtHoverEvent} hoverEv
hover event (from hover mgr)

{string} getToolTipContent(ev)
Gets the tooltip content (typically set using #setToolTipContent). Controls that want to return dynamic tooltip content should override this method.
Parameters:
{DwtEvent} ev
the mouseover event
Returns:
{string} the tooltip content set for the control

{boolean} getVisibility()
Gets the visibility of the control HTML element.
Returns:
{boolean} if true, the control is visible (i.e. the HTML elements visibility play style attribute is not "hidden")
See:
Dwt#getVisibility

{boolean} getVisible()
Gets the visible state of the control. For example, the control HTML elements display style attribute is not "none".
Returns:
{boolean} if true, the control is visible
See:
Dwt#getVisibile

{number} getW()
Gets the width of the control.
Returns:
{number} the width of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getX
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{number} getX()
Gets the X coordinate of the control (if absolutely positioned).
Returns:
{number} the X coordinate of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getXW
#getY
#getYH
#setBounds
#setSize
#setLocation

{number} getXW()
Gets the horizontal extent of the control (if absolutely positioned).
Returns:
{number} the horizontal extent of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getY
#getYH
#setBounds
#setSize
#setLocation

{number} getY()
Gets the Y coordinate of the control (if it is absolutely positioned).
Returns:
{number} the Y coordinate of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getYH
#setBounds
#setSize
#setLocation

{number} getYH()
Gets the vertical extent of the control (if it is absolutely positioned).
Returns:
{number} the vertical extent of the control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#setBounds
#setSize
#setLocation

{number} getZIndex(getFromStyle)
Gets the control z-index value.
Parameters:
{boolean} getFromStyle
get the value from the style attribute of the control element, or a parent
Returns:
{number} the z-index value

{boolean} hasFocus()
Checks if this control has focus.
Returns:
{boolean} true if this control has keyboard focus; false otherwise

<static> DwtControl.hideToolTip()
A helper method to hide the toolTip.

{boolean} isAlertShown()
Checks if the control is showing an alert.
Returns:
{boolean} true if showing an altert; false otherwise

{boolean} isDisposed()
Checks if the control is disposed.
Returns:
{boolean} true if the control is in a disposed state; false otherwise
See:
#dispose
#addDisposeListener
#removeDisposeListener

{boolean} isInitialized()
Checks if the control is initialized. In general, a control will not be initialized if it has been created in deferred mode and has not yet been initialized.
Returns:
{boolean} true if the control is in a initialized; false otherwise

{boolean} isListenerRegistered(eventType)
Checks if there are any listeners registered for a particular event type.
Parameters:
{string} eventType
the event type (may not be null)
Returns:
{boolean} true if there is an listener registered for the specified event type
See:
DwtEvent

notifyListeners(eventType, event)
Notifies all listeners of type eventType with event.
Parameters:
{string} eventType
the event type (may not be null)
{DwtEvent} event
the event

preventContextMenu(targetEl)
Prevents a context menu on the specified element.
Parameters:
{Element} targetEl
the element

preventSelection(targetEl)
Prevents selection on the specified element.
Parameters:
{Element} targetEl
the element

{boolean} removeAllListeners(eventType)
Removes all listeners for a particular event type.
Parameters:
{string} eventType
the event type (may not be null)
Returns:
{boolean} true if all listeners are removed
See:
DwtEvent
#addListener
#removeListener

removeControlListener(listener)
Removes a control event listener for control events. Control events are essentially resize and coordinate change events.
Parameters:
{AjxListener} listener
the listener to remove
See:
DwtControlEvent
#addControlListener
#removeAllListeners

removeDisposeListener(listener)
Removes a dispose event listener for control events. Dispose events are fired when a control is "destroyed" via the #dispose method call.
Parameters:
{AjxListener} listener
the listener to remove
See:
DwtDisposeEvent
#addDisposeListener
#removeAllListeners
#dispose
#isDisposed

removeListener(eventType, listener)
Removes a listener from the control.
Parameters:
{string} eventType
the event type for which to listen (may not be null)
{AjxListener} listener
the listener to remove (may not be null)
See:
DwtEvent
#addListener
#removeAllListeners

reparent(newParent, index)
Re-parents the control within the component hierarchy. Unlike reparentHtmlElement which re-parents the controls div within the DOM hierarchy, this method re-parents the whole control.
Parameters:
{DwtComposite} newParent
the control's new parent
{number} index
the index
See:
#reparentHtmlElement

reparentHtmlElement(htmlEl, position)
Re-parents the HTML element of the control to the html element supplied as the parameter to this method. Note this method only re-parents the control's div element and does not affect the component hierarchy. To re-parent the control within the component hierarchy, use the reparent method.
Parameters:
{string|HTMLElement} htmlEl
a string representing an element ID or an HTML element
{number} position
the position to insert the element
See:
#reparent

replaceElement(elemOrId, inheritClass, inheritStyle)
Replaces the specified element with this control element.
Parameters:
{Element|string} elemOrId
the DOM element or an element id
inheritClass
inheritStyle

{DwtControl} setBounds(x, y, width, height)
Sets the bounds of a control. The position type of the control must be absolute or else an exception is thrown. To omit setting a value set the actual parameter value to Dwt.DEFAULT
Parameters:
{number|string} x
the x coordinate of the element (for example: 10, "10px", Dwt.DEFAULT)
{number|string} y
the y coordinate of the element (for example: 10, "10px", Dwt.DEFAULT)
{number|string} width
the width of the element (for example: 100, "100px", "75%", Dwt.DEFAULT)
{number|string} height
the height of the element (for example: 100, "100px", "75%", Dwt.DEFAULT)
Returns:
{DwtControl} this control
See:
DwtRectangle
#getBounds
#getInsetBounds
#getInsets
#setSize
#setLocation
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#getYH

setClassName(className)
Sets the control class name. This also automatically sets the control CSS class name (i.e. the control htmlElement class name). Subclasses of DwtControl may override this method to perform a different behavior.
Parameters:
{string} className
the new class name for the control
See:
#getClassName

setContent(content)
Sets the content of the control HTML element to the provided content. Care should be taken when using this method as it can blow away all the content of the control which can be particularly bad if the control is a DwtComposite with children. Generally this method should be used controls which are being directly instantiated and used as a canvas
Parameters:
{string} content
the HTML content

setCursor(cursorName)
Sets the control cursor.
Parameters:
{string} cursorName
the name of the new cursor
See:
#getCursor

setData(key, value)
Sets the data for a given key. This method is useful for associating client data with a control.
Parameters:
{string} key
the key
{Object} value
the data
See:
#getData

setDisplay(value)
Sets the display.
Parameters:
{string} value
the display value

setDisplayState(state)
Sets the display state.
Parameters:
{Object} state
the state

setDragBox(dragBox)
Set the control drag box. The drag box handles the display of a dotted rectangle that is typically used to select items.
Parameters:
{DwtDragBox} dragBox
the control drag box
See:
#getDragBox

setDragSource(dragSource)
Set the control drag source. The drag source binds the drag-and-drop system with an application. Setting a control drag source makes the control "draggable".
Parameters:
{DwtDragSource} dragSource
the control drag source
See:
#getDragSource

setDropTarget(dropTarget)
Sets the drop target for the control. The drop target binds the drag-and-drop system with an application. Setting a control drop target makes the control a potential drop target within an application.
Parameters:
{DwtDropTarget} dropTarget
the control drop target
See:
#getDropTarget

setEnabled(enabled, setHtmlElement)
Sets the control enabled state. If setHtmlElement is true, then this method will also set the control HTML element disabled attribute.
Parameters:
{boolean} enabled
true if the control is enabled
{boolean} setHtmlElement
true to set the control HTML element disabled attribute

setEventPropagation(propagate, events)
Set the default behavior for whether an event will propagate (bubble up).
Parameters:
{boolean} propagate
if true, event will propagate
{array} events
one or more events

setFocusElement(el)
Sets the "focus element" if this control is focusable. Adds focus/blur event handlers and a tabIndex to the focus element. If no element is provided, defaults to the control's input element or its container (DIV).
Parameters:
{HTMLElement} el
(optional) new focus element

setHandler(eventType, hdlrFunc)
Sets the event handling function for a given event type. This method should be used judiciously as it can lead to unexpected results (for example if overriding the control's mouse handlers). This method calls through to Dwt.setHandler
Parameters:
{string} eventType
the event type (defined in {@see DwtEvent}) to override
{function} hdlrFunc
Event handler function
See:
DwtEvent

setHtmlElementId(id)
Sets the control HTML element id attribute.
Parameters:
{string} id
the new element Id

{DwtControl} setLocation(x, y)
Sets the location of the control. The position style of the control must be absolute or else an exception is thrown. To only set one of the coordinates, pass in a value of Dwt.DEFAULT for the coordinate for which the value is not to be set. Any DwtEvent.CONTROL listeners registered on the control will be called.
Parameters:
{number|string} x
the x coordinate of the element (for example: 10, "10px", Dwt.DEFAULT)
{number|string} y
the y coordinate of the element (for example: 10, "10px", Dwt.DEFAULT)
Returns:
{DwtControl} this control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#getLocation
#getH
#getW
#getX
#getXW
#getY
#setBounds
#setSize
Dwt

setOpacity(opacity)
Sets the opacity of the control HTML element.
Parameters:
{Number} opacity
opacity, as a percentage between 0 and 100
See:
Dwt#setOpacity

setPosition(position)
Sets the control position. The position determines the control's location within the context of which it was created. Possible values are:
Parameters:
{number} position
the control new position

setScrollStyle(scrollStyle)
Sets the control scroll style. The scroll style determines the control's behavior when content overflows its div's boundaries. Possible values are:
Parameters:
{int} scrollStyle
the control new scroll style

{DwtControl} setSize(width, height)
Sets the size of the control
Parameters:
{number|string} width
the width of the control (for example: 100, "100px", "75%", Dwt.DEFAULT)
{number|string} height
the height of the control (for example: 100, "100px", "75%", Dwt.DEFAULT)
Returns:
{DwtControl} this control
See:
#getBounds
#getInsetBounds
#getInsets
#getSize
#setLocation
#getH
#getW
#getX
#getXW
#getY
#getYH
#setBounds

setToolTipContent(toolTip, useBrowser)
Sets tooltip content for the control. The toolTip passed in may be plain text, HTML or an object containing a callback function. If DwtControl.useBrowserTooltips is set to true, and the tooltip does not have HTML, returns, or tabs, use a browser tooltip by setting the 'title' attribute on the element.
Parameters:
{string/object} toolTip
the tooltip content
useBrowser

setVisibility(visible)
Sets the visibility of the control HTML element.
Parameters:
{boolean} visible
if true then the control is visible
See:
Dwt#setVisibility

setVisible(visible)
Sets the the visible state of the control HTML element. Note: Gets style "display: none", don't confuse with setVisibility).
Parameters:
{boolean} visible
if true, the control should be displayed; if false, the control should not be displayed
See:
Dwt#setVisible

setZIndex(idx)
Sets the z-index for the control HTML element. Since z-index is only relevant among peer elements, we make sure that all elements that are being displayed via z-index hang off the main shell.
Parameters:
{number} idx
the new z-index for this element

showAlert(alert)
Shows an alert in the control. For example, to indicate that a new message has arrived.
Parameters:
{string} alert
the alert

<static> DwtControl.showToolTip(content, x, y, obj, hoverEv)
A helper method to show the toolTips.
Parameters:
content
x
[Number] The x coordinate of the toolTip.
y
[Number] The y coordinate of the toolTip.
obj
hoverEv

zShow(show)
Convenience function to toggle visibility using z-index. It uses the two lowest level z-indexes (Dwt.Z_VIEW and Dwt.Z_HIDDEN respectively). Any further stacking will have to use #setZIndex directly.
Parameters:
{boolean} show
if true, show the element; false to hide the element
See:
#setZIndex

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:28 GMT-0400 (EDT)