com.sun.webui.jsf.component
Class DropDown

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.DropDown
All Implemented Interfaces:
com.sun.webui.jsf.component.ComplexComponent, com.sun.webui.jsf.component.ListManager, com.sun.webui.jsf.component.SelectorManager, javax.faces.component.ActionSource, javax.faces.component.ActionSource2, javax.faces.component.EditableValueHolder, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, javax.faces.component.ValueHolder

public class DropDown
extends ListSelector
implements javax.faces.component.ActionSource2

The DropDown component is used to display a drop down menu to allow users to select one or more items from a list.


Field Summary
static java.lang.String SUBMIT
           
 
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
DropDown()
          Default constructor.
 
Method Summary
 void addActionListener(javax.faces.event.ActionListener listener)
          Add a new ActionListener to the set of listeners interested in being notified when ActionEvents occur.
 void broadcast(javax.faces.event.FacesEvent event)
          In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent) processing, pass the ActionEvent being broadcast to the method referenced by actionListener (if any), and to the default ActionListener registered on the Application.
 javax.faces.el.MethodBinding getAction()
          Deprecated.  
 javax.el.MethodExpression getActionExpression()
          Used to specify the action to take when this component is activated by the user.
 javax.faces.el.MethodBinding getActionListener()
          Deprecated.  
 javax.el.MethodExpression getActionListenerExpression()
          The actionListenerExpression attribute is used to specify a method to handle an action event that is triggered when this component is activated by the user.
 javax.faces.event.ActionListener[] getActionListeners()
          Return the set of registered ActionListeners for this ActionSource2 instance.
 java.lang.String getFamily()
          Return the family for this component.
 java.lang.String getHtmlTemplate()
          Get alternative HTML template to be used by this component.
 boolean getMultiple()
          Getter for property multiple
 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, Integer.MIN_VALUE is returned if no value has been set, or there is no value binding.
 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 isForgetValue()
          If this flag is set to true, then the component is always rendered with no initial selection.
 boolean isLabelOnTop()
           If true, the label is rendered above the component.
 boolean isNavigateToValue()
          When this attribute is set to true, the value of the menu selection is used as the action, to determine which page is displayed next according to the registered navigation rules.
 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.
 boolean isSubmitForm()
          When the submitForm attribute is set to true, the form is immediately submitted when the user changes the selection in the drop down list.
 void processDecodes(javax.faces.context.FacesContext context)
          The DropDown needs to override the standard decoding behaviour since it may also be an action source.
 void queueEvent(javax.faces.event.FacesEvent e)
          Intercept queueEvent and, for ActionEvents, mark the phaseId for the event to be PhaseId.APPLY_REQUEST_VALUES if the immediate flag is true, PhaseId.INVOKE_APPLICATION otherwise.
 void removeActionListener(javax.faces.event.ActionListener listener)
          Remove an existing ActionListener (if any) from the set of listeners interested in being notified when ActionEvents occur.
 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 setAction(javax.faces.el.MethodBinding action)
          Deprecated.  
 void setActionExpression(javax.el.MethodExpression me)
          The actionExpression attribute is used to specify the action to take when this component is activated by the user.
 void setActionListener(javax.faces.el.MethodBinding actionListener)
          Deprecated.  
 void setActionListenerExpression(javax.el.MethodExpression me)
          The actionListenerExpression attribute is used to specify a method to handle an action event that is triggered when this component is activated by the user.
 void setForgetValue(boolean forgetValue)
          If this flag is set to true, then the component is always rendered with no initial selection.
 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 setMultiple(boolean multiple)
          Setter for property multiple
 void setNavigateToValue(boolean navigateToValue)
          When this attribute is set to true, the value of the menu selection is used as the action, to determine which page is displayed next according to the registered navigation rules.
 void setRows(int DisplayRows)
          Setter for property Rows.
 void setSubmitForm(boolean submitForm)
          When this attribute is set to true, the form is immediately submitted when the user changes the selection in the drop down list.
 void setToolTip(java.lang.String toolTip)
          Sets the value of the title attribute for the HTML element.
 void validate(javax.faces.context.FacesContext context)
           
 
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, 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, isMultiple, 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
getValidator, getValidatorExpression, getValueChangeListener, getValueChangeListenerExpression, 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
 
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, 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.ActionSource
isImmediate, setImmediate
 
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, isMultiple
 

Field Detail

SUBMIT

public static final java.lang.String SUBMIT
See Also:
Constant Field Values
Constructor Detail

DropDown

public DropDown()
Default constructor.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.

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.


getMultiple

public boolean getMultiple()
Getter for property multiple

Returns:
Value of property multiple

setMultiple

public void setMultiple(boolean multiple)
Setter for property multiple

Overrides:
setMultiple in class Selector
Parameters:
multiple - New value of property multiple

addActionListener

public void addActionListener(javax.faces.event.ActionListener listener)

Add a new ActionListener to the set of listeners interested in being notified when ActionEvents occur.

Specified by:
addActionListener in interface javax.faces.component.ActionSource
Parameters:
listener - The ActionListener to be added
Throws:
java.lang.NullPointerException - if listener is null

getActionListeners

public javax.faces.event.ActionListener[] getActionListeners()

Return the set of registered ActionListeners for this ActionSource2 instance. If there are no registered listeners, a zero-length array is returned.

Specified by:
getActionListeners in interface javax.faces.component.ActionSource

removeActionListener

public void removeActionListener(javax.faces.event.ActionListener listener)

Remove an existing ActionListener (if any) from the set of listeners interested in being notified when ActionEvents occur.

Specified by:
removeActionListener in interface javax.faces.component.ActionSource
Parameters:
listener - The ActionListener to be removed
Throws:
java.lang.NullPointerException - if listener is null

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)

The DropDown needs to override the standard decoding behaviour since it may also be an action source. We decode the component w.r.t. the value first, and validate it if the component is immediate. Then we fire an action event.

Overrides:
processDecodes in class WebuiInput
Parameters:
context - FacesContext for this request.
Throws:
java.lang.NullPointerException

broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException

In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent) processing, pass the ActionEvent being broadcast to the method referenced by actionListener (if any), and to the default ActionListener registered on the Application.

Overrides:
broadcast in class WebuiInput
Parameters:
event - FacesEvent to be broadcast
Throws:
javax.faces.event.AbortProcessingException - Signal the JavaServer Faces implementation that no further processing on the current event should be performed @exception IllegalArgumentException if the implementation class of this FacesEvent is not supported by this component
java.lang.NullPointerException - if event is null

queueEvent

public void queueEvent(javax.faces.event.FacesEvent e)

Intercept queueEvent and, for ActionEvents, mark the phaseId for the event to be PhaseId.APPLY_REQUEST_VALUES if the immediate flag is true, PhaseId.INVOKE_APPLICATION otherwise.

Overrides:
queueEvent in class javax.faces.component.UIComponentBase

validate

public void validate(javax.faces.context.FacesContext context)
Overrides:
validate in class javax.faces.component.UIInput

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Description copied from class: ListSelector

Save the state of this component.

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

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Description copied from class: ListSelector

Restore the state of this component.

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

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

getRows

public int getRows()
Description copied from class: ListSelector
The number of items to display, Integer.MIN_VALUE is returned if no value has been set, or there is no value binding. Subclasses should provide a reasonable default.

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

setRows

public void setRows(int DisplayRows)
Setter for property Rows.

Overrides:
setRows in class ListSelector
Parameters:
DisplayRows - New value of property DisplayRows.
See Also:
ListSelector.getRows()

getValue

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

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 dropDown.width defined in the messages theme category. If this theme property is not defined, the width is determined by the longest option element in 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.

getActionExpression

public javax.el.MethodExpression getActionExpression()

Used to specify the action to take when this component is activated by the user. The value of the actionExpression attribute must be one of the following:

When you use the actionExpression attribute in the DropDown component, you must set the submitForm attribute to true.

Specified by:
getActionExpression in interface javax.faces.component.ActionSource2

setActionExpression

public void setActionExpression(javax.el.MethodExpression me)

The actionExpression attribute is used to specify the action to take when this component is activated by the user. The value of the actionExpression attribute must be one of the following:

When you use the actionExpression attribute in the DropDown component, you must also set the submitForm attribute to true.

Specified by:
setActionExpression in interface javax.faces.component.ActionSource2

getAction

public javax.faces.el.MethodBinding getAction()
Deprecated. 

Specified by:
getAction in interface javax.faces.component.ActionSource

setAction

public void setAction(javax.faces.el.MethodBinding action)
Deprecated. 

Specified by:
setAction in interface javax.faces.component.ActionSource

getActionListener

public javax.faces.el.MethodBinding getActionListener()
Deprecated. 

Specified by:
getActionListener in interface javax.faces.component.ActionSource

setActionListener

public void setActionListener(javax.faces.el.MethodBinding actionListener)
Deprecated. 

Specified by:
setActionListener in interface javax.faces.component.ActionSource

getActionListenerExpression

public javax.el.MethodExpression getActionListenerExpression()

The actionListenerExpression attribute is used to specify a method to handle an action event that is triggered when this component is activated by the user. The actionListenerExpression attribute value must be a JavaServer Faces EL expression that resolves to a method in a backing bean. The method must take a single parameter that is an ActionEvent, and its return type must be void. The class that defines the method must implement the java.io.Serializable interface or javax.faces.component.StateHolder interface.

The actionListenerExpression method is only invoked when the submitForm attribute is true.


setActionListenerExpression

public void setActionListenerExpression(javax.el.MethodExpression me)

The actionListenerExpression attribute is used to specify a method to handle an action event that is triggered when this component is activated by the user. The actionListenerExpression attribute value must be a JavaServer Faces EL expression that resolves to a method in a backing bean. The method must take a single parameter that is an ActionEvent, and its return type must be void. The class that defines the method must implement the java.io.Serializable interface or javax.faces.component.StateHolder interface.

The actionListenerExpression method is only invoked when the submitForm attribute is true.


isForgetValue

public boolean isForgetValue()

If this flag is set to true, then the component is always rendered with no initial selection. By default, the component displays the selection that was made in the last submit of the page. This value should be set to true when the drop down is used for navigation.


setForgetValue

public void setForgetValue(boolean forgetValue)

If this flag is set to true, then the component is always rendered with no initial selection. By default, the component displays the selection that was made in the last submit of the page. This value should be set to true when the drop down is used for navigation.

See Also:
isForgetValue()

isNavigateToValue

public boolean isNavigateToValue()

When this attribute is set to true, the value of the menu selection is used as the action, to determine which page is displayed next according to the registered navigation rules. Use this attribute instead of the action attribute when the drop down is used for navigation. When you set navigateToValue to true, you must also set submitForm to true.


setNavigateToValue

public void setNavigateToValue(boolean navigateToValue)

When this attribute is set to true, the value of the menu selection is used as the action, to determine which page is displayed next according to the registered navigation rules. Use this attribute instead of the action attribute when the drop down is used for navigation. When you set navigateToValue to true, you must also set submitForm to true.

See Also:
isNavigateToValue()

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

isSubmitForm

public boolean isSubmitForm()

When the submitForm attribute is set to true, the form is immediately submitted when the user changes the selection in the drop down list.


setSubmitForm

public void setSubmitForm(boolean submitForm)

When this attribute is set to true, the form is immediately submitted when the user changes the selection in the drop down list.

See Also:
isSubmitForm()

getToolTip

public java.lang.String getToolTip()

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()

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 dropDown.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()


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