org.omnifaces.component.validator
Class ValidateOrder

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by org.omnifaces.component.validator.ValidatorFamily
              extended by org.omnifaces.component.validator.ValidateMultipleFields
                  extended by org.omnifaces.component.validator.ValidateOrder
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder

public class ValidateOrder
extends ValidateMultipleFields

ValidateOrder validates if the values of the given UIInput components as specified in the components attribute are in the order as specified by the type attribute which accepts the following values:

The default message is

{0}: Please fill out the values of all those fields in order

For general usage instructions, refer ValidateMultipleFields documentation.

This validator has the additional requirement that the to-be-validated values must implement Comparable. This validator throws an IllegalArgumentException when one or more of the values do not implement it. Note that when this validator is placed before all of the components, then it will only compare the raw unconverted submitted string values, not the converted object values. If you need to compare by the converted object values, then you need to place this validator after all of the components.

Author:
Bauke Scholtz

Field Summary
static java.lang.String COMPONENT_TYPE
          The standard component type.
 
Fields inherited from class org.omnifaces.component.validator.ValidatorFamily
COMPONENT_FAMILY
 
Fields inherited from class javax.faces.component.UIComponent
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
 
Constructor Summary
ValidateOrder()
          The default constructor sets the default message.
 
Method Summary
 java.lang.String getType()
          Returns the ordering type to be used.
 void setType(java.lang.String type)
          Sets the ordering type to be used.
protected  boolean validateValues(javax.faces.context.FacesContext context, java.util.List<javax.faces.component.UIInput> components, java.util.List<java.lang.Object> values)
          Validate if all values are in specified order.
 
Methods inherited from class org.omnifaces.component.validator.ValidateMultipleFields
collectComponents, collectValues, getComponents, getMessage, getShowMessageFor, isDisabled, isValidationFailed, setComponents, setDisabled, setMessage, setShowMessageFor, showMessage, validateComponents, validateHierarchy
 
Methods inherited from class org.omnifaces.component.validator.ValidatorFamily
encodeChildren, getFamily, getRendersChildren, processDecodes, processUpdates, processValidators
 
Methods inherited from class javax.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent, visitTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
The standard component type.

See Also:
Constant Field Values
Constructor Detail

ValidateOrder

public ValidateOrder()
The default constructor sets the default message.

Method Detail

validateValues

protected boolean validateValues(javax.faces.context.FacesContext context,
                                 java.util.List<javax.faces.component.UIInput> components,
                                 java.util.List<java.lang.Object> values)
Validate if all values are in specified order.

Specified by:
validateValues in class ValidateMultipleFields
Parameters:
context - The faces context to work with.
components - The input components whose values are to be validated.
values - The values of the input components to be validated.
Returns:
true if validation is successful, otherwise false (and thus show the message).

getType

public java.lang.String getType()
Returns the ordering type to be used.

Returns:
The ordering type to be used.

setType

public void setType(java.lang.String type)
Sets the ordering type to be used.

Parameters:
type - The ordering type to be used.