Package org.zkoss.zul

Class SimpleNumberInputConstraint<T extends java.lang.Number & java.lang.Comparable<T>>

    • Constructor Detail

      • SimpleNumberInputConstraint

        public SimpleNumberInputConstraint()
        Constructs a constraint.
      • SimpleNumberInputConstraint

        public SimpleNumberInputConstraint​(java.lang.String constraint)
        Constructs a constraint with a list of constraints separated by comma.
        Parameters:
        constraint - a list of constraints separated by comma. Example: no positive, no zero
    • Method Detail

      • getMin

        public T getMin()
        Returns the minimum value.
      • setMin

        public void setMin​(T min)
        Sets the minimum value.
      • getMax

        public T getMax()
        Returns the maximum value.
      • setMax

        public void setMax​(T max)
        Sets the maximum value.
      • parseValue

        protected abstract T parseValue​(java.lang.String value)
        Parse the string value to the specified number type T. This method should be implemented by subclasses to convert a string representation of a number to the appropriate numeric type for this constraint.
        Parameters:
        value - the string representation of a number
        Returns:
        the parsed number of type T
      • parseConstraint

        protected int parseConstraint​(java.lang.String constraint)
                               throws org.zkoss.zk.ui.UiException
        Description copied from class: SimpleConstraint
        Parses a constraint into an integer value. For example, "no positive" is parsed to SimpleConstraint.NO_POSITIVE.

        Deriving classes might override this to provide more constraints.

        Overrides:
        parseConstraint in class SimpleConstraint
        Throws:
        org.zkoss.zk.ui.UiException
      • validate

        public void validate​(org.zkoss.zk.ui.Component comp,
                             java.lang.Object value)
                      throws org.zkoss.zk.ui.WrongValueException
        Description copied from interface: Constraint
        Verifies whether the value is acceptable.
        Specified by:
        validate in interface Constraint
        Overrides:
        validate in class SimpleConstraint
        Parameters:
        comp - the component being validated
        Throws:
        org.zkoss.zk.ui.WrongValueException
      • outOfRangeValue

        protected org.zkoss.zk.ui.WrongValueException outOfRangeValue​(org.zkoss.zk.ui.Component comp)