Class DwtControl
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
Defined in: DwtControl.js.
Class Detail
DwtControl(params, parent, className, posStyle, deferred, id, parentElement, index, isFocusable, role)
Creates a control.
Author: Ross Dargahi.
Field Detail
<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 Detail
addClassName(className)
Adds a class name to this control HTML element.
addControlListener(listener)
Adds a control event listener for control events. Control events are essentially
resize and coordinate change events.
addDisposeListener(listener)
Registers a dispose listener for control events. Dispose events are fired when
a control is "destroyed" via the #dispose call.
addListener(eventType, listener, index)
Adds a listener to the control. The listener will be call when events
of type
eventType fire.
appendElement(elemOrId)
Appends this control element to the specified element.
{DwtControl|Element}
blur()
Takes browser and keyboard focus away from this control.
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)
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).
delClassName(delClass, addClass)
Removes a class name from this control's HTML element. Optionally adds a new class name, if specified.
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. <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.
{DwtControl|Element}
focus()
Sets browser and keyboard focus to this control.
<static>
{DwtControl}
DwtControl.fromElement(htmlEl)
Returns the control associated with the given element, if any.
<static>
{DwtControl}
DwtControl.fromElementId(htmlElId)
Returns the control associated with the given element ID, if any.
{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).
{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.
{string}
getContent()
Returns the content of the control HTML element.
{string}
getCursor()
Gets the control cursor.
{Object}
getData(key)
Gets the data associated with the specified key.
{DwtDragBox}
getDragBox()
Gets the control drag box.
{DwtDragSource}
getDragSource()
Gets the control drag source.
{DwtDropTarget}
getDropTarget()
Gets the control drop target.
{boolean}
getEnabled()
Gets the enabled state.
{HTMLElement}
getFocusElement()
Returns the element that should get browser focus when this control is focused.
{number}
getH()
Gets the height of the control.
{HTMLElement}
getHtmlElement()
Gets the control containing HTML element. By default this is a
div element
{string}
getHTMLElId()
Gets 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.
{DwtRectangle}
getInsets()
Gets the insets of the component, i.e. the width of borders and paddings.
{DwtPoint}
getLocation()
Gets the location of the control.
{DwtRectangle}
getMargins()
Gets the margins of the component.
{Number}
getOpacity()
Gets the opacity of the control HTML element.
{DwtPoint}
getOuterSize()
Gets the outer size -- that is, the size including margins, padding, and borders -- of an
HTML element.
getPosition()
Returns the positioning style
{HTMLElement}
getScrollContainer()
Returns the element that this control scrolls within.
{number}
getScrollStyle()
Gets the control scroll style. The scroll style determines the control
behavior when content overflows its div's boundaries. Possible values are:
{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.
{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.
<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.
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.
{string}
getToolTipContent(ev)
Gets the tooltip content (typically set using #setToolTipContent). Controls
that want to return dynamic tooltip content should override this method.
{boolean}
getVisibility()
Gets the visibility of the control HTML element.
{boolean}
getVisible()
Gets the visible state of the control. For example, the control HTML elements display style attribute is not "none".
{number}
getW()
Gets the width of the control.
{number}
getX()
Gets the X coordinate of the control (if absolutely positioned).
{number}
getXW()
Gets the horizontal extent of the control (if absolutely positioned).
{number}
getY()
Gets the Y coordinate of the control (if it is absolutely positioned).
{number}
getYH()
Gets the vertical extent of the control (if it is absolutely positioned).
{number}
getZIndex(getFromStyle)
Gets the control z-index value.
{boolean}
hasFocus()
Checks if this control has focus.
<static>
DwtControl.hideToolTip()
A helper method to hide the toolTip.
{boolean}
isAlertShown()
Checks if the control is showing an alert.
{boolean}
isDisposed()
Checks if the control is disposed.
{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.
{boolean}
isListenerRegistered(eventType)
Checks if there are any listeners registered for a particular event type.
notifyListeners(eventType, event)
Notifies all listeners of type
eventType with event .
preventContextMenu(targetEl)
Prevents a context menu on the specified element.
preventSelection(targetEl)
Prevents selection on the specified element.
{boolean}
removeAllListeners(eventType)
Removes all listeners for a particular event type.
removeControlListener(listener)
Removes a control event listener for control events. Control events are essentially
resize and coordinate change events.
removeDisposeListener(listener)
Removes a dispose event listener for control events. Dispose events are fired when
a control is "destroyed" via the #dispose method call.
removeListener(eventType, listener)
Removes a listener from the control.
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.
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.
replaceElement(elemOrId, inheritClass, inheritStyle)
Replaces the specified element with this control element.
{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
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.
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
setCursor(cursorName)
Sets the control cursor.
setData(key, value)
Sets the data for a given key. This method is useful for associating client data with a control.
setDisplay(value)
Sets the display.
setDisplayState(state)
Sets the display 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.
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".
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.
setEnabled(enabled, setHtmlElement)
Sets the control enabled state. If
setHtmlElement is true, then
this method will also set the control HTML element disabled attribute.
setEventPropagation(propagate, events)
Set the default behavior for whether an event will propagate (bubble up).
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).
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
setHtmlElementId(id)
Sets the control HTML element id attribute.
{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.
setOpacity(opacity)
Sets the opacity of the control HTML element.
setPosition(position)
Sets the control position. The position determines the control's
location within the context of which it was created. Possible values are:
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:
{DwtControl}
setSize(width, height)
Sets the size of the control
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.
setVisibility(visible)
Sets the visibility of the control HTML element.
setVisible(visible)
Sets the the visible state of the control HTML element. Note: Gets style
"display: none", don't confuse with setVisibility).
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.
showAlert(alert)
Shows an alert in the control. For example, to indicate that a new message has arrived.
<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. 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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:28 GMT-0400 (EDT)
|