Package org.zkoss.zul

Examples of org.zkoss.zul.Constraint


   * <p>Default: use  {@link #getConstraint}'s {@link Constraint#validate},
   * if not null.
   * <p>You rarely need to override this method.
   */
  protected void validate(Object value) throws WrongValueException {
    final Constraint constr = getConstraint();
    if (constr != null) { //then _auxinf must be non-null
      //Bug 1698190: contructor might be zscript
      Scopes.beforeInterpret(this);
      try {
        constr.validate(this, value);
        if (!_auxinf.checkOnly && (constr instanceof CustomConstraint)) {
          try {
            ((CustomConstraint)constr).showCustomError(this, null);
            //not call thru showCustomError(Wrong...) for better performance
          } catch (Throwable ex) {
View Full Code Here


    if ((v = getMaxlength()) > 0) renderer.render("maxlength", v);
    if (_cols > 0) renderer.render("cols", _cols);
    if ((v = getTabindex()) != 0) renderer.render("tabindex", v);

    boolean constrDone = false;
    final Constraint constr = _auxinf != null ? _auxinf.constr: null;
    if (constr instanceof CustomConstraint) { //client ignored if custom
      renderer.render("constraint", "[c"); //implies validated at server
      constrDone = true;
    } else if (constr instanceof ClientConstraint) {
      final ClientConstraint cc = (ClientConstraint)constr;
View Full Code Here

    }

    public abstract void recalculateHoursGroup();

    public Constraint validateTotalHours() {
        return new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                if(value == null) {
                    orderElementTotalHours.setValue(0);
View Full Code Here

            }
        };
    }

    public Constraint validatePercentage() {
        return new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                HoursGroupWrapper hoursGroupWrapper = (HoursGroupWrapper) ((Row) comp
                        .getParent()).getValue();
View Full Code Here

    /**
     * Operations to filter the machines by multiple filters
     */

    public Constraint checkConstraintFinishDate() {
        return new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                Date finishDate = (Date) value;
                if ((finishDate != null)
View Full Code Here

            }
        };
    }

    public Constraint checkConstraintStartDate() {
        return new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                Date startDate = (Date) value;
                if ((startDate != null)
View Full Code Here

    public List<OrderElement> getOrderElements() {
        return workReportModel.getOrderElements();
    }

    public Constraint checkConstraintFinishDateLine() {
        return new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                Date finishDateLine = (Date) value;
                if ((finishDateLine != null)
View Full Code Here

            }
        };
    }

    public Constraint checkConstraintStartDateLine() {
        return new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                Date startDateLine = (Date) value;
                if ((startDateLine != null)
View Full Code Here

    public AdvanceType getAdvanceType() {
        return advanceTypeModel.getAdvanceType();
    }

    public Constraint lessThanDefaultMaxValue() {
        Constraint newConstraint = new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                if (((BigDecimal) value) == null) {
                    throw new WrongValueException(comp,
View Full Code Here

        };
        return newConstraint;
    }

    public Constraint greaterThanPrecision() {
        Constraint newConstraint = new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                if (((BigDecimal) value) == null) {
                    throw new WrongValueException(comp,
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Constraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.