Class TaskComponent

  • 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

    public class TaskComponent
    extends javax.faces.component.UINamingContainer
    • Field Summary

      • Fields inherited from class javax.faces.component.UINamingContainer

        COMPONENT_FAMILY, COMPONENT_TYPE, SEPARATOR_CHAR_PARAM_NAME
      • Fields 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_KEY
      • Fields inherited from interface javax.faces.component.NamingContainer

        SEPARATOR_CHAR
    • Constructor Summary

      Constructors 
      Constructor Description
      TaskComponent()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PromptFancySelectItem getFancySelectItemValue()
      Finds the PromptFancySelectItem corresponding to the currently selected task.
      void setFancySelectItemValue​(PromptFancySelectItem item)
      Sets the selected task from the given PromptFancySelectItem.
      • Methods inherited from class javax.faces.component.UINamingContainer

        createUniqueId, getFamily, getSeparatorChar, visitTree
      • Methods 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, unsubscribeFromEvent
      • Methods 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, setValueExpression
      • Methods inherited from interface javax.faces.component.StateHolder

        isTransient, restoreState, saveState, setTransient
    • Constructor Detail

      • TaskComponent

        public TaskComponent()
    • Method Detail

      • getFancySelectItemValue

        public PromptFancySelectItem getFancySelectItemValue()
        Finds the PromptFancySelectItem corresponding to the currently selected task.

        Access the cc.attrs.value attribute of the closest TaskComponent component; which must be a string representing the selected task. Then accesses the cc.attrs.options attribute of the same component; which must be a list of PromptFancySelectItem instances representing the available options. Finally, finds the option whose value matches 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 entire PromptFancySelectItem that contains the label and description to display.

        Returns:
        The selected PromptFancySelectItem, or null if no option is selected.
      • setFancySelectItemValue

        public void setFancySelectItemValue​(PromptFancySelectItem item)
        Sets the selected task from the given PromptFancySelectItem.

        Accesses the given item's value and writes it to the cc.attrs.value attribute of the closest TaskComponent component.

        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 entire PromptFancySelectItem that contains the label and description to display.

        Parameters:
        item - The selected PromptFancySelectItem, or null to clear the selection.