com.sun.rave.web.ui.component
Class LabelBase

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended byjavax.faces.component.UIOutput
              extended bycom.sun.rave.web.ui.component.LabelBase
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.component.ValueHolder
Direct Known Subclasses:
Label

public abstract class LabelBase
extends javax.faces.component.UIOutput

Use the ui:label tag to display a label for a component. To specify which component the label belongs to you can do one of the following:

If the tags are adjacent on the page, it is simpler to place the component in the body of the ui:label tag.

Note that many components in this library have label and labelLevel attributes (and sometimes labelOnTop) which can be used instead of ui:label. The main reason to use ui:label is to specify the appearance of the label beyond what these attributes permit.

HTML Elements and Layout

The ui:label tag results in a HTML <label> or <span> element. A <span> element is rendered if no labeled component is found.

If the tag has a body, the body must consist of tags for JavaServer Faces components only. The components become children of the Label component, and are rendered after the <label> element.

If the tag has a body but no for attribute, a <label> element is rendered. Its for attribute is set to the element ID of the first child component that is an EditableValueHolder.

Theme Identifiers

The Label renderer relies on the following theme classes:

 LblLev1Txt
 LblLev2Txt 
 LblLev3Txt 
 LblRqdDiv
 

Client Side Javascript Functions

None.

Example

Example 1: ui:label with for attribute

 
       <ui:label id="label1" text="Label 1:" for="field1" labelLevel="2"/>
       <ui:field id="field1" text="#{Bean.value}" type="text" trim="true"/>
 

Example 2: ui:label with labeled component in tag body

 
       <ui:label id="label2" text="Label 2:" labelLevel="2"/>
           <ui:field id="field2" text="#{Bean.value}" type="text" 
                     trim="true"/>
       </ui:label> 
 

Example 3: Using the label attribute instead of ui:label

 
       <ui:field id="field3" text="#{Bean.value}" type="text" 
                 trim="true" label="Label 3:" labelLevel="2"/>
 

Auto-generated component class. Do NOT modify; all changes will be lost!


Field Summary
 
Fields inherited from class javax.faces.component.UIOutput
COMPONENT_FAMILY, COMPONENT_TYPE
 
Constructor Summary
LabelBase()
          Construct a new LabelBase.
 
Method Summary
 java.lang.String getFamily()
          Return the family for this component.
 java.lang.String getFor()
          Use this attribute to specify the labeled component.
 int getLabelLevel()
          Style level for this label, where lower values typically specify progressively larger font sizes, and/or bolder font weights.
 java.lang.String getOnClick()
          Scripting code executed when a mouse click occurs over this component.
 java.lang.String getOnMouseDown()
          Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
 java.lang.String getOnMouseMove()
          Scripting code executed when the user moves the mouse pointer while over the component.
 java.lang.String getOnMouseOut()
          Scripting code executed when a mouse out movement occurs over this component.
 java.lang.String getOnMouseOver()
          Scripting code executed when the user moves the mouse pointer into the boundary of this component.
 java.lang.String getOnMouseUp()
          Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
 java.lang.String getStyle()
          CSS style(s) to be applied when this component is rendered.
 java.lang.String getStyleClass()
          CSS style class(es) to be applied when this component is rendered.
 java.lang.Object getText()
          The label text to be displayed for this label.
 java.lang.String getToolTip()
          Display the text as a tooltip for this component
 javax.faces.el.ValueBinding getValueBinding(java.lang.String name)
          Return the ValueBinding stored for the specified name (if any), respecting any property aliases.
 boolean isHideIndicators()
          Use the hideIndicators attribute to prevent display of the required and invalid icons with the label.
 boolean isRequiredIndicator()
          Flag indicating that the labeled component should be marked as required.
 boolean isVisible()
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext _context)
          Save the state of this component.
 void setFor(java.lang.String _for)
          Use this attribute to specify the labeled component.
 void setHideIndicators(boolean hideIndicators)
          Use the hideIndicators attribute to prevent display of the required and invalid icons with the label.
 void setLabelLevel(int labelLevel)
          Style level for this label, where lower values typically specify progressively larger font sizes, and/or bolder font weights.
 void setOnClick(java.lang.String onClick)
          Scripting code executed when a mouse click occurs over this component.
 void setOnMouseDown(java.lang.String onMouseDown)
          Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
 void setOnMouseMove(java.lang.String onMouseMove)
          Scripting code executed when the user moves the mouse pointer while over the component.
 void setOnMouseOut(java.lang.String onMouseOut)
          Scripting code executed when a mouse out movement occurs over this component.
 void setOnMouseOver(java.lang.String onMouseOver)
          Scripting code executed when the user moves the mouse pointer into the boundary of this component.
 void setOnMouseUp(java.lang.String onMouseUp)
          Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
 void setRequiredIndicator(boolean requiredIndicator)
          Flag indicating that the labeled component should be marked as required.
 void setStyle(java.lang.String style)
          CSS style(s) to be applied when this component is rendered.
 void setStyleClass(java.lang.String styleClass)
          CSS style class(es) to be applied when this component is rendered.
 void setText(java.lang.Object text)
          The label text to be displayed for this label.
 void setToolTip(java.lang.String toolTip)
          Display the text as a tooltip for this component
 void setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)
          Set the ValueBinding stored for the specified name (if any), respecting any property aliases.
 void setVisible(boolean visible)
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, getValue, setConverter, setValue
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelBase

public LabelBase()

Construct a new LabelBase.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.


getValueBinding

public javax.faces.el.ValueBinding getValueBinding(java.lang.String name)

Return the ValueBinding stored for the specified name (if any), respecting any property aliases.

Parameters:
name - Name of value binding to retrieve

setValueBinding

public void setValueBinding(java.lang.String name,
                            javax.faces.el.ValueBinding binding)

Set the ValueBinding stored for the specified name (if any), respecting any property aliases.

Parameters:
name - Name of value binding to set
binding - ValueBinding to set, or null to remove

getFor

public java.lang.String getFor()

Use this attribute to specify the labeled component. The attribute is only relevant if the component to be labeled is not a child of the ui:label tag. The value of the attribute should be the id of the component relative to the label, not the DOM ID of the rendered HTML element.


setFor

public void setFor(java.lang.String _for)

Use this attribute to specify the labeled component. The attribute is only relevant if the component to be labeled is not a child of the ui:label tag. The value of the attribute should be the id of the component relative to the label, not the DOM ID of the rendered HTML element.

See Also:
getFor()

isHideIndicators

public boolean isHideIndicators()

Use the hideIndicators attribute to prevent display of the required and invalid icons with the label. When the required attribute on the component to be labeled is set to true, the required icon is displayed next to the label. If the user submits the page with an invalid value for the component, the invalid icon is displayed. This attribute is useful when the component has more than one label, and only one label should show the icons.


setHideIndicators

public void setHideIndicators(boolean hideIndicators)

Use the hideIndicators attribute to prevent display of the required and invalid icons with the label. When the required attribute on the component to be labeled is set to true, the required icon is displayed next to the label. If the user submits the page with an invalid value for the component, the invalid icon is displayed. This attribute is useful when the component has more than one label, and only one label should show the icons.

See Also:
isHideIndicators()

getLabelLevel

public int getLabelLevel()

Style level for this label, where lower values typically specify progressively larger font sizes, and/or bolder font weights. Valid values are 1, 2, and 3. The default label level is 2. Any label level outside this range will result in no label level being added.


setLabelLevel

public void setLabelLevel(int labelLevel)

Style level for this label, where lower values typically specify progressively larger font sizes, and/or bolder font weights. Valid values are 1, 2, and 3. The default label level is 2. Any label level outside this range will result in no label level being added.

See Also:
getLabelLevel()

getOnClick

public java.lang.String getOnClick()

Scripting code executed when a mouse click occurs over this component.


setOnClick

public void setOnClick(java.lang.String onClick)

Scripting code executed when a mouse click occurs over this component.

See Also:
getOnClick()

getOnMouseDown

public java.lang.String getOnMouseDown()

Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.


setOnMouseDown

public void setOnMouseDown(java.lang.String onMouseDown)

Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.

See Also:
getOnMouseDown()

getOnMouseMove

public java.lang.String getOnMouseMove()

Scripting code executed when the user moves the mouse pointer while over the component.


setOnMouseMove

public void setOnMouseMove(java.lang.String onMouseMove)

Scripting code executed when the user moves the mouse pointer while over the component.

See Also:
getOnMouseMove()

getOnMouseOut

public java.lang.String getOnMouseOut()

Scripting code executed when a mouse out movement occurs over this component.


setOnMouseOut

public void setOnMouseOut(java.lang.String onMouseOut)

Scripting code executed when a mouse out movement occurs over this component.

See Also:
getOnMouseOut()

getOnMouseOver

public java.lang.String getOnMouseOver()

Scripting code executed when the user moves the mouse pointer into the boundary of this component.


setOnMouseOver

public void setOnMouseOver(java.lang.String onMouseOver)

Scripting code executed when the user moves the mouse pointer into the boundary of this component.

See Also:
getOnMouseOver()

getOnMouseUp

public java.lang.String getOnMouseUp()

Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.


setOnMouseUp

public void setOnMouseUp(java.lang.String onMouseUp)

Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.

See Also:
getOnMouseUp()

isRequiredIndicator

public boolean isRequiredIndicator()

Flag indicating that the labeled component should be marked as required. It is only relevant if the labeled component is not a child of the label tag. Set this flag to ensure that the required icon shows up the first time the page is rendered.


setRequiredIndicator

public void setRequiredIndicator(boolean requiredIndicator)

Flag indicating that the labeled component should be marked as required. It is only relevant if the labeled component is not a child of the label tag. Set this flag to ensure that the required icon shows up the first time the page is rendered.

See Also:
isRequiredIndicator()

getStyle

public java.lang.String getStyle()

CSS style(s) to be applied when this component is rendered.


setStyle

public void setStyle(java.lang.String style)

CSS style(s) to be applied when this component is rendered.

See Also:
getStyle()

getStyleClass

public java.lang.String getStyleClass()

CSS style class(es) to be applied when this component is rendered.


setStyleClass

public void setStyleClass(java.lang.String styleClass)

CSS style class(es) to be applied when this component is rendered.

See Also:
getStyleClass()

getText

public java.lang.Object getText()

The label text to be displayed for this label. This attribute can be set to a literal string, to a value binding expression that corresponds to a property of a managed bean, or to a value binding expression that corresponds to a message from a resource bundle declared using f:loadBundle.


setText

public void setText(java.lang.Object text)

The label text to be displayed for this label. This attribute can be set to a literal string, to a value binding expression that corresponds to a property of a managed bean, or to a value binding expression that corresponds to a message from a resource bundle declared using f:loadBundle.

See Also:
getText()

getToolTip

public java.lang.String getToolTip()

Display the text as a tooltip for this component


setToolTip

public void setToolTip(java.lang.String toolTip)

Display the text as a tooltip for this component

See Also:
getToolTip()

isVisible

public boolean isVisible()

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.


setVisible

public void setVisible(boolean visible)

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.

See Also:
isVisible()

restoreState

public void restoreState(javax.faces.context.FacesContext _context,
                         java.lang.Object _state)

Restore the state of this component.


saveState

public java.lang.Object saveState(javax.faces.context.FacesContext _context)

Save the state of this component.