Package org.apache.pivot.wtk
Class Label
- java.lang.Object
-
- org.apache.pivot.wtk.Component
-
- 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
Nested Classes Modifier and Type Class Description static interfaceLabel.TextBindMappingTranslates 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears any bound values in the component.ListenerList<LabelBindingListener>getLabelBindingListeners()ListenerList<LabelListener>getLabelListeners()intgetMaximumLength()java.lang.StringgetText()Label.TextBindMappinggetTextBindMapping()BindTypegetTextBindType()java.lang.StringgetTextKey()Returns the label's text key.voidload(java.lang.Object context)Copies bound values from the bind context to the component.voidsetMaximumLength(int maximumLength)Sets the maximum length of the label text.voidsetText(java.lang.String text)Set the text of the Label.voidsetTextBindMapping(Label.TextBindMapping textBindMapping)voidsetTextBindType(BindType textBindType)voidsetTextKey(java.lang.String textKey)Sets the label's text key.voidsetTextOrEmpty(java.lang.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).voidstore(java.lang.Object context)Copies bound values from the component to the bind context.java.lang.StringtoString()-
Methods inherited from class org.apache.pivot.wtk.Component
checkSkin, clearFocus, contains, copyStyle, copyStyle, 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, getScreenBounds, getSize, getSkin, getStyle, getStyle, getStyleBoolean, getStyleBoolean, getStyleColor, getStyleColor, getStyleFont, getStyleFont, getStyleInt, getStyleInt, getStyles, getTextInputMethodListener, 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, offsetToScreen, paint, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, 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
-
-
-
-
Method Detail
-
getText
public java.lang.String getText()
- Returns:
- The label's text.
-
setText
public void setText(java.lang.String text)
Set the text of the Label.- Parameters:
text- The text to set, must be notnull.- Throws:
java.lang.IllegalArgumentException- if the text isnullor if the text length exceeds the allowed maximum.
-
setTextOrEmpty
public void setTextOrEmpty(java.lang.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 (ifnullwill set an empty string"").- See Also:
setText(java.lang.String)
-
getTextKey
public java.lang.String getTextKey()
Returns the label's text key.- Returns:
- The text key, or
nullif no text key is set.
-
getMaximumLength
public int getMaximumLength()
- 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.- Throws:
java.lang.IllegalArgumentException- if the length given is negative.
-
setTextKey
public void setTextKey(java.lang.String textKey)
Sets the label's text key.- Parameters:
textKey- The text key, ornullto 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(java.lang.Object context)
Description copied from class:ComponentCopies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.
-
store
public void store(java.lang.Object context)
Description copied from class:ComponentCopies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.
-
clear
public void clear()
Description copied from class:ComponentClears any bound values in the component. This functionality must be provided by the subclass; the base implementation is a no-op.
-
getLabelListeners
public ListenerList<LabelListener> getLabelListeners()
-
getLabelBindingListeners
public ListenerList<LabelBindingListener> getLabelBindingListeners()
-
-