com.sun.webui.jsf.component
Class Listbox

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by com.sun.webui.jsf.component.WebuiInput
                      extended by com.sun.webui.jsf.component.Selector
                          extended by com.sun.webui.jsf.component.ListSelector
                              extended by com.sun.webui.jsf.component.Listbox
All Implemented Interfaces:
com.sun.webui.jsf.component.ComplexComponent, com.sun.webui.jsf.component.ListManager, com.sun.webui.jsf.component.SelectorManager, javax.faces.component.EditableValueHolder, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, javax.faces.component.ValueHolder

public class Listbox
extends ListSelector

The Listbox component allows users to select one or more items from a list.


Field Summary
 
Fields inherited from class com.sun.webui.jsf.component.ListSelector
LABEL_FACET, LIST_ID, VALUE_ID, VALUE_LABEL_ID
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
Listbox()
          Default constructor.
 
Method Summary
 java.lang.String getFamily()
          Return the identifier of the component family to which this component belongs.
 java.lang.String getHtmlTemplate()
          Get alternative HTML template to be used by this component.
 java.lang.String getOnSelect()
          Scripting code executed when some text in this component value is selected.
 java.lang.String getRendererType()
           
 int getRows()
          The number of items to display.
 java.lang.String getToolTip()
          Sets the value of the title attribute for the HTML element.
 java.lang.Object getValue()
           
 java.lang.String getWidth()
          Return a value suitable for the CSS width property to be applied to an HTML select element or null.
 boolean isLabelOnTop()
           If true, the label is rendered above the component.
 boolean isMonospace()
           When set to true, this attribute causes the list items to be rendered in a monospace font.
 boolean isMultiple()
           Flag indicating that the application user can make select more than one option at a time from the listbox.
 boolean isReadOnly()
          If this attribute is set to true, the value of the component is rendered as text, preceded by the label if one was defined.
 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 setHtmlTemplate(java.lang.String htmlTemplate)
          Set alternative HTML template to be used by this component.
 void setLabelOnTop(boolean labelOnTop)
           If true, the label is rendered above the component.
 void setMonospace(boolean monospace)
          When set to true, this attribute causes the list items to be rendered in a monospace font.
 void setMultiple(boolean multiple)
           Flag indicating that the application user can make select more than one option at a time from the listbox.
 void setToolTip(java.lang.String toolTip)
          Sets the value of the title attribute for the HTML element.
 
Methods inherited from class com.sun.webui.jsf.component.ListSelector
checkSelectionModel, getFocusElementId, getIndicatorComponent, getLabelComponent, getLabeledElementId, getListItems, getListItems, getPrimaryElementID, getReadOnlyValueComponent, getSeparatorLength, getValueAsReadOnly, getValueAsStringArray, isSeparators, isVisible, mainListSubmits, setRows, setSeparators, setVisible, setWidth
 
Methods inherited from class com.sun.webui.jsf.component.Selector
getConvertedValue, getItems, getLabel, getLabelLevel, getOnBlur, getOnChange, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getRendersChildren, getSelected, getStyle, getStyleClass, getTabIndex, getValueExpression, isDisabled, setDisabled, setItems, setLabel, setLabelLevel, setOnBlur, setOnChange, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setReadOnly, setSelected, setStyle, setStyleClass, setTabIndex, setValueExpression, toString
 
Methods inherited from class com.sun.webui.jsf.component.WebuiInput
broadcast, getValidator, getValidatorExpression, getValueChangeListener, getValueChangeListenerExpression, processDecodes, processUpdates, processValidators, setConverter, setId, setImmediate, setRendered, setRequired, setValidatorExpression, setValueChangeListenerExpression
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, decode, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidatorMessage, getValidators, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setLocalValueSet, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue
 
Methods inherited from class javax.faces.component.UIComponentBase
encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.faces.component.EditableValueHolder
addValidator, addValueChangeListener, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, setValueChangeListener
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter, setValue
 
Methods inherited from interface com.sun.webui.jsf.component.SelectorManager
getClientId, getOnChange, getStyle, getStyleClass, getTabIndex, isDisabled
 

Constructor Detail

Listbox

public Listbox()
Default constructor.

Method Detail

getFamily

public java.lang.String getFamily()

Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate renderer for this component instance.

Overrides:
getFamily in class ListSelector

getRendererType

public java.lang.String getRendererType()
Overrides:
getRendererType in class javax.faces.component.UIComponentBase

getHtmlTemplate

public java.lang.String getHtmlTemplate()
Get alternative HTML template to be used by this component.


setHtmlTemplate

public void setHtmlTemplate(java.lang.String htmlTemplate)
Set alternative HTML template to be used by this component.


getOnSelect

public java.lang.String getOnSelect()
Description copied from class: Selector

Scripting code executed when some text in this component value is selected.

Overrides:
getOnSelect in class Selector

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface javax.faces.component.ValueHolder
Overrides:
getValue in class javax.faces.component.UIOutput

isMonospace

public boolean isMonospace()

When set to true, this attribute causes the list items to be rendered in a monospace font.

If this property is not set by the application, a themed default value will be sought, using the key listbox.monospace from the messages.properties file. If there is no value for the key, false is returned.


setMonospace

public void setMonospace(boolean monospace)

When set to true, this attribute causes the list items to be rendered in a monospace font.

See Also:
isMonospace()

isMultiple

public boolean isMultiple()

Flag indicating that the application user can make select more than one option at a time from the listbox.

If this property is not set by the application, a themed default value will be sought, using the key listbox.multiple from the messages.properties file. If there is no value for the key, false is returned.

Specified by:
isMultiple in interface com.sun.webui.jsf.component.SelectorManager
Overrides:
isMultiple in class Selector
Returns:
Value of property multiple.

setMultiple

public void setMultiple(boolean multiple)

Flag indicating that the application user can make select more than one option at a time from the listbox.

Overrides:
setMultiple in class Selector
Parameters:
multiple - New value of property multiple.
See Also:
isMultiple()

isLabelOnTop

public boolean isLabelOnTop()

If true, the label is rendered above the component. If false, the label is rendered next to the component.

If this property is not set by the application, a themed default value will be sought, using the key listbox.labelOnTop from the messages.properties file. If there is no value for the key, false is returned.

Overrides:
isLabelOnTop in class ListSelector

setLabelOnTop

public void setLabelOnTop(boolean labelOnTop)

If true, the label is rendered above the component. If false, the label is rendered next to the component.

Overrides:
setLabelOnTop in class ListSelector
See Also:
isLabelOnTop()

getRows

public int getRows()
The number of items to display. If this property is not set by the application, a themed default value will be sought, using the key listbox.size from the messages.properties file. If there is no value for the key, or the value is less than or equal to 0, 12 is returned. The String property value is coerced to int using Integer.parseInt(String). If this fails 12 is returned.

Specified by:
getRows in interface com.sun.webui.jsf.component.ListManager
Overrides:
getRows in class ListSelector
Returns:
The number of items to display.

isReadOnly

public boolean isReadOnly()

If this attribute is set to true, the value of the component is rendered as text, preceded by the label if one was defined.

Deprecated: The attribute is deprecated starting from version 4.1

Specified by:
isReadOnly in interface com.sun.webui.jsf.component.SelectorManager
Overrides:
isReadOnly in class Selector

getToolTip

public java.lang.String getToolTip()
Description copied from class: Selector

Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element.

Specified by:
getToolTip in interface com.sun.webui.jsf.component.ListManager
Overrides:
getToolTip in class Selector

setToolTip

public void setToolTip(java.lang.String toolTip)

Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element.

Overrides:
setToolTip in class Selector
See Also:
getToolTip()

getWidth

public java.lang.String getWidth()
Return a value suitable for the CSS width property to be applied to an HTML select element or null.

If no value has been set, a default value is determined from the theme property listbox.width defined in the messages theme category. If this theme property is not defined, the width is determined by the longest option element of the rendered select element.

Specified by:
getWidth in interface com.sun.webui.jsf.component.ListManager
Overrides:
getWidth in class ListSelector
Returns:
The value used to determine the width of a select HTML element.

restoreState

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

Restore the state of this component.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class ListSelector

saveState

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

Save the state of this component.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class ListSelector


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.