public abstract class AbstractSimpleDateTimeConstraint<T extends Comparable<? super T>> extends SimpleConstraint
Modifier and Type | Field and Description |
---|---|
protected T |
_beg |
protected T |
_end |
protected TimeZone |
_tzone |
_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 and Description |
---|
AbstractSimpleDateTimeConstraint(int flags)
Constraints a constraint.
|
AbstractSimpleDateTimeConstraint(int flags,
Pattern regex,
String errmsg)
Constructs a constraint combining regular expression.
|
AbstractSimpleDateTimeConstraint(int flags,
String errmsg)
Constraints a constraint.
|
AbstractSimpleDateTimeConstraint(int flags,
String regex,
String errmsg)
Deprecated.
As of release 8.0.1, replaced with
AbstractSimpleDateTimeConstraint(int, Pattern, String) |
AbstractSimpleDateTimeConstraint(Pattern regex,
String errmsg)
Constructs a regular-expression constraint.
|
AbstractSimpleDateTimeConstraint(String constraint)
Constructs a constraint with a list of constraints separated by comma.
|
AbstractSimpleDateTimeConstraint(String regex,
String errmsg)
Deprecated.
As of release 8.0.1, replaced with
AbstractSimpleDateTimeConstraint(int, Pattern, String) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
fixConstraint() |
T |
getBeginDate()
Returns the beginning date, or null if there is no constraint of
the beginning date.
|
T |
getEndDate()
Returns the ending date, or null if there is no constraint of
the ending date.
|
protected int |
parseConstraint(String constraint)
Parses a constraint into an integer value.
|
protected abstract T |
parseFrom(String val) |
void |
setTimeZone(TimeZone tzone)
Sets time zone that this date constraint belongs to
|
void |
validate(org.zkoss.zk.ui.Component comp,
Object value)
Verifies whether the value is acceptable.
|
protected void |
validate0(org.zkoss.zk.ui.Component comp,
T value) |
protected abstract String |
valueToString(org.zkoss.zk.ui.Component comp,
T value) |
getClientConstraint, getClientPackages, getErrorMessage, getFlags, getInstance
protected T extends Comparable<? super T> _beg
protected T extends Comparable<? super T> _end
protected TimeZone _tzone
public AbstractSimpleDateTimeConstraint(int flags)
flags
- a combination of SimpleConstraint.NO_POSITIVE
, SimpleConstraint.NO_NEGATIVE
,
SimpleConstraint.NO_ZERO
, and so on.public AbstractSimpleDateTimeConstraint(int flags, String errmsg)
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.@Deprecated public AbstractSimpleDateTimeConstraint(String regex, String errmsg)
AbstractSimpleDateTimeConstraint(int, Pattern, String)
regex
- ignored if null or empty. Unlike constraint, the regex doesn't need to enclose with '/'.errmsg
- the error message to display. Ignored if null or empty.public AbstractSimpleDateTimeConstraint(Pattern regex, String errmsg)
regex
- ignored if null or emptyerrmsg
- the error message to display. Ignored if null or empty.@Deprecated public AbstractSimpleDateTimeConstraint(int flags, String regex, String errmsg)
AbstractSimpleDateTimeConstraint(int, Pattern, String)
flags
- a combination of SimpleConstraint.NO_POSITIVE
, SimpleConstraint.NO_NEGATIVE
,
SimpleConstraint.NO_ZERO
, and so on.regex
- ignored if null or empty. Unlike constraint, the regex doesn't need to enclose with '/'.errmsg
- the error message to display. Ignored if null or empty.public AbstractSimpleDateTimeConstraint(int flags, Pattern regex, String errmsg)
flags
- a combination of SimpleConstraint.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.public AbstractSimpleDateTimeConstraint(String constraint)
constraint
- a list of constraints separated by comma.
Example: "between 20071012 and 20071223", "before 20080103"protected abstract void fixConstraint()
public T getBeginDate()
public T getEndDate()
public void setTimeZone(TimeZone tzone)
protected int parseConstraint(String constraint) throws org.zkoss.zk.ui.UiException
SimpleConstraint
SimpleConstraint.NO_POSITIVE
.
Deriving classes might override this to provide more constraints.
parseConstraint
in class SimpleConstraint
org.zkoss.zk.ui.UiException
protected abstract T parseFrom(String val) throws org.zkoss.zk.ui.UiException
org.zkoss.zk.ui.UiException
public void validate(org.zkoss.zk.ui.Component comp, Object value) throws org.zkoss.zk.ui.WrongValueException
Constraint
validate
in interface Constraint
validate
in class SimpleConstraint
comp
- the component being validatedorg.zkoss.zk.ui.WrongValueException
protected void validate0(org.zkoss.zk.ui.Component comp, T value) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueException
Copyright © 2020. All rights reserved.