Class SelectOneFancyComponent
- All Implemented Interfaces:
EventListener, javax.faces.component.NamingContainer, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.TransientStateHolder, javax.faces.component.UniqueIdVendor, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder
-
Field Summary
Fields inherited from class javax.faces.component.UINamingContainer
COMPONENT_FAMILY, COMPONENT_TYPE, SEPARATOR_CHAR_PARAM_NAMEFields inherited from class javax.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEYFields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFinds thePromptFancySelectItemcorresponding to the currently selected value.voidSets the selected value from the givenPromptFancySelectItem.Methods inherited from class javax.faces.component.UINamingContainer
createUniqueId, getFamily, getSeparatorChar, visitTreeMethods inherited from class javax.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEventMethods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpressionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.faces.component.StateHolder
isTransient, restoreState, saveState, setTransient
-
Constructor Details
-
SelectOneFancyComponent
public SelectOneFancyComponent()
-
-
Method Details
-
getFancySelectItemValue
Finds thePromptFancySelectItemcorresponding to the currently selected value.Access the
cc.attrs.valueattribute of the closestSelectOneFancyComponentcomponent; which must be a string representing the selected value. Then accesses thecc.attrs.optionsattribute of the same component; which must be a list ofPromptFancySelectIteminstances representing the available options. Finally, finds the option whosevaluematches the selected value, and returns that option.This is a workaround for the
<p:selectOneMenu>component. We want to use a custom UI for each option, but PrimeFaces only makes the select item value available as an EL variable (which is a string). We need to access the entirePromptFancySelectItemthat contains the label and description to display.- Returns:
- The selected
PromptFancySelectItem, ornullif no option is selected.
-
setFancySelectItemValue
Sets the selected value from the givenPromptFancySelectItem.Accesses the given item's
valueand writes it to thecc.attrs.valueattribute of the closestSelectOneFancyComponentcomponent.This is a workaround for the
<p:selectOneMenu>component. We want to use a custom UI for each option, but PrimeFaces only makes the select item value available as an EL variable (which is a string). We need to access the entirePromptFancySelectItemthat contains the label and description to display.- Parameters:
item- The selectedPromptFancySelectItem, ornullto clear the selection.
-