Package org.zkoss.zul
Class AbstractSimpleDateTimeConstraint<T extends Comparable<? super T>>
java.lang.Object
org.zkoss.zul.SimpleConstraint
org.zkoss.zul.AbstractSimpleDateTimeConstraint<T>
- All Implemented Interfaces:
Serializable,ClientConstraint,Constraint
- Direct Known Subclasses:
SimpleDateConstraint,SimpleLocalDateConstraint,SimpleLocalTimeConstraint
public abstract class AbstractSimpleDateTimeConstraint<T extends Comparable<? super T>>
extends SimpleConstraint
A skeleton of simple date/time constraint.
- Since:
- 9.0.0
- Author:
- rudyhuang
- See Also:
-
Field Summary
FieldsFields inherited from class org.zkoss.zul.SimpleConstraint
_finishParseCst, _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
ConstructorsConstructorDescriptionAbstractSimpleDateTimeConstraint(int flags) Constraints a constraint.AbstractSimpleDateTimeConstraint(int flags, String errmsg) Constraints a constraint.AbstractSimpleDateTimeConstraint(int flags, Pattern regex, String errmsg) Constructs a constraint combining regular expression.AbstractSimpleDateTimeConstraint(String constraint) Constructs a constraint with a list of constraints separated by comma.AbstractSimpleDateTimeConstraint(Pattern regex, String errmsg) Constructs a regular-expression constraint. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidReturns the beginning date, or null if there is no constraint of the beginning date.Returns the ending date, or null if there is no constraint of the ending date.protected intparseConstraint(String constraint) Parses a constraint into an integer value.protected abstract TvoidsetTimeZone(TimeZone tzone) Sets time zone that this date constraint belongs tovoidVerifies whether the value is acceptable.protected voidprotected abstract StringvalueToString(org.zkoss.zk.ui.Component comp, T value) Methods inherited from class org.zkoss.zul.SimpleConstraint
getClientConstraint, getClientPackages, getErrorMessage, getFlags, getInstance, getRawValue
-
Field Details
-
_beg
-
_end
-
_tzone
-
-
Constructor Details
-
AbstractSimpleDateTimeConstraint
public AbstractSimpleDateTimeConstraint(int flags) Constraints a constraint.- Parameters:
flags- a combination ofSimpleConstraint.NO_POSITIVE,SimpleConstraint.NO_NEGATIVE,SimpleConstraint.NO_ZERO, and so on.
-
AbstractSimpleDateTimeConstraint
Constraints a constraint.- Parameters:
flags- a combination ofSimpleConstraint.NO_POSITIVE,SimpleConstraint.NO_NEGATIVE,SimpleConstraint.NO_ZERO, and so on.errmsg- the error message to display. Ignored if null or empty.
-
AbstractSimpleDateTimeConstraint
Constructs a regular-expression constraint.- Parameters:
regex- ignored if null or emptyerrmsg- the error message to display. Ignored if null or empty.
-
AbstractSimpleDateTimeConstraint
Constructs a constraint combining regular expression.- Parameters:
flags- a combination ofSimpleConstraint.NO_POSITIVE,SimpleConstraint.NO_NEGATIVE,SimpleConstraint.NO_ZERO, and so on.regex- ignored if null or emptyerrmsg- the error message to display. Ignored if null or empty.
-
AbstractSimpleDateTimeConstraint
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 Details
-
fixConstraint
protected abstract void fixConstraint() -
getBeginDate
Returns the beginning date, or null if there is no constraint of the beginning date. -
getEndDate
Returns the ending date, or null if there is no constraint of the ending date. -
setTimeZone
Sets time zone that this date constraint belongs to -
parseConstraint
Description copied from class:SimpleConstraintParses a constraint into an integer value. For example, "no positive" is parsed toSimpleConstraint.NO_POSITIVE.Deriving classes might override this to provide more constraints.
- Overrides:
parseConstraintin classSimpleConstraint- Throws:
org.zkoss.zk.ui.UiException
-
parseFrom
- Throws:
org.zkoss.zk.ui.UiException
-
validate
public void validate(org.zkoss.zk.ui.Component comp, Object value) throws org.zkoss.zk.ui.WrongValueException Description copied from interface:ConstraintVerifies whether the value is acceptable.- Specified by:
validatein interfaceConstraint- Overrides:
validatein classSimpleConstraint- Parameters:
comp- the component being validated- Throws:
org.zkoss.zk.ui.WrongValueException
-
validate0
protected void validate0(org.zkoss.zk.ui.Component comp, T value) throws org.zkoss.zk.ui.WrongValueException - Throws:
org.zkoss.zk.ui.WrongValueException
-
valueToString
-