org.zkoss.zul
Class SimpleDateConstraint

java.lang.Object
  extended by org.zkoss.zul.SimpleConstraint
      extended by org.zkoss.zul.SimpleDateConstraint
All Implemented Interfaces:
java.io.Serializable, ClientConstraint, Constraint

public class SimpleDateConstraint
extends SimpleConstraint

A simple date constraint.

Since:
3.0.2
Author:
tomyeh
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.zkoss.zul.SimpleConstraint
_flags, AFTER_END, AFTER_POINTER, AFTER_START, AT_POINTER, BEFORE_END, BEFORE_START, END_AFTER, END_BEFORE, NO_EMPTY, NO_FUTURE, NO_NEGATIVE, NO_PAST, NO_POSITIVE, NO_TODAY, NO_ZERO, OVERLAP, OVERLAP_AFTER, OVERLAP_BEFORE, OVERLAP_END, SERVER, START_AFTER, START_BEFORE, STRICT
 
Constructor Summary
SimpleDateConstraint(int flags)
           
SimpleDateConstraint(int flags, java.util.Date begin, java.util.Date end, java.lang.String errmsg)
          Constructs a constraint with beginning and ending date.
SimpleDateConstraint(int flags, java.lang.String errmsg)
          Constraints a constraint.
SimpleDateConstraint(int flags, java.lang.String regex, java.lang.String errmsg)
          Constructs a constraint combining regular expression.
SimpleDateConstraint(java.lang.String constraint)
          Constructs a constraint with a list of constraints separated by comma.
SimpleDateConstraint(java.lang.String regex, java.lang.String errmsg)
          Constructs a regular-expression constraint.
 
Method Summary
 java.util.Date getBeginDate()
          Returns the beginning date, or null if there is no constraint of the beginning date.
 java.util.Date getEndDate()
          Returns the ending date, or null if there is no constraint of the ending date.
protected  int parseConstraint(java.lang.String constraint)
          Parses a constraint into an integer value.
 void validate(Component comp, java.lang.Object value)
          Verifies whether the value is acceptable.
 
Methods inherited from class org.zkoss.zul.SimpleConstraint
getClientConstraint, getClientPackages, getErrorMessage, getFlags, getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDateConstraint

public SimpleDateConstraint(int flags)

SimpleDateConstraint

public SimpleDateConstraint(int flags,
                            java.lang.String errmsg)
Constraints a constraint.

Parameters:
flags - a combination of SimpleConstraint.NO_POSITIVE, SimpleConstraint.NO_NEGATIVE, SimpleConstraint.NO_ZERO, and so on.
errmsg - the error message to display. Ignored if null or empty.

SimpleDateConstraint

public SimpleDateConstraint(java.lang.String regex,
                            java.lang.String errmsg)
Constructs a regular-expression constraint.

Parameters:
regex - ignored if null or empty
errmsg - the error message to display. Ignored if null or empty.

SimpleDateConstraint

public SimpleDateConstraint(int flags,
                            java.lang.String regex,
                            java.lang.String errmsg)
Constructs a constraint combining regular expression.

Parameters:
flags - a combination of SimpleConstraint.NO_POSITIVE, SimpleConstraint.NO_NEGATIVE, SimpleConstraint.NO_ZERO, and so on.
regex - ignored if null or empty
errmsg - the error message to display. Ignored if null or empty.

SimpleDateConstraint

public SimpleDateConstraint(int flags,
                            java.util.Date begin,
                            java.util.Date end,
                            java.lang.String errmsg)
Constructs a constraint with beginning and ending date.

Parameters:
flags - a combination of SimpleConstraint.NO_POSITIVE, SimpleConstraint.NO_NEGATIVE, SimpleConstraint.NO_ZERO, and so on.
begin - the beginning date, or null if no constraint at the beginning date.
end - the ending date, or null if no constraint at the ending date.
errmsg - the error message to display. Ignored if null or empty.

SimpleDateConstraint

public SimpleDateConstraint(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: "between 20071012 and 20071223", "before 20080103"
Method Detail

getBeginDate

public java.util.Date getBeginDate()
Returns the beginning date, or null if there is no constraint of the beginning date.


getEndDate

public java.util.Date getEndDate()
Returns the ending date, or null if there is no constraint of the ending date.


parseConstraint

protected int parseConstraint(java.lang.String constraint)
                       throws 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:
UiException

validate

public void validate(Component comp,
                     java.lang.Object value)
              throws 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:
WrongValueException


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo