java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.validation.validator.AbstractValidator<String>
com.inductiveautomation.ignition.gateway.web.util.CharValidator
All Implemented Interfaces:
Serializable, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, org.apache.wicket.util.io.IClusterable, org.apache.wicket.validation.INullAcceptingValidator<String>, org.apache.wicket.validation.IValidator<String>

public class CharValidator extends org.apache.wicket.validation.validator.AbstractValidator<String>
An IValidator that validates text fields in two modes: normal and strict.
Normal Mode
Ensures that the characters consist of only characters in AbstractPage.isValidChars().
Strict Mode
Ensures that the characters consist of only characters in AbstractPage.isStrictValidChars().
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
     
    protected boolean
     
    static final CharValidator
    The STRICT validator only allows numbers, letters and "_".
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    CharValidator(boolean strict)
     
    CharValidator(boolean strict, String allowed)
    Creates a new char filter with optional strictness, and a string of characters that are explicitly allowed
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Returns true if x is null or:
    Starts with a letter and consists of: Letters digits _ (underscore)
    static boolean
    Returns true if x is null or consists of: Letters digits .
    protected void
    onValidate(org.apache.wicket.validation.IValidatable<String> validatable)
     

    Methods inherited from class org.apache.wicket.validation.validator.AbstractValidator

    error, error, error, error, resourceKey, validate, validateOnNullValue, variablesMap

    Methods inherited from class org.apache.wicket.behavior.Behavior

    afterRender, beforeRender, bind, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, onRemove, renderHead, unbind

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STRICT

      public static final CharValidator STRICT
      The STRICT validator only allows numbers, letters and "_".
    • strict

      protected boolean strict
    • allowed

      protected String allowed
  • Constructor Details

    • CharValidator

      public CharValidator()
    • CharValidator

      public CharValidator(boolean strict)
    • CharValidator

      public CharValidator(boolean strict, String allowed)
      Creates a new char filter with optional strictness, and a string of characters that are explicitly allowed
  • Method Details

    • isStrictValidChars

      public static boolean isStrictValidChars(String x)
      Returns true if x is null or:
      Starts with a letter and consists of:
      • Letters
      • digits
      • _ (underscore)
    • isValidChars

      public static boolean isValidChars(String x)
      Returns true if x is null or consists of:
      • Letters
      • digits
      • . (dot)
      • ! (bang)
      • _ (underscore)
      • (space)
    • onValidate

      protected void onValidate(org.apache.wicket.validation.IValidatable<String> validatable)
      Specified by:
      onValidate in class org.apache.wicket.validation.validator.AbstractValidator<String>