org.apache.pivot.wtk
Class Label

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.Label
All Implemented Interfaces:
ConstrainedVisual, Visual
Direct Known Subclasses:
SpinnerItemRenderer, TableViewCellRenderer

public class Label
extends Component

Component that displays a string of text.


Nested Class Summary
static interface Label.TextBindMapping
          Translates between text and context data during data binding.
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Constructor Summary
Label()
           
Label(String text)
           
 
Method Summary
 void clear()
          Clears any bound values in the component.
 ListenerList<LabelBindingListener> getLabelBindingListeners()
           
 ListenerList<LabelListener> getLabelListeners()
           
 int getMaximumLength()
          Returns the maximum length of the label text.
 String getText()
          Returns the label's text.
 Label.TextBindMapping getTextBindMapping()
           
 BindType getTextBindType()
           
 String getTextKey()
          Returns the label's text key.
 void load(Object context)
          Copies bound values from the bind context to the component.
 void setMaximumLength(int maximumLength)
          Sets the maximum length of the label text.
 void setText(String text)
          Set the text of the Label.
 void setTextBindMapping(Label.TextBindMapping textBindMapping)
           
 void setTextBindType(BindType textBindType)
           
 void setTextKey(String textKey)
          Sets the label's text key.
 void setTextOrEmpty(String text)
          Utility method to set text to the given value, or to an empty string if null (to avoid the setText throw an IllegalArgumentException).
 void store(Object context)
          Copies bound values from the component to the bind context.
 String toString()
           
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, contains, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, layout, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setParent, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setVisible, setWidth, setWidthLimits, setWidthLimits, setX, setY, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Label

public Label()

Label

public Label(String text)
Method Detail

getText

public String getText()
Returns the label's text.

Returns:
The text.

setText

public void setText(String text)
Set the text of the Label.

Parameters:
text - The text to set, must be not null.

setTextOrEmpty

public void setTextOrEmpty(String text)
Utility method to set text to the given value, or to an empty string if null (to avoid the setText throw an IllegalArgumentException). This is useful to be called by code.

Parameters:
text - The text to set
See Also:
setText(java.lang.String)

getTextKey

public String getTextKey()
Returns the label's text key.

Returns:
The text key, or null if no text key is set.

getMaximumLength

public int getMaximumLength()
Returns the maximum length of the label text.

Returns:
The maximum length of the label text.

setMaximumLength

public void setMaximumLength(int maximumLength)
Sets the maximum length of the label text.

Parameters:
maximumLength - The maximum length of the label text.

setTextKey

public void setTextKey(String textKey)
Sets the label's text key.

Parameters:
textKey - The text key, or null to clear the binding.

getTextBindType

public BindType getTextBindType()

setTextBindType

public void setTextBindType(BindType textBindType)

getTextBindMapping

public Label.TextBindMapping getTextBindMapping()

setTextBindMapping

public void setTextBindMapping(Label.TextBindMapping textBindMapping)

load

public void load(Object context)
Description copied from class: Component
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
load in class Component

store

public void store(Object context)
Description copied from class: Component
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
store in class Component

clear

public void clear()
Description copied from class: Component
Clears any bound values in the component.

Overrides:
clear in class Component

getLabelListeners

public ListenerList<LabelListener> getLabelListeners()

getLabelBindingListeners

public ListenerList<LabelBindingListener> getLabelBindingListeners()

toString

public String toString()
Overrides:
toString in class Component