Zimlet JavaScript API Reference - DwtLabel

Class DwtLabel


Extends DwtComposite.

This class represents a label, which consists of an image and/or text. It is used both as a concrete class and as the base class for DwtButton. The label components are managed within a table. The label can be enabled or disabled, which are reflected in its display. A disabled label looks greyed out.

CSS

  • .className table - the label table
  • .className .Icon - class name for the icon image cell
  • .className .Text - enabled text cell
  • .className .DisabledText - disabled text cell

Keyboard Actions

None

Events

None

Defined in: DwtLabel.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
DwtLabel(params)
Creates a label.
Field Summary
Field Attributes Field Name and Description
<static>  
DwtLabel.ALIGN_CENTER
Defines the "center" align label.
<static>  
DwtLabel.ALIGN_LEFT
Defines the "left" align label.
<static>  
DwtLabel.ALIGN_RIGHT
Defines the "right" align label.
<static>  
DwtLabel.IMAGE_BOTH
Defines both "right" and "left" align images (i.e.
<static>  
DwtLabel.IMAGE_LEFT
Defines the "left" align image (i.e.
<static>  
DwtLabel.IMAGE_RIGHT
Defines the "right" align image (i.e.
<static>  
DwtLabel.LEFT
Defines the "left" side icon
<static>  
DwtLabel.RIGHT
Defines the "right" side icon
Method Summary
Method Attributes Method Name and Description
 
Disposes of the label.
 
getImage(direction)
Gets the current image info.
 
Gets the label text.
 
isStyle(style)
Checks if the given style is set as the current label style.
 
setAlign(alignStyle)
Sets the align style.
 
setDisabledImage(imageInfo)
Sets the disabled image.
 
setEnabled(enabled)
Sets the enabled/disabled state of the label.
 
setIconEl(htmlElement/DOM, direction)
Set _iconEl, used for buttons that contains only images
 
setImage(imageInfo, direction, altText)
Sets the main (enabled) image.
 
setText(text)
Sets the label text, and manages the placement and display.
 
Sets the text background.
 
Sets the text foreground.
 
Returns a string representation of the object.
Methods borrowed from class DwtComposite:
addChild, cleanupSeparators, clear, getChild, getChildren, getNumChildren, getTabGroupMember, removeChild, removeChildren
Methods borrowed from class DwtControl:
addClassName, addControlListener, addDisposeListener, addListener, appendElement, blur, clearContent, clearHandler, condClassName, delClassName, focus, getBounds, getClassName, getContent, getCursor, getData, getDragBox, getDragSource, getDropTarget, getEnabled, getFocusElement, getH, getHtmlElement, getHTMLElId, getInsetBounds, getInsets, getLocation, getMargins, getOpacity, getOuterSize, getPosition, getScrollContainer, getScrollStyle, getSize, getTooltipBase, getToolTipContent, getVisibility, getVisible, getW, getX, getXW, getY, getYH, getZIndex, hasFocus, isAlertShown, isDisposed, isInitialized, isListenerRegistered, notifyListeners, preventContextMenu, preventSelection, removeAllListeners, removeControlListener, removeDisposeListener, removeListener, reparent, reparentHtmlElement, replaceElement, setBounds, setClassName, setContent, setCursor, setData, setDisplay, setDisplayState, setDragBox, setDragSource, setDropTarget, setEventPropagation, setFocusElement, setHandler, setHtmlElementId, setLocation, setOpacity, setPosition, setScrollStyle, setSize, setToolTipContent, setVisibility, setVisible, setZIndex, showAlert, zShow
Class Detail
DwtLabel(params)
Creates a label.
Author: Ross Dargahi.
Parameters:
{hash} params
the hash of parameters
{DwtComposite} params.parent
the parent widget
{constant} params.style
the label style: May be one of: DwtLabel.IMAGE_LEFT or DwtLabel.IMAGE_RIGHT arithmetically or'd (|) with one of: DwtLabel.ALIGN_LEFT, DwtLabel.ALIGN_CENTER, or DwtLabel.ALIGN_LEFT The first determines were in the label the icon will appear (if one is set), the second determine how the content of the label will be aligned. The default value for this parameter is: DwtLabel.IMAGE_LEFT | DwtLabel.ALIGN_CENTER
{string} params.className
the CSS class
{constant} params.posStyle
the positioning style (see DwtControl)
{string} params.id
the to use for the control HTML element
{number} params.index
the index at which to add this control among parent's children
Field Detail
<static> DwtLabel.ALIGN_CENTER
Defines the "center" align label.

<static> DwtLabel.ALIGN_LEFT
Defines the "left" align label.

<static> DwtLabel.ALIGN_RIGHT
Defines the "right" align label.

<static> DwtLabel.IMAGE_BOTH
Defines both "right" and "left" align images (i.e. align to the left and to the right of text, if all present).

<static> DwtLabel.IMAGE_LEFT
Defines the "left" align image (i.e. align to the left of text, if both present).

<static> DwtLabel.IMAGE_RIGHT
Defines the "right" align image (i.e. align to the right of text, if both present).

<static> DwtLabel.LEFT
Defines the "left" side icon

<static> DwtLabel.RIGHT
Defines the "right" side icon
Method Detail
dispose()
Disposes of the label.

{string} getImage(direction)
Gets the current image info.
Parameters:
{string} direction
position of the image
Returns:
{string} the image info

{string} getText()
Gets the label text.
Returns:
{string} the text or null if not set

{boolean} isStyle(style)
Checks if the given style is set as the current label style.
Parameters:
{constant} style
the style
Returns:
{boolean} true if the style is set

setAlign(alignStyle)
Sets the align style.
Parameters:
{constant} alignStyle
the align style (see DwtControl)

setDisabledImage(imageInfo)
Sets the disabled image. If the label is currently disabled, its image is updated.
Parameters:
{string} imageInfo
the image
Deprecated:
no longer support different images for disabled
See:
#setImage

setEnabled(enabled)
Sets the enabled/disabled state of the label. A disabled label may have a different image, and greyed out text. This method overrides DwtControl#setEnabled.
Parameters:
{boolean} enabled
if true, set the label as enabled

setIconEl(htmlElement/DOM, direction)
Set _iconEl, used for buttons that contains only images
Parameters:
htmlElement/DOM
node
{string} direction
position of the image

setImage(imageInfo, direction, altText)
Sets the main (enabled) image. If the label is currently enabled, the image is updated.
Parameters:
{string} imageInfo
the image
{string} direction
position of the image
{string} altText
alternate text for non-visual users

setText(text)
Sets the label text, and manages the placement and display.
Parameters:
{string} text
the new label text

setTextBackground(color)
Sets the text background.
Parameters:
{string} color
the background color

setTextForeground(color)
Sets the text foreground.
Parameters:
{string} color
the foreground color

{string} toString()
Returns a string representation of the object.
Returns:
{string} a string representation of the object

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