- All Implemented Interfaces:
PartialStateHolder,StateHolder,TransientStateHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener,MultiFieldValidator
The <o: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:
lt(default): from least to greatest, without duplicates.lte: from least to greatest, allowing duplicates (equal values next to each other).gt: from greatest to least, without duplicates.gte: from greatest to least, allowing duplicates (equal values next to each other).
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.
The default message is
{0}: Please fill out the values of all those fields in order
For general usage instructions, refer ValidateMultipleFields documentation.
- Author:
- Bauke Scholtz
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe component type, which is "org.omnifaces.component.validator.ValidateOrder".Fields inherited from class org.omnifaces.component.validator.ValidatorFamily
COMPONENT_FAMILYFields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetType()Returns the ordering type to be used.voidSets the ordering type to be used.booleanvalidateValues(FacesContext context, List<UIInput> components, List<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, isInvalidateAll, isValidationFailed, setComponents, setDisabled, setInvalidateAll, setMessage, setShowMessageFor, shouldInvalidateInput, showMessage, validateComponents, validateHierarchyMethods inherited from class org.omnifaces.component.validator.ValidatorFamily
encodeChildren, getFamily, getRendersChildren, processDecodes, processUpdates, processValidatorsMethods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeAll, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getPassThroughAttributes, getRenderer, getRendererType, invokeOnComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, visitTreeMethods inherited from class jakarta.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent
-
Field Details
-
COMPONENT_TYPE
The component type, which is "org.omnifaces.component.validator.ValidateOrder".- See Also:
-
-
Constructor Details
-
ValidateOrder
public ValidateOrder()
-
-
Method Details
-
validateValues
Validate if all values are in specified order.- 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, in the same order as the components.- Returns:
trueif validation is successful, otherwisefalse(and thus show the message).
-
getType
Returns the ordering type to be used.- Returns:
- The ordering type to be used.
-
setType
Sets the ordering type to be used.- Parameters:
type- The ordering type to be used.
-